twisted/plugins/fixbot_nexus_plugin.py
author Tero Marttila <terom@fixme.fi>
Sat, 20 Feb 2010 23:06:43 +0200
changeset 64 8574aeff9b36
parent 62 e4db89a5f6bc
permissions -rw-r--r--
blind error handling tweaks
from zope.interface import implements

from twisted.python import usage
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker

from twisted.application import internet

from fixbot import config, nexus, api

class NexusOptions (api.ServerOptions) :
    
    optParameters = [
        (   "irc-server",   "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
        (   "irc-port",     "p",    6667,               "IRC server port",                      int     ),
        (   "irc-nickname", "N",    "FixBotDev",        "IRC nickname",                                 ),
        (   "irc-username", "U",    "fixbot",           "IRC username",                                 ),
        (   "irc-channel",  "C",    "#fixme-test",      "IRC channel",                                  ),
    ]

    optFlags = [

    ]

class MyServiceMaker (object) :
    implements(IServiceMaker, IPlugin)
    tapname = "fixbot-nexus"
    description = "FixBot (nexus component)"
    options = NexusOptions

    def makeService (self, config) :
        #if config['api-secret'] is None :
        #    raise usage.UsageError("No value given for required option api-secret")

        return nexus.makeService(config)

serviceMaker = MyServiceMaker()