From d6458b66aab2b84ff7d5a800b1e603f25181d723 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sun, 31 Jan 2010 15:09:58 +0000 Subject: inclus xmppy0.5-RC1 avec les sources, sinon c'est chiant. --- src/xmpppy-0.5.0rc1/doc/advanced.html | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 src/xmpppy-0.5.0rc1/doc/advanced.html (limited to 'src/xmpppy-0.5.0rc1/doc/advanced.html') diff --git a/src/xmpppy-0.5.0rc1/doc/advanced.html b/src/xmpppy-0.5.0rc1/doc/advanced.html new file mode 100644 index 00000000..4766eff0 --- /dev/null +++ b/src/xmpppy-0.5.0rc1/doc/advanced.html @@ -0,0 +1,116 @@ + + + + + + Xmpppy usage - advanced. + + + +

Introduction

+

To write a programs using XMPP technology you must understand the basic + principles of it. Xmpppy uses it's own implementation of XML handling + procedures - so you should get used to it. Though it is simple enough I hope.

+
+ Node class +
+
+ prototype +
Node.__init__(name='', attrs={}, payload=[], parent=None, node=None)
+ Note that 'name' argument really consists of namespace and node name, space separated. Example: +
node=Node('jabber:client message', attrs={'to':'target@jid.com'},payload=[Node('body',payload=['Hello target!'])])
+ or
+ node=Node('jabber:client message')
+ node['to']='target@jid.com'
+ node.NT.body='Hello target!' +
+
+ NT stands for 'New Tag' and explicitly adds new child to the current node. + Also the T can be used. That means "find Tag" but if tag exists it acts just like NT otherwise. +
+ + Protocol class +
+ Uses similar syntax. We will use 'node' attribute now: +
+ prototype +
Protocol.__init__(name=None, to=None, typ=None, frm=None, attrs={}, payload=[], timestamp=None, xmlns='jabber:client', node=None)
+ example +
p=Protocol(node=node)
+ or
+ proto=Protocol('message',to='target@jid.com',payload=[Node('body',payload=['Hello target!'])])
+ or
+ proto=Protocol('message',to='target@jid.com')
+ proto.NT.body='Hello target!' +
+
+
+ + Message class +
+ Similar syntax: +
+ prototype +
Message.__init__(to=None, body=None, typ=None, subject=None, attrs={}, frm=None, payload=[], timestamp=None, xmlns='jabber:client', node=None)
+ example +
m=Message(node=proto)
+ or
+ m=Message('target@jid.com','Hello target!')
+
+
+
+ + Iq class +
+ Similar syntax: +
+ prototype +
Iq.__init__(typ=None, queryNS=None, attrs={}, to=None, frm=None, payload=[], xmlns='jabber:client', node=None)
+ example +
iq=Iq('set',NS_AUTH,payload=[Node('username',payload=['user']),Node('password',payload=['secret'])])
+ or
+ iq=Iq('set',NS_AUTH)
+ iq.T.query.NT.username='user'
+ iq.T.query.NT.password='secret'
+ or
+ iq=Iq('set',NS_AUTH)
+ iq.T.query.T.username='user'
+ iq.T.query.T.password='secret'
+ As I already noted - 'T' acts just like 'NT' if tag doesn't exists. +
+
+
+ + Presence class +
+ Similar syntax: +
+ prototype +
Presence.__init__(to=None, typ=None, priority=None, show=None, status=None, attrs={}, frm=None, timestamp=None, payload=[], xmlns='jabber:client', node=None)
+ example +
pres=Presence(priority=5, show='xa',status="I'm away from my computer")
+ or
+ pres=Presence()
+ pres.setPriority(5) + pres.setShow('xa') + pres.setStatus("I'm away from my computer") + pres.setTimestamp() + or
+ pres=Presence()
+ pres.T.priority=5 + pres.T.show='xa' + pres.T.status="I'm away from my computer" + pres.setTimestamp() +
+
+
+ +
+ + -- cgit v1.2.3