tools: renamed tools.jid.JID attribute "short" to "bare"

This commit is contained in:
souliane 2013-10-29 16:26:55 +01:00
commit 36cea6fc91

View file

@ -110,15 +110,15 @@ class QuickChat(object):
if self.target.startswith(const_PRIVATE_PREFIX):
target = unescapePrivate(self.target)
else:
target = self.target.short
target = self.target.bare
self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].short, target, 20, profile=profile, callback=onHistory, errback=onHistoryError)
self.host.bridge.getHistory(self.host.profiles[profile]['whoami'].bare, target, 20, profile=profile, callback=onHistory, errback=onHistoryError)
def _get_nick(self, jid):
"""Return nick of this jid when possible"""
if self.target.startswith(const_PRIVATE_PREFIX):
unescaped = unescapePrivate(self.target)
if jid.startswith(const_PRIVATE_PREFIX) or unescaped.short == jid.short:
if jid.startswith(const_PRIVATE_PREFIX) or unescaped.bare == jid.bare:
return unescaped.resource
return jid.resource if self.type == "group" else (self.host.contact_list.getCache(jid,'nick') or self.host.contact_list.getCache(jid,'name') or jid.node)
@ -126,7 +126,7 @@ class QuickChat(object):
"""Print message in chat window. Must be implemented by child class"""
jid=JID(from_jid)
nick = self._get_nick(jid)
mymess = (jid.resource == self.nick) if self.type == "group" else (jid.short == self.host.profiles[profile]['whoami'].short) #mymess = True if message comes from local user
mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user
if msg.startswith('/me '):
self.printInfo('* %s %s' % (nick, msg[4:]),type='me', timestamp=timestamp)
return