diff src/plugins/plugin_xep_0277.py @ 2218:6a2fa651d7fa

plugin XEP-0060: node create/delete improvments: - use client instead of profile for createNode and deleteNode - new bridge method psCreateNode - renamed psDeleteNode to psNodeDelete
author Goffi <goffi@goffi.org>
date Mon, 03 Apr 2017 00:22:58 +0200
parents e67e8cd24141
children 79d279d1ee88
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Mon Apr 03 00:13:33 2017 +0200
+++ b/src/plugins/plugin_xep_0277.py	Mon Apr 03 00:22:58 2017 +0200
@@ -512,7 +512,7 @@
             comments_service = self.getCommentsService(client, service)
 
         try:
-            yield self._p.createNode(comments_service, comments_node, options, profile_key=profile)
+            yield self._p.createNode(client, comments_service, comments_node, options)
         except error.StanzaError as e:
             if e.condition == 'conflict':
                 log.info(u"node {} already exists on service {}".format(comments_node, comments_service))
@@ -629,7 +629,9 @@
 
         If the node already exists, it change options
         @param access: Node access model, according to xep-0060 #4.5
-        @param profile_key: profile key"""
+        @param profile_key: profile key
+        """
+        client = self.host.getClient(profile_key)
 
         _jid, xmlstream = self.host.getJidNStream(profile_key)
         if not _jid:
@@ -650,14 +652,14 @@
             #If the node already exists, the condition is "conflict",
             #else we have an unmanaged error
             if s_error.value.condition == 'conflict':
-                #d = self.host.plugins["XEP-0060"].deleteNode(_jid.userhostJID(), NS_MICROBLOG, profile_key=profile_key)
+                #d = self.host.plugins["XEP-0060"].deleteNode(client, _jid.userhostJID(), NS_MICROBLOG)
                 #d.addCallback(lambda x: create_node().addCallback(cb).addErrback(fatal_err))
                 change_node_options().addCallback(cb).addErrback(fatal_err)
             else:
                 fatal_err(s_error)
 
         def create_node():
-            return self._p.createNode(_jid.userhostJID(), NS_MICROBLOG, _options, profile_key=profile_key)
+            return self._p.createNode(client, _jid.userhostJID(), NS_MICROBLOG, _options)
 
         def change_node_options():
             return self._p.setOptions(_jid.userhostJID(), NS_MICROBLOG, _jid.userhostJID(), _options, profile_key=profile_key)