annotate idavoll/disco.py @ 160:d183e48a5049

update tags
author convert-repo
date Thu, 18 Jun 2009 11:52:06 +0000
parents 5191ba7c4df8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
155
5191ba7c4df8 Work towards first release 0.5.0.
Ralph Meijer <ralphm@ik.nu>
parents: 152
diff changeset
1 # Copyright (c) 2003-2006 Ralph Meijer
5191ba7c4df8 Work towards first release 0.5.0.
Ralph Meijer <ralphm@ik.nu>
parents: 152
diff changeset
2 # See LICENSE for details.
5191ba7c4df8 Work towards first release 0.5.0.
Ralph Meijer <ralphm@ik.nu>
parents: 152
diff changeset
3
152
ea8b4189ae3b Update to Twisted Words 0.3.0.
Ralph Meijer <ralphm@ik.nu>
parents: 69
diff changeset
4 from twisted.words.xish import domish
69
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
6 NS = 'http://jabber.org/protocol/disco'
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
7 NS_INFO = NS + '#info'
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
8 NS_ITEMS = NS + '#items'
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
9
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
10 class Feature(domish.Element):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
11 def __init__(self, feature):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
12 domish.Element.__init__(self, (NS_INFO, 'feature'),
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
13 attribs={'var': feature})
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
14 class Identity(domish.Element):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
15 def __init__(self, category, type, name = None):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
16 domish.Element.__init__(self, (NS_INFO, 'identity'),
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
17 attribs={'category': category,
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
18 'type': type})
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
19 if name:
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
20 self['name'] = name
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
21
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
22 class Item(domish.Element):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
23 def __init__(self, jid, node = None, name = None):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
24 domish.Element.__init__(self, (NS_ITEMS, 'item'),
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
25 attribs={'jid': jid})
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
26 if node:
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
27 self['node'] = node
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
28
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
29 if name:
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
30 self['name'] = name
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
31