get vCard infos
This commit is contained in:
parent
b553f44952
commit
96e6ccf3dc
|
@ -62,7 +62,7 @@ An example of usage for a simple client would be ( only psuedo code !)
|
|||
|
||||
"""
|
||||
|
||||
# $Id: jabber.py,v 1.4 2004/01/14 01:06:27 asterix86 Exp $
|
||||
# $Id$
|
||||
|
||||
import xmlstream
|
||||
import sha, time
|
||||
|
@ -276,6 +276,7 @@ class Connection(xmlstream.Client):
|
|||
if not self.handlers[name].has_key(ns): ns=''
|
||||
if not self.handlers[name].has_key(typ): typ=''
|
||||
if not self.handlers[name].has_key(typns): typns=''
|
||||
if typ==typns: typns=''
|
||||
|
||||
chain=[]
|
||||
for key in ['default',typ,ns,typns]: # we will use all handlers: from very common to very particular
|
||||
|
|
24
core/core.py
24
core/core.py
|
@ -49,6 +49,24 @@ class GajimCore:
|
|||
for a in string.split(accts, ' '):
|
||||
self.accounts[a] = self.cfgParser.tab[a]
|
||||
|
||||
def vCardCB(self, con, vc):
|
||||
"""Called when we recieve a vCard"""
|
||||
# print vc
|
||||
if vc._getTag('vCard') == common.jabber.NS_VCARD:
|
||||
print "vcard :"
|
||||
card = vc.getChildren()[0]
|
||||
for info in card.getChildren():
|
||||
# print "name"
|
||||
print info.getName() + " : " + info.getData()
|
||||
# print "Data"
|
||||
# print info.getData()
|
||||
# print "DataAsParts"
|
||||
# print info.getDataAsParts()
|
||||
# print "Namespace"
|
||||
# print info.getNamespace()
|
||||
# print "Children"
|
||||
# print info.getChildren()
|
||||
|
||||
def messageCB(self, con, msg):
|
||||
"""Called when we recieve a message"""
|
||||
self.hub.sendPlugin('MSG', (msg.getFrom().getBasic(), \
|
||||
|
@ -147,6 +165,7 @@ class GajimCore:
|
|||
|
||||
self.con.registerHandler('message', self.messageCB)
|
||||
self.con.registerHandler('presence', self.presenceCB)
|
||||
self.con.registerHandler('iq',self.vCardCB,'result')#common.jabber.NS_VCARD)
|
||||
self.con.setDisconnectHandler(self.disconnectedCB)
|
||||
#BUG in jabberpy library : if hostname is wrong : "boucle"
|
||||
if self.con.auth(name, password, ressource):
|
||||
|
@ -280,6 +299,11 @@ class GajimCore:
|
|||
print "error " + c.lastErr
|
||||
else:
|
||||
self.hub.sendPlugin('ACC_OK', ev[1])
|
||||
elif ev[0] == 'TEST_VCARD':
|
||||
iq = ev[1]
|
||||
id = self.con.getAnID()
|
||||
iq.setID(id)
|
||||
self.con.send(ev[1])
|
||||
else:
|
||||
log.debug("Unknown Command %s" % ev[0])
|
||||
elif self.connected == 1:
|
||||
|
|
|
@ -52,6 +52,13 @@ class user:
|
|||
|
||||
class infoUser_Window:
|
||||
"""Class for user's information window"""
|
||||
def test_vcard(self):
|
||||
iq = common.jabber.Iq(to="asterix2@jabber.lagaule.org", type="get")
|
||||
print iq
|
||||
iq._setTag('vcard', common.jabber.NS_VCARD)
|
||||
print iq
|
||||
self.r.queueOUT.put(('TEST_VCARD', iq))
|
||||
|
||||
def delete_event(self, widget):
|
||||
"""close window"""
|
||||
self.window.destroy()
|
||||
|
@ -170,6 +177,8 @@ class infoUser_Window:
|
|||
xml.signal_connect('on_remove_clicked', self.on_remove)
|
||||
xml.signal_connect('on_entry_new_key_press_event', \
|
||||
self.on_new_key_pressed)
|
||||
print "\n*** TEST ***\n"
|
||||
self.test_vcard()
|
||||
|
||||
|
||||
class preference_Window:
|
||||
|
|
Loading…
Reference in New Issue