twisted/plugins/fixbot_nexus_plugin.py
changeset 62 e4db89a5f6bc
parent 43 78bc61c677d8
equal deleted inserted replaced
61:1e26ee53381f 62:e4db89a5f6bc
     4 from twisted.plugin import IPlugin
     4 from twisted.plugin import IPlugin
     5 from twisted.application.service import IServiceMaker
     5 from twisted.application.service import IServiceMaker
     6 
     6 
     7 from twisted.application import internet
     7 from twisted.application import internet
     8 
     8 
     9 from fixbot import config, nexus
     9 from fixbot import config, nexus, api
    10 
    10 
    11 class NexusOptions (config.ConfigOptions) :
    11 class NexusOptions (api.ServerOptions) :
    12     
    12     
    13     optParameters = [
    13     optParameters = [
    14         (   "irc-server",   "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
    14         (   "irc-server",   "s",    "irc.fixme.fi",     "IRC server hostname",                          ),
    15         (   "irc-port",     "p",    6667,               "IRC server port",                      int     ),
    15         (   "irc-port",     "p",    6667,               "IRC server port",                      int     ),
    16         (   "irc-nickname", "N",    "FixBotDev",        "IRC nickname",                                 ),
    16         (   "irc-nickname", "N",    "FixBotDev",        "IRC nickname",                                 ),
    17         (   "irc-username", "U",    "fixbot",           "IRC username",                                 ),
    17         (   "irc-username", "U",    "fixbot",           "IRC username",                                 ),
    18         (   "irc-channel",  "C",    "#fixme-test",      "IRC channel",                                  ),
    18         (   "irc-channel",  "C",    "#fixme-test",      "IRC channel",                                  ),
    19         (   "api-listen",   "l",    "127.0.0.1",        "address for API server to listen on"           ),
       
    20         (   "api-port",     "P",    34888,              "port for API server to listen on",     int     ),
       
    21         (   "api-secret",   None,   None,               "secret key for API connections"                ),
       
    22     ]
    19     ]
    23 
    20 
    24     optFlags = [
    21     optFlags = [
    25 
    22 
    26     ]
    23     ]
    30     tapname = "fixbot-nexus"
    27     tapname = "fixbot-nexus"
    31     description = "FixBot (nexus component)"
    28     description = "FixBot (nexus component)"
    32     options = NexusOptions
    29     options = NexusOptions
    33 
    30 
    34     def makeService (self, config) :
    31     def makeService (self, config) :
    35         if config['api-secret'] is None :
    32         #if config['api-secret'] is None :
    36             raise usage.UsageError("No value given for required option api-secret")
    33         #    raise usage.UsageError("No value given for required option api-secret")
    37 
    34 
    38         return nexus.makeService(config)
    35         return nexus.makeService(config)
    39 
    36 
    40 serviceMaker = MyServiceMaker()
    37 serviceMaker = MyServiceMaker()
    41 
    38