diff --git a/src/common/gajim.py b/src/common/gajim.py index d596a8df5..8edf75198 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -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''' diff --git a/src/gajim.py b/src/gajim.py index fc82f475d..c1a3284b5 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -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, \ diff --git a/src/roster_window.py b/src/roster_window.py index f8d314282..da03915b7 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -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