Send fake quit and nick messages to every channel
This commit is contained in:
parent
3a92ebab6b
commit
1c8cbf808b
30
core/bot.py
30
core/bot.py
|
@ -336,10 +336,10 @@ class IRCBot(IRCClient):
|
||||||
Called when a user has quit.
|
Called when a user has quit.
|
||||||
"""
|
"""
|
||||||
nick = prefix.split('!')[0]
|
nick = prefix.split('!')[0]
|
||||||
if nick == self.nickname:
|
#if nick == self.nickname:
|
||||||
self.botQuit(prefix, params[0])
|
#self.botQuit(prefix, params[0])
|
||||||
else:
|
#else:
|
||||||
self.userQuit(prefix, params[0])
|
self.userQuit(prefix, params[0])
|
||||||
|
|
||||||
def irc_NICK(self, prefix, params):
|
def irc_NICK(self, prefix, params):
|
||||||
"""
|
"""
|
||||||
|
@ -416,13 +416,8 @@ class IRCBot(IRCClient):
|
||||||
|
|
||||||
def userQuit(self, user, quitMessage):
|
def userQuit(self, user, quitMessage):
|
||||||
nick, ident, host = self.parsen(user)
|
nick, ident, host = self.parsen(user)
|
||||||
|
self.chanlessEvent(type="quit", nick=nick, ident=ident, host=host, message=quitMessage)
|
||||||
userinfo.delUserByNetwork(self.net, nick, user)
|
userinfo.delUserByNetwork(self.net, nick, user)
|
||||||
self.event(type="quit", nick=nick, ident=ident, host=host, message=quitMessage)
|
|
||||||
|
|
||||||
def botQuit(self, user, quitMessage):
|
|
||||||
nick, ident, host = self.parsen(user)
|
|
||||||
userinfo.delUserByNetwork(self.net, nick, user)
|
|
||||||
self.event(type="quit", nick=nick, ident=ident, host=host, message=quitMessage)
|
|
||||||
|
|
||||||
def userKicked(self, kickee, channel, kicker, message):
|
def userKicked(self, kickee, channel, kicker, message):
|
||||||
nick, ident, host = self.parsen(kicker)
|
nick, ident, host = self.parsen(kicker)
|
||||||
|
@ -432,10 +427,19 @@ class IRCBot(IRCClient):
|
||||||
self.botLeft(channel)
|
self.botLeft(channel)
|
||||||
self.event(type="kick", nick=nick, ident=ident, host=host, target=channel, message=message, user=kickee)
|
self.event(type="kick", nick=nick, ident=ident, host=host, target=channel, message=message, user=kickee)
|
||||||
|
|
||||||
|
def chanlessEvent(self, **cast):
|
||||||
|
chans = userinfo.getChansSingle(self.net, cast["nick"])
|
||||||
|
if chans == None:
|
||||||
|
self.event(**cast)
|
||||||
|
return
|
||||||
|
for i in chans:
|
||||||
|
cast["target"] = i
|
||||||
|
self.event(**cast)
|
||||||
|
|
||||||
def userRenamed(self, oldname, newname):
|
def userRenamed(self, oldname, newname):
|
||||||
nick, ident, host = self.parsen(oldname)
|
nick, ident, host = self.parsen(oldname)
|
||||||
|
self.chanlessEvent(type="nick", nick=nick, ident=ident, host=host, user=newname)
|
||||||
userinfo.renameUser(self.net, nick, oldname, newname, newname+"!"+ident+"@"+host)
|
userinfo.renameUser(self.net, nick, oldname, newname, newname+"!"+ident+"@"+host)
|
||||||
self.event(type="nick", nick=nick, ident=ident, host=host, user=newname)
|
|
||||||
|
|
||||||
def topicUpdated(self, user, channel, newTopic):
|
def topicUpdated(self, user, channel, newTopic):
|
||||||
nick, ident, host = self.parsen(user)
|
nick, ident, host = self.parsen(user)
|
||||||
|
@ -449,7 +453,7 @@ class IRCBot(IRCClient):
|
||||||
argList = list(args)
|
argList = list(args)
|
||||||
modeList = [i for i in modes]
|
modeList = [i for i in modes]
|
||||||
for a, m in zip(argList, modeList):
|
for a, m in zip(argList, modeList):
|
||||||
self.event(type="mode", nick=nick, ident=ident, host=host, target=channel, modes=m, modeargs=a)
|
self.event(type="mode", nick=nick, ident=ident, host=host, target=channel, modes=m, status=toset, modeargs=a)
|
||||||
|
|
||||||
class IRCBotFactory(ReconnectingClientFactory):
|
class IRCBotFactory(ReconnectingClientFactory):
|
||||||
def __init__(self, name, relay=None, relayCommands=None, user=None, stage2=None):
|
def __init__(self, name, relay=None, relayCommands=None, user=None, stage2=None):
|
||||||
|
@ -478,7 +482,7 @@ class IRCBotFactory(ReconnectingClientFactory):
|
||||||
|
|
||||||
def clientConnectionLost(self, connector, reason):
|
def clientConnectionLost(self, connector, reason):
|
||||||
if not self.relay:
|
if not self.relay:
|
||||||
userinfo.delNetwork(self.name, self.client.channels)
|
userinfo.delNetwork(self.net, self.client.channels)
|
||||||
if not self.client == None:
|
if not self.client == None:
|
||||||
self.client.connected = False
|
self.client.connected = False
|
||||||
self.client.channels = []
|
self.client.channels = []
|
||||||
|
|
Loading…
Reference in New Issue