core: use of the new core.log module:
/!\ this is a massive refactoring and was largely automated, it probably did bring some bugs /!\
This commit is contained in:
parent
dc5c042fe7
commit
501bc92528
1 changed files with 707 additions and 941 deletions
|
|
@ -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 @@ class XEP_0249(object):
|
|||
}
|
||||
|
||||
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 @@ class XEP_0249(object):
|
|||
"""
|
||||
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 @@ class XEP_0249(object):
|
|||
"""
|
||||
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 @@ class XEP_0249(object):
|
|||
"""
|
||||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue