Show
Ignore:
Timestamp:
09/04/07 21:01:00 (15 months ago)
Author:
asterix
Message:

request vcard, last_status_time and os_info to real jid if we know it. fixes #3304

Location:
branches/gajim_0.11.1/src/common
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.1/src/common/connection_handlers.py

    r8709 r8711  
    797797                self.vcard_shas = {} # sha of contacts 
    798798                self.room_jids = [] # list of gc jids so that vcard are saved in a folder 
    799                 self.groupchat_jids = {} # {ID : groupchat_jid} 
    800                  
     799 
    801800        def add_sha(self, p, send_caps = True): 
    802801                c = p.setTag('x', namespace = common.xmpp.NS_VCARD_UPDATE) 
     
    13001299                except: 
    13011300                        return 
    1302                 who = helpers.get_full_jid_from_iq(iq_obj) 
     1301                id = iq_obj.getID() 
     1302                if id in self.groupchat_jids: 
     1303                        who = self.groupchat_jids[id] 
     1304                        del self.groupchat_jids[id] 
     1305                else: 
     1306                        who = helpers.get_full_jid_from_iq(iq_obj) 
    13031307                jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who) 
    13041308                self.dispatch('LAST_STATUS_TIME', (jid_stripped, resource, seconds, status)) 
     
    13151319                if qp.getTag('os'): 
    13161320                        os_info += qp.getTag('os').getData() 
    1317                 who = helpers.get_full_jid_from_iq(iq_obj) 
     1321                id = iq_obj.getID() 
     1322                if id in self.groupchat_jids: 
     1323                        who = self.groupchat_jids[id] 
     1324                        del self.groupchat_jids[id] 
     1325                else: 
     1326                        who = helpers.get_full_jid_from_iq(iq_obj) 
    13181327                jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who) 
    13191328                self.dispatch('OS_INFO', (jid_stripped, resource, client_info, os_info)) 
  • branches/gajim_0.11.1/src/common/connection.py

    r8683 r8711  
    8080                # Do we continue connection when we get roster (send presence,get vcard...) 
    8181                self.continue_connect_info = None 
     82                # To know the groupchat jid associated with a sranza ID. Useful to 
     83                # request vcard or os info... to a real JID but act as if it comes from 
     84                # the fake jid 
     85                self.groupchat_jids = {} # {ID : groupchat_jid} 
    8286                if USE_GPG: 
    8387                        self.gpg = GnuPG.GnuPG(gajim.config.get('use_gpg_agent')) 
     
    905909                self.name = new_name 
    906910 
    907         def request_last_status_time(self, jid, resource): 
     911        def request_last_status_time(self, jid, resource, groupchat_jid=None): 
     912                '''groupchat_jid is used when we want to send a request to a real jid 
     913                and act as if the answer comes from the groupchat_jid''' 
    908914                if not self.connection: 
    909915                        return 
     
    913919                iq = common.xmpp.Iq(to = to_whom_jid, typ = 'get', queryNS =\ 
    914920                        common.xmpp.NS_LAST) 
    915                 self.connection.send(iq) 
    916  
    917         def request_os_info(self, jid, resource): 
     921                id = self.connection.getAnID() 
     922                iq.setID(id) 
     923                if groupchat_jid: 
     924                        self.groupchat_jids[id] = groupchat_jid 
     925                self.connection.send(iq) 
     926 
     927        def request_os_info(self, jid, resource, groupchat_jid=None): 
     928                '''groupchat_jid is used when we want to send a request to a real jid 
     929                and act as if the answer comes from the groupchat_jid''' 
    918930                if not self.connection: 
    919931                        return 
     
    927939                iq = common.xmpp.Iq(to = to_whom_jid, typ = 'get', queryNS =\ 
    928940                        common.xmpp.NS_VERSION) 
     941                id = self.connection.getAnID() 
     942                iq.setID(id) 
     943                if groupchat_jid: 
     944                        self.groupchat_jids[id] = groupchat_jid 
    929945                self.connection.send(iq) 
    930946