Added forcekick command to opserv to allow kicking of +k opers.
authorThiefMaster <thiefmaster@gamesurge.net>
Fri, 22 Jun 2007 19:36:07 +0000 (21:36 +0200)
committerMichael Poole <mdpoole@troilus.org>
Sat, 28 Jul 2007 02:01:18 +0000 (22:01 -0400)
src/opserv.c
src/opserv.help

index 55640af0704b2b8c6e78c8e9d6e8b85c4f038cd4..8a5f2a53fcf034130be5f90f1d5a85a0355e2cf5 100644 (file)
@@ -252,6 +252,7 @@ static const struct message_entry msgtab[] = {
     { "OSMSG_CHANINFO_USER_COUNT", "Users (%d):" },
     { "OSMSG_CSEARCH_CHANNEL_INFO", "%s [%d users] %s %s" },
     { "OSMSG_TRACE_MAX_CHANNELS", "You may not use the 'channel' criterion more than %d times." },
+    { "OSMSG_FORCEKICK_LOCAL", "You cannot kick $b%s$b forcefully." },
     { NULL, NULL }
 };
 
@@ -1006,6 +1007,34 @@ static MODCMD_FUNC(cmd_kick)
     return 1;
 }
 
+static MODCMD_FUNC(cmd_forcekick)
+{
+    struct userNode *target;
+    char *reason;
+
+    if (argc < 3) {
+        reason = alloca(strlen(OSMSG_KICK_REQUESTED)+strlen(user->nick)+1);
+        sprintf(reason, OSMSG_KICK_REQUESTED, user->nick);
+    } else {
+        reason = unsplit_string(argv+2, argc-2, NULL);
+    }
+    target = GetUserH(argv[1]);
+    if (!target) {
+        reply("MSG_NICK_UNKNOWN", argv[1]);
+        return 0;
+    }
+    if (!GetUserMode(channel, target)) {
+        reply("OSMSG_NOT_ON_CHANNEL", target->nick, channel->name);
+        return 0;
+    }
+    if (IsLocal(target)) {
+        reply("OSMSG_FORCEKICK_LOCAL", target->nick);
+        return 0;
+    }
+    irc_kick(cmd->parent->bot, target, channel, reason);
+    return 1;
+}
+
 static MODCMD_FUNC(cmd_kickall)
 {
     unsigned int limit, n, inchan;
@@ -4267,6 +4296,7 @@ init_opserv(const char *nick)
     opserv_define_func("JUMP", cmd_jump, 900, 0, 2);
     opserv_define_func("JUPE", cmd_jupe, 900, 0, 4);
     opserv_define_func("KICK", cmd_kick, 100, 2, 2);
+    opserv_define_func("FORCEKICK", cmd_forcekick, 800, 2, 2);
     opserv_define_func("KICKALL", cmd_kickall, 400, 2, 0);
     opserv_define_func("KICKBAN", cmd_kickban, 100, 2, 2);
     opserv_define_func("KICKBANALL", cmd_kickbanall, 450, 2, 0);
index 508c9fb896e860854eee4f00bbb4b5dfe773f234..b9aa12805e5290f16cb490abc92376ffed13df44 100644 (file)
         "  DEOP       [${level/deop}]",
         "  DEOPALL    [${level/deopall}]",
         "  DEVOICEALL [${level/devoiceall}]",
+        "  FORCEKICK  [${level/forcekick}]",
         "  KICK       [${level/kick}]",
         "  KICKALL    [${level/kickall}]",
         "  KICKBAN    [${level/kickban}]",
 "KICK" ("/msg $O KICK <#channel> <nick> [reason]",
         "Kicks the specified user from the specified channel.",
         "If the channel is omitted, then $bkick$b will be done in the channel where the command was given.",
-        "$uSee Also:$u ban, kickall, kickban, kickbanall");
+        "$uSee Also:$u ban, kickall, kickban, kickbanall, forcekick");
+"FORCEKICK" ("/msg $O FORCEKICK <#channel> <nick> [reason]",
+        "Kicks the specified user from the specified channel even if he is a channel service (+k).",
+        "If the channel is omitted, then $bforcekick$b will be done in the channel where the command was given.",
+        "$uSee Also:$u ban, kick, kickall, kickban, kickbanall");
 "KICKALL" ("/msg $O KICKALL <#channel> [reason]",
         "Kicks all users in the specified channel except for the user issuing the command.",
         "If the channel is omitted, then $bkickall$b will be done in the channel where the command was given.",