Mercurial > libervia-backend
diff src/plugins/plugin_misc_groupblog.py @ 703:0c2c1dfb79e4
plugin group blog: renamed options parameter as extra for consistency with sendMessage
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 14 Nov 2013 16:49:57 +0100 |
parents | 69a8bfd266a5 |
children | 3c304929af74 |
line wrap: on
line diff
--- a/src/plugins/plugin_misc_groupblog.py Wed Nov 13 14:03:16 2013 +0100 +++ b/src/plugins/plugin_misc_groupblog.py Thu Nov 14 16:49:57 2013 +0100 @@ -240,14 +240,14 @@ @return: node's name (string)""" return NS_NODE_PREFIX + publisher.userhost() - def _publishMblog(self, service, client, access_type, access_list, message, options): + def _publishMblog(self, service, client, access_type, access_list, message, extra): """Actually publish the message on the group blog @param service: jid of the item-access pubsub service @param client: SatXMPPClient of the published @param access_type: one of "PUBLIC", "GROUP", "JID" @param access_list: set of entities (empty list for all, groups or jids) allowed to see the item @param message: message to publish - @param options: dict which option name as key, which can be: + @param extra: dict which option name as key, which can be: - allow_comments: True to accept comments, False else (default: False) """ node_name = self.getNodeName(client.jid) @@ -255,7 +255,7 @@ P = self.host.plugins["XEP-0060"] access_model_value = ACCESS_TYPE_MAP[access_type] - if options.get('allow_comments', 'False').lower() == 'true': + if extra.get('allow_comments', 'False').lower() == 'true': comments_node = "%s_%s__%s" % (NS_COMMENT_PREFIX, str(uuid.uuid4()), node_name) mblog_data['comments'] = "xmpp:%(service)s?%(query)s" % {'service': service.userhost(), 'query': urllib.urlencode([('node',comments_node.encode('utf-8'))])} @@ -301,13 +301,13 @@ #TODO return failure - def sendGroupBlog(self, access_type, access_list, message, options, profile_key='@NONE@'): + def sendGroupBlog(self, access_type, access_list, message, extra, profile_key='@NONE@'): """Publish a microblog with given item access @param access_type: one of "PUBLIC", "GROUP", "JID" @param access_list: list of authorized entity (empty list for PUBLIC ACCESS, list of groups or list of jids) for this item @param message: microblog - @param options: dict which option name as key, which can be: + @param extra: dict which option name as key, which can be: - allow_comments: True to accept comments, False else (default: False) @profile_key: %(doc_profile)s """ @@ -317,12 +317,12 @@ if access_type == "PUBLIC": if access_list: raise Exception("Publishers list must be empty when getting microblogs for all contacts") - self._publishMblog(client.item_access_pubsub, client, "PUBLIC", [], message, options) + self._publishMblog(client.item_access_pubsub, client, "PUBLIC", [], message, extra) elif access_type == "GROUP": _groups = set(access_list).intersection(client.roster.getGroups()) # We only keep group which actually exist if not _groups: raise BadAccessListError("No valid group") - self._publishMblog(client.item_access_pubsub, client, "GROUP", _groups, message, options) + self._publishMblog(client.item_access_pubsub, client, "GROUP", _groups, message, extra) elif access_type == "JID": raise NotImplementedError else: