powered by Jive Software

RosterListener: bug or feature?

Hi,

I’'ve written some code which wraps a Roster object to provide a UI model. My wrapper implements RosterListener, and must rebuild the internal state whenever rosterModified() is called.

My problem is that when I delete an entry using removeEntry(RosterEntry), I see two calls to rosterModified(). In the first call, the RosterEntry is not in the Roster (according to getEntries()). But by the second call, the RosterEntry has come back!. If I call getEntries() a third time, the entry has (finally) disappeared.

I’‘m not trying to do anything clever here, it’'s one, single threaded, client connecting to a jabberd server.

I’'m using Smack 1.4.0, but 1.3.0 behaves the same.

Is this as intended? I’'m suprised to get TWO callbacks to the RosterListener. The debugger shows this sequence of packets:


SENT


<item jid="user@server.com" name="user" subscription="remove">

General


RECEIVED


<item jid="user@server.com" name="user" subscription="remove">

General


RECEIVED



RECEIVED


<item jid="user@server.com" name="user" subscription="none">

General

Any ideas as to what I can do to keep my roster model in sync?

Many thanks,

Jon.

Jon,

Sorry for the late reply. This seems to be a server problem not a Smack error. Your Smack client shouldn’'t be receiving the last IQ packet which is generating this confusion. You can use another client an confirm if in fact this is a server issue.

According to the XMPP spec the server shouldn’‘t send the last IQ packet that it’'s actually sending. To learn more about the spec follow this link: http://www.jabber.org/ietf/draft-ietf-xmpp-im-22.html#int (section 8.6)

Regards,

– Gato