Hi, I’m working with JRuby 1.5.6, OpenFire 3.6.4 and the latest nightly of smack/smackx (smack_2011-01-30). What I’m trying to do is to modify the affiliation of a node subscriber:
---- BEGIN SNIP ----
conn, mgr = establish_xmpp_connection(node_owner, password)
form = ConfigureForm.new(FormType.submit)
form.setNodeType(NodeType.leaf)
form.setAccessModel(AccessModel.open)
form.setPublishModel(PublishModel.publishers)
form.setPersistentItems(true)
form.setNotifyRetract(true)
Workaround for OF-16
form.setMaxItems(65535)
Create node, as owner-user
my_leaf_node = mgr.createNode(’/foo/bar’)
my_node.sendConfigurationForm(form)
conn.disconnect
…
…
now subscribe user (login, passwd) to ‘/foo/bar’
conn, mgr = establish_xmpp_connection(login, password)
jid = conn.getUser.split(’/’).first
user_node = mgr.getNode(’/foo/bar’) #LeafNode
user_node.subscribe(jid)
set_member_affiliation(‘member’, user_node, jid) <------- Method to be written
---- END SNIP ----
Following
http://xmpp.org/extensions/xep-0060.html#owner-affiliations-modify-request
I’d expect smackx to provide some high-level abstraction to connect to the pubsub service as the ‘/foo/bar’ node owner and then modify the affiliation of the user from the default ‘none’ to ‘member’ After having read both javadocs and documentation, I can’t find any class/method that performs the desired operation.
Moreover, if I try to go a little bit deeper into the stack, I can’t find any way to use Node.sendPubsubPacket for sending the stanza:
<iq type=‘set’
from=‘hamlet@denmark.lit/elsinore’
to=‘pubsub.shakespeare.lit’
id=‘ent2’>
<iq type=‘set’
from='admin@example.net/mac'
to='pubsub.example.net'
id='ent2'>
<affiliations node='/foo/bar'>
<affiliation jid='test-user@example.net' affiliation='member'/>
</affiliations>
Appart from what was said in http://community.igniterealtime.org/thread/31210 (a bit outdated and unanswered) and http://community.igniterealtime.org/thread/43547 (it’s not an API question), I couldn’t find any more information in these forums about how to use smackx to have an user’s affiliation set, other than maybe sending the raw stanza.
Any help will be much appreciated. TIA.
//nando