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

plugins/admin: allow sending KICK from servers (#90)

This commit is contained in:
James Lu 2015-08-21 00:39:58 -07:00
parent bd2bd55e89
commit c1d98838d7

View File

@ -144,11 +144,14 @@ def kick(irc, source, args):
except IndexError: except IndexError:
utils.msg(irc, source, "Error: not enough arguments. Needs 3-4: source nick, channel, target, reason (optional).") utils.msg(irc, source, "Error: not enough arguments. Needs 3-4: source nick, channel, target, reason (optional).")
return return
u = utils.nickToUid(irc, nick) u = utils.nickToUid(irc, nick) or nick
targetu = utils.nickToUid(irc, target) targetu = utils.nickToUid(irc, target)
if not utils.isChannel(channel): if not utils.isChannel(channel):
utils.msg(irc, source, "Error: Invalid channel name %r." % channel) utils.msg(irc, source, "Error: Invalid channel name %r." % channel)
return return
if utils.isInternalServer(irc, u):
irc.proto.kickServer(irc, u, channel, targetu, reason)
else:
irc.proto.kickClient(irc, u, channel, targetu, reason) irc.proto.kickClient(irc, u, channel, targetu, reason)
irc.callHooks([u, 'PYLINK_ADMIN_KICK', {'channel': channel, 'target': targetu, 'text': reason, 'parse_as': 'KICK'}]) irc.callHooks([u, 'PYLINK_ADMIN_KICK', {'channel': channel, 'target': targetu, 'text': reason, 'parse_as': 'KICK'}])