From 0c64b91de473a4c6aeac4519e7e6aeba65fc70d0 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Mon, 8 Aug 2005 13:34:48 +0000 Subject: [PATCH] no need to knowthe ID to know if it's our vcard --- src/common/connection.py | 20 +++++++------------- src/common/xmpp/dispatcher.py | 7 +------ 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index 17137d2dd..617d022da 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -137,7 +137,6 @@ class Connection: self.gpg = None self.vcard_sha = None self.status = '' - self.myVCardID = [] self.new_account_info = None self.bookmarks = [] self.on_purpose = False @@ -193,14 +192,15 @@ class Connection: """Called when we receive a vCard Parse the vCard and send it to plugins""" frm_iq = vc.getFrom() + name = gajim.config.get_per('accounts', self.name, 'name') + hostname = gajim.config.get_per('accounts', self.name, 'hostname') + our_jid = name + '@' + hostname resource = '' if frm_iq: frm = frm_iq.getStripped() resource = frm_iq.getResource() else: - name = gajim.config.get_per('accounts', self.name, 'name') - hostname = gajim.config.get_per('accounts', self.name, 'hostname') - frm = name + '@' + hostname + frm = our_jid vcard = {'jid': frm, 'resource': resource} if not vc.getTag('vCard'): return @@ -221,8 +221,7 @@ class Connection: vcard[name] = {} for c in info.getChildren(): vcard[name][c.getName()] = c.getData() - if int(vc.getID()) in self.myVCardID: - self.myVCardID.remove(int(vc.getID())) + if frm == our_jid: if vcard.has_key('PHOTO') and type(vcard['PHOTO']) == type({}) and \ vcard['PHOTO'].has_key('BINVAL'): photo = vcard['PHOTO']['BINVAL'] @@ -1339,8 +1338,7 @@ class Connection: self.dispatch('STATUS', 'invisible') if initial: #ask our VCard - iq = self.request_vcard(None) - self.myVCardID.append(iq.getID()) + self.request_vcard(None) #Get bookmarks from private namespace self.get_bookmarks() @@ -1395,8 +1393,7 @@ class Connection: self.connection.send(p) self.dispatch('STATUS', show) #ask our VCard - iq = self.request_vcard(None) - self.myVCardID.append(iq.getID()) + self.request_vcard(None) #Get bookmarks from private namespace self.get_bookmarks() @@ -1630,10 +1627,7 @@ class Connection: if jid: iq.setTo(jid) iq.setTag(common.xmpp.NS_VCARD + ' vCard') - id = self.connection.getAnID() - iq.setID(id) self.to_be_sent.append(iq) - return iq #('VCARD', {entry1: data, entry2: {entry21: data, ...}, ...}) def send_vcard(self, vcard): diff --git a/src/common/xmpp/dispatcher.py b/src/common/xmpp/dispatcher.py index 361879c13..0643ef10c 100644 --- a/src/common/xmpp/dispatcher.py +++ b/src/common/xmpp/dispatcher.py @@ -43,12 +43,7 @@ class Dispatcher(PlugIn): self.RegisterEventHandler,self.UnregisterCycleHandler,self.RegisterCycleHandler,\ self.RegisterHandlerOnce,self.UnregisterHandler,self.RegisterProtocol,\ self.WaitForResponse,self.SendAndWaitForResponse,self.send,self.disconnect,\ - self.SendAndCallForResponse, self.getAnID] - - def getAnID(self): - global ID - ID+=1 - return ID + self.SendAndCallForResponse, ] def dumpHandlers(self): """ Return set of user-registered callbacks in it's internal format.