Hello,
I use the jabberd2 server. I’‘ve creates an admin account on the server, so i have the privileges to see all online users. i’'ve tested this the JAJC client and it works.
But it seems that smack ignores the admin privileges of the user. I’'ve implemented the PacketListener and the RosterListener. I need the presence state information of all users, but I only get it if the presence of an user that is on my buddy list changes.
Is this actually possible with smack? (im using smack 1.3.0)
judy
judy,
I use the jabberd2 server. I’'ve creates an admin
account on the server, so i have the privileges to
see all online users. i’'ve tested this the JAJC
client and it works.
I checked the XMPP specs and I couldn’‘t find that an admin user should receive the presence notifications of all the users in the server. Smack only supports the XMPP spec so unless this requirement is correct you won’'t find official support for it.
But it seems that smack ignores the admin privileges
of the user. I’'ve implemented the PacketListener and
the RosterListener. I need the presence state
information of all users, but I only get it if the
presence of an user that is on my buddy list
changes.
Is this actually possible with smack? (im using smack
1.3.0)
First off, you should download the latest release which is 1.4.0. This release won’'t solve your request but it adds new important features and many bug fixes.
As you noticed, Smack will only fire the RosterListeners whenever a user that is in the roster originated a presence notification. However, Smack will maintain all the received presences no matter whether the user is in the roster or not. Therefore, you can create your own PacketListener that will listen for packets of type Presence and you can use Roster.getPresence(String user) in order to retrieve the received presences.
Regards,
– Gato
judy,
I use the jabberd2 server. I’'ve creates an admin
account on the server, so i have the privileges to
see all online users. i’'ve tested this the JAJC
client and it works.
I checked the XMPP specs and I couldn’'t find that an
admin user should receive the presence notifications
of all the users in the server. Smack only supports
the XMPP spec so unless this requirement is correct
you won’'t find official support for it.
But it seems that smack ignores the admin
privileges
of the user. I’'ve implemented the PacketListener
and
the RosterListener. I need the presence state
information of all users, but I only get it if the
presence of an user that is on my buddy list
changes.
Is this actually possible with smack? (im using
smack
1.3.0)
First off, you should download the latest release
which is 1.4.0. This release won’'t solve your request
but it adds new important features and many bug
fixes.
As you noticed, Smack will only fire the
RosterListeners whenever a user that is in the roster
originated a presence notification. However, Smack
will maintain all the received presences no matter
whether the user is in the roster or not. Therefore,
you can create your own PacketListener that will
listen for packets of type Presence and you can use
Roster.getPresence(String user) in order to retrieve
the received presences.
I’'ve created my own Packetlistener, but in processPacket i only get precence packets of users in the roster?!
Judy,
Sorry for the late reply. I’'d like to check if Smack is in fact receiving those presence packets. Could you open a debugger and confirm that you are receiving those packets?
If you do receive them, I’'d like to check your PacketListener. Something like this should work for you:
PacketListener packetListener = new PacketListener() {
public void processPacket(Packet packet) {
Presence presence = (Presence) packet;
System.out.println(presence);
}
};
PacketFilter presenceFilter = new PacketTypeFilter(Presence.class);
connection.addPacketListener(packetListener, presenceFilter);
Let me know how it goes.
Regards,
– Gato
Hello,
Thanks for your help, but it does’‘t work. I’'ve implemented the PacketListener, but i only get the Presence information of users that are on the roster.
greetings judy
Judy,
Hmm, did you open a debugger to see if those packes were actually received by Smack?
Regards,
– Gato
Hello,
Yes, but i don’'t receive any packets.
regards,
judy
judy,
If JAJC is receiving those packets then Smack should receive them also. You can open the JAJC’‘s debugger to check the packets that JAJC is receiving and Smack doesn’‘t. The server should behave the same way no matter the client you are using. Maybe JAJC is doing something different like browsing the user’'s directory. You can check the sent packets by Smack and JAJC in order to find the difference.
Regards,
– Gato