diff options
author | daniel-Jones <daniel@danieljon.es> | 2017-12-03 21:41:16 +1030 |
---|---|---|
committer | daniel-Jones <daniel@danieljon.es> | 2017-12-03 21:54:16 +1030 |
commit | 7b5341ae68522bf812ca2829c501a64981e2f80b (patch) | |
tree | 3058f6623f246c33215bb3cbdbd8660858443602 /miniircd | |
parent | 4eaba9e9a754213f52d15787f1fe334b5d8d6361 (diff) | |
download | miniircd-7b5341ae68522bf812ca2829c501a64981e2f80b.tar.gz miniircd-7b5341ae68522bf812ca2829c501a64981e2f80b.zip |
basic /kill implemented, testing with /kick. more tests, really.
Diffstat (limited to 'miniircd')
-rwxr-xr-x | miniircd | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -554,6 +554,31 @@ class Client(object): self.reply("401 %s %s :No such nick" % (self.nickname, username)) + iplist = '127.0.0.1' + def kill_handler(): + if len(arguments) < 1: + return + username = arguments[0] + user = server.get_client(username) + if user and self.host in iplist: + print("kill requested of '%s@%s' by %s" % (user.nickname, user.host, self.nickname)) + if len(arguments) < 2: + quitmsg = self.nickname + else: + quitmsg = arguments[1] + user.disconnect("killed: " + quitmsg) + + def kick_handler(): + if len(arguments) < 2: + return + username = arguments[0] + channel = arguments[1] + user = server.get_client(username) + if user and channel in user.channels and self.host in iplist: + kickmsg = "%s was kicked from %s by %s" % (user.nickname, channel, self.nickname) + print("kick requested of '%s@%s'" % (user.nickname, user.host)) + server.remove_member_from_channel(user, channel) + handler_table = { "AWAY": away_handler, "ISON": ison_handler, @@ -574,6 +599,8 @@ class Client(object): "WALLOPS": wallops_handler, "WHO": who_handler, "WHOIS": whois_handler, + "KILL": kill_handler, + #"KICK": kick_handler, } server = self.server valid_channel_re = self.__valid_channelname_regexp |