Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2004-02-19 00:03:45 +0300
committerYann Leboulanger <asterix@lagaule.org>2004-02-19 00:03:45 +0300
commit96e6ccf3dce389c7318f7fff6b88cffacbeb3d16 (patch)
tree1ed9c4cd4996026e1af0b26516751876c15e6c10
parentb553f44952cab9029a9aa6b5137d2e073877fb5f (diff)
get vCard infos
-rw-r--r--common/jabber.py3
-rw-r--r--core/core.py24
-rw-r--r--plugins/gtkgui/gtkgui.py9
3 files changed, 35 insertions, 1 deletions
diff --git a/common/jabber.py b/common/jabber.py
index b7a7afc60..bcf678489 100644
--- a/common/jabber.py
+++ b/common/jabber.py
@@ -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
diff --git a/core/core.py b/core/core.py
index ce1bc8b38..7fdfaec88 100644
--- a/core/core.py
+++ b/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:
diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py
index 652a575bc..694d6d0e2 100644
--- a/plugins/gtkgui/gtkgui.py
+++ b/plugins/gtkgui/gtkgui.py
@@ -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: