20140414 roster management with openfire userservice - plembo/onemoretech GitHub Wiki

title: Roster management with Openfire userservice link: https://onemoretech.wordpress.com/2014/04/14/roster-management-with-openfire-userservice/ author: phil2nc description: post_id: 7359 created: 2014/04/14 09:21:08 created_gmt: 2014/04/14 13:21:08 comment_status: closed post_name: roster-management-with-openfire-userservice status: publish post_type: post

Roster management with Openfire userservice

Been experimenting with ways to manage user rosters in my XMPP environment. Looks like one way would be to employ Openfire's User Service. To add an entry to a user's roster (example modified from plugin documentation):

https://chat.example.com:9091/plugins/userService/userservice?type=add_roster&secret=WXYZ1234&username=pausanias&[email protected]&name=Marcus Aurelius&subscription=3

Note: In scripting this, I'd also do a companion operation to add pausanius to aurlelius's roster. Some terms: "type" is the operation type, "secret" is a special password assigned to the User Service for use by admins, "item_jid" is the jid of the roster item, and "name" is the nickname to be associated with that roster item. The "subscription" term indicates the type of subscription to be added: "0" is for none, "1" for "to", "2" for "from" and "3" for both. This was tested on Openfire 3.9.1 with version 1.4.2 of the User Service. In fact I had trouble with deploying the User Service on Openfire 3.8.2 and had to upgrade to 3.9.1 for it to work. Removing a roster item basically mirrors the above, with the type of operation changed from "add_roster" to "delete_roster". Modfication of a roster item (for example, its nickname) would be an "update_roster" type operation. A couple of things I like about this method: (1) it allows manipulation of rosters by admins, not just by the users themselves (XMPP protocol operations only allow the latter); and (2) it can be done over HTTP (or HTTPS), so it doesn't require an XMPP client. The downside is that this facility is only available in Openfire. Reliance on it will create a dependency on that product. But then other methods I've tried, like manipulating the back end database tables that store roster information, are also highly product specific.

Copyright 2004-2019 Phil Lembo