Mercurial > libervia-backend
diff src/plugins/plugin_xep_0249.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 | 75f3b3b430ff |
children | 291eb8216f6e |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0249.py Sat Apr 19 16:48:26 2014 +0200 +++ b/src/plugins/plugin_xep_0249.py Sat Apr 19 19:19:19 2014 +0200 @@ -19,14 +19,14 @@ from sat.core.i18n import _ from sat.core.constants import Const as C -from logging import debug, info, warning, error +from sat.core.log import getLogger +log = getLogger(__name__) from twisted.words.xish import domish -from twisted.internet import protocol, defer -from twisted.words.protocols.jabber import client, jid, xmlstream +from twisted.words.protocols.jabber import jid from zope.interface import implements -from wokkel import disco, iwokkel, data_form +from wokkel import disco, iwokkel try: @@ -76,7 +76,7 @@ } def __init__(self, host): - info(_("Plugin XEP_0249 initialization")) + log.info(_("Plugin XEP_0249 initialization")) self.host = host host.memory.updateParams(self.params) host.bridge.addMethod("inviteMUC", ".plugin", in_sign='sssa{ss}s', out_sign='', method=self._invite) @@ -94,7 +94,7 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - error(_("Profile doesn't exists !")) + log.error(_("Profile doesn't exists !")) return message = domish.Element((None, 'message')) message["to"] = target.full() @@ -122,11 +122,12 @@ """ profile = self.host.memory.getProfileName(profile_key) if not profile: - error(_("Profile doesn't exists !")) + log.error(_("Profile doesn't exists !")) return - info(_('Invitation accepted for room %(room)s [%(profile)s]') % {'room': room, 'profile': profile}) + log.info(_('Invitation accepted for room %(room)s [%(profile)s]') % {'room': room, 'profile': profile}) _jid, xmlstream = self.host.getJidNStream(profile) d = self.host.plugins["XEP-0045"].join(jid.JID(room), _jid.user, {}, profile) + return d def onInvitation(self, message, profile): """ @@ -136,13 +137,13 @@ """ try: room = message.firstChildElement()['jid'] - info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': room, 'profile': profile}) + log.info(_('Invitation received for room %(room)s [%(profile)s]') % {'room': room, 'profile': profile}) except: - error(_('Error while parsing invitation')) + log.error(_('Error while parsing invitation')) return from_ = message["from"] if room in self.host.plugins["XEP-0045"].clients[profile].joined_rooms: - info(_("Invitation silently discarded because user is already in the room.")) + log.info(_("Invitation silently discarded because user is already in the room.")) return autojoin = self.host.memory.getParamA(AUTOJOIN_NAME, AUTOJOIN_KEY, profile_key=profile)