diff src/plugins/plugin_xep_0115.py @ 941:c6d8fc63b1db

core, plugins: host.getClient now raise an exception instead of returning None when no profile is found, plugins have been adapted consequently and a bit cleaned
author Goffi <goffi@goffi.org>
date Fri, 28 Mar 2014 18:07:02 +0100
parents 1a759096ccbd
children e1842ebcb2f3
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0115.py	Fri Mar 28 18:06:51 2014 +0100
+++ b/src/plugins/plugin_xep_0115.py	Fri Mar 28 18:07:02 2014 +0100
@@ -21,11 +21,8 @@
 from sat.core.constants import Const as C
 from logging import debug, info, error, warning
 from twisted.words.xish import domish
-from twisted.words.protocols.jabber import client, jid, xmlstream
-from twisted.words.protocols.jabber import error as jab_error
-from twisted.words.protocols.jabber.xmlstream import IQ
+from twisted.words.protocols.jabber import jid
 from sat.memory.persistent import PersistentBinaryDict
-import os.path
 import types
 
 from zope.interface import implements
@@ -126,9 +123,6 @@
             raise HashGenerationError
 
         client = self.host.getClient(profile_key)
-        if not client:
-            error('Requesting hash for an inexistant client')
-            raise HashGenerationError
 
         def generateHash_2(services, profile):
             _s = []
@@ -149,7 +143,7 @@
             debug(_('Capability hash generated: [%s]') % XEP_0115.cap_hash)
             self.presenceHack(profile)
 
-        services = client.discoHandler.info(client.jid, client.jid, '').addCallback(generateHash_2, profile)
+        client.discoHandler.info(client.jid, client.jid, '').addCallback(generateHash_2, profile)
 
 
 class XEP_0115_handler(XMPPHandler):