resources are now checked case insensitive in connection.py with the one we already have

This commit is contained in:
Yann Leboulanger 2005-11-03 09:21:12 +00:00
parent 2e9d0fbeba
commit 66a7f4b07c
1 changed files with 15 additions and 12 deletions

View File

@ -183,11 +183,15 @@ class Connection:
the function accetps jid and fjid''' the function accetps jid and fjid'''
ji, resource = gajim.get_room_and_nick_from_fjid(jid) ji, resource = gajim.get_room_and_nick_from_fjid(jid)
for rjid in gajim.contacts[self.name]: for rjid in gajim.contacts[self.name]:
if ji.lower() == rjid.lower(): if ji.lower() == rjid.lower(): # we found the jid
ji = rjid if not resource:
if resource: return rjid
return ji + '/' + resource for contact in gajim.contacts[self.name][rjid]:
return ji if contact.resource.lower() == resource.lower():
# we found the resource
return rjid + '/' + contact.resource
return rjid + '/' + resource # we don't have this resource yet
return ji # We don't have the jid in our roster
def get_full_jid(self, iq_obj): def get_full_jid(self, iq_obj):
'''return the full jid (with resource) from an iq as unicode''' '''return the full jid (with resource) from an iq as unicode'''
@ -260,8 +264,8 @@ class Connection:
our_jid = gajim.get_jid_from_account(self.name) our_jid = gajim.get_jid_from_account(self.name)
resource = '' resource = ''
if frm_iq: if frm_iq:
frm = self.get_jid(vc) who = self.get_full_jid(vc)
resource = frm_iq.getResource() frm, resource = gajim.get_room_and_nick_from_fjid(who)
else: else:
frm = our_jid frm = our_jid
if vc.getTag('vCard').getNamespace() == common.xmpp.NS_VCARD: if vc.getTag('vCard').getNamespace() == common.xmpp.NS_VCARD:
@ -415,8 +419,7 @@ class Connection:
avatar_sha = x.getTagData('photo') avatar_sha = x.getTagData('photo')
who = self.get_full_jid(prs) who = self.get_full_jid(prs)
jid_stripped = self.get_jid(prs) jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
resource = prs.getFrom().getResource()
status = prs.getStatus() status = prs.getStatus()
show = prs.getShow() show = prs.getShow()
if not show in STATUS_LIST: if not show in STATUS_LIST:
@ -1186,9 +1189,9 @@ class Connection:
client_info += ' ' + qp.getTag('version').getData() client_info += ' ' + qp.getTag('version').getData()
if qp.getTag('os'): if qp.getTag('os'):
os_info += qp.getTag('os').getData() os_info += qp.getTag('os').getData()
jid = self.get_jid(iq_obj) who = self.get_full_jid(iq_obj)
resource = iq_obj.getFrom().getResource() jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
self.dispatch('OS_INFO', (jid, resource, client_info, os_info)) self.dispatch('OS_INFO', (jid_stripped, resource, client_info, os_info))
def parse_data_form(self, node): def parse_data_form(self, node):
dic = {} dic = {}