powered by Jive Software

IQ handling


Quick question. I have the following eventhandlers:

m_Connection.addEventListener( “message”, this );

m_Connection.addEventListener( “iq”, this );

m_Connection.addEventListener( “presence”, this );

They are meant to trigger the following functions:

case “message”:



case “iq”:



case “presence”:



But when I run my flash movie I only get trace results for “message” and “presence”.

I can see that there are IQ messages coming in if I add an incomingData handler, but why can’'t I get the IQ handler to respond??



Hi Nick - there isn’‘t a generic “iq” event in the XMPPConnection class. IQ handling is done internally by the library using extensions. So, if you need to handle a specific IQ look to the proper extension, assuming one exists for what you’'re doing.

The type of the IQ event will not be “iq” but rather will be the namespace of the IQ. For instance, if it was a service disco IQ it would be something like “http://jabber.org/protocol/disco” or if it were an IQ used during registration it would be something like “jabber:iq:register”

Again, as all the complicated IQ handling is supposed to be internalized by the library, you shouldn’‘t need to even bother with handling IQs unless you’'re writing your own extension.

Thanks Sean,

I’‘ve been back to it and that really helped. I have a much better idea what’'s going on.

However, I’‘m confused by something that’'s happening to the roster of a person who is logged in at the time one of their buddies removes their subscription rights.

I’'m using the ‘‘modelChanged’’ event to see when the roster changes in any way.

I start my flash movie, and I see all my buddies and their status. Then, using a separate jabber client (Psi), I remove the authorization of the flash movie user.

In the flash movie, a ‘‘set’’ IQ arrives with subscription=’‘from’’ for the buddy who removed authorization.

At this point I trace my roster.length and it has increased by 1. I do a trace on the new item and it shows as:

jid: undefined

displayName: undefined

group: undefined

subscribeType: undefined

status: Offline

show: unavailable

priority: null

Yet the roster item for the buddy who removed my authorization is unchanged - he still traces as being online/available with subscribStatus as ‘‘both’’.

If I log out and log back in again, this is all fixed and the roster length has dropped back down to the number is should be, with the buddy who removed my authorization coming through as subscription=’‘from’’.

Am I doing this all the wrong way again?

Incidentally, this undefined extra roster item shows up even if I use a datagrid as a dataprovider for the roster.



Might be a bug … I’'ll need to think about it further and let you know.