comparison src/plugins/plugin_xep_0092.py @ 993:301b342c697a

core: use of the new core.log module: /!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
author Goffi <goffi@goffi.org>
date Sat, 19 Apr 2014 19:19:19 +0200
parents 8ca5c990ed92
children 069ad98b360d
comparison
equal deleted inserted replaced
992:f51a1895275c 993:301b342c697a
21 from sat.core.constants import Const as C 21 from sat.core.constants import Const as C
22 from twisted.internet import reactor, defer 22 from twisted.internet import reactor, defer
23 from twisted.words.protocols.jabber import jid 23 from twisted.words.protocols.jabber import jid
24 from wokkel import compat 24 from wokkel import compat
25 from sat.core import exceptions 25 from sat.core import exceptions
26 from logging import debug, info, warning, error 26 from sat.core.log import getLogger
27 log = getLogger(__name__)
27 28
28 NS_VERSION = "jabber:iq:version" 29 NS_VERSION = "jabber:iq:version"
29 TIMEOUT = 10 30 TIMEOUT = 10
30 31
31 PLUGIN_INFO = { 32 PLUGIN_INFO = {
42 43
43 44
44 class XEP_0092(object): 45 class XEP_0092(object):
45 46
46 def __init__(self, host): 47 def __init__(self, host):
47 info(_("Plugin XEP_0092 initialization")) 48 log.info(_("Plugin XEP_0092 initialization"))
48 self.host = host 49 self.host = host
49 host.bridge.addMethod("getSoftwareVersion", ".plugin", in_sign='ss', out_sign='(sss)', method=self._getVersion, async=True) 50 host.bridge.addMethod("getSoftwareVersion", ".plugin", in_sign='ss', out_sign='(sss)', method=self._getVersion, async=True)
50 try: 51 try:
51 self.host.plugins[C.TEXT_CMDS].addWhoIsCb(self._whois, 50) 52 self.host.plugins[C.TEXT_CMDS].addWhoIsCb(self._whois, 50)
52 except KeyError: 53 except KeyError:
53 info(_("Text commands not available")) 54 log.info(_("Text commands not available"))
54 55
55 def _getVersion(self, entity_jid_s, profile_key): 56 def _getVersion(self, entity_jid_s, profile_key):
56 def prepareForBridge(data): 57 def prepareForBridge(data):
57 name, version, os = data 58 name, version, os = data
58 return (name or '', version or '', os or '') 59 return (name or '', version or '', os or '')