2
votes

i'm developing a chat with Smack libraries and Openfire server. I would like to set a user to publisher on my pubsub node. I've searched for the web but i can't find anything.

I've set the pubsub with this configuration:

nodeconfig.setPublishModel(PublishModel.publishers);

I've saw that i can create the affiliation:

Affiliation af = new Affiliation(mypubsub,Affiliation.Type.publisher);

What can i do?

1

1 Answers

2
votes

You need to retrieve the Node's ConfigurationForm via Node.getNodeConfiguration(), create an answer form from it with createAnswerForm, and call Form.setAnswer(String, String) to set the pubsub#publisher option. Then send the answer form with Node.sendConfigurationForm(Form).

from.setAnswer("pubsub#publisher", "[email protected]");

See also XEP-60 8.2.