1
# Copyright (c) 2001-2006 Twisted Matrix Laboratories.
2
# See LICENSE for details.
5
Public Jabber Interfaces.
8
from zope.interface import Attribute, Interface
10
class IInitializer(Interface):
12
Interface for XML stream initializers.
14
Initializers perform a step in getting the XML stream ready to be
15
used for the exchange of XML stanzas.
18
class IInitiatingInitializer(IInitializer):
20
Interface for XML stream initializers for the initiating entity.
23
xmlstream = Attribute("""The associated XML stream""")
27
Initiate the initialization step.
29
May return a deferred when the initialization is done asynchronously.
32
class IIQResponseTracker(Interface):
34
IQ response tracker interface.
36
The XMPP stanza C{iq} has a request-response nature that fits
37
naturally with deferreds. You send out a request and when the response
38
comes back a deferred is fired.
40
The L{IQ} class implements a C{send} method that returns a deferred. This
41
deferred is put in a dictionary that is kept in an L{XmlStream} object,
42
keyed by the request stanzas C{id} attribute.
44
An object providing this interface (usually an instance of L{XmlStream}),
45
keeps the said dictionary and sets observers on the iq stanzas of type
46
C{result} and C{error} and lets the callback fire the associated deferred.
48
iqDeferreds = Attribute("Dictionary of deferreds waiting for an iq "
51
class IService(Interface):
53
External server-side component service interface.
55
Services that provide this interface can be added to L{ServiceManager} to
56
implement (part of) the functionality of the server-side component.
59
def componentConnected(xs):
61
Parent component has established a connection.
63
At this point, authentication was succesful, and XML stanzas
64
can be exchanged over the XML stream L{xs}. This method can be used
65
to setup observers for incoming stanzas.
67
@param xs: XML Stream that represents the established connection.
68
@type xs: L{xmlstream.XmlStream}
71
def componentDisconnected():
73
Parent component has lost the connection to the Jabber server.
75
Subsequent use of C{self.parent.send} will result in data being
76
queued until a new connection has been established.
79
def transportConnected(xs):
81
Parent component has established a connection over the underlying
84
At this point, no traffic has been exchanged over the XML stream. This
85
method can be used to change properties of the XML Stream (in L{xs}),
86
the service manager or it's authenticator prior to stream
87
initialization (including authentication).