From b83a3d8f35937c128fa3c6076ca04721e313822e Mon Sep 17 00:00:00 2001 From: kongr45gpen Date: Sun, 27 Apr 2014 17:27:51 +0300 Subject: Add `port` configuration variable --- plugin.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'plugin.py') diff --git a/plugin.py b/plugin.py index 3ea8568..61ff897 100644 --- a/plugin.py +++ b/plugin.py @@ -33,6 +33,7 @@ import urlparse import threading import BaseHTTPServer +import supybot.log as log import supybot.conf as conf import supybot.utils as utils import supybot.world as world @@ -46,20 +47,17 @@ import supybot.callbacks as callbacks RequestHandler = utils.python.universalImport('handler.GithubHandler', 'local.handler.GithubHandler') Utility = utils.python.universalImport('local.utility') -# Possible colours: -# white, black, (light/dark) blue, (light) green, red, brown, purple, -# orange, yellow, teal, pink, light/dark gray/grey - class Github(callbacks.Plugin): """Add the help for \"@plugin help Github\" here This should describe how to use this plugin.""" threaded = True + port = Utility.configValue('port') pass - def ServerStart(self, httpd): + def ServerStart(self, httpd, port): try: - print time.asctime(), 'Server Starts - %s:%s' % ('', 8093) + log.info('Server Starts - %s:%s' % ('', port)) httpd.serve_forever() except: return @@ -68,8 +66,8 @@ class Github(callbacks.Plugin): self.__parent = super(Github, self) self.__parent.__init__(irc) server_class = BaseHTTPServer.HTTPServer - self.httpd = server_class(('', 8093), RequestHandler.GithubHandler) - t = threading.Thread(target=self.ServerStart, args=(self.httpd,)) + self.httpd = server_class(('', self.port), RequestHandler.GithubHandler) + t = threading.Thread(target=self.ServerStart, args=(self.httpd, self.port)) t.daemon = False t.start() -- cgit v1.2.3