aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2014-04-27 21:52:48 +0300
committerkongr45gpen <electrovesta@gmail.com>2014-04-27 21:55:52 +0300
commitf77b81fb4b8da3e014959ef72cc20d3c64479a4e (patch)
tree0709ef6720252f44ae1f78fc0a7ff96da2e3ff12
parentb83a3d8f35937c128fa3c6076ca04721e313822e (diff)
downloadsupybot_github-f77b81fb4b8da3e014959ef72cc20d3c64479a4e.tar.gz
supybot_github-f77b81fb4b8da3e014959ef72cc20d3c64479a4e.tar.bz2
supybot_github-f77b81fb4b8da3e014959ef72cc20d3c64479a4e.zip
Minor refactoring
-rw-r--r--.gitignore6
-rw-r--r--local/handler/GithubHandler.py5
-rw-r--r--local/utility.py4
-rw-r--r--plugin.py6
4 files changed, 17 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index ded6067..3b660bb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,9 @@ nosetests.xml
.mr.developer.cfg
.project
.pydevproject
+
+# Supybot test files
+conf
+logs
+test-conf
+test-logs
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py
index db0d3d5..c5510c8 100644
--- a/local/handler/GithubHandler.py
+++ b/local/handler/GithubHandler.py
@@ -9,6 +9,7 @@ import threading
import BaseHTTPServer
from time import strftime
+import supybot.log as log
import supybot.conf as conf
import supybot.utils as utils
import supybot.world as world
@@ -40,7 +41,6 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
s.end_headers()
s.wfile.write('<!DOCTYPE html><html><head><title>Hello</title></head>')
s.wfile.write("<body><p>Thanks, you're awesome.</p>")
-
s.wfile.write('</body></html>\n')
s.wfile.write(s.path.split('/'))
@@ -106,3 +106,6 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
#msgs.append( ircmsgs.privmsg("#main", "%s" % ()) )
for msg in msgs:
irc.queueMsg(msg)
+
+ def log_message(self, format, *args):
+ log.info(format % args)
diff --git a/local/utility.py b/local/utility.py
index 4fba906..7c66d9e 100644
--- a/local/utility.py
+++ b/local/utility.py
@@ -61,3 +61,7 @@ def getShortURL(longurl):
response = urllib2.urlopen(req)
url = response.info().getheader('Location')
return ircutils.mircColor(url, "purple")
+
+# Possible colours:
+# white, black, (light/dark) blue, (light) green, red, brown, purple,
+# orange, yellow, teal, pink, light/dark gray/grey
diff --git a/plugin.py b/plugin.py
index 61ff897..75adadd 100644
--- a/plugin.py
+++ b/plugin.py
@@ -55,9 +55,9 @@ class Github(callbacks.Plugin):
port = Utility.configValue('port')
pass
- def ServerStart(self, httpd, port):
+ def ServerStart(self, httpd):
try:
- log.info('Server Starts - %s:%s' % ('', port))
+ log.info('Server Starts - %s:%s' % ('', self.port))
httpd.serve_forever()
except:
return
@@ -67,7 +67,7 @@ class Github(callbacks.Plugin):
self.__parent.__init__(irc)
server_class = BaseHTTPServer.HTTPServer
self.httpd = server_class(('', self.port), RequestHandler.GithubHandler)
- t = threading.Thread(target=self.ServerStart, args=(self.httpd, self.port))
+ t = threading.Thread(target=self.ServerStart, args=(self.httpd,))
t.daemon = False
t.start()

© 2014-2024 Faster IT GmbH | imprint | privacy policy