plugin OTR: a warning is logged when Account is instancied with a bare jid.

This commit is contained in:
Goffi 2014-08-25 21:32:23 +02:00
commit ed3313c169
2 changed files with 7 additions and 3 deletions

View file

@ -80,7 +80,7 @@ class Context(potr.context.Context):
def setState(self, state):
old_state = self.state
super(Context, self).setState(state)
log.debug(u"setState: %s (old_state=%s) " % (state, old_state))
log.debug(u"setState: %s (old_state=%s)" % (state, old_state))
if state == potr.context.STATE_PLAINTEXT:
feedback = _(u"/!\\ conversation with %(other_jid)s is now UNENCRYPTED") % {'other_jid': self.peer.full()}
@ -116,7 +116,9 @@ class Account(potr.context.Account):
def __init__(self, host, client):
log.debug(u"new account: %s" % client.jid)
super(Account, self).__init__(client.jid, "xmpp", 1024)
if not client.jid.resource:
log.warning("Account created without resource")
super(Account, self).__init__(unicode(client.jid), "xmpp", 1024)
self.host = host
self.client = client
@ -147,6 +149,8 @@ class ContextManager(object):
def getContextForUser(self, other):
log.debug(u"getContextForUser [%s]" % other)
if not other.resource:
log.warning("getContextForUser called with a bare jid")
return self.startContext(other)

View file

@ -220,9 +220,9 @@ class XEP_0045(object):
def _configureRoomMenu(self, menu_data, profile):
"""Return room configuration form
@param menu_data: %(menu_data)s
@param profile: %(doc_profile)s
"""
try:
room_jid = jid.JID(menu_data['room_jid'])