plugin misc list: Comments node creation can now be specified with comments field in extra.
This commit is contained in:
parent
53fdaa9d09
commit
f7c8ebea06
1 changed files with 11 additions and 1 deletions
|
|
@ -322,13 +322,23 @@ class PubsubLists:
|
||||||
@param extra(dict, None): same as for [XEP-0060.send_item] with additional keys:
|
@param extra(dict, None): same as for [XEP-0060.send_item] with additional keys:
|
||||||
- update(bool): if True, get previous item data to merge with current one
|
- update(bool): if True, get previous item data to merge with current one
|
||||||
if True, item_id must be set
|
if True, item_id must be set
|
||||||
|
- comments(bool): indicate if a new comment node must be created.
|
||||||
|
If True a new comment node will be create, and replace existing one if
|
||||||
|
there is already one.
|
||||||
|
If not set, comment node will be create if not ``item_id`` is specified,
|
||||||
|
and won't be modified otherwise.
|
||||||
other arguments are same as for [self._s.send_data_form_item]
|
other arguments are same as for [self._s.send_data_form_item]
|
||||||
@return (unicode): id of the created item
|
@return (unicode): id of the created item
|
||||||
"""
|
"""
|
||||||
if not node:
|
if not node:
|
||||||
node = self.namespace
|
node = self.namespace
|
||||||
|
|
||||||
if not item_id:
|
if extra is None:
|
||||||
|
extra = {}
|
||||||
|
|
||||||
|
# FIXME: presence of a field where comments node can be added must be checked.
|
||||||
|
add_comments_node = extra.get("comments")
|
||||||
|
if add_comments_node or (add_comments_node is None and not item_id):
|
||||||
comments_service = await self._m.get_comments_service(client, service)
|
comments_service = await self._m.get_comments_service(client, service)
|
||||||
|
|
||||||
# we need to use uuid for comments node, because we don't know item id in
|
# we need to use uuid for comments node, because we don't know item id in
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue