I’m trying to create an external component that probes the presence information for a given user on behalf of another user. I created an external component with the Whack library and am using the Tinder Presence class. I am having difficulty working out firstly if
a) this is possible
b) what the from address should be
I’m using the following snippet to test things
Presence presence = new Presence(Presence.Type.probe);
presence.setFrom(from);
presence.setTo(to);
mgr.sendPacket(component, presence);
The two users adb@atacama and adb_l@atacama have exchanged contacts so can see each other’s presence. The component name is roster.atacama
When adb@atacama is logged in with Spark client and adb_l is not logged in, if I set
from = adb_l@atacama/roster
to = adb@atacama
I get the following in Openfire’s debug.log
2011.06.09 10:05:50 RoutingTableImpl: Failed to route packet to JID: adb_l@atacama/roster packet: Online1</presen ce>
This makes some sense as adb_l is not logged in, so there’s no way to send it to that user although the use of the full JID is not part of RFC 6121. If I set
from = adb_l@atacama
to = adb@atacama
then I get nothing in debug.log and no response in my component. This I don’t understand, but there seems to be an interoperability issue here which is mentioned in rfc 6121, section 4.3 which talks about using the bare JID for probes, whereas 3921 used the full JID. Still, if I set
from = roster.atacama
to = adb@atacama
then I get nothing in debug.log, but my component receives a presence error response
<presence type="error" to="roster.atacama" from="adb@atacama">
<error code="403" type="auth">
<forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>
</error>
</presence>
That also makes some kind of sense as the component is not in adb@atacama’s roster. So, I feel the answer is (a) that this is not possible, but would like a definitive answer and if not, how can my component find out the presence status between a pair of JIDs? One thing I saw is pre-approvals (rfc section 3.4) but I don’t really want to force the component to be in the user’s roster.
I would really appreciate anyone with any experience out there that can comment on this.
Thanks
Antony