Software version support

I’‘m currently trying to implement url=http://www.jabber.org/jeps/jep-0092.htmlJEP 92[/url]. I know which xml I have to send and what to expect to receive, but how would I go about to implement this in Smack? I suppose I’‘ll have to add this to the smackx package, but the provider/packet structure isn’‘t too clear to me. I’‘d appreciate it if you’'d correct me here.

If I’'m correct, I have to add this to the smack.providers file:

query

jabber:iq:version

org.jivesoftware.smackx.packet.Version

Next, I’'ll be creating that Version class which extends IQ. The method I have to make sure to override is getChildElementXML which in this case would contain:

The Version constructor would initialize these values.

To ask for someone’'s version, I would use:

Time timeRequest = new Time();

timeRequest.setType(IQ.Type.GET);

timeRequest.setTo(someUser@example.com/resource);

But how exactly do I know when to reply to a version query myself?

I’'ll have to correct myself: name and version will have to be set by the application that uses Smack. The operating system can be detected by Smack.

Depending on a boolean value, Smack to append ‘’(using Smack SMACK_VERSION)’’ to the name.

Just thinking out loud a bit here.

I think there’‘s an error in Smack somewhere or else I’'m doing something very wrong. Whenever I sent a iq:version to smack, I see this in the debug window:

Smack lib

1.0

Windows XP

The problem here is that jid1 and jid2 are switched. The resource using Smack is jid2. In this piece of xml it seems like the other resource is sending it, while in fact it is Smack who is the sender.

I’'ve tried sending iq:time from Psi to Smack, with exactly the same result, sender and receiver are also switched.

I’‘ve had a look at it myself but can’'t find where the problem is right away.

Heh, I was thinking of doing that JEP too! In order to reply to version requests, you’'d need to add a packet listener to the connection with a filter that accepts version request packets. Check out the docs for XMPPConnection.addPacketListener().

Hope that helps,

–Doug

I was expecting Smack to know itself to listen for these packets, since I saw the right package pass by the Debug Window, with just the from and to jids switched.

If I’‘ve read the docs correctly, you don’'t have to use addPacketListener() when you put the package in smack.providers?