powered by Jive Software

Find presence without adding as a friend

I would like to be able to get the presence information of any user in the system without having to add the user in the admin’s roster. Is there any way of doing this?

Thanks,

Neha.

I am using Jabberd 2 and Smack 3.0.4

There happens to be a provision in the sm.xml file for specifying the acl of type ‘all’ or ‘disco’ that allows the specified jid to discover presence information of all users in the system. When I try to use the jid I have specified here ‘admin@domain’, with the roster.getPresence(jid) method, I am not able to get the correct presence of any user who is not added to the admin’s roster. I would like the admin to be able to find the presence of any user without having to add the user is the admin’s roster. Is there any method besides roster.getPresence(jid) that will gie me the required information?

Any ideas? Please help.

Thanks,

Neha.

No, the protocol specification prohibits spying on users like that. You need to be subscribed to their presence in order to be informed about it.

You can use shared groups, but then all the users see each other as well. The simpliest is to send a subscription request.

There are ways to publish presences to a website, for example. Although this also always should need the users authorization.

I agree, but Jabberd 2 allows us to specify one user who can obtain presence information of any unadded user.

This I found in the sm.xml file

<aci>

<!-- The JIDs listed here will get access to all restricted

functions, regardless of restrictions further down -->

<acl type=‘all’>

<jid>admin@domain</jid>

</acl>

<!-- These JIDs can discover active user/session information -->

<acl type=‘disco’>

<jid>admin@domain</jid>

</acl>

</aci>

There must be a way to use this functionality from Smack, right?

Thanks,

Neha.

Ah, I see. Yes, you should be able to use that through service discovery and IQ packets. I can’t help you with the details on those though, as I haven’t needed to use them yet.

Yep, was checking the same.

Was hoping someone could give me some more details? Anyone used Discover* or IQ packets for something similar before?

Thanks,

Neha.

I get the following error whenever I try to use the ServiceDiscoveryManager class.

stream:error (text)

at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:306)

at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)

at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

No response from the server.:

at org.jivesoftware.smackx.ServiceDiscoveryManager.discoverInfo(ServiceDiscoveryMa nager.java:410)

at org.jivesoftware.smackx.ServiceDiscoveryManager.discoverInfo(ServiceDiscoveryMa nager.java:379)

at com.temp.Jabberd2MsgManager.getPresenceInfo(Jabberd2MsgManager.java:85)

at com.temp.JabberClientTester.main(JabberClientTester.java:22)

Any ideas?

And after I get this error, simple tasks like creation of user/ change password etc give exception with message

No response from server.

Would appreciate any kind of help.

Thanks,

Neha.