Roster.getEntry() can''t handle addr supplied to RstListener.presenceChanged

Hi,

RosterListener’'s methods get XMPP addresses rather than RosterEntrys as parameters. For example,

RosterListener.presenceChanged(“foo@laptop/Smack”)

could be called. Now the documentation of Roster.getEntry(address) claims that address can be in any valid format, including the above “foo@laptop/Smack”. However looking at the sourcecode of Roster.getEntry(), this seems to be incorrect: It just does a (case insensitive) String compare. Therefore,

Roster.getEntry(“foo@laptop/Smack”)

will return null even if the roster contains an entry “foo@laptop”.

Also, I wonder how I should handle the RosterListener.entriesDeleted() event, as at that time I can’'t get the corresponding roster entries any more, can I?

Thanks in advance.

Tobias

Hey,

You could try a

RosterListener#presenceChanged(RosterEntry#getUser())

/code

in order to use the correct JID.

You question about RosterListener#entriesDeleted is a good one. Currently I am not using it. When an entry gets deleted its not on my roster anymore, so when I’'m displaying the Roster if its been deleted it will no longer appear.

I wonder if anyone can point out the correct way in using entriesDeleted?

I’'m not sure if you understood my question correctly. I think there is an error in Roster.getEntry(). Specifically, Roster.getEntry(String user) should call

user = StringUtils.parseBareAddress(user);

before proceeding any further.