Changeset 148
- Timestamp:
- 06/11/08 16:38:51 (2 months ago)
- Files:
-
- trunk/antimatter/luke/myplugs/libtracker/auth.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/antimatter/luke/myplugs/libtracker/auth.py
r147 r148 8 8 """ Not authentication, just checks that the name exists 9 9 Input: Bot, Ircevent 10 Output: User (or None if authentication failed)10 Output: bool 11 11 """ 12 bot.say(ievent.nick,"Username?",how='msg') 13 #rlog(99,"Debug","Testing for auth reload") 14 username = waitforuser(bot, ievent.userhost, 30) 15 if (username == None): 16 bot.say(ievent.nick,"You have failed to provide a username, do you want to try again? (y/n)") 17 response = waitforuser(bot, ievent.userhost, 10) 18 if (not response == None): 19 if (response.txt == "y"): 20 username = authenticate_name(bot, ievent) 12 user = check_auth(ievent) 13 if (not user == None): 14 bot.say(ievent.nick, "You're still authenticated") 15 #TODO: Tell how long until authentication ends 16 return True 17 bot.say(ievent.nick, "Username?") 18 reply = waitforuser(bot, ievent.userhost, 30) 19 if (reply == None): 20 bot.say(ievent.nick, "You have failed to provide a username, do you want to try again? (y/n)") 21 reply = waitforuser(bot, ievent.userhost, 10) 22 if (not reply == None): 23 if (reply.txt == "y"): 24 if (not authenticate_name(bot, ievent)): 25 return False 26 else: 27 return False 21 28 else: 22 username = username.txt29 username = reply.txt 23 30 24 user = User(username) 25 return user 31 set_auth(ievent, User(username)) 32 33 return True 26 34 27 35 def check_auth(ievent): 28 36 """ Checks to see if the user is already authenticated 29 37 Input: Ircevent 30 Output: User 38 Output: User (or None if the user is not authenticated) 31 39 """ 32 pass 40 try: 41 user = authenticated[ievent.userhost] 42 except KeyError: 43 user = None 33 44 34 def set_auth(ievent ):45 def set_auth(ievent, user): 35 46 """ Puts the userhost into the authentication dictionary 36 Input: Ircevent 37 Output: bool 47 Input: Ircevent, User 38 48 """ 39 pass49 authenticated[ievent.userhost] = user