Ignore:
Timestamp:
Oct 18, 2008, 12:40:56 PM (14 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@113
Message:

Compatibility fixes for Twisted 8.0 and 8.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/component.py

    r40 r41  
    1515from twisted.words.xish import domish
    1616
     17try:
     18    #from twisted.words.protocols.jabber.xmlstream import XMPPHandler
     19    from twisted.words.protocols.jabber.xmlstream import XMPPHandlerCollection
     20except ImportError:
     21    #from wokkel.subprotocols import XMPPHandler
     22    from wokkel.subprotocols import XMPPHandlerCollection
     23
     24try:
     25    from twisted.words.protocols.jabber.xmlstream import XmlStreamServerFactory
     26except ImportError:
     27    from wokkel.compat import XmlStreamServerFactory
     28
    1729from wokkel.generic import XmlPipe
    1830from wokkel.subprotocols import StreamManager
     
    6779
    6880
    69 class InternalComponent(xmlstream.XMPPHandlerCollection, service.Service):
     81class InternalComponent(XMPPHandlerCollection, service.Service):
    7082    """
    7183    Component service that connects directly to a router.
     
    7789
    7890    def __init__(self, router, domain):
    79         xmlstream.XMPPHandlerCollection.__init__(self)
     91        XMPPHandlerCollection.__init__(self)
    8092        self.router = router
    8193        self.domain = domain
     
    116128        Add a new handler and connect it to the stream.
    117129        """
    118         xmlstream.XMPPHandlerCollection.addHandler(self, handler)
     130        XMPPHandlerCollection.addHandler(self, handler)
    119131
    120132        if self.xmlstream:
     
    169181        xmlstream.ListenAuthenticator.streamStarted(self, rootElement)
    170182
    171         # Compatibility fix
     183        # Compatibility fix for pre-8.2 implementations of ListenAuthenticator
    172184        if not self.xmlstream.sid:
    173185            from twisted.python import randbytes
     
    300312
    301313
    302 class XMPPComponentServerFactory(xmlstream.XmlStreamServerFactory):
     314class XMPPComponentServerFactory(XmlStreamServerFactory):
    303315    """
    304316    XMPP Component Server factory.
     
    318330            return ListenComponentAuthenticator(self.secret)
    319331
    320         xmlstream.XmlStreamServerFactory.__init__(self, authenticatorFactory)
     332        XmlStreamServerFactory.__init__(self, authenticatorFactory)
    321333        self.addBootstrap(xmlstream.STREAM_CONNECTED_EVENT,
    322334                          self.makeConnection)
Note: See TracChangeset for help on using the changeset viewer.