Skip navigation
1058 Views 3 Replies Latest reply: Jun 19, 2011 5:56 PM by Antony RSS
Antony Bronze 65 posts since
May 29, 2011
Currently Being Moderated

Jun 8, 2011 5:38 PM

Presence probes and components...

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: <presence id="Sxr7m-6" from="adb@atacama/spark" to="adb_l@atacama/roster"><status>Online</status><priority>1</priority></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

  • Guus der Kinderen KeyContributor 777 posts since
    Sep 8, 2005
    Currently Being Moderated
    Jun 18, 2011 3:50 AM (in response to Antony)
    Presence probes and components...

    I'm not sure that I fully understand what you're trying to do, but from your description, the behavior that's logged does make sense:

     

    If an XMPP entity (such as a user, but a component is an entity too) is not subscribed to the presence information of another entity, it is not allowed to do probes. This most likely is the cause of the auth/forbidden error that your component receives. The workaround is simple, as you already identified: make sure that the component is subscribed to the presence of the entities that it is trying to probe.

     

    A warning: Did you consider the potential consequences of your setup? If your network is an IM-provider, exposing presence this way might allow for presence information being leaked to users that should not get this information.

     

    You could create a custom component that runs in Openfire (a Plugin that implements the Component interface, for example). You could use this to tap into the internals of Openfire, and get presence information from there. Not a real elegant or portable solution, but it could do the trick.

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points