annotate idavoll/disco.py @ 69:6c0cc9c6caea

Initial revision
author Ralph Meijer <ralphm@ik.nu>
date Sun, 07 Nov 2004 14:16:37 +0000
parents
children ea8b4189ae3b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
69
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
1 from twisted.xish import domish
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
2
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
3 NS = 'http://jabber.org/protocol/disco'
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
4 NS_INFO = NS + '#info'
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
5 NS_ITEMS = NS + '#items'
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
6
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
7 class Feature(domish.Element):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
8 def __init__(self, feature):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
9 domish.Element.__init__(self, (NS_INFO, 'feature'),
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
10 attribs={'var': feature})
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
11 class Identity(domish.Element):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
12 def __init__(self, category, type, name = None):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
13 domish.Element.__init__(self, (NS_INFO, 'identity'),
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
14 attribs={'category': category,
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
15 'type': type})
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
16 if name:
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
17 self['name'] = name
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
18
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
19 class Item(domish.Element):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
20 def __init__(self, jid, node = None, name = None):
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
21 domish.Element.__init__(self, (NS_ITEMS, 'item'),
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
22 attribs={'jid': jid})
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
23 if node:
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
24 self['node'] = node
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
25
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
26 if name:
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
27 self['name'] = name
6c0cc9c6caea Initial revision
Ralph Meijer <ralphm@ik.nu>
parents:
diff changeset
28