Changeset 165:76a61f5aa343 for wokkel/iwokkel.py
- Timestamp:
- Jan 22, 2012, 2:51:25 PM (10 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/iwokkel.py
r160 r165 1 # -*- test-case-name: wokkel.test.test_iwokkel -*- 2 # 1 3 # Copyright (c) Ralph Meijer. 2 4 # See LICENSE for details. … … 6 8 """ 7 9 8 from zope.interface import Attribute, Interface 9 10 class IXMPPHandler(Interface): 11 """ 12 Interface for XMPP protocol handlers. 13 14 Objects that provide this interface can be added to a stream manager to 15 handle of (part of) an XMPP extension protocol. 16 """ 17 18 parent = Attribute("""XML stream manager for this handler""") 19 xmlstream = Attribute("""The managed XML stream""") 20 21 def setHandlerParent(parent): 22 """ 23 Set the parent of the handler. 24 25 @type parent: L{IXMPPHandlerCollection} 26 """ 27 28 29 def disownHandlerParent(parent): 30 """ 31 Remove the parent of the handler. 32 33 @type parent: L{IXMPPHandlerCollection} 34 """ 35 36 37 def makeConnection(xs): 38 """ 39 A connection over the underlying transport of the XML stream has been 40 established. 41 42 At this point, no traffic has been exchanged over the XML stream 43 given in C{xs}. 44 45 This should setup L{xmlstream} and call L{connectionMade}. 46 47 @type xs: L{XmlStream<twisted.words.protocols.jabber.XmlStream>} 48 """ 49 50 51 def connectionMade(): 52 """ 53 Called after a connection has been established. 54 55 This method can be used to change properties of the XML Stream, its 56 authenticator or the stream manager prior to stream initialization 57 (including authentication). 58 """ 59 60 61 def connectionInitialized(): 62 """ 63 The XML stream has been initialized. 64 65 At this point, authentication was successful, and XML stanzas can be 66 exchanged over the XML stream L{xmlstream}. This method can be 67 used to setup observers for incoming stanzas. 68 """ 69 70 71 def connectionLost(reason): 72 """ 73 The XML stream has been closed. 74 75 Subsequent use of L{parent.send} will result in data being queued 76 until a new connection has been established. 77 78 @type reason: L{twisted.python.failure.Failure} 79 """ 80 81 82 83 class IXMPPHandlerCollection(Interface): 84 """ 85 Collection of handlers. 86 87 Contain several handlers and manage their connection. 88 """ 89 90 def __iter__(): 91 """ 92 Get an iterator over all child handlers. 93 """ 94 95 96 def addHandler(handler): 97 """ 98 Add a child handler. 99 100 @type handler: L{IXMPPHandler} 101 """ 102 103 104 def removeHandler(handler): 105 """ 106 Remove a child handler. 107 108 @type handler: L{IXMPPHandler} 109 """ 110 10 __all__ = ['IXMPPHandler', 'IXMPPHandlerCollection', 11 'IPubSubClient', 'IPubSubService', 'IPubSubResource', 12 'IMUCClient', 'IMUCStatuses'] 13 14 from zope.interface import Interface 15 from twisted.python.deprecate import deprecatedModuleAttribute 16 from twisted.python.versions import Version 17 from twisted.words.protocols.jabber.ijabber import IXMPPHandler 18 from twisted.words.protocols.jabber.ijabber import IXMPPHandlerCollection 19 20 deprecatedModuleAttribute( 21 Version("Wokkel", 0, 7, 0), 22 "Use twisted.words.protocols.jabber.ijabber.IXMPPHandler instead.", 23 __name__, 24 "IXMPPHandler") 25 26 deprecatedModuleAttribute( 27 Version("Wokkel", 0, 7, 0), 28 "Use twisted.words.protocols.jabber.ijabber.IXMPPHandlerCollection " 29 "instead.", 30 __name__, 31 "IXMPPHandlerCollection") 111 32 112 33 … … 143 64 @type nodeIdentifier: C{unicode} 144 65 """ 66 145 67 146 68 … … 250 172 @rtype: L{defer.Deferred} 251 173 """ 174 252 175 253 176 … … 1029 952 1030 953 954 1031 955 class IMUCStatuses(Interface): 1032 956 """
Note: See TracChangeset
for help on using the changeset viewer.