From c4f95513937071e046928c0e5131b88baa74e301 Mon Sep 17 00:00:00 2001 From: kongr45gpen Date: Wed, 31 Jul 2013 16:40:14 +0300 Subject: Add passcode configuration variable --- plugin.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'plugin.py') 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('Hello') - s.wfile.write("

Thanks, you're great.

") + s.wfile.write('Hello') + s.wfile.write("

Thanks, you're awesome.

") + + s.wfile.write('\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('') - s.wfile.write(vars(s)) - print json.dumps(data, sort_keys=True, indent=4, separators=(',', ': ')) for irc in world.ircs: # Handle different event types -- cgit v1.2.3