frontends: define the constants with classes and inheritance instance of using __builtin__
This commit is contained in:
parent
b824f9c2ce
commit
f5dd3f2265
1 changed files with 169 additions and 95 deletions
|
|
@ -20,6 +20,7 @@
|
|||
from logging import debug, info, warning, error
|
||||
from sat.tools.jid import JID
|
||||
from sat_frontends.quick_frontend.quick_utils import unescapePrivate
|
||||
from sat_frontends.quick_frontend.constants import Const
|
||||
|
||||
|
||||
class QuickChat(object):
|
||||
|
|
@ -107,7 +108,7 @@ class QuickChat(object):
|
|||
def onHistoryError(err):
|
||||
error (_("Can't get history"))
|
||||
|
||||
if self.target.startswith(const_PRIVATE_PREFIX):
|
||||
if self.target.startswith(Const.PRIVATE_PREFIX):
|
||||
target = unescapePrivate(self.target)
|
||||
else:
|
||||
target = self.target.bare
|
||||
|
|
@ -116,9 +117,9 @@ class QuickChat(object):
|
|||
|
||||
def _get_nick(self, jid):
|
||||
"""Return nick of this jid when possible"""
|
||||
if self.target.startswith(const_PRIVATE_PREFIX):
|
||||
if self.target.startswith(Const.PRIVATE_PREFIX):
|
||||
unescaped = unescapePrivate(self.target)
|
||||
if jid.startswith(const_PRIVATE_PREFIX) or unescaped.bare == jid.bare:
|
||||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue