plugin XEP-0060: node create/delete improvments:
- use client instead of profile for createNode and deleteNode
- new bridge method psCreateNode
- renamed psDeleteNode to psNodeDelete
This commit is contained in:
parent
6b0c5dc01a
commit
697da436af
1 changed files with 24 additions and 10 deletions
|
|
@ -512,7 +512,7 @@ class XEP_0277(object):
|
|||
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 @@ class XEP_0277(object):
|
|||
|
||||
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 @@ class XEP_0277(object):
|
|||
#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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue