如何使用Smack在PubSub节点上设置发布者



我正在开发一个与Smack库和Openfire服务器的聊天。我想将用户设置为我的发布节点上的发布者。我已经在网上搜索过了,但是什么也找不到。

我用这样的配置设置了pubsub:

nodeconfig.setPublishModel(PublishModel.publishers);

我已经看到我可以创建从属关系:

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

我能做什么?

您需要通过Node.getNodeConfiguration()检索节点的ConfigurationForm,使用createAnswerForm从它创建一个回答表单,并调用Form.setAnswer(String, String)来设置pubsub#publisher选项。然后用Node.sendConfigurationForm(Form)发送答案表。

from.setAnswer("pubsub#publisher", "publisher@example.org");

最新更新