Mercurial > libervia-pubsub
comparison idavoll/idavoll.py @ 140:d79f0816f6c3
Revert changes to error handling into disco calls.
Bump version.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Wed, 27 Apr 2005 20:22:51 +0000 |
parents | 3d77f3808bfa |
children | 5191ba7c4df8 |
comparison
equal
deleted
inserted
replaced
139:8f6956b9a688 | 140:d79f0816f6c3 |
---|---|
5 import pubsub | 5 import pubsub |
6 import xmpp_error | 6 import xmpp_error |
7 import disco | 7 import disco |
8 | 8 |
9 import sys | 9 import sys |
10 | |
11 __version__ = '0.2' | |
10 | 12 |
11 NS_VERSION = 'jabber:iq:version' | 13 NS_VERSION = 'jabber:iq:version' |
12 | 14 |
13 IQ_GET = '/iq[@type="get"]' | 15 IQ_GET = '/iq[@type="get"]' |
14 IQ_SET = '/iq[@type="set"]' | 16 IQ_SET = '/iq[@type="set"]' |
37 | 39 |
38 def onVersion(self, iq): | 40 def onVersion(self, iq): |
39 iq.swapAttributeValues("to", "from") | 41 iq.swapAttributeValues("to", "from") |
40 iq["type"] = "result" | 42 iq["type"] = "result" |
41 name = iq.addElement("name", None, 'Idavoll') | 43 name = iq.addElement("name", None, 'Idavoll') |
42 version = iq.addElement("version", None, '0.1') | 44 version = iq.addElement("version", None, __version__) |
43 self.send(iq) | 45 self.send(iq) |
44 iq.handled = True | 46 iq.handled = True |
45 | 47 |
46 def onDiscoInfo(self, iq): | 48 def onDiscoInfo(self, iq): |
47 dl = [] | 49 dl = [] |
50 for c in self.parent: | 52 for c in self.parent: |
51 if component.IService.providedBy(c): | 53 if component.IService.providedBy(c): |
52 if hasattr(c, "get_disco_info"): | 54 if hasattr(c, "get_disco_info"): |
53 dl.append(c.get_disco_info(node)) | 55 dl.append(c.get_disco_info(node)) |
54 d = defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1) | 56 d = defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1) |
57 d.addCallback(self._disco_info_results, iq, node) | |
55 d.addErrback(self._error, iq) | 58 d.addErrback(self._error, iq) |
56 d.addCallback(self._disco_info_results, iq, node) | |
57 d.addCallback(self.send) | 59 d.addCallback(self.send) |
58 | 60 |
59 iq.handled = True | 61 iq.handled = True |
60 | 62 |
61 def _disco_info_results(self, results, iq, node): | 63 def _disco_info_results(self, results, iq, node): |
89 for c in self.parent: | 91 for c in self.parent: |
90 if component.IService.providedBy(c): | 92 if component.IService.providedBy(c): |
91 if hasattr(c, "get_disco_items"): | 93 if hasattr(c, "get_disco_items"): |
92 dl.append(c.get_disco_items(node)) | 94 dl.append(c.get_disco_items(node)) |
93 d = defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1) | 95 d = defer.DeferredList(dl, fireOnOneErrback=1, consumeErrors=1) |
96 d.addCallback(self._disco_items_result, iq, node) | |
94 d.addErrback(self._error, iq) | 97 d.addErrback(self._error, iq) |
95 d.addCallback(self._disco_items_result, iq, node) | |
96 d.addCallback(self.send) | 98 d.addCallback(self.send) |
97 | 99 |
98 iq.handled = True | 100 iq.handled = True |
99 | 101 |
100 def _disco_items_result(self, results, iq, node): | 102 def _disco_items_result(self, results, iq, node): |