Mercurial > libervia-pubsub
comparison idavoll/pubsub.py @ 97:cf918d581da5
Enable admin to hide all nodes when the service is queried using disco items.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Tue, 23 Nov 2004 17:05:21 +0000 |
parents | f289c3e1dd0a |
children | b9c449f4c167 |
comparison
equal
deleted
inserted
replaced
96:f289c3e1dd0a | 97:cf918d581da5 |
---|---|
115 d.addCallback(self.send) | 115 d.addCallback(self.send) |
116 iq.handled = True | 116 iq.handled = True |
117 | 117 |
118 class ComponentServiceFromService(Service): | 118 class ComponentServiceFromService(Service): |
119 | 119 |
120 def __init__(self, backend): | |
121 Service.__init__(self, backend) | |
122 self.hide_nodes = False | |
123 | |
120 def get_disco_info(self, node): | 124 def get_disco_info(self, node): |
121 info = [] | 125 info = [] |
122 | 126 |
123 if not node: | 127 if not node: |
124 info.append(disco.Identity('pubsub', 'generic', | 128 info.append(disco.Identity('pubsub', 'generic', |
139 d.addCallback(lambda x: [disco.Identity('pubsub', x)]) | 143 d.addCallback(lambda x: [disco.Identity('pubsub', x)]) |
140 d.addErrback(lambda _: []) | 144 d.addErrback(lambda _: []) |
141 return d | 145 return d |
142 | 146 |
143 def get_disco_items(self, node): | 147 def get_disco_items(self, node): |
144 if node: | 148 if node or self.hide_nodes: |
145 return defer.succeed([]) | 149 return defer.succeed([]) |
146 | 150 |
147 d = self.backend.get_nodes() | 151 d = self.backend.get_nodes() |
148 d.addCallback(lambda nodes: [disco.Item(self.parent.jabberId, node) | 152 d.addCallback(lambda nodes: [disco.Item(self.parent.jabberId, node) |
149 for node in nodes]) | 153 for node in nodes]) |