How to get Openfire Roster to only contain Online Contacts

Trying to tell the Roster to only store people that are currently online. If a user sends a presence packet and he comes online then it should only add him to the user’s Roster. Had a look at the Roster.java class in Smack, and well can’t seem to modify the roster from there. On login after getting the Roster I would like to loop through the Roster and remove the people who are not online, not delete them, just remove them from the Roster until they come online. I am trying to save bandwidth on a mobile phone, since all 300 GoogleTalk contacts come through and only about 3 or 4 are ever online at one specific time, getting the offline presence of 300 users is quite hectic. Has anyone got any idea of how to do this without custom building Smack? Thanks in advance.

to the best of my knowledge you cannot do this. the roster shows all approved contacts regardless of status. it is a feature of the individual software a to how they group/show offline users. Most software provides a way to group/hide the offline contacts but they are still queried.

Thanks for the reply. Just as a test I am going to see if I can modify the outgoing packet and remove offline users from the response by using a packet interceptor from Openfire.

if u do something about “\spark\src\java\org\jivesoftware\spark\ui\ContractGroup.java”

i think it will a good result to be,meybe!

Thanks for reply. However I need this to be server side and not client side on Spark, so that I can avoid unneccessary traffic from the server to the client. Thus only sending presence and roster entries of contacts that are online.