root / trunk / twisted / plugins / twisted_words.py

Revision 25272, 1.1 kB (checked in by ralphm, 8 months ago)

Add XMPP router functionality and twistd plugin 'xmpp-router'.

Author: ralphm.
Reviewer: therve.
Fixes #3407.

An XMPP router connects parts of a Jabber server known as 'components' and
routes XML Stanzas between components based on addressing on stanzas.
Components usually connect over a TCP socket, so this change adds a factory to
listen for incoming component connections that are tied to the router. Using
the new XmlPipe?, components can also be connected to the router within the same
process without using a socket. Finally, a random stream ID is generated for
all incoming XML Streams.

The new xmpp-router twistd plugin allows for easy deployment of a stand-alone
XMPP router.

Line 
1 # Copyright (c) 2001-2008 Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 from zope.interface import classProvides
5
6 from twisted.plugin import IPlugin
7
8 from twisted.application.service import ServiceMaker
9 from twisted.words import iwords
10
11 TwistedTOC = ServiceMaker(
12     "Twisted TOC Server",
13     "twisted.words.toctap",
14     "An AIM TOC service.",
15     "toc")
16
17 NewTwistedWords = ServiceMaker(
18     "New Twisted Words",
19     "twisted.words.tap",
20     "A modern words server",
21     "words")
22
23 TwistedXMPPRouter = ServiceMaker(
24     "XMPP Router",
25     "twisted.words.xmpproutertap",
26     "An XMPP Router server",
27     "xmpp-router")
28
29 class RelayChatInterface(object):
30     classProvides(IPlugin, iwords.IProtocolPlugin)
31
32     name = 'irc'
33
34     def getFactory(cls, realm, portal):
35         from twisted.words import service
36         return service.IRCFactory(realm, portal)
37     getFactory = classmethod(getFactory)
38
39 class PBChatInterface(object):
40     classProvides(IPlugin, iwords.IProtocolPlugin)
41
42     name = 'pb'
43
44     def getFactory(cls, realm, portal):
45         from twisted.spread import pb
46         return pb.PBServerFactory(portal, True)
47     getFactory = classmethod(getFactory)
48
Note: See TracBrowser for help on using the browser.