merge to logics about jid being a transport into one. use the superior one
This commit is contained in:
parent
a643b7d466
commit
73905ec169
|
@ -240,21 +240,11 @@ def get_transport_name_from_jid(jid, use_config_setting = True):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def jid_is_transport(jid):
|
def jid_is_transport(jid):
|
||||||
aim = jid.startswith('aim')
|
# if not '@' or '@' starts the jid then it is transport
|
||||||
gg = jid.startswith('gg') # gadugadu
|
if jid.find('@') <= 0:
|
||||||
irc = jid.startswith('irc')
|
return True
|
||||||
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
|
|
||||||
else:
|
else:
|
||||||
is_transport = False
|
return False
|
||||||
|
|
||||||
return is_transport
|
|
||||||
|
|
||||||
def get_jid_from_account(account_name):
|
def get_jid_from_account(account_name):
|
||||||
'''return the jid we use in the given account'''
|
'''return the jid we use in the given account'''
|
||||||
|
|
|
@ -317,7 +317,7 @@ class Interface:
|
||||||
if not resource:
|
if not resource:
|
||||||
resource = ''
|
resource = ''
|
||||||
priority = array[4]
|
priority = array[4]
|
||||||
if jid.find('@') <= 0:
|
if gajim.jid_is_transport(jid):
|
||||||
# It must be an agent
|
# It must be an agent
|
||||||
ji = jid.replace('@', '')
|
ji = jid.replace('@', '')
|
||||||
else:
|
else:
|
||||||
|
@ -374,7 +374,7 @@ class Interface:
|
||||||
contact1.keyID = keyID
|
contact1.keyID = keyID
|
||||||
if contact1.jid not in gajim.newly_added[account]:
|
if contact1.jid not in gajim.newly_added[account]:
|
||||||
contact1.last_status_time = time.localtime()
|
contact1.last_status_time = time.localtime()
|
||||||
if jid.find('@') <= 0:
|
if gajim.jid_is_transport(jid):
|
||||||
# It must be an agent
|
# It must be an agent
|
||||||
if ji in jid_list:
|
if ji in jid_list:
|
||||||
# Update existing iter
|
# Update existing iter
|
||||||
|
@ -463,7 +463,7 @@ class Interface:
|
||||||
chatstate = array[6]
|
chatstate = array[6]
|
||||||
msg_id = array[7]
|
msg_id = array[7]
|
||||||
composing_jep = array[8]
|
composing_jep = array[8]
|
||||||
if jid.find('@') <= 0:
|
if gajim.jid_is_transport(jid):
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
|
|
||||||
chat_control = self.msg_win_mgr.get_control(jid, account)
|
chat_control = self.msg_win_mgr.get_control(jid, account)
|
||||||
|
@ -605,7 +605,7 @@ class Interface:
|
||||||
gc_control.set_subject(gc_control.subject)
|
gc_control.set_subject(gc_control.subject)
|
||||||
return
|
return
|
||||||
|
|
||||||
if jid.find('@') <= 0:
|
if gajim.jid_is_transport(jid):
|
||||||
jid = jid.replace('@', '')
|
jid = jid.replace('@', '')
|
||||||
self.roster.on_message(jid, _('error while sending') + \
|
self.roster.on_message(jid, _('error while sending') + \
|
||||||
' \"%s\" ( %s )' % (array[3], array[2]), array[4], account, \
|
' \"%s\" ( %s )' % (array[3], array[2]), array[4], account, \
|
||||||
|
|
|
@ -194,8 +194,7 @@ class RosterWindow:
|
||||||
# If contact already in roster, do not add it
|
# If contact already in roster, do not add it
|
||||||
if len(self.get_contact_iter(jid, account)):
|
if len(self.get_contact_iter(jid, account)):
|
||||||
return
|
return
|
||||||
if contact.jid.find('@') <= 0:
|
if gajim.jid_is_transport(contact.jid):
|
||||||
# if not '@' or '@' starts the jid ==> agent
|
|
||||||
contact.groups = [_('Transports')]
|
contact.groups = [_('Transports')]
|
||||||
|
|
||||||
# JEP-0162
|
# JEP-0162
|
||||||
|
|
Loading…
Reference in New Issue