twisted/plugins/fixbot_nexus_plugin.py
changeset 23 67e71e9170e5
child 25 6c0a53a512d8
equal deleted inserted replaced
22:1f1a21852abc 23:67e71e9170e5
       
     1 from zope.interface import implements
       
     2 
       
     3 from twisted.python import usage
       
     4 from twisted.plugin import IPlugin
       
     5 from twisted.application.service import IServiceMaker
       
     6 
       
     7 from twisted.application import internet
       
     8 
       
     9 from fixbot import nexus
       
    10 
       
    11 class NexusOptions (usage.Options) :
       
    12     optParameters = [
       
    13 #        (   "uid",          "u",    "fixbot",           "user to run as"                                ),
       
    14 #        (   "gid",          "g",    "nogroup",          "group to run as"                               ),
       
    15         (   "irc-hostname", "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
       
    16         (   "irc-port",     "p",    6667,               "IRC server port",                      int     ),
       
    17         (   "irc-nickname", "n",    "FixBotDev",        "IRC nickname",                                 ),
       
    18         (   "irc-username", "U",    "fixbot",           "IRC username",                                 ),
       
    19         (   "irc-channel",  "c",    "#fixme-test",      "IRC channel",                                  ),
       
    20         (   "api-listen",   "l",    "127.0.0.1",        "address for API server to listen on"           ),
       
    21         (   "api-port",     "P",    34888,              "port for API server to listen on",     int     ),
       
    22     ]
       
    23 
       
    24     optFlags = [
       
    25 
       
    26     ]
       
    27 
       
    28 class MyServiceMaker (object) :
       
    29     implements(IServiceMaker, IPlugin)
       
    30     tapname = "fixbot_nexus"
       
    31     description = "A SysAdmin's best friend"
       
    32     options = NexusOptions
       
    33 
       
    34     def makeService (self, config) :
       
    35         return nexus.makeService(config)
       
    36 
       
    37 serviceMaker = MyServiceMaker()
       
    38 
       
    39