diff src/plugins/plugin_xep_0033.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 c897c8d321b3
children c37a24922f27
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0033.py	Sat Apr 19 16:48:26 2014 +0200
+++ b/src/plugins/plugin_xep_0033.py	Sat Apr 19 19:19:19 2014 +0200
@@ -18,8 +18,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
-import logging
-from sat.core import exceptions
+from sat.core.log import getLogger
+log = getLogger(__name__)
 from wokkel import disco, iwokkel
 from zope.interface import implements
 from twisted.words.protocols.jabber.jid import JID
@@ -29,9 +29,8 @@
     from twisted.words.protocols.xmlstream import XMPPHandler
 except ImportError:
     from wokkel.subprotocols import XMPPHandler
-from threading import Timer
 from twisted.words.xish import domish
-from twisted.internet import defer, threads
+from twisted.internet import defer
 
 from sat.core.sat_main import MessageSentAndStored, AbortSendMessage
 from sat.tools.misc import TriggerManager
@@ -70,7 +69,7 @@
     Implementation for XEP 0033
     """
     def __init__(self, host):
-        logging.info(_("Extended Stanza Addressing plugin initialization"))
+        log.info(_("Extended Stanza Addressing plugin initialization"))
         self.host = host
         self.internal_data = {}
         host.trigger.add("sendMessage", self.sendMessageTrigger, TriggerManager.MIN_PRIORITY)
@@ -87,8 +86,8 @@
                 if entity is None:
                     return Failure(AbortSendMessage(_("XEP-0033 is being used but the server doesn't support it!")))
                 if mess_data["to"] != entity:
-                    logging.warning(_("Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': entity, 'current': mess_data["to"]})
-                    logging.warning(_("TODO: addressing has be fixed by the backend... fix it in the frontend!"))
+                    log.warning(_("Stanzas using XEP-0033 should be addressed to %(expected)s, not %(current)s!") % {'expected': entity, 'current': mess_data["to"]})
+                    log.warning(_("TODO: addressing has be fixed by the backend... fix it in the frontend!"))
                     mess_data["to"] = entity
                 element = mess_data['xml'].addElement('addresses', NS_ADDRESS)
                 entries = [entry.split(':') for entry in mess_data['extra']['address'].split('\n') if entry != '']