merge to logics about jid being a transport into one. use the superior one

This commit is contained in:
Nikos Kouremenos 2006-03-28 11:32:53 +00:00
parent a643b7d466
commit 73905ec169
3 changed files with 9 additions and 20 deletions

View File

@ -240,21 +240,11 @@ def get_transport_name_from_jid(jid, use_config_setting = True):
return None
def jid_is_transport(jid):
aim = jid.startswith('aim')
gg = jid.startswith('gg') # gadugadu
irc = jid.startswith('irc')
icq = jid.startswith('icq') or jid.startswith('jit')
msn = jid.startswith('msn')
sms = jid.startswith('sms')
tlen = jid.startswith('tlen')
yahoo = jid.startswith('yahoo')
if aim or gg or irc or icq or msn or sms or yahoo or tlen:
is_transport = True
# if not '@' or '@' starts the jid then it is transport
if jid.find('@') <= 0:
return True
else:
is_transport = False
return is_transport
return False
def get_jid_from_account(account_name):
'''return the jid we use in the given account'''

View File

@ -317,7 +317,7 @@ class Interface:
if not resource:
resource = ''
priority = array[4]
if jid.find('@') <= 0:
if gajim.jid_is_transport(jid):
# It must be an agent
ji = jid.replace('@', '')
else:
@ -374,7 +374,7 @@ class Interface:
contact1.keyID = keyID
if contact1.jid not in gajim.newly_added[account]:
contact1.last_status_time = time.localtime()
if jid.find('@') <= 0:
if gajim.jid_is_transport(jid):
# It must be an agent
if ji in jid_list:
# Update existing iter
@ -463,7 +463,7 @@ class Interface:
chatstate = array[6]
msg_id = array[7]
composing_jep = array[8]
if jid.find('@') <= 0:
if gajim.jid_is_transport(jid):
jid = jid.replace('@', '')
chat_control = self.msg_win_mgr.get_control(jid, account)
@ -605,7 +605,7 @@ class Interface:
gc_control.set_subject(gc_control.subject)
return
if jid.find('@') <= 0:
if gajim.jid_is_transport(jid):
jid = jid.replace('@', '')
self.roster.on_message(jid, _('error while sending') + \
' \"%s\" ( %s )' % (array[3], array[2]), array[4], account, \

View File

@ -194,8 +194,7 @@ class RosterWindow:
# If contact already in roster, do not add it
if len(self.get_contact_iter(jid, account)):
return
if contact.jid.find('@') <= 0:
# if not '@' or '@' starts the jid ==> agent
if gajim.jid_is_transport(contact.jid):
contact.groups = [_('Transports')]
# JEP-0162