Просмотр исходного кода

* Port [3096] to 1.2.12
* cmd_mop no longer defaults to console channel if no channel is specified. (fixes #302)


svn: 3097

Bryan Drewery 19 лет назад
Родитель
Сommit
da9ad8a126
3 измененных файлов с 14 добавлено и 12 удалено
  1. 1 0
      doc/UPDATES
  2. 3 4
      misc/help.txt
  3. 10 8
      src/mod/irc.mod/cmdsirc.c

+ 1 - 0
doc/UPDATES

@@ -13,6 +13,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Added ARCH entry for bots in .whois
 * Added a new error code (22) which displays if attempting to run binary before using -C.
 * cmd_swhois is now -|- and hides all restricted information, channels; see 'help swhois'.
+* cmd_mop no longer defaults to console channel if no channel is specified. (fixes #302)
 
 1.2.11 - http://wraith.shatow.net/milestone/1.2.11
 * Fixed typo in help for .set/.conf/.channel

+ 3 - 4
misc/help.txt

@@ -1242,13 +1242,12 @@ See also: randstring, sha1, encrypt, decrypt
    Performs an action on the party line. This appears as "* Wcc is leaving",
    etc.
 :leaf:mop:
-###  $bmop$b [channel|*]
+###  $bmop$b <channel|*>
    Bot will op all users in the specified channel that are valid ops
    for the channel. If '*' is specified, the bot will scan all channels
-   and op all users in all channels that are valid ops in each chan. If 
-   no channel is specified, the console channel is used.
+   and op all users in all channels that are valid ops in each chan.
  
-See also: whois, console
+See also: whois
 ::motd
 ###  $bmotd$b %{+m}<message>%{-}
    This redisplays the partyline Message Of The Day, which was shown when you

+ 10 - 8
src/mod/irc.mod/cmdsirc.c

@@ -7,7 +7,7 @@
 
 /* Do we have any flags that will allow us ops on a channel?
  */
-static struct chanset_t *get_channel(int idx, char *chname)
+static struct chanset_t *get_channel(int idx, char *chname, bool check_console = 1)
 {
   struct chanset_t *chan = NULL;
 
@@ -17,7 +17,7 @@ static struct chanset_t *get_channel(int idx, char *chname)
       return chan;
     else
       dprintf(idx, "No such channel.\n");
-  } else {
+  } else if (check_console) {
     chname = dcc[idx].u.chat->con_chan;
     chan = findchan_by_dname(chname);
     if (chan)
@@ -25,7 +25,7 @@ static struct chanset_t *get_channel(int idx, char *chname)
     else
       dprintf(idx, "Invalid console channel.\n");
   }
-  return 0;
+  return NULL;
 }
 
 /* Do we have any flags that will allow us ops on a channel?
@@ -1030,16 +1030,18 @@ static void cmd_mop(int idx, char *par)
     newsplit(&par);
   } else {
     if (par[0] && (strchr(CHANMETA, par[0]) != NULL)) {
-      chan = get_channel(idx, newsplit(&par));
+      chan = get_channel(idx, newsplit(&par), 0);
     } else
-      chan = get_channel(idx, "");
+      chan = get_channel(idx, "", 0);
   }
 
-  if (!chan && !all)
-    return;
-
   putlog(LOG_CMDS, "*", "#%s# (%s) mop %s", dcc[idx].nick, all ? "*" : chan->dname, par);
 
+  if (!chan && !all) {
+    dprintf(idx, "Usage: mop <channel|*>\n");
+    return;
+  }
+
   memberlist *m = NULL;
   char s[256] = "";