Jelajahi Sumber

* Fixed cmd_boot to allow users to boot users they can whois. (Users with lower flags)
* Removed an invalid line from the help for cmd_boot regarding 'remote_boots' (#20)


svn: 1972

Bryan Drewery 21 tahun lalu
induk
melakukan
f876237a45
4 mengubah file dengan 21 tambahan dan 27 penghapusan
  1. 2 1
      doc/UPDATES
  2. 1 2
      misc/help.txt
  3. 13 11
      src/botcmd.c
  4. 5 13
      src/cmds.c

+ 2 - 1
doc/UPDATES

@@ -59,7 +59,8 @@ Lines prefixxed with '-' were disabled before release and are not finishsed, or
 * Fixed bot's not being able to link when the botnick case did not match (userlist vs binary -C).
 * Fixed bot's not being able to link when the botnick case did not match (userlist vs binary -C).
 * Fixed colors still showing for characters ":@()<>" when colors were turned off.
 * Fixed colors still showing for characters ":@()<>" when colors were turned off.
 * Reverted patch from 1.2 which disabled removing duplicate msgs in server queue. (Fixes most queue/excess flood bugs)
 * Reverted patch from 1.2 which disabled removing duplicate msgs in server queue. (Fixes most queue/excess flood bugs)
-* Users can no longer who PERM OWNERS unless they are themselves one.
+* Users can no longer whois PERM OWNERS unless they are themselves one.
+* Fixed cmd_boot to allow users to boot users they can whois. (Users with lower flags)
 
 
 1.2.2
 1.2.2
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.
 * Don't sanity check flags for users on DCC CHAT if they are on the bot via .botcmd.

+ 1 - 2
misc/help.txt

@@ -248,8 +248,7 @@ See also: tcl
 ###  $bboot$b <handle[@bot]> [reason]
 ###  $bboot$b <handle[@bot]> [reason]
    Kicks a user off the party line and displays the reason, if you specify
    Kicks a user off the party line and displays the reason, if you specify
    one. You can also specify a bot, and attempt to boot someone from another
    one. You can also specify a bot, and attempt to boot someone from another
-   bot on the botnet, though it may be rejected if that bot does not allow
-   remote boots. You can not boot a bot owner.
+   bot on the botnet. You can not boot a bot owner.
 :hub:botcmd:
 :hub:botcmd:
 ###  $bbotcmd$b <bot> <cmd> [params]
 ###  $bbotcmd$b <bot> <cmd> [params]
    The specified cmd and optional parameters are executed on the specified bot, 
    The specified cmd and optional parameters are executed on the specified bot, 

+ 13 - 11
src/botcmd.c

@@ -823,17 +823,19 @@ static void bot_reject(int idx, char *par)
       int ok = 0;
       int ok = 0;
 
 
       for (i = 0; (i < dcc_total) && (!ok); i++) {
       for (i = 0; (i < dcc_total) && (!ok); i++) {
-	if (dcc[i].type && (!egg_strcasecmp(who, dcc[i].nick)) && (dcc[i].type->flags & DCT_CHAT)) {
-	  u = get_user_by_handle(userlist, dcc[i].nick);
-	  if (u && ((u->flags & USER_OWNER) && !(dcc[idx].user->flags & USER_ADMIN))) {
-	    add_note(from, conf.bot->nick, BOT_NOOWNERBOOT, -1, 0);
-	    return;
-	  }
-	  do_boot(i, from, par);
-	  ok = 1;
-	  putlog(LOG_CMDS, "*", "#%s# boot %s (%s)", from, who, par[0] ? par : "No reason");
-	}
-     }
+        if (dcc[i].type && (!egg_strcasecmp(who, dcc[i].nick)) && (dcc[i].type->flags & DCT_CHAT)) {
+          u = get_user_by_handle(userlist, from);
+          if (u) {
+            if (!whois_access(u, dcc[idx].user)) {
+              add_note(from, conf.bot->nick, "Sorry, you cannot boot them.", -1, 0);
+              return;
+            }
+            do_boot(i, from, par);
+            ok = 1;
+            putlog(LOG_CMDS, "*", "#%s# boot %s (%s)", from, who, par[0] ? par : "No reason");
+          }
+        }
+      }
     } else {
     } else {
       i = nextbot(destbot);
       i = nextbot(destbot);
       *--destbot = '@';
       *--destbot = '@';

+ 5 - 13
src/cmds.c

@@ -1055,25 +1055,17 @@ static void cmd_boot(int idx, char *par)
         dprintf(idx, "No such bot connected.\n");
         dprintf(idx, "No such bot connected.\n");
         return;
         return;
       }
       }
-      botnet_send_reject(i, dcc[idx].nick, conf.bot->nick, whonick,
-			 who, par[0] ? par : dcc[idx].nick);
-      putlog(LOG_BOTS, "*", "#%s# boot %s@%s (%s)", dcc[idx].nick, whonick,
-	     who, par[0] ? par : dcc[idx].nick);
+      botnet_send_reject(i, dcc[idx].nick, conf.bot->nick, whonick, who, par[0] ? par : dcc[idx].nick);
+      putlog(LOG_BOTS, "*", "#%s# boot %s@%s (%s)", dcc[idx].nick, whonick, who, par[0] ? par : dcc[idx].nick);
     return;
     return;
   }
   }
   for (i = 0; i < dcc_total; i++) {
   for (i = 0; i < dcc_total; i++) {
     if (dcc[i].type && !egg_strcasecmp(dcc[i].nick, who) && !ok && (dcc[i].type->flags & DCT_CANBOOT)) {
     if (dcc[i].type && !egg_strcasecmp(dcc[i].nick, who) && !ok && (dcc[i].type->flags & DCT_CANBOOT)) {
-      u2 = get_user_by_handle(userlist, dcc[i].nick);
-      if (u2 && (u2->flags & USER_OWNER)
-          && egg_strcasecmp(dcc[idx].nick, who)) {
-        dprintf(idx, "You can't boot a bot owner.\n");
+      if (!whois_access(dcc[idx].user, dcc[i].user)) {
+        dprintf(idx, "Sorry, you cannot boot %s.\n", dcc[i].nick);
         return;
         return;
       }
       }
-      if (u2 && (u2->flags & USER_MASTER) && !(dcc[idx].user && (dcc[idx].user->flags & USER_MASTER))) {
-        dprintf(idx, "You can't boot a bot master.\n");
-        return;
-      }
-      dprintf(idx, "Booted %s from the party line.\n", dcc[i].nick);
+      dprintf(idx, "Booting %s from the party line.\n", dcc[i].nick);
       putlog(LOG_CMDS, "*", "#%s# boot %s %s", dcc[idx].nick, who, par);
       putlog(LOG_CMDS, "*", "#%s# boot %s %s", dcc[idx].nick, who, par);
       do_boot(i, dcc[idx].nick, par);
       do_boot(i, dcc[idx].nick, par);
       ok = 1;
       ok = 1;