diff src/plugins/plugin_xep_0277.py @ 2390:f57a8eaec8ed

plugins import, tickets import, bugzilla import: comments handling: - comments are put in "comments" key in import data, it's a list of microblog data - in resulting item, the comments uri is put in comments_uri field - (plugin import) root_service and root_node are kept in session - (plugin ticket) reporter name is now in "reporter" key instead of "reporter_name" - (plugin bugizlla): if not reporter name is found, first part of email address is used
author Goffi <goffi@goffi.org>
date Fri, 20 Oct 2017 08:48:41 +0200
parents 72cbb6478f97
children 70399d1acb47
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py	Fri Oct 20 08:44:09 2017 +0200
+++ b/src/plugins/plugin_xep_0277.py	Fri Oct 20 08:48:41 2017 +0200
@@ -662,12 +662,9 @@
         @param access: Node access model, according to xep-0060 #4.5
         @param profile_key: profile key
         """
+        # FIXME: check if this mehtod is needed, deprecate it if not
         client = self.host.getClient(profile_key)
 
-        _jid, xmlstream = self.host.getJidNStream(profile_key)
-        if not _jid:
-            log.error(_(u"Can't find profile's jid"))
-            return
         _options = {self._p.OPT_ACCESS_MODEL: access, self._p.OPT_PERSIST_ITEMS: 1, self._p.OPT_MAX_ITEMS: -1, self._p.OPT_DELIVER_PAYLOADS: 1, self._p.OPT_SEND_ITEM_SUBSCRIBE: 1}
 
         def cb(result):
@@ -683,17 +680,17 @@
             #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(client, _jid.userhostJID(), NS_MICROBLOG)
+                #d = self.host.plugins["XEP-0060"].deleteNode(client, 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(client, _jid.userhostJID(), NS_MICROBLOG, _options)
+            return self._p.createNode(client, 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)
+            return self._p.setOptions(client.jid.userhostJID(), NS_MICROBLOG, client.jid.userhostJID(), _options, profile_key=profile_key)
 
         create_node().addCallback(cb).addErrback(err_cb)