diff --git a/src/plugins/plugin_xep_0050.py b/src/plugins/plugin_xep_0050.py index c4077868..d6918662 100644 --- a/src/plugins/plugin_xep_0050.py +++ b/src/plugins/plugin_xep_0050.py @@ -227,6 +227,12 @@ class XEP_0050(object): def profileConnected(self, profile): self.addAdHocCommand(self._statusCallback, _("Status"), profile_key="@ALL@") + def profileDisconnected(self, profile): + try: + del self.answering[profile] + except KeyError: + pass + def _statusCallback(self, command_elt, session_data, action, node, profile): """ Ad-hoc command used to change the "show" part of status """ actions = session_data.setdefault('actions',[]) @@ -350,7 +356,7 @@ class XEP_0050_handler(XMPPHandler): def getDiscoItems(self, requestor, target, nodeIdentifier=''): ret = [] if nodeIdentifier == NS_COMMANDS: - for command in self.plugin_parent.answering[self.parent.profile].values(): + for command in self.plugin_parent.answering.get(self.parent.profile,{}).values(): if command.isAuthorised(requestor): ret.append(disco.DiscoItem(self.parent.jid, command.node, command.getName())) #TODO: manage name language return ret