plugin XEP-0050: fixed UnknownGroupError management + "@ALL@" profile for status command
This commit is contained in:
parent
fa6e44507c
commit
5d29ffbdda
1 changed files with 6 additions and 2 deletions
|
|
@ -102,7 +102,10 @@ class AdHocCommand(XMPPHandler):
|
||||||
return False
|
return False
|
||||||
allowed = set(self.allowed_jids)
|
allowed = set(self.allowed_jids)
|
||||||
for group in self.allowed_groups:
|
for group in self.allowed_groups:
|
||||||
allowed.update(self.client.roster.getJidsFromGroup(group))
|
try:
|
||||||
|
allowed.update(self.client.roster.getJidsFromGroup(group))
|
||||||
|
except exceptions.UnknownGroupError:
|
||||||
|
warning(_("The groups [%(group)s] is unknown for profile [%(profile)s])" % {'group':group, 'profile':self.client.profile}))
|
||||||
if requestor.userhostJID() in allowed:
|
if requestor.userhostJID() in allowed:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
@ -218,7 +221,7 @@ class XEP_0050(object):
|
||||||
return XEP_0050_handler(self)
|
return XEP_0050_handler(self)
|
||||||
|
|
||||||
def profileConnected(self, profile):
|
def profileConnected(self, profile):
|
||||||
self.addAdHocCommand(self._statusCallback, _("Status"), profile_key="@ALL@")
|
self.addAdHocCommand(self._statusCallback, _("Status"), profile_key=profile)
|
||||||
|
|
||||||
def profileDisconnected(self, profile):
|
def profileDisconnected(self, profile):
|
||||||
try:
|
try:
|
||||||
|
|
@ -413,6 +416,7 @@ class XEP_0050(object):
|
||||||
@param profile_key: profile key associated with this command, @ALL@ means can be accessed with every profiles
|
@param profile_key: profile key associated with this command, @ALL@ means can be accessed with every profiles
|
||||||
@return: node of the added command, useful to remove the command later
|
@return: node of the added command, useful to remove the command later
|
||||||
"""
|
"""
|
||||||
|
# FIXME: "@ALL@" for profile_key seems useless and dangerous
|
||||||
|
|
||||||
node = node.strip()
|
node = node.strip()
|
||||||
if not node:
|
if not node:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue