Changeset 677
- Timestamp:
- 06/15/08 15:36:36 (5 months ago)
- Files:
-
- oss/headstock/headstock/api/contact.py (modified) (1 diff)
- oss/headstock/headstock/api/discovery.py (modified) (3 diffs)
- oss/headstock/headstock/api/error.py (modified) (2 diffs)
- oss/headstock/headstock/api/im.py (modified) (5 diffs)
- oss/headstock/headstock/api/profile.py (added)
- oss/headstock/headstock/api/pubsub.py (modified) (12 diffs)
- oss/headstock/headstock/api/registration.py (modified) (1 diff)
- oss/headstock/headstock/lib/logger.py (modified) (3 diffs)
- oss/headstock/headstock/lib/utils.py (modified) (2 diffs)
- oss/headstock/headstock/protocol/extension/discovery.py (modified) (9 diffs)
- oss/headstock/headstock/protocol/extension/pubsub.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
oss/headstock/headstock/api/contact.py
r668 r677 23 23 24 24 def __repr__(self): 25 return '<Presence %s (%s) at %s>' % (str(self.from_jid), self. subscription, hex(id(self)))25 return '<Presence %s (%s) at %s>' % (str(self.from_jid), self.type, hex(id(self))) 26 26 27 27 @staticmethod oss/headstock/headstock/api/discovery.py
r668 r677 14 14 15 15 __all__ = ['FeaturesDiscovery', 'ItemsDiscovery', 16 'SubscriptionsDiscovery' ]16 'SubscriptionsDiscovery', 'AffiliationsDiscovery'] 17 17 18 18 class Identity(object): … … 51 51 return '<Subscription %s [%s:%s] at %s>' % (str(self.jid), self.node, 52 52 self.state, hex(id(self))) 53 54 class Affiliation(object): 55 def __init__(self, node, affiliation): 56 self.node = node 57 self.affiliation = affiliation 58 59 def __repr__(self): 60 return '<Affiliation %s (%s) at %s>' % (self.node, self.affiliation, hex(id(self))) 53 61 54 62 class FeaturesDiscovery(Entity): … … 172 180 type=e.get_attribute_value('type'), 173 181 stanza_id=e.get_attribute_value('id')) 174 175 for c in e.xml_children: 176 if not isinstance(c, E): 177 continue 178 179 if c.xml_ns == XMPP_PUBSUB_NS: 180 if c.xml_name == 'subscriptions': 181 for i in c.xml_children: 182 if i.xml_name == 'subscription' and i.xml_ns == XMPP_DISCO_ITEMS_NS: 183 jid = JID.parse(unicode(i.get_attribute_value('jid'))) 184 item = Subscription(i.get_attribute_value('node'), 185 jid, i.get_attribute_value('subscription')) 186 disco.subscriptions.append(item) 182 for c in e.xml_children: 183 if not isinstance(c, E): 184 continue 185 186 if c.xml_ns == XMPP_PUBSUB_NS and c.xml_name == 'pubsub': 187 for p in c.xml_children: 188 if not isinstance(p, E): 189 continue 190 if p.xml_ns == XMPP_PUBSUB_NS and p.xml_name == 'subscriptions': 191 for s in p.xml_children: 192 if not isinstance(s, E): 193 continue 194 jid = s.get_attribute_value('jid', None) 195 if jid: 196 JID.parse(jid) 197 sub = Subscription(s.get_attribute_value('node'), jid, 198 s.get_attribute_value('subscription')) 199 disco.subscriptions.append(sub) 187 200 elif c.xml_ns == XMPP_CLIENT_NS and c.xml_name == 'error': 188 201 disco.error = Error.from_element(c) 189 202 190 203 return disco 204 205 class AffiliationsDiscovery(Entity): 206 def __init__(self, from_jid, to_jid, type=u'get', stanza_id=None): 207 Entity.__init__(self, from_jid, to_jid, type, stanza_id) 208 self.affiliations = [] 209 210 @staticmethod 211 def to_element(e): 212 iq = Entity.to_element(e) 213 query = E(u'query', namespace=XMPP_PUBSUB_NS, parent=iq) 214 E('affiliations', namespace=XMPP_PUBSUB_NS, parent=query) 215 216 return iq 217 218 @staticmethod 219 def from_element(e): 220 disco = AffiliationsDiscovery(JID.parse(e.get_attribute_value('from')), 221 JID.parse(e.get_attribute_value('to')), 222 type=e.get_attribute_value('type'), 223 stanza_id=e.get_attribute_value('id')) 224 for c in e.xml_children: 225 if not isinstance(c, E): 226 continue 227 228 if c.xml_ns == XMPP_PUBSUB_NS and c.xml_name == 'pubsub': 229 for p in c.xml_children: 230 if not isinstance(p, E): 231 continue 232 if p.xml_ns == XMPP_PUBSUB_NS and p.xml_name == 'affiliations': 233 for s in p.xml_children: 234 if not isinstance(s, E): 235 continue 236 aff = Affiliation(s.get_attribute_value('node'), 237 s.get_attribute_value('affiliation')) 238 disco.affiliations.append(aff) 239 elif c.xml_ns == XMPP_CLIENT_NS and c.xml_name == 'error': 240 disco.error = Error.from_element(c) 241 242 return disco oss/headstock/headstock/api/error.py
r667 r677 24 24 @staticmethod 25 25 def from_element(e): 26 error_type = e.get_attribute ('type')27 code = e.get_attribute ('code')26 error_type = e.get_attribute_value('type') 27 code = e.get_attribute_value('code') 28 28 condition = text = lang = foreign = None 29 29 for child in e.xml_children: … … 31 31 if child.xml_name == u'text': 32 32 text = child.xml_text 33 lang = child.get_attribute ('lang')33 lang = child.get_attribute_value('lang') 34 34 else: 35 35 condition = child.xml_name oss/headstock/headstock/api/im.py
r668 r677 14 14 from bridge import Attribute as A 15 15 from bridge.common import XML_NS, XML_PREFIX, XMPP_CLIENT_NS, \ 16 XMPP_EVENT_NS, XMPP_XOOB_NS 16 XMPP_EVENT_NS, XMPP_XOOB_NS, XMPP_XHTML_IM_NS, XHTML1_NS 17 17 18 18 class Body(object): … … 26 26 def __str__(self): 27 27 return str(self.plain_body) 28 29 class XHTMLBody(object): 30 def __init__(self, inner): 31 self.inner = inner 32 33 def __repr__(self): 34 return '<XHTMLBody at %s>' % (hex(id(self)),) 28 35 29 36 class Subject(object): … … 50 57 class Message(Entity): 51 58 def __init__(self, from_jid, to_jid, type=u'normal', stanza_id=None, lang=None): 52 Entity.__init__(self, from_jid, to_jid) 53 self.type = type 59 Entity.__init__(self, from_jid, to_jid, type, stanza_id) 54 60 self.lang = lang 55 self.stanza_id = stanza_id56 61 57 62 self.bodies = [] … … 100 105 elif child.xml_name == 'thread': 101 106 message.thread = child.xml_text 107 if child.xml_name == 'html' and child.xml_ns == XMPP_XHTML_IM_N: 108 b = XHTMLBody(child.xml_children.clone()) 109 message.bodies.append(b) 102 110 else: 103 111 message.foreign.append(Foreign(child)) … … 132 140 133 141 for body in m.bodies: 134 b = E(u'body', content=body.plain_body, 135 namespace=XMPP_CLIENT_NS, parent=e) 136 if body.lang: 137 A(u'lang', value=body.lang, 138 prefix=XML_PREFIX, namespace=XML_NS, parent=b) 142 if isinstance(body, Body): 143 b = E(u'body', content=body.plain_body, 144 namespace=XMPP_CLIENT_NS, parent=e) 145 if body.lang: 146 A(u'lang', value=body.lang, 147 prefix=XML_PREFIX, namespace=XML_NS, parent=b) 148 elif isinstance(body, XHTMLBody): 149 h = E(u'html', namespace=XMPP_XHTML_IM_NS, parent=e) 150 b = E(u'body', namespace=XHTML1_NS, parent=h) 151 body.inner.xml_parent = b 152 b.xml_children.append(body.inner) 139 153 140 154 if m.thread: oss/headstock/headstock/api/pubsub.py
r668 r677 8 8 from headstock.api.error import Error 9 9 from headstock.api.jid import JID 10 from headstock.api.dataform import Data, Field 10 11 from bridge import Element as E 11 12 from bridge import Attribute as A … … 15 16 16 17 class Configure(object): 17 def __init__(self, data=None): 18 self.data = data 18 def __init__(self, x=None): 19 self.x = x 20 21 @staticmethod 22 def to_element(e, parent=None): 23 c = E(u'configure', namespace=XMPP_PUBSUB_NS, parent=parent) 24 Data.to_element(e.x, parent=c) 25 return c 26 27 @staticmethod 28 def make_collection_node(): 29 d = Data(u'submit') 30 d.fields.append(Field(field_type=u'hidden', var=u'FORM_TYPE', 31 values=[u'http://jabber.org/protocol/pubsub#node_config'])) 32 d.fields.append(Field(field_type=None, var=u'pubsub#node_type', 33 values=[u'collection'])) 34 return Configure(x=d) 19 35 20 36 def create_leaf_node_whitelist(cls): … … 44 60 Entity.__init__(self, from_jid, to_jid, type, stanza_id) 45 61 self.node_name = node_name 62 self.configure = None 46 63 if kwargs: 47 64 self.__dict__.update(kwargs) … … 50 67 return '<Node "%s" at %s>' % (self.node_name, hex(id(self))) 51 68 69 def set_default_collection_conf(self): 70 self.configure = Configure.make_collection_node() 71 52 72 @staticmethod 53 73 def to_creation_element(e): … … 56 76 attrs = {u'node': e.node_name} 57 77 E(u'create', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) 58 E(u'configure', namespace=XMPP_PUBSUB_NS, parent=pubsub) 78 if not e.configure: 79 E(u'configure', namespace=XMPP_PUBSUB_NS, parent=pubsub) 80 else: 81 Configure.to_element(e.configure, parent=pubsub) 59 82 return iq 60 83 … … 72 95 if p.xml_name == 'create': 73 96 node.node_name = p.get_attribute('node') 74 elif i.xml_ns == XMPP_ STREAM_NS and i.xml_name == 'error':97 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 75 98 node.error = Error.from_element(i) 76 99 … … 98 121 if p.xml_name == 'create': 99 122 node.node_name = p.get_attribute('node') 100 elif i.xml_ns == XMPP_STREAM_NS and i.xml_name == 'error': 123 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 124 node.error = Error.from_element(i) 125 126 return node 127 128 @staticmethod 129 def to_purge_element(e): 130 iq = Entity.to_element(e) 131 pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_OWNER_NS, parent=iq) 132 attrs = {u'node': e.node_name} 133 E(u'purge', attributes=attrs, namespace=XMPP_PUBSUB_OWNER_NS, parent=pubsub) 134 return iq 135 136 @staticmethod 137 def from_purge_element(e): 138 node = Node(JID.parse(e.get_attribute_value('from')), 139 JID.parse(e.get_attribute_value('to')), 140 type=e.get_attribute_value('type'), 141 stanza_id=e.get_attribute_value('id')) 142 143 for i in e.xml_children: 144 if i.xml_ns in [XMPP_PUBSUB_NS]: 145 for p in i.xml_children: 146 if p.xml_ns in [XMPP_PUBSUB_NS]: 147 if p.xml_name == 'create': 148 node.node_name = p.get_attribute('node') 149 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 101 150 node.error = Error.from_element(i) 102 151 … … 107 156 iq = Entity.to_element(e) 108 157 pubsub = E(u'pubsub', namespace=XMPP_PUBSUB_NS, parent=iq) 109 sub_jid = e.sub_jid110 158 attrs = {u'node': e.node_name, u'jid': e.sub_jid} 111 159 E(u'subscribe', attributes=attrs, namespace=XMPP_PUBSUB_NS, parent=pubsub) … … 126 174 sub.node_name = p.get_attribute('node') 127 175 sub.sub_jid = p.get_attribute('jid') 128 elif i.xml_ns == XMPP_ STREAM_NS and i.xml_name == 'error':176 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 129 177 sub.error = Error.from_element(i) 130 178 … … 154 202 sub.node_name = p.get_attribute('node') 155 203 sub.sub_jid = p.get_attribute('jid') 156 elif i.xml_ns == XMPP_ STREAM_NS and i.xml_name == 'error':204 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 157 205 sub.error = Error.from_element(i) 158 206 … … 192 240 payload = q.xml_children[0].clone() 193 241 node.item = Item(q.get_attribute('id'), payload) 194 elif i.xml_ns == XMPP_ STREAM_NS and i.xml_name == 'error':242 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 195 243 node.error = Error.from_element(i) 196 244 … … 224 272 if q.xml_name == 'item': 225 273 node.item = Item(q.get_attribute('id')) 226 elif i.xml_ns == XMPP_ STREAM_NS and i.xml_name == 'error':274 elif i.xml_ns == XMPP_CLIENT_NS and i.xml_name == 'error': 227 275 node.error = Error.from_element(i) 228 276 oss/headstock/headstock/api/registration.py
r668 r677 65 65 66 66 if e.x: 67 Data.to_element( x, parent=query)67 Data.to_element(e.x, parent=query) 68 68 69 69 return iq oss/headstock/headstock/lib/logger.py
r652 r677 7 7 8 8 import logging 9 from logging import handlers 9 10 10 11 class Logger(component): … … 14 15 "signal" : "UNUSED",} 15 16 16 def __init__(self, path=None, stdout=False ):17 def __init__(self, path=None, stdout=False, name=None): 17 18 super(Logger, self).__init__() 18 19 19 20 self.path = path 20 21 self.with_stdout = stdout 22 self.name = name 21 23 22 24 def main(self): 23 logger = logging.getLogger("kamaelia.logger ")25 logger = logging.getLogger("kamaelia.logger.%s" % self.name or '') 24 26 logger.setLevel(logging.DEBUG) 25 27 … … 27 29 28 30 if self.path: 29 h = logging.FileHandler(self.path)31 h = handlers.RotatingFileHandler(self.path, maxBytes=1048576, backupCount=5) 30 32 h.setLevel(logging.DEBUG) 31 33 h.setFormatter(logfmt) oss/headstock/headstock/lib/utils.py
r667 r677 1 #!/usr/bin/env python2 1 # -*- coding: utf-8 -*- 3 2 import codecs 4 3 import sha 5 4 from time import time 6 5 from random import random 7 6 8 __all__ = ['generate_unique'] 7 8 __all__ = ['generate_unique', 'remove_BOM'] 9 9 10 10 def generate_unique(seed=None): … … 12 12 seed = str(time() * random()) 13 13 return unicode(abs(hash(sha.new(seed).hexdigest()))) 14 15 def remove_BOM(text): 16 if text[0] == codecs.BOM_UTF8.decode("utf-8"): 17 return text.replace(codecs.BOM_UTF8.decode("utf-8"), '') 18 if text[0] == codecs.BOM.decode("utf-16"): 19 return text.replace(codecs.BOM.decode("utf-16"), '') 20 if text[0] == codecs.BOM_BE.decode("utf-16-be"): 21 return text.replace(codecs.BOM_BE.decode("utf-16-be"), '') 22 if text[0] == codecs.BOM_LE.decode("utf-16-le"): 23 return text.replace(codecs.BOM_LE.decode("utf-16-le"), '') 24 25 return text oss/headstock/headstock/protocol/extension/discovery.py
r660 r677 2 2 3 3 from headstock.api.discovery import FeaturesDiscovery, ItemsDiscovery,\ 4 SubscriptionsDiscovery 4 SubscriptionsDiscovery, AffiliationsDiscovery 5 5 from bridge import Element as E 6 6 from bridge import Attribute as A … … 12 12 13 13 __all__ = ['FeaturesDiscoveryDispatcher', 'ItemsDiscoveryDispatcher', 14 'SubscriptionsDiscoveryDispatcher', 'DiscoveryDispatcher'] 14 'SubscriptionsDiscoveryDispatcher', 'AffiliationsDiscoveryDispatcher', 15 'DiscoveryDispatcher'] 15 16 16 17 class FeaturesDiscoveryDispatcher(component): … … 157 158 if self.dataReady("inbox"): 158 159 handled = False 159 e = self.recv("inbox") 160 e = e.xml_parent.xml_parent 161 print e.xml() 160 s = self.recv("inbox") 161 e = s.xml_parent.xml_parent 162 162 self.send(('INCOMING', e), "log") 163 163 … … 177 177 yield 1 178 178 179 class AffiliationsDiscoveryDispatcher(component): 180 181 Inboxes = {"inbox" : "bridge.Element instance", 182 "control" : "Shutdown the client stream", 183 "forward" : "headstock.api.contact.Message instance to be sent back to the client. Transforms the instance to a bridge.Element instance and puts it into the 'outbox'", 184 } 185 186 Outboxes = {"outbox" : "bridge.Element instance", 187 "signal" : "Shutdown signal", 188 "log" : "log", 189 "unknown" : "Unknown element that could not be dispatched properly", 190 "xmpp.get" : "Activity requests", 191 "xmpp.set" : "Activity requests", 192 "xmpp.result" : "Activity responses", 193 "xmpp.error" : "Activity response error", 194 } 195 196 def __init__(self): 197 super(AffiliationsDiscoveryDispatcher, self).__init__() 198 199 def main(self): 200 while 1: 201 if self.dataReady("control"): 202 mes = self.recv("control") 203 204 if isinstance(mes, shutdownMicroprocess) or isinstance(mes, producerFinished): 205 self.send(producerFinished(), "signal") 206 break 207 208 if self.dataReady("forward"): 209 m = self.recv("forward") 210 self.send(AffiliationsDiscovery.to_element(m), "outbox") 211 212 if self.dataReady("inbox"): 213 handled = False 214 s = self.recv("inbox") 215 e = s.xml_parent.xml_parent 216 self.send(('INCOMING', e), "log") 217 218 msg_type = e.get_attribute_value(u'type') or u'get' 219 key = 'xmpp.%s' % unicode(msg_type) 220 221 if key in self.outboxes: 222 self.send(AffiliationsDiscovery.from_element(e), key) 223 handled = True 224 225 if not handled: 226 self.send(e, "unknown") 227 228 if not self.anyReady(): 229 self.pause() 230 231 yield 1 232 179 233 class DiscoveryDispatcher(component): 180 234 Inboxes = {"inbox" : "bridge.Element instance", … … 182 236 "features.inbox": "", 183 237 "subscription.inbox": "", 238 "affiliation.inbox": "", 184 239 "items.inbox": "", 185 240 "features.forward": "", 186 241 "subscription.forward": "", 242 "affiliation.forward": "", 187 243 "items.forward": "", 188 244 "in.features.get" : "Activity requests", … … 197 253 "in.subscription.set" : "Activity requests", 198 254 "in.subscription.result" : "Activity responses", 199 "in.subscription.error" : "Activity response error",} 255 "in.subscription.error" : "Activity response error", 256 "in.affiliation.get" : "Activity requests", 257 "in.affiliation.set" : "Activity requests", 258 "in.affiliation.result" : "Activity responses", 259 "in.affiliation.error" : "Activity response error",} 200 260 201 261 Outboxes = {"outbox" : "bridge.Element instance", … … 205 265 "features.outbox": "", 206 266 "subscription.outbox": "", 267 "affiliation.outbox": "", 207 268 "items.outbox": "", 208 269 "out.features.get" : "Activity requests", … … 218 279 "out.subscription.result" : "Activity responses", 219 280 "out.subscription.error" : "Activity response error", 281 "out.affiliation.get" : "Activity requests", 282 "out.affiliation.set" : "Activity requests", 283 "out.affiliation.result" : "Activity responses", 284 "out.affiliation.error" : "Activity response error", 220 285 } 221 286 … … 239 304 self.link((subdisp, 'log'), (self, 'log'), passthrough=2) 240 305 self.addChildren(subdisp) 241 subdisp.activate() 306 subdisp.activate() 307 308 affdisp = AffiliationsDiscoveryDispatcher() 309 self.link((self, 'affiliation.inbox'), (affdisp, 'inbox'), passthrough=1) 310 self.link((self, 'affiliation.forward'), (affdisp, 'forward'), passthrough=1) 311 self.link((self, 'in.affiliation.get'), (affdisp, 'forward'), passthrough=1) 312 self.link((self, 'in.affiliation.set'), (affdisp, 'forward'), passthrough=1) 313 self.link((self, 'in.affiliation.result'), (affdisp, 'forward'), passthrough=1) 314 self.link((self, 'in.affiliation.error'), (affdisp, 'forward'), passthrough=1) 315 self.link((affdisp, 'outbox'), (self, 'affiliation.outbox'), passthrough=2) 316 self.link((affdisp, 'xmpp.get'), (self, 'out.affiliation.get'), passthrough=2) 317 self.link((affdisp, 'xmpp.set'), (self, 'out.affiliation.set'), passthrough=2) 318 self.link((affdisp, 'xmpp.result'), (self, 'out.affiliation.result'), passthrough=2) 319 self.link((affdisp, 'xmpp.error'), (self, 'out.affiliation.error'), passthrough=2) 320 self.link((affdisp, 'unknown'), (self, 'unknown'), passthrough=2) 321 self.link((affdisp, 'log'), (self, 'log'), passthrough=2) 322 self.addChildren(affdisp) 323 affdisp.activate() 242 324 243 325 featdisp = FeaturesDiscoveryDispatcher() oss/headstock/headstock/protocol/extension/pubsub.py
r654 r677 12 12 'NodeDeletionDispatcher', 'UnsubscriptionDispatcher', 13 13 'ItemPublicationDispatcher', 'ItemDeletionDispatcher', 14 'MessageEventDispatcher', 'PubSubDispatcher'] 14 'MessageEventDispatcher', 'NodePurgeDispatcher', 15 'PubSubDispatcher'] 15 16 16 17 class SubscriptionDispatcher(component): … … 246 247 yield 1 247 248 248 class ItemPublicationDispatcher(component):249 class NodePurgeDispatcher(component): 249 250 250 251 Inboxes = {"inbox" : "bridge.Element instance", … … 264 265 265 266 def __init__(self): 266 super( ItemPublicationDispatcher, self).__init__()267 super(NodePurgeDispatcher, self).__init__() 267 268 268 269 def main(self): … … 279 280 if self.dataReady("forward"): 280 281 s = self.recv("forward") 281 self.send(Node.to_pu blication_element(s), "outbox")282 self.send(Node.to_purge_element(s), "outbox") 282 283 283 284 if self.dataReady("inbox"): … … 291 292 292 293 if key in self.outboxes: 293 self.send(Node.from_pu blication_element(e), key)294 self.send(Node.from_purge_element(e), key) 294 295 handled = True 295 296 … … 304 305 yield 1 305 306 306 class Item DeletionDispatcher(component):307 class ItemPublicationDispatcher(component): 307 308 308 309 Inboxes = {"inbox" : "bridge.Element instance", … … 322 323 323 324 def __init__(self): 325 super(ItemPublicationDispatcher, self).__init__() 326 327 def main(self): 328 yield 1 329 330 while 1: 331 if self.dataReady("control"): 332 mes = self.recv("control") 333 334 if isinstance(mes, shutdownMicroprocess) or isinstance(mes, producerFinished): 335 self.send(producerFinished(), "signal") 336 break 337 338 if self.dataReady("forward"): 339 s = self.recv("forward") 340 self.send(Node.to_publication_element(s), "outbox") 341 342 if self.dataReady("inbox"): 343 handled = False 344 a = self.recv("inbox") 345 e = a.xml_parent.xml_parent 346 self.send(('INCOMING', e), "log") 347 348 msg_type = e.get_attribute_value(u'type') or 'get' 349 key = 'xmpp.%s' % unicode(msg_type) 350 351 if key in self.outboxes: 352 self.send(Node.from_publication_element(e), key) 353 handled = True 354 355 if not handled: 356 self.send(e, "unknown") 357 358 if not self.anyReady(): 359 self.pause() 360 361 yield 1 362 363 yield 1 364 365 class ItemDeletionDispatcher(component): 366 367 Inboxes = {"inbox" : "bridge.Element instance", 368 "control" : "Shutdown the client stream", 369 "forward" : "headstock.api.contact.Message instance to be sent back to the client. Transforms the instance to a bridge.Element instance and puts it into the 'outbox'", 370 } 371 372 Outboxes = {"outbox" : "bridge.Element instance", 373 "signal" : "Shutdown signal", 374 "log" : "log", 375 "unknown" : "Unknown element that could not be dispatched properly", 376 "xmpp.get" : "Activity requests", 377 "xmpp.set" : "Activity responses", 378 "xmpp.result" : "Activity responses", 379 "xmpp.error" : "Activity response error", 380 } 381 382 def __init__(self): 324 383 super(ItemDeletionDispatcher, self).__init__() 325 384 … … 407 466 "create.inbox" : "", 408 467 "create.forward" : "", 468 "purge.inbox" : "", 469 "purge.forward" : "", 409 470 "delete.inbox" : "", 410 471 "delete.forward" : "", … … 418 479 "retract.forward" : "", 419 480 "message.inbox" : "", 481 "in.create.error" : "Publish items response error", 420 482 "in.create.get" : "Publish items requests", 421 483 "in.create.set" : "Publish items responses", 422 484 "in.create.result" : "Publish items responses", 485 "in.purge.error" : "Publish items response error", 486 "in.purge.get" : "Publish items requests", 487 "in.purge.set" : "Publish items responses", 488 "in.purge.result" : "Publish items responses", 423 489 "in.delete.error" : "Publish items response error", 424 490 "in.delete.get" : "Publish items requests", 425 491 "in.delete.set" : "Publish items responses", 426 492 "in.delete.result" : "Publish items responses", 427 "in.create.error" : "Publish items response error",428 493 "in.subscribe.get" : "Publish items requests", 429 494 "in.subscribe.set" : "Publish items responses", … … 448 513 "log" : "log", 449 514 "create.outbox" : "", 515 "purge.outbox" : "", 450 516 "delete.outbox" : "", 451 517 "subscribe.outbox" : "", … … 457 523 "out.create.set" : "Publish items responses", 458 524 "out.create.result" : "Publish items responses", 525 "out.purge.error" : "Publish items response error", 526 "out.purge.get" : "Publish items requests", 527 "out.purge.set" : "Publish items responses", 528 "out.purge.result" : "Publish items responses", 459 529 "out.delete.error" : "Publish items response error", 460 530 "out.delete.get" : "Publish items requests", … … 535 605 nodecreatedisp.activate() 536 606 607 nodepurgedisp = NodePurgeDispatcher() 608 self.link((self, 'purge.inbox'), (nodepurgedisp, 'inbox'), passthrough=1) 609 self.link((self, 'purge.forward'), (nodepurgedisp, 'forward'), passthrough=1) 610 self.link((self, 'in.purge.get'), (nodepurgedisp, 'forward'), passthrough=1) 611 self.link((self, 'in.purge.set'), (nodepurgedisp, 'forward'), passthrough=1) 612 self.link((self, 'in.purge.result'), (nodepurgedisp, 'forward'), passthrough=1) 613 self.link((self, 'in.purge.error'), (nodepurgedisp, 'forward'), passthrough=1) 614 self.link((nodepurgedisp, 'outbox'), (self, 'purge.outbox'), passthrough=2) 615 self.link((nodepurgedisp, 'xmpp.get'), (self, 'out.purge.get'), passthrough=2) 616 self.link((nodepurgedisp, 'xmpp.set'), (self, 'out.purge.set'), passthrough=2) 617 self.link((nodepurgedisp, 'xmpp.result'), (self, 'out.purge.result'), passthrough=2) 618 self.link((nodepurgedisp, 'xmpp.error'), (self, 'out.purge.error'), passthrough=2) 619 self.link((nodepurgedisp, 'unknown'), (self, 'unknown'), passthrough=2) 620 self.link((nodepurgedisp, 'log'), (self, 'log'), passthrough=2) 621 self.addChildren(nodepurgedisp) 622 nodepurgedisp.activate() 623 537 624 nodedeletedisp = NodeDeletionDispatcher() 538 625 self.link((self, 'delete.inbox'), (nodedeletedisp, 'inbox'), passthrough=1)
