Ignore:
Timestamp:
Oct 10, 2008, 5:24:28 PM (14 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@90
Message:

Add XMPP router and server side component authenticator.

Author: ralphm.
Fixed #30.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/generic.py

    r30 r35  
    1313from twisted.words.protocols.jabber import error
    1414from twisted.words.protocols.jabber.xmlstream import toResponse
    15 from twisted.words.xish import domish
     15from twisted.words.xish import domish, utility
    1616
    1717from wokkel import disco
     
    121121    def getDiscoItems(self, requestor, target, node):
    122122        return defer.succeed([])
     123
     124
     125
     126class XmlPipe(object):
     127    """
     128    XML stream pipe.
     129
     130    Connects two objects that communicate stanzas through an XML stream like
     131    interface. Each of the ends of the pipe (sink and source) can be used to
     132    send XML stanzas to the other side, or add observers to process XML stanzas
     133    that were sent from the other side.
     134
     135    XML pipes are usually used in place of regular XML streams that are
     136    transported over TCP. This is the reason for the use of the names source
     137    and sink for both ends of the pipe. The source side corresponds with the
     138    entity that initiated the TCP connection, whereas the sink corresponds with
     139    the entity that accepts that connection. In this object, though, the source
     140    and sink are treated equally.
     141
     142    Unlike Jabber
     143    L{XmlStream<twisted.words.protocols.jabber.xmlstream.XmlStream>}s, the sink
     144    and source objects are assumed to represent an eternal connected and
     145    initialized XML stream. As such, events corresponding to connection,
     146    disconnection, initialization and stream errors are not dispatched or
     147    processed.
     148
     149    @ivar source: Source XML stream.
     150    @ivar sink: Sink XML stream.
     151    """
     152
     153    def __init__(self):
     154        self.source = utility.EventDispatcher()
     155        self.sink = utility.EventDispatcher()
     156        self.source.send = lambda obj: self.sink.dispatch(obj)
     157        self.sink.send = lambda obj: self.source.dispatch(obj)
Note: See TracChangeset for help on using the changeset viewer.