-
Notifications
You must be signed in to change notification settings - Fork 0
/
LibUnderscore.py
30 lines (28 loc) · 1.3 KB
/
LibUnderscore.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from twisted.internet import reactor
def checkAuthStatus(client, nick, authenticatedFunction,
noSuchNickFunction,
notAuthenticatedFunction):
def callback(prefix, command, params):
if prefix == "330" and params[1].lower() == nick.lower() and authenticatedFunction:
#client.msg(channel, "%s is logged in as %s" % (params[1], params[2]))
authenticatedFunction(params[1], params[2])
return True
elif prefix == "ERR_NOSUCHNICK" and params[1].lower() == nick.lower() and noSuchNickFunction:
#client.msg(channel, "%s does not appear to be a current user" % (params[1]))
noSuchNickFunction(params[1])
return True
elif prefix == "RPL_ENDOFWHOIS" and params[1].lower() == nick.lower() and notAuthenticatedFunction:
#client.msg(channel, "%s does not appear to be logged in." % (params[1]))
notAuthenticatedFunction(params[1])
return True
else:
return False
client.addCallback(callback)
client.sendLine("WHOIS %s" % nick)
def loadUserList():
users = {}
f = open('shadow/nick-account_map');
for line in f:
nick,account = line.strip().split(',')
users[nick] = account
return users