Преглед изворни кода

* Fix (+|-)(ban|exempt|invite) commands to properly handle if the channel is given first so that a #chan!*@* ban is not created.

Bryan Drewery пре 17 година
родитељ
комит
886bb85348
2 измењених фајлова са 27 додато и 3 уклоњено
  1. 1 0
      doc/UPDATES
  2. 26 3
      src/mod/channels.mod/cmdschan.c

+ 1 - 0
doc/UPDATES

@@ -37,6 +37,7 @@
 * Fix issues with server-port not being updated to the current server list (fixes #176)
 * Fix aliases not properly indicating bad command on leaf bots (fixes #297)
 * Fix botlink problems when hub and leaf nicks are long
+* Fix (+|-)(ban|exempt|invite) commands to properly handle if the channel is given first so that a #chan!*@* ban is not created.
 
 1.2.16 - http://wraith.botpack.net/milestone/1.2.16
 * Add 'set altchars' so that alternative characters used for nicks can be changed. (fixes #418)

+ 26 - 3
src/mod/channels.mod/cmdschan.c

@@ -37,6 +37,7 @@ static void cmd_pls_mask(const char type, int idx, char *par)
   const char *cmd = (type == 'b' ? "ban" : type == 'e' ? "exempt" : "invite");
 
   if (!par[0]) {
+usage:
     dprintf(idx, "Usage: +%s <hostmask> [channel] [%%<XdXhXm>] [reason]\n", cmd);
     return;
   }
@@ -49,8 +50,17 @@ static void cmd_pls_mask(const char type, int idx, char *par)
   who = newsplit(&par);
   if (par[0] && strchr(CHANMETA, par[0]))
     chname = newsplit(&par);
-  else
-    chname = 0;
+
+  /* Did they mix up the two params? */
+  if (!chname && strchr(CHANMETA, who[0])) {
+    if (par[0]) {
+      chname = who;
+      who = newsplit(&par);
+    } else {
+      goto usage;
+    }
+  }
+
   if (chname || !(dcc[idx].user->flags & USER_MASTER)) {
     if (!chname)
       chname = dcc[idx].u.chat->con_chan;
@@ -191,6 +201,7 @@ static void cmd_mns_mask(const char type, int idx, char *par)
   const char *cmd = (type == 'b' ? "ban" : type == 'e' ? "exempt" : "invite");
 
   if (!par[0]) {
+usage:
     dprintf(idx, "Usage: -%s <hostmask> [channel]\n", cmd);
     return;
   }
@@ -203,8 +214,20 @@ static void cmd_mns_mask(const char type, int idx, char *par)
   who = newsplit(&par);
   if (par[0] && strchr(CHANMETA, par[0]))
     chname = newsplit(&par);
-  else
+
+  /* Did they mix up the two params? */
+  if (!chname && strchr(CHANMETA, who[0])) {
+    if (par[0]) {
+      chname = who;
+      who = newsplit(&par);
+    } else {
+      goto usage;
+    }
+  }
+
+  if (!chname)
     chname = dcc[idx].u.chat->con_chan;
+
   if (chname || !(dcc[idx].user->flags & USER_MASTER)) {
     if (!chname)
       chname = dcc[idx].u.chat->con_chan;