3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 12:12:53 +01:00

relay: show reasons when clientbot is force parted or kicked

This commit is contained in:
James Lu 2016-07-29 01:08:14 -07:00
parent 8eed60a8f5
commit accd5b70b3

View File

@ -954,7 +954,8 @@ def handle_part(irc, numeric, command, args):
for user in irc.channels[channel].users: for user in irc.channels[channel].users:
if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)): if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)):
irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user, irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
'text': 'Clientbot force parted from channel.', 'parse_as': 'KICK'}]) 'text': 'Clientbot was force parted (Reason: %s)' % text or 'None',
'parse_as': 'KICK'}])
irc.proto.join(irc.pseudoclient.uid, channel) irc.proto.join(irc.pseudoclient.uid, channel)
return return
@ -1096,8 +1097,9 @@ def handle_kick(irc, source, command, args):
if irc.protoname == 'clientbot' and irc.pseudoclient and target == irc.pseudoclient.uid: if irc.protoname == 'clientbot' and irc.pseudoclient and target == irc.pseudoclient.uid:
for user in irc.channels[channel].users: for user in irc.channels[channel].users:
if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)): if (not irc.isInternalClient(user)) and (not isRelayClient(irc, user)):
reason = "Clientbot kicked by %s (Reason: %s)" % (irc.getFriendlyName(source), text)
irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user, irc.callHooks([irc.sid, 'CLIENTBOT_SERVICE_KICKED', {'channel': channel, 'target': user,
'text': 'Clientbot was kicked from channel.', 'parse_as': 'KICK'}]) 'text': reason, 'parse_as': 'KICK'}])
return return