powered by Jive Software

The Roster and The RosterListener

Hi everyone,

I’‘m coding on MyOwnMessenger. Currently I’‘m working on the roster presentation. The thing is, I’'d like to have my RosterListener listen to my Connection just before the login.

Why do I want that? Because else I could miss people signing of just after I logged in (Slow computer).

And if the case is that I have a RosterListener before the logging in, I could use this Listener to build up my RosterPresentation. Or am I wrong? The roster is send to the client after the login, isn’'t? So I would only have to write this code once.

Now I’‘m looking closer, I’‘d like to see some things change a litle. We now have a method rosterModified with no argument. I’‘d like to know what has modified, so I don’‘t have to rebuild the whole Roster. I don’'t know this is possible in the current protocol, but I think this would suit a lot of people.

Regards,

Mark Monster

Mark,

There’‘s also a presenceChanged() method that will tell you when the presence of anyone on your roster has been modified. I agree that adding a roster changed method that tells you exactly what the change is would be useful, but that won’‘t happen for at least a couple of releases (since it’‘s a larger change). What I’'d recommend is having code that displays the roster tree along with the presence of each node in that tree. Every time rosterChanged gets called, just rebuild the tree. Every time presenceChanged gets called, just change the individual presence display.

Also, I don’‘t think you should need to setup a roster listener before logging in. The Roster class will always report the latest information about the roster available. So, if you login, the roster changes, then you ask for the roster, that roster data will still be correct since it’'s being constantly updated. That make sense?

Regards,

Matt