Commit 225bfb59 authored by Philipp Hörist's avatar Philipp Hörist

UserNickame: Add option to make node public

parent fda964ed
......@@ -91,13 +91,24 @@ class Nickname(BaseModule):
return nickname.getData() or None
@iq_request_task
def set_nickname(self, nickname):
def set_nickname(self, nickname, public=False):
task = yield
access_model = 'open' if public else 'presence'
options = {
'pubsub#persist_items': 'true',
'pubsub#access_model': access_model,
}
item = Node('nick', {'xmlns': Namespace.NICK})
if nickname is not None:
item.addData(nickname)
result = yield self.publish(Namespace.NICK, item, id_='current')
result = yield self.publish(Namespace.NICK,
item,
id_='current',
options=options,
force_node_options=True)
yield finalize(task, result)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment