diff options
Diffstat (limited to 'vendor/Twisted-10.0.0/twisted/plugins')
21 files changed, 670 insertions, 0 deletions
diff --git a/vendor/Twisted-10.0.0/twisted/plugins/__init__.py b/vendor/Twisted-10.0.0/twisted/plugins/__init__.py new file mode 100644 index 0000000000..9ff4e58507 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/__init__.py @@ -0,0 +1,17 @@ +# -*- test-case-name: twisted.test.test_plugin -*- +# Copyright (c) 2005 Divmod, Inc. +# Copyright (c) 2007 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Plugins go in directories on your PYTHONPATH named twisted/plugins: +this is the only place where an __init__.py is necessary, thanks to +the __path__ variable. + +@author: Jp Calderone +@author: Glyph Lefkowitz +""" + +from twisted.plugin import pluginPackagePaths +__path__.extend(pluginPackagePaths(__name__)) +__all__ = [] # nothing to see here, move along, move along diff --git a/vendor/Twisted-10.0.0/twisted/plugins/cred_anonymous.py b/vendor/Twisted-10.0.0/twisted/plugins/cred_anonymous.py new file mode 100644 index 0000000000..8b4c00bea2 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/cred_anonymous.py @@ -0,0 +1,40 @@ +# -*- test-case-name: twisted.test.test_strcred -*- +# +# Copyright (c) 2007-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Cred plugin for anonymous logins. +""" + +from zope.interface import implements + +from twisted import plugin +from twisted.cred.checkers import AllowAnonymousAccess +from twisted.cred.strcred import ICheckerFactory +from twisted.cred.credentials import IAnonymous + + +anonymousCheckerFactoryHelp = """ +This allows anonymous authentication for servers that support it. +""" + + +class AnonymousCheckerFactory(object): + """ + Generates checkers that will authenticate an anonymous request. + """ + implements(ICheckerFactory, plugin.IPlugin) + authType = 'anonymous' + authHelp = anonymousCheckerFactoryHelp + argStringFormat = 'No argstring required.' + credentialInterfaces = (IAnonymous,) + + + def generateChecker(self, argstring=''): + return AllowAnonymousAccess() + + + +theAnonymousCheckerFactory = AnonymousCheckerFactory() + diff --git a/vendor/Twisted-10.0.0/twisted/plugins/cred_file.py b/vendor/Twisted-10.0.0/twisted/plugins/cred_file.py new file mode 100644 index 0000000000..fbc6145e3f --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/cred_file.py @@ -0,0 +1,60 @@ +# -*- test-case-name: twisted.test.test_strcred -*- +# +# Copyright (c) 2007-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Cred plugin for a file of the format 'username:password'. +""" + +import sys + +from zope.interface import implements + +from twisted import plugin +from twisted.cred.checkers import FilePasswordDB +from twisted.cred.strcred import ICheckerFactory +from twisted.cred.credentials import IUsernamePassword, IUsernameHashedPassword + + + +fileCheckerFactoryHelp = """ +This checker expects to receive the location of a file that +conforms to the FilePasswordDB format. Each line in the file +should be of the format 'username:password', in plain text. +""" + +invalidFileWarning = 'Warning: not a valid file' + + + +class FileCheckerFactory(object): + """ + A factory for instances of L{FilePasswordDB}. + """ + implements(ICheckerFactory, plugin.IPlugin) + authType = 'file' + authHelp = fileCheckerFactoryHelp + argStringFormat = 'Location of a FilePasswordDB-formatted file.' + # Explicitly defined here because FilePasswordDB doesn't do it for us + credentialInterfaces = (IUsernamePassword, IUsernameHashedPassword) + + errorOutput = sys.stderr + + def generateChecker(self, argstring): + """ + This checker factory expects to get the location of a file. + The file should conform to the format required by + L{FilePasswordDB} (using defaults for all + initialization parameters). + """ + from twisted.python.filepath import FilePath + if not argstring.strip(): + raise ValueError, '%r requires a filename' % self.authType + elif not FilePath(argstring).isfile(): + self.errorOutput.write('%s: %s\n' % (invalidFileWarning, argstring)) + return FilePasswordDB(argstring) + + + +theFileCheckerFactory = FileCheckerFactory() diff --git a/vendor/Twisted-10.0.0/twisted/plugins/cred_memory.py b/vendor/Twisted-10.0.0/twisted/plugins/cred_memory.py new file mode 100644 index 0000000000..33153f7970 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/cred_memory.py @@ -0,0 +1,68 @@ +# -*- test-case-name: twisted.test.test_strcred -*- +# +# Copyright (c) 2007-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Cred plugin for an in-memory user database. +""" + +from zope.interface import implements + +from twisted import plugin +from twisted.cred.strcred import ICheckerFactory +from twisted.cred.checkers import InMemoryUsernamePasswordDatabaseDontUse +from twisted.cred.credentials import IUsernamePassword, IUsernameHashedPassword + + + +inMemoryCheckerFactoryHelp = """ +A checker that uses an in-memory user database. + +This is only of use in one-off test programs or examples which +don't want to focus too much on how credentials are verified. You +really don't want to use this for anything else. It is a toy. +""" + + + +class InMemoryCheckerFactory(object): + """ + A factory for in-memory credentials checkers. + + This is only of use in one-off test programs or examples which don't + want to focus too much on how credentials are verified. + + You really don't want to use this for anything else. It is, at best, a + toy. If you need a simple credentials checker for a real application, + see L{cred_passwd.PasswdCheckerFactory}. + """ + implements(ICheckerFactory, plugin.IPlugin) + authType = 'memory' + authHelp = inMemoryCheckerFactoryHelp + argStringFormat = 'A colon-separated list (name:password:...)' + credentialInterfaces = (IUsernamePassword, + IUsernameHashedPassword) + + def generateChecker(self, argstring): + """ + This checker factory expects to get a list of + username:password pairs, with each pair also separated by a + colon. For example, the string 'alice:f:bob:g' would generate + two users, one named 'alice' and one named 'bob'. + """ + checker = InMemoryUsernamePasswordDatabaseDontUse() + if argstring: + pieces = argstring.split(':') + if len(pieces) % 2: + from twisted.cred.strcred import InvalidAuthArgumentString + raise InvalidAuthArgumentString( + "argstring must be in format U:P:...") + for i in range(0, len(pieces), 2): + username, password = pieces[i], pieces[i+1] + checker.addUser(username, password) + return checker + + + +theInMemoryCheckerFactory = InMemoryCheckerFactory() diff --git a/vendor/Twisted-10.0.0/twisted/plugins/cred_unix.py b/vendor/Twisted-10.0.0/twisted/plugins/cred_unix.py new file mode 100644 index 0000000000..b67df8f62e --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/cred_unix.py @@ -0,0 +1,138 @@ +# -*- test-case-name: twisted.test.test_strcred -*- +# +# Copyright (c) 2007-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Cred plugin for UNIX user accounts. +""" + +from zope.interface import implements + +from twisted import plugin +from twisted.cred.strcred import ICheckerFactory +from twisted.cred.checkers import ICredentialsChecker +from twisted.cred.credentials import IUsernamePassword +from twisted.cred.error import UnauthorizedLogin +from twisted.internet import defer + + + +def verifyCryptedPassword(crypted, pw): + if crypted[0] == '$': # md5_crypt encrypted + salt = '$1$' + crypted.split('$')[2] + else: + salt = crypted[:2] + try: + import crypt + except ImportError: + crypt = None + + if crypt is None: + raise NotImplementedError("cred_unix not supported on this platform") + return crypt.crypt(pw, salt) == crypted + + + +class UNIXChecker(object): + """ + A credentials checker for a UNIX server. This will check that + an authenticating username/password is a valid user on the system. + + Does not work on Windows. + + Right now this supports Python's pwd and spwd modules, if they are + installed. It does not support PAM. + """ + implements(ICredentialsChecker) + credentialInterfaces = (IUsernamePassword,) + + + def checkPwd(self, pwd, username, password): + try: + cryptedPass = pwd.getpwnam(username)[1] + except KeyError: + return defer.fail(UnauthorizedLogin()) + else: + if cryptedPass in ('*', 'x'): + # Allow checkSpwd to take over + return None + elif verifyCryptedPassword(cryptedPass, password): + return defer.succeed(username) + + + def checkSpwd(self, spwd, username, password): + try: + cryptedPass = spwd.getspnam(username)[1] + except KeyError: + return defer.fail(UnauthorizedLogin()) + else: + if verifyCryptedPassword(cryptedPass, password): + return defer.succeed(username) + + + def requestAvatarId(self, credentials): + username, password = credentials.username, credentials.password + + try: + import pwd + except ImportError: + pwd = None + + if pwd is not None: + checked = self.checkPwd(pwd, username, password) + if checked is not None: + return checked + + try: + import spwd + except ImportError: + spwd = None + + if spwd is not None: + checked = self.checkSpwd(spwd, username, password) + if checked is not None: + return checked + # TODO: check_pam? + # TODO: check_shadow? + return defer.fail(UnauthorizedLogin()) + + + +unixCheckerFactoryHelp = """ +This checker will attempt to use every resource available to +authenticate against the list of users on the local UNIX system. +(This does not support Windows servers for very obvious reasons.) + +Right now, this includes support for: + + * Python's pwd module (which checks /etc/passwd) + * Python's spwd module (which checks /etc/shadow) + +Future versions may include support for PAM authentication. +""" + + + +class UNIXCheckerFactory(object): + """ + A factory for L{UNIXChecker}. + """ + implements(ICheckerFactory, plugin.IPlugin) + authType = 'unix' + authHelp = unixCheckerFactoryHelp + argStringFormat = 'No argstring required.' + credentialInterfaces = UNIXChecker.credentialInterfaces + + def generateChecker(self, argstring): + """ + This checker factory ignores the argument string. Everything + needed to generate a user database is pulled out of the local + UNIX environment. + """ + return UNIXChecker() + + + +theUnixCheckerFactory = UNIXCheckerFactory() + diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_conch.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_conch.py new file mode 100644 index 0000000000..3214866b98 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_conch.py @@ -0,0 +1,18 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedSSH = ServiceMaker( + "Twisted Conch Server", + "twisted.conch.tap", + "A Conch SSH service.", + "conch") + +TwistedManhole = ServiceMaker( + "Twisted Manhole (new)", + "twisted.conch.manhole_tap", + ("An interactive remote debugger service accessible via telnet " + "and ssh and providing syntax coloring and basic line editing " + "functionality."), + "manhole") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_ftp.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_ftp.py new file mode 100644 index 0000000000..a3d2a1f7cb --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_ftp.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedFTP = ServiceMaker( + "Twisted FTP", + "twisted.tap.ftp", + "An FTP server.", + "ftp") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_inet.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_inet.py new file mode 100644 index 0000000000..b05df88efe --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_inet.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedINETD = ServiceMaker( + "Twisted INETD Server", + "twisted.runner.inetdtap", + "An inetd(8) replacement.", + "inetd") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_lore.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_lore.py new file mode 100644 index 0000000000..43bb913656 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_lore.py @@ -0,0 +1,38 @@ + +from zope.interface import implements + +from twisted.lore.scripts.lore import IProcessor +from twisted.plugin import IPlugin + +class _LorePlugin(object): + implements(IPlugin, IProcessor) + + def __init__(self, name, moduleName, description): + self.name = name + self.moduleName = moduleName + self.description = description + +DefaultProcessor = _LorePlugin( + "lore", + "twisted.lore.default", + "Lore format") + +MathProcessor = _LorePlugin( + "mlore", + "twsited.lore.lmath", + "Lore format with LaTeX formula") + +SlideProcessor = _LorePlugin( + "lore-slides", + "twisted.lore.slides", + "Lore for slides") + +ManProcessor = _LorePlugin( + "man", + "twisted.lore.man2lore", + "UNIX Man pages") + +NevowProcessor = _LorePlugin( + "nevow", + "twisted.lore.nevowlore", + "Nevow for Lore") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_mail.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_mail.py new file mode 100644 index 0000000000..869b0cb5f0 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_mail.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedMail = ServiceMaker( + "Twisted Mail", + "twisted.mail.tap", + "An email service", + "mail") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_manhole.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_manhole.py new file mode 100644 index 0000000000..126f251893 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_manhole.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedManhole = ServiceMaker( + "Twisted Manhole (old)", + "twisted.tap.manhole", + "An interactive remote debugger service.", + "manhole-old") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_names.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_names.py new file mode 100644 index 0000000000..e48edaf356 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_names.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedNames = ServiceMaker( + "Twisted DNS Server", + "twisted.names.tap", + "A domain name server.", + "dns") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_news.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_news.py new file mode 100644 index 0000000000..8970ae254a --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_news.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedNews = ServiceMaker( + "Twisted News", + "twisted.news.tap", + "A news server.", + "news") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_portforward.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_portforward.py new file mode 100644 index 0000000000..77d605ed6a --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_portforward.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedPortForward = ServiceMaker( + "Twisted Port-Forwarding", + "twisted.tap.portforward", + "A simple port-forwarder.", + "portforward") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_qtstub.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_qtstub.py new file mode 100644 index 0000000000..1b9b08a03b --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_qtstub.py @@ -0,0 +1,45 @@ +# Copyright (c) 2006 Twisted Matrix Laboratories. +# See LICENSE for details. + +""" +Backwards-compatibility plugin for the Qt reactor. + +This provides a Qt reactor plugin named C{qt} which emits a deprecation +warning and a pointer to the separately distributed Qt reactor plugins. +""" + +import warnings + +from twisted.application.reactors import Reactor, NoSuchReactor + +wikiURL = 'http://twistedmatrix.com/trac/wiki/QTReactor' +errorMessage = ('qtreactor is no longer a part of Twisted due to licensing ' + 'issues. Please see %s for details.' % (wikiURL,)) + +class QTStub(Reactor): + """ + Reactor plugin which emits a deprecation warning on the successful + installation of its reactor or a pointer to further information if an + ImportError occurs while attempting to install it. + """ + def __init__(self): + super(QTStub, self).__init__( + 'qt', 'qtreactor', 'QT integration reactor') + + + def install(self): + """ + Install the Qt reactor with a deprecation warning or try to point + the user to further information if it cannot be installed. + """ + try: + super(QTStub, self).install() + except (ValueError, ImportError): + raise NoSuchReactor(errorMessage) + else: + warnings.warn( + "Please use -r qt3 to import qtreactor", + category=DeprecationWarning) + + +qt = QTStub() diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_reactors.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_reactors.py new file mode 100644 index 0000000000..428e96c407 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_reactors.py @@ -0,0 +1,38 @@ +# Copyright (c) 2006 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.reactors import Reactor + +default = Reactor( + 'default', 'twisted.internet.default', + 'The best reactor for the current platform.') + +select = Reactor( + 'select', 'twisted.internet.selectreactor', 'select(2)-based reactor.') +wx = Reactor( + 'wx', 'twisted.internet.wxreactor', 'wxPython integration reactor.') +gtk = Reactor( + 'gtk', 'twisted.internet.gtkreactor', 'Gtk1 integration reactor.') +gtk2 = Reactor( + 'gtk2', 'twisted.internet.gtk2reactor', 'Gtk2 integration reactor.') +glib2 = Reactor( + 'glib2', 'twisted.internet.glib2reactor', + 'GLib2 event-loop integration reactor.') +glade = Reactor( + 'debug-gui', 'twisted.manhole.gladereactor', + 'Semi-functional debugging/introspection reactor.') +win32er = Reactor( + 'win32', 'twisted.internet.win32eventreactor', + 'Win32 WaitForMultipleObjects-based reactor.') +poll = Reactor( + 'poll', 'twisted.internet.pollreactor', 'poll(2)-based reactor.') +epoll = Reactor( + 'epoll', 'twisted.internet.epollreactor', 'epoll(4)-based reactor.') +cf = Reactor( + 'cf' , 'twisted.internet.cfreactor', + 'CoreFoundation integration reactor.') +kqueue = Reactor( + 'kqueue', 'twisted.internet.kqreactor', 'kqueue(2)-based reactor.') +iocp = Reactor( + 'iocp', 'twisted.internet.iocpreactor', + 'Win32 IO Completion Ports-based reactor.') diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_socks.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_socks.py new file mode 100644 index 0000000000..354a4de9b4 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_socks.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedSOCKS = ServiceMaker( + "Twisted SOCKS", + "twisted.tap.socks", + "A SOCKSv4 proxy service.", + "socks") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_telnet.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_telnet.py new file mode 100644 index 0000000000..62be6027e7 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_telnet.py @@ -0,0 +1,10 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedTelnet = ServiceMaker( + "Twisted Telnet Shell Server", + "twisted.tap.telnet", + "A simple, telnet-based remote debugging service.", + "telnet") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_trial.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_trial.py new file mode 100644 index 0000000000..debc8afa03 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_trial.py @@ -0,0 +1,59 @@ + +from zope.interface import implements + +from twisted.trial.itrial import IReporter +from twisted.plugin import IPlugin + +class _Reporter(object): + implements(IPlugin, IReporter) + + def __init__(self, name, module, description, longOpt, shortOpt, klass): + self.name = name + self.module = module + self.description = description + self.longOpt = longOpt + self.shortOpt = shortOpt + self.klass = klass + + +Tree = _Reporter("Tree Reporter", + "twisted.trial.reporter", + description="verbose color output (default reporter)", + longOpt="verbose", + shortOpt="v", + klass="TreeReporter") + +BlackAndWhite = _Reporter("Black-And-White Reporter", + "twisted.trial.reporter", + description="Colorless verbose output", + longOpt="bwverbose", + shortOpt="o", + klass="VerboseTextReporter") + +Minimal = _Reporter("Minimal Reporter", + "twisted.trial.reporter", + description="minimal summary output", + longOpt="summary", + shortOpt="s", + klass="MinimalReporter") + +Classic = _Reporter("Classic Reporter", + "twisted.trial.reporter", + description="terse text output", + longOpt="text", + shortOpt="t", + klass="TextReporter") + +Timing = _Reporter("Timing Reporter", + "twisted.trial.reporter", + description="Timing output", + longOpt="timing", + shortOpt=None, + klass="TimingTextReporter") + +Subunit = _Reporter("Subunit Reporter", + "twisted.trial.reporter", + description="subunit output", + longOpt="subunit", + shortOpt=None, + klass="SubunitReporter") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_web.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_web.py new file mode 100644 index 0000000000..861e4dfa25 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_web.py @@ -0,0 +1,11 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from twisted.application.service import ServiceMaker + +TwistedWeb = ServiceMaker( + "Twisted Web", + "twisted.web.tap", + ("A general-purpose web server which can serve from a " + "filesystem or application resource."), + "web") diff --git a/vendor/Twisted-10.0.0/twisted/plugins/twisted_words.py b/vendor/Twisted-10.0.0/twisted/plugins/twisted_words.py new file mode 100644 index 0000000000..d1d0a77699 --- /dev/null +++ b/vendor/Twisted-10.0.0/twisted/plugins/twisted_words.py @@ -0,0 +1,48 @@ +# Copyright (c) 2001-2008 Twisted Matrix Laboratories. +# See LICENSE for details. + +from zope.interface import classProvides + +from twisted.plugin import IPlugin + +from twisted.application.service import ServiceMaker +from twisted.words import iwords + +TwistedTOC = ServiceMaker( + "Twisted TOC Server", + "twisted.words.toctap", + "An AIM TOC service.", + "toc") + +NewTwistedWords = ServiceMaker( + "New Twisted Words", + "twisted.words.tap", + "A modern words server", + "words") + +TwistedXMPPRouter = ServiceMaker( + "XMPP Router", + "twisted.words.xmpproutertap", + "An XMPP Router server", + "xmpp-router") + +class RelayChatInterface(object): + classProvides(IPlugin, iwords.IProtocolPlugin) + + name = 'irc' + + def getFactory(cls, realm, portal): + from twisted.words import service + return service.IRCFactory(realm, portal) + getFactory = classmethod(getFactory) + +class PBChatInterface(object): + classProvides(IPlugin, iwords.IProtocolPlugin) + + name = 'pb' + + def getFactory(cls, realm, portal): + from twisted.spread import pb + return pb.PBServerFactory(portal, True) + getFactory = classmethod(getFactory) + |