aboutsummaryrefslogtreecommitdiffstats
path: root/plugin.py
diff options
context:
space:
mode:
authorkongr45gpen <kongr45gpen@helit.org>2013-07-31 16:40:14 +0300
committerkongr45gpen <kongr45gpen@helit.org>2013-07-31 16:40:14 +0300
commitc4f95513937071e046928c0e5131b88baa74e301 (patch)
treef2c0f475b6f74aec64fafa01b0b87862988a19c7 /plugin.py
parentcc2d1d9b586162e103294933964414378d60c20b (diff)
downloadsupybot_github-c4f95513937071e046928c0e5131b88baa74e301.tar.gz
supybot_github-c4f95513937071e046928c0e5131b88baa74e301.tar.bz2
supybot_github-c4f95513937071e046928c0e5131b88baa74e301.zip
Add passcode configuration variable
Diffstat (limited to 'plugin.py')
-rw-r--r--plugin.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/plugin.py b/plugin.py
index 303338f..2c542c5 100644
--- a/plugin.py
+++ b/plugin.py
@@ -98,12 +98,32 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
s.send_response(200)
s.send_header('Content-type', 'text/html')
s.end_headers()
- s.wfile.write('<html><head><title>Hello</title></head>')
- s.wfile.write("<body><p>Thanks, you're great.</p>")
+ 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('/'))
+ #print json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
+
+ path = s.path.split('/')
+ channel = configValue('channel')
+ receivedcode = ''
+ requireCode = configValue('passcode').strip() \
+ and configValue('passcode').strip().lower() != 'false' \
+ and configValue('passcode').strip().lower() != 'null' \
+ and configValue('passcode').strip().lower() != 'no'
+
+ i = 0
+ for part in path:
+ if i == 1 and requireCode:
+ receivedcode = part
+ i+=1
+
+ if requireCode and receivedcode != configValue('passcode'):
+ # The password is wrong
+ s.wfile.write("The password is wrong")
+ return
- s.wfile.write('</body></html>')
- s.wfile.write(vars(s))
- print json.dumps(data, sort_keys=True, indent=4, separators=(',', ': '))
for irc in world.ircs:
# Handle different event types

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