Mercurial > libervia-backend
changeset 821:38bc9abd6722
plugin XEP-0050: fixed UnknownGroupError management + "@ALL@" profile for status command
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 13 Feb 2014 18:50:56 +0100 |
parents | 462f2052af26 |
children | 30ed86ea1c82 |
files | src/plugins/plugin_xep_0050.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0050.py Thu Feb 13 18:50:49 2014 +0100 +++ b/src/plugins/plugin_xep_0050.py Thu Feb 13 18:50:56 2014 +0100 @@ -102,7 +102,10 @@ return False allowed = set(self.allowed_jids) 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: return True return False @@ -218,7 +221,7 @@ return XEP_0050_handler(self) def profileConnected(self, profile): - self.addAdHocCommand(self._statusCallback, _("Status"), profile_key="@ALL@") + self.addAdHocCommand(self._statusCallback, _("Status"), profile_key=profile) def profileDisconnected(self, profile): try: @@ -413,6 +416,7 @@ @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 """ + # FIXME: "@ALL@" for profile_key seems useless and dangerous node = node.strip() if not node: