Changeset 169:bb939a909750 for wokkel/component.py
- Timestamp:
- Feb 25, 2012, 8:27:56 PM (10 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/component.py
r166 r169 5 5 6 6 """ 7 XMPP External Component utilities 7 XMPP External Component utilities. 8 8 """ 9 9 … … 21 21 22 22 class Component(StreamManager, service.Service): 23 """ 24 XMPP External Component service. 25 26 This service is a XMPP stream manager that connects as an External 27 Component to an XMPP server, as described in 28 U{XEP-0114<http://xmpp.org/extensions/xep-0114.html>}. 29 """ 23 30 def __init__(self, host, port, jid, password): 24 31 self.host = host … … 29 36 StreamManager.__init__(self, factory) 30 37 38 31 39 def _authd(self, xs): 40 """ 41 Called when stream initialization has completed. 42 43 This replaces the C{send} method of the C{XmlStream} instance 44 that represents the current connection so that outgoing stanzas 45 always have a from attribute set to the JID of the component. 46 """ 32 47 old_send = xs.send 33 48 … … 41 56 StreamManager._authd(self, xs) 42 57 58 43 59 def initializationFailed(self, reason): 44 60 """ … … 51 67 reason.raiseException() 52 68 69 53 70 def startService(self): 71 """ 72 Start the service and connect to the server. 73 """ 54 74 service.Service.startService(self) 55 75 76 self._connection = self._getConnection() 77 78 79 def stopService(self): 80 """ 81 Stop the service, close the connection and prevent reconnects. 82 """ 83 service.Service.stopService(self) 84 56 85 self.factory.stopTrying() 57 self._connection = self._getConnection()58 59 def stopService(self):60 service.Service.stopService(self)61 62 86 self._connection.disconnect() 63 87 88 64 89 def _getConnection(self): 90 """ 91 Create a connector that connects to the server. 92 """ 65 93 return reactor.connectTCP(self.host, self.port, self.factory) 66 94
Note: See TracChangeset
for help on using the changeset viewer.