Improve IRCLogin slightly and add extra symlinks to ease use of the Web features
This commit is contained in:
parent
d7aa038d05
commit
7fc67de3d6
|
@ -77,7 +77,6 @@ launchpad"""
|
||||||
irc.reply('Running...')
|
irc.reply('Running...')
|
||||||
user2nick = {}
|
user2nick = {}
|
||||||
nick2user = {}
|
nick2user = {}
|
||||||
#TODO: Make the team configurable, just needs a config entry
|
|
||||||
users = lp.getUsers()
|
users = lp.getUsers()
|
||||||
for user in users:
|
for user in users:
|
||||||
lpuser = lp.getIRCNick(user, False)
|
lpuser = lp.getIRCNick(user, False)
|
||||||
|
@ -98,7 +97,9 @@ launchpad"""
|
||||||
return
|
return
|
||||||
fd = open(uf, 'rb')
|
fd = open(uf, 'rb')
|
||||||
up = Unpickler(fd)
|
up = Unpickler(fd)
|
||||||
(user2nick, nick2user) = up.load()
|
(self.user2nick, self.nick2user) = up.load()
|
||||||
|
nick2user = self.nick2user
|
||||||
|
user2nick = self.user2nick
|
||||||
self.knownusers = [i.lower() for i in nick2user.keys()]
|
self.knownusers = [i.lower() for i in nick2user.keys()]
|
||||||
allusers = [u.name.lower() for u in ircdb.users.itervalues()]
|
allusers = [u.name.lower() for u in ircdb.users.itervalues()]
|
||||||
to_add = [x for x in self.knownusers if x not in allusers]
|
to_add = [x for x in self.knownusers if x not in allusers]
|
||||||
|
@ -115,7 +116,6 @@ launchpad"""
|
||||||
for u in nick2user.keys():
|
for u in nick2user.keys():
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(u.lower())
|
user = ircdb.users.getUser(u.lower())
|
||||||
#Add bantracker capability to all users from launchpad team
|
|
||||||
if not 'bantracker' in user.capabilities:
|
if not 'bantracker' in user.capabilities:
|
||||||
user.addCapability('bantracker')
|
user.addCapability('bantracker')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
@ -142,15 +142,29 @@ launchpad"""
|
||||||
if not msg.tagged('identified'):
|
if not msg.tagged('identified'):
|
||||||
irc.error('You are not identified')
|
irc.error('You are not identified')
|
||||||
return
|
return
|
||||||
|
nick = msg.nick.lower()
|
||||||
|
user = None
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(msg.prefix[:msg.prefix.find('!')].lower())
|
user = self.nick2user.get(nick, None)
|
||||||
|
if user:
|
||||||
|
user = ircdb.users.getUser(user)
|
||||||
except:
|
except:
|
||||||
self.loadUsers()
|
user = None
|
||||||
|
pass
|
||||||
|
if not user:
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(msg.prefix[:msg.prefix.find('!')].lower())
|
user = ircdb.users.getUser(msg.prefix)
|
||||||
except:
|
except:
|
||||||
irc.error(conf.supybot.replies.incorrectAuthentication())
|
self.loadUsers()
|
||||||
return
|
try:
|
||||||
|
user = ircdb.users.getUser(msg.prefix)
|
||||||
|
except:
|
||||||
|
for (id, obj) in ircdb.users.users.iteritems():
|
||||||
|
if obj.name.lower() == nick:
|
||||||
|
user = obj
|
||||||
|
if not user:
|
||||||
|
irc.error(conf.supybot.replies.incorrectAuthentication())
|
||||||
|
return
|
||||||
user.addAuth(msg.prefix)
|
user.addAuth(msg.prefix)
|
||||||
ircdb.users.setUser(user, flush=False)
|
ircdb.users.setUser(user, flush=False)
|
||||||
irc.replySuccess()
|
irc.replySuccess()
|
||||||
|
@ -161,23 +175,26 @@ launchpad"""
|
||||||
return
|
return
|
||||||
if chr(1) in msg.args[1]:
|
if chr(1) in msg.args[1]:
|
||||||
return
|
return
|
||||||
to = msg.args[0]
|
|
||||||
cmd = msg.args[1]
|
|
||||||
try:
|
try:
|
||||||
user = ircdb.users.getUser(msg.prefix)
|
user = ircdb.users.getUser(msg.prefix)
|
||||||
if user.checkHostmask(msg.prefix):
|
if user.checkHostmask(msg.prefix):
|
||||||
|
#self.log.info("%s is a known user: %r" % (msg.prefix, user))
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if to.lower() == irc.nick.lower():
|
|
||||||
if cmd != "login":
|
text = callbacks.addressed(irc.nick, msg)
|
||||||
|
if not text or text != "login":
|
||||||
|
if msg.args[1]:
|
||||||
|
if msg.args[1][0] == '@':
|
||||||
|
cmd = msg.args[1][1:]
|
||||||
|
else:
|
||||||
|
cmd = msg.args[1]
|
||||||
|
if cmd != "login":
|
||||||
|
return
|
||||||
|
else:
|
||||||
return
|
return
|
||||||
elif msg.args[1][0] in conf.supybot.reply.whenAddressedBy.chars():
|
self.log.info("Calling login for %s" % msg.prefix)
|
||||||
cmd = msg.args[1][1:]
|
|
||||||
if cmd != "login":
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
self._callCommand(["login"], irc, msg, [])
|
self._callCommand(["login"], irc, msg, [])
|
||||||
|
|
||||||
def do290(self, irc, msg):
|
def do290(self, irc, msg):
|
||||||
|
@ -190,12 +207,18 @@ launchpad"""
|
||||||
irc.queueMsg(ircmsgs.IrcMsg('CAPAB IDENTIFY-MSG'))
|
irc.queueMsg(ircmsgs.IrcMsg('CAPAB IDENTIFY-MSG'))
|
||||||
|
|
||||||
def inFilter(self, irc, msg):
|
def inFilter(self, irc, msg):
|
||||||
|
if not msg.command == "PRIVMSG":
|
||||||
|
return msg
|
||||||
if getattr(irc,'_Freenode_capabed',None) and msg.command == 'PRIVMSG':
|
if getattr(irc,'_Freenode_capabed',None) and msg.command == 'PRIVMSG':
|
||||||
first = msg.args[1][0]
|
if msg.tagged('identified') == None:
|
||||||
rest = msg.args[1][1:]
|
first = msg.args[1][0]
|
||||||
msg.tag('identified', first == '+')
|
rest = msg.args[1][1:]
|
||||||
msg = ircmsgs.privmsg(msg.args[0], rest, msg=msg)
|
msg.tag('identified', first == '+')
|
||||||
assert msg.receivedAt and msg.receivedOn and msg.receivedBy
|
if first in ('+', '-'):
|
||||||
|
msg = ircmsgs.privmsg(msg.args[0], rest, msg=msg)
|
||||||
|
assert msg.receivedAt and msg.receivedOn and msg.receivedBy
|
||||||
|
if len(msg.args) >= 2 and msg.args[1] and msg.args[1][0] in ('+', '-'):
|
||||||
|
self.do376(irc, msg)
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
Class = IRCLogin
|
Class = IRCLogin
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Bantracker/empty.tmpl
|
|
@ -0,0 +1 @@
|
||||||
|
Encyclopedia/factoids.cgi
|
|
@ -0,0 +1 @@
|
||||||
|
Encyclopedia/factoids.tmpl
|
|
@ -0,0 +1 @@
|
||||||
|
Webcal/timezones.html
|
Loading…
Reference in New Issue