plugin XEP-0060: fixed payload parsing in sendItem
This commit is contained in:
parent
9780bd3480
commit
abbd14484b
1 changed files with 4 additions and 2 deletions
|
|
@ -453,6 +453,7 @@ class XEP_0060(object):
|
|||
profile_key=C.PROF_KEY_NONE):
|
||||
client = self.host.getClient(profile_key)
|
||||
service = None if not service else jid.JID(service)
|
||||
payload = generic.parseXml(payload.encode())
|
||||
extra = data_format.deserialise(extra_ser)
|
||||
d = self.sendItem(
|
||||
client, service, nodeIdentifier, payload, item_id or None, extra
|
||||
|
|
@ -465,7 +466,7 @@ class XEP_0060(object):
|
|||
client = self.host.getClient(profile_key)
|
||||
service = None if not service else jid.JID(service)
|
||||
try:
|
||||
items = [generic.parseXml(item.encode('utf-8')) for item in items]
|
||||
items = [generic.parseXml(item.encode()) for item in items]
|
||||
except Exception as e:
|
||||
raise exceptions.DataError(_("Can't parse items: {msg}").format(
|
||||
msg=e))
|
||||
|
|
@ -492,11 +493,12 @@ class XEP_0060(object):
|
|||
@param service(jid.JID, None): service to send the item to
|
||||
None to use PEP
|
||||
@param NodeIdentifier(unicode): PubSub node to use
|
||||
@param payload(domish.Element, unicode): payload of the item to send
|
||||
@param payload(domish.Element): payload of the item to send
|
||||
@param item_id(unicode, None): id to use or None to create one
|
||||
@param extra(dict, None): extra option, not used yet
|
||||
@return (unicode, None): id of the created item
|
||||
"""
|
||||
assert isinstance(payload, domish.Element)
|
||||
item_elt = domish.Element((pubsub.NS_PUBSUB, 'item'))
|
||||
if item_id is not None:
|
||||
item_elt['id'] = item_id
|
||||
|
|
|
|||
Loading…
Reference in a new issue