From e49f9d4d30f69a5b733c361987715beb40c252c8 Mon Sep 17 00:00:00 2001 From: Jan Vidar Krey Date: Thu, 9 Apr 2009 00:48:00 +0200 Subject: [PATCH] Added kick support Signed-off-by: Jan Vidar Krey --- src/commands.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/commands.c b/src/commands.c index e2f328f..12f6530 100644 --- a/src/commands.c +++ b/src/commands.c @@ -126,7 +126,28 @@ static int command_uptime(struct user* user, const char* message) static int command_kick(struct user* user, const char* message) { - send_message(user, "*** Kick not implemented!"); + if (strlen(message) < 7) + { + send_message(user, "*** No nickname given, try: !kick "); + return 0; + } + + const char* nick = &message[7]; + struct user* target = get_user_by_nick(user->hub, nick); + + if (!target) + { + send_message(user, "*** No such user"); + return 0; + } + + if (target == user) + { + send_message(user, "*** No can do."); + return 0; + } + + user_disconnect(target, quit_kicked); return 0; }