mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Added server attribute to Irc objects.
This commit is contained in:
parent
e4db34da14
commit
a763674d83
@ -401,7 +401,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
"""
|
"""
|
||||||
_nickSetters = sets.Set(['001', '002', '003', '004', '250', '251', '252',
|
_nickSetters = sets.Set(['001', '002', '003', '004', '250', '251', '252',
|
||||||
'254', '255', '265', '266', '372', '375', '376',
|
'254', '255', '265', '266', '372', '375', '376',
|
||||||
'333', '353', '332', '366'])
|
'333', '353', '332', '366', '005'])
|
||||||
def __init__(self, nick, user='', ident='', password='', callbacks=None):
|
def __init__(self, nick, user='', ident='', password='', callbacks=None):
|
||||||
world.ircs.append(self)
|
world.ircs.append(self)
|
||||||
self.nick = nick
|
self.nick = nick
|
||||||
@ -417,6 +417,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.queue = IrcMsgQueue()
|
self.queue = IrcMsgQueue()
|
||||||
self._nickmods = copy.copy(conf.nickmods)
|
self._nickmods = copy.copy(conf.nickmods)
|
||||||
self.lastTake = 0
|
self.lastTake = 0
|
||||||
|
self.server = None
|
||||||
self.fastqueue = smallqueue()
|
self.fastqueue = smallqueue()
|
||||||
self.lastping = time.time()
|
self.lastping = time.time()
|
||||||
self.outstandingPing = False
|
self.outstandingPing = False
|
||||||
@ -430,6 +431,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
"""Resets the Irc object. Useful for handling reconnects."""
|
"""Resets the Irc object. Useful for handling reconnects."""
|
||||||
self.state.reset()
|
self.state.reset()
|
||||||
self.queue.reset()
|
self.queue.reset()
|
||||||
|
self.server = None
|
||||||
self.lastping = time.time()
|
self.lastping = time.time()
|
||||||
self.outstandingPing = False
|
self.outstandingPing = False
|
||||||
self.fastqueue = queue()
|
self.fastqueue = queue()
|
||||||
@ -529,6 +531,9 @@ class Irc(IrcCommandDispatcher):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def do001(self, msg):
|
||||||
|
pass
|
||||||
|
|
||||||
def doPing(self, msg):
|
def doPing(self, msg):
|
||||||
"""Handles PING messages."""
|
"""Handles PING messages."""
|
||||||
self.sendMsg(ircmsgs.pong(msg.args[0]))
|
self.sendMsg(ircmsgs.pong(msg.args[0]))
|
||||||
@ -597,9 +602,13 @@ class Irc(IrcCommandDispatcher):
|
|||||||
user.addHostmask(msg.prefix)
|
user.addHostmask(msg.prefix)
|
||||||
user.setPassword(utils.mktemp())
|
user.setPassword(utils.mktemp())
|
||||||
ircdb.users.setUser(0, user)
|
ircdb.users.setUser(0, user)
|
||||||
|
|
||||||
if msg.command in self._nickSetters and msg.args[0] != self.nick:
|
# This keeps our nick and server attributes updated.
|
||||||
self.nick = msg.args[0]
|
if msg.command in self._nickSetters:
|
||||||
|
if msg.args[0] != self.nick:
|
||||||
|
self.nick = msg.args[0]
|
||||||
|
if msg.prefix != self.server:
|
||||||
|
self.server = msg.prefix
|
||||||
|
|
||||||
# Now update the IrcState object.
|
# Now update the IrcState object.
|
||||||
try:
|
try:
|
||||||
@ -612,8 +621,8 @@ class Irc(IrcCommandDispatcher):
|
|||||||
try:
|
try:
|
||||||
m = callback.inFilter(self, msg)
|
m = callback.inFilter(self, msg)
|
||||||
if not m:
|
if not m:
|
||||||
debugmsg = '%s.inFilter returned None' % callback.name()
|
s = '%s.inFilter returned None' % callback.name()
|
||||||
debug.msg(debugmsg)
|
debug.msg(s)
|
||||||
return
|
return
|
||||||
msg = m
|
msg = m
|
||||||
except:
|
except:
|
||||||
|
Loading…
Reference in New Issue
Block a user