plugin groupblog, XEP-0060: added ACCESS_PUBLISHER_ROSTER and switched to it in groupblog

This commit is contained in:
Goffi 2017-03-23 09:11:25 +01:00
commit 425d342183

View file

@ -99,8 +99,7 @@ class GroupBlog(object):
if config_form is None:
return
access_model = config_form.get(self._p.OPT_ACCESS_MODEL, self._p.ACCESS_OPEN)
# FIXME: ACCESS_ROSTER need to be changed to a new ACCESS_PUBLISHER_ROSTER when available
if access_model == self._p.ACCESS_ROSTER:
if access_model == self._p.ACCESS_PUBLISHER_ROSTER:
data_format.iter2dict('group', config_form.fields[self._p.OPT_ROSTER_GROUPS_ALLOWED].values, microblog_data)
def _data2entryTrigger(self, client, mb_data, entry_elt, item_elt):
@ -116,8 +115,7 @@ class GroupBlog(object):
raise exceptions.CancelError(u"GroupBlog is not available")
log.debug(u"This entry use group blog")
form = data_form.Form('submit', formNamespace=NS_PUBSUB_ITEM_CONFIG)
# FIXME: ACCESS_ROSTER need to be changed to a new ACCESS_PUBLISHER_ROSTER when available
access = data_form.Field(None, self._p.OPT_ACCESS_MODEL, value=self._p.ACCESS_ROSTER)
access = data_form.Field(None, self._p.OPT_ACCESS_MODEL, value=self._p.ACCESS_PUBLISHER_ROSTER)
allowed = data_form.Field(None, self._p.OPT_ROSTER_GROUPS_ALLOWED, values=groups)
form.addField(access)
form.addField(allowed)
@ -129,8 +127,7 @@ class GroupBlog(object):
It changes the access mode to roster if needed, and give the authorized groups
"""
if "group" in mb_data:
# FIXME: ACCESS_ROSTER need to be changed to a new ACCESS_PUBLISHER_ROSTER when available
options[self._p.OPT_ACCESS_MODEL] = self._p.ACCESS_ROSTER
options[self._p.OPT_ACCESS_MODEL] = self._p.ACCESS_PUBLISHER_ROSTER
options[self._p.OPT_ROSTER_GROUPS_ALLOWED] = list(data_format.dict2iter('group', mb_data))