no need to knowthe ID to know if it's our vcard
This commit is contained in:
parent
ac36bbf306
commit
0c64b91de4
|
@ -137,7 +137,6 @@ class Connection:
|
||||||
self.gpg = None
|
self.gpg = None
|
||||||
self.vcard_sha = None
|
self.vcard_sha = None
|
||||||
self.status = ''
|
self.status = ''
|
||||||
self.myVCardID = []
|
|
||||||
self.new_account_info = None
|
self.new_account_info = None
|
||||||
self.bookmarks = []
|
self.bookmarks = []
|
||||||
self.on_purpose = False
|
self.on_purpose = False
|
||||||
|
@ -193,14 +192,15 @@ class Connection:
|
||||||
"""Called when we receive a vCard
|
"""Called when we receive a vCard
|
||||||
Parse the vCard and send it to plugins"""
|
Parse the vCard and send it to plugins"""
|
||||||
frm_iq = vc.getFrom()
|
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 = ''
|
resource = ''
|
||||||
if frm_iq:
|
if frm_iq:
|
||||||
frm = frm_iq.getStripped()
|
frm = frm_iq.getStripped()
|
||||||
resource = frm_iq.getResource()
|
resource = frm_iq.getResource()
|
||||||
else:
|
else:
|
||||||
name = gajim.config.get_per('accounts', self.name, 'name')
|
frm = our_jid
|
||||||
hostname = gajim.config.get_per('accounts', self.name, 'hostname')
|
|
||||||
frm = name + '@' + hostname
|
|
||||||
vcard = {'jid': frm, 'resource': resource}
|
vcard = {'jid': frm, 'resource': resource}
|
||||||
if not vc.getTag('vCard'):
|
if not vc.getTag('vCard'):
|
||||||
return
|
return
|
||||||
|
@ -221,8 +221,7 @@ class Connection:
|
||||||
vcard[name] = {}
|
vcard[name] = {}
|
||||||
for c in info.getChildren():
|
for c in info.getChildren():
|
||||||
vcard[name][c.getName()] = c.getData()
|
vcard[name][c.getName()] = c.getData()
|
||||||
if int(vc.getID()) in self.myVCardID:
|
if frm == our_jid:
|
||||||
self.myVCardID.remove(int(vc.getID()))
|
|
||||||
if vcard.has_key('PHOTO') and type(vcard['PHOTO']) == type({}) and \
|
if vcard.has_key('PHOTO') and type(vcard['PHOTO']) == type({}) and \
|
||||||
vcard['PHOTO'].has_key('BINVAL'):
|
vcard['PHOTO'].has_key('BINVAL'):
|
||||||
photo = vcard['PHOTO']['BINVAL']
|
photo = vcard['PHOTO']['BINVAL']
|
||||||
|
@ -1339,8 +1338,7 @@ class Connection:
|
||||||
self.dispatch('STATUS', 'invisible')
|
self.dispatch('STATUS', 'invisible')
|
||||||
if initial:
|
if initial:
|
||||||
#ask our VCard
|
#ask our VCard
|
||||||
iq = self.request_vcard(None)
|
self.request_vcard(None)
|
||||||
self.myVCardID.append(iq.getID())
|
|
||||||
|
|
||||||
#Get bookmarks from private namespace
|
#Get bookmarks from private namespace
|
||||||
self.get_bookmarks()
|
self.get_bookmarks()
|
||||||
|
@ -1395,8 +1393,7 @@ class Connection:
|
||||||
self.connection.send(p)
|
self.connection.send(p)
|
||||||
self.dispatch('STATUS', show)
|
self.dispatch('STATUS', show)
|
||||||
#ask our VCard
|
#ask our VCard
|
||||||
iq = self.request_vcard(None)
|
self.request_vcard(None)
|
||||||
self.myVCardID.append(iq.getID())
|
|
||||||
|
|
||||||
#Get bookmarks from private namespace
|
#Get bookmarks from private namespace
|
||||||
self.get_bookmarks()
|
self.get_bookmarks()
|
||||||
|
@ -1630,10 +1627,7 @@ class Connection:
|
||||||
if jid:
|
if jid:
|
||||||
iq.setTo(jid)
|
iq.setTo(jid)
|
||||||
iq.setTag(common.xmpp.NS_VCARD + ' vCard')
|
iq.setTag(common.xmpp.NS_VCARD + ' vCard')
|
||||||
id = self.connection.getAnID()
|
|
||||||
iq.setID(id)
|
|
||||||
self.to_be_sent.append(iq)
|
self.to_be_sent.append(iq)
|
||||||
return iq
|
|
||||||
#('VCARD', {entry1: data, entry2: {entry21: data, ...}, ...})
|
#('VCARD', {entry1: data, entry2: {entry21: data, ...}, ...})
|
||||||
|
|
||||||
def send_vcard(self, vcard):
|
def send_vcard(self, vcard):
|
||||||
|
|
|
@ -43,12 +43,7 @@ class Dispatcher(PlugIn):
|
||||||
self.RegisterEventHandler,self.UnregisterCycleHandler,self.RegisterCycleHandler,\
|
self.RegisterEventHandler,self.UnregisterCycleHandler,self.RegisterCycleHandler,\
|
||||||
self.RegisterHandlerOnce,self.UnregisterHandler,self.RegisterProtocol,\
|
self.RegisterHandlerOnce,self.UnregisterHandler,self.RegisterProtocol,\
|
||||||
self.WaitForResponse,self.SendAndWaitForResponse,self.send,self.disconnect,\
|
self.WaitForResponse,self.SendAndWaitForResponse,self.send,self.disconnect,\
|
||||||
self.SendAndCallForResponse, self.getAnID]
|
self.SendAndCallForResponse, ]
|
||||||
|
|
||||||
def getAnID(self):
|
|
||||||
global ID
|
|
||||||
ID+=1
|
|
||||||
return ID
|
|
||||||
|
|
||||||
def dumpHandlers(self):
|
def dumpHandlers(self):
|
||||||
""" Return set of user-registered callbacks in it's internal format.
|
""" Return set of user-registered callbacks in it's internal format.
|
||||||
|
|
Loading…
Reference in New Issue