Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
225bfb59 by lovetox at 2020-11-17T21:08:59+01:00
UserNickame: Add option to make node public

- - - - -


1 changed file:

- nbxmpp/modules/nickname.py


Changes:

=====================================
nbxmpp/modules/nickname.py
=====================================
@@ -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)



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/225bfb597875ee6e0578d0a106eaa56f461ce143

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/commit/225bfb597875ee6e0578d0a106eaa56f461ce143
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to