org.jivesoftware.xiff.events.RosterEvent.USER_ADDED

When is this event suppose to fire off? Every time I login, this event is fired for my one and only contact in my roster. It seems, by the name of it, this would fire off just when a **new **user is added. Assuming that this event is fired for each of my contacts, can I instead listen to an event that will return my entire roster?

Thanks.

Perhaps you are looking for RosterEvent.ROSTER_LOADED?

This will fire after every user has been added.

I noticed that RosterEvent.ROSTER_LOADED does fires off directly after the USER_ADDED event. However, USER_ADDED fires off everytime I log in; which, by the name of it seems that it should fire off when I have a added a new user to my roster. ROSTER_LOADED does fire off once, but with its data property with a value of *undefined *and its JID with a value of null.

I hope that helps.

Thanks for your time Sean.

Gotcha. Maybe I need a better understanding of the use case.

XIFF was originally developed in AS1 long before the time of data binding, so it inherits some legacy. Part of this legacy is this event, which was used to manually update a roster list view everytime a user was added to or removed from the roster. Perhaps the event name is misleading?

What I gather is that you want an event to fire when a new user who was not on the roster before is added to the roster?

I don’t think the event name, USER_ADDED is misleading anymore or ever was. And now, I don’t see why there should be an event specifically for new users added. I was unsure what ROSTER_LOADED event was. Which now I understand, this fires off when all of the USER_ADDED events has fired.

So now, everything makes sense. Thanks for pointing me back to ROSTER_LOADED event.