terom@23: from zope.interface import implements terom@23: terom@23: from twisted.python import usage terom@23: from twisted.plugin import IPlugin terom@23: from twisted.application.service import IServiceMaker terom@23: terom@23: from twisted.application import internet terom@23: terom@37: from fixbot import config, nexus terom@23: terom@37: class NexusOptions (config.ConfigOptions) : terom@37: terom@23: optParameters = [ terom@37: ( "irc-server", "s", "irc.fixme.fi", "IRC server hostname", ), terom@23: ( "irc-port", "p", 6667, "IRC server port", int ), terom@37: ( "irc-nickname", "N", "FixBotDev", "IRC nickname", ), terom@23: ( "irc-username", "U", "fixbot", "IRC username", ), terom@37: ( "irc-channel", "C", "#fixme-test", "IRC channel", ), terom@23: ( "api-listen", "l", "127.0.0.1", "address for API server to listen on" ), terom@23: ( "api-port", "P", 34888, "port for API server to listen on", int ), terom@35: ( "api-secret", None, None, "secret key for API connections" ), terom@23: ] terom@23: terom@23: optFlags = [ terom@23: terom@23: ] terom@23: terom@23: class MyServiceMaker (object) : terom@23: implements(IServiceMaker, IPlugin) terom@23: tapname = "fixbot_nexus" terom@25: description = "FixBot (nexus component)" terom@23: options = NexusOptions terom@23: terom@23: def makeService (self, config) : terom@35: if config['api-secret'] is None : terom@37: raise usage.UsageError("No value given for required option api-secret") terom@35: terom@23: return nexus.makeService(config) terom@23: terom@23: serviceMaker = MyServiceMaker() terom@23: terom@23: