Global roster. How?

Hello,

In my project I need that users will not have their own roster but will get online users only as their contact list. Looking at OpenFire server I can think of several approaches to achieve this. It might be a plugin that implements ad-hock command like get-online-users and client that instead of getting user contact list will call this command. Or make my own implementation of getRoster() command of User object. Is there easier (or already implemented) way to get it working?

If anybody could give me direction to move on with this task it will help me a lot.

With thanks,

Eugene.

Message was edited by: evgol

Hi Eugene,

what about shared groups ? If I got you right it’'s nearly perfect for you.

Finn

Finn,

Thanks, shared groups really look like what I need. The only question is when a client comes online is full list of all users in shared group being loaded? Is there a possibility to request only a list of currently online users? My problem is that I have a few millions of registered users while only a few dozens of them are being online simultaneously.

Thanks,

Eugene.

Hi Eugene,

do you want to add all users to one shared group? It may make more sense to create some small groups.

LG

Hi LG,

Thanks for your reply. Yes, having a few small groups makes more sense. As I have seen it is possible (correct me if I’'m wrong!) to add/remove users in a group programmatically. If my assumption is correct I can manage “online” shared group in a plugin that would listen to SessionManager events.

Thanks,

Eugene.

Hi Eugene,

you can already mange groups with the existing http://sever:9090/group-edit.jsp?group=foobar page but I agree that the interface may be improved a lot to make it possible to really “manage” users.

LG

The problem with the proposed solution is that default group provider doesn’'t notify connected users on add/remove members events. Looking at the code I see that users are only being inserted/deleted to a database. Currently connected clients know nothing about group members change. This makes the approach of manipulating shared groups for managing users roster pretty useless. Did anyone deal with a similar task with Openfire?

Thanks,

Eugene.

Hi evgol,

I’'ve been working a lot with sharedgroup in my company and I would say they are not and ideal solution for the kind of things you want to do.

I think that the good way to go will be to have your online users joined a MUC. On connection, your clients will join a room with all online users. With MUC you only have the list of occupants (ie. online users).

Of course this will only work if you control the client.

If you don’'t have the choice you might go for a sharedgroup based solution, but you have to know that it might corrupt the subscription state between your users. The right way to go will be to make a plugin.

To know when sessions are created/removed have a look to the SessionEventDispatcher

To add an user to a group just do the following:

Group g = GroupManager.getInstance().getGroup(“online users”);

g.add(userJid);

Hope this help,

-Yann

Yann,

Thanks for reply.

Yes I do control the client. Your idea of implementing the whole system as one MUC looks very interesting. I’'ll check this out.

Currently I’‘m using exactly the same code as you proposed (Group class doesn’‘t have add method. I use GroupProvider.addMember method). The only problem that server doesn’'t notify connected users on membership changes. But it seems that call to GroupEventDispatcher.dispatchEvent does the trick.

Thanks,

Eugene.