Sfoglia il codice sorgente

* Port [2988] to 1.2.11
* cmd_bans/exempts/invites [global] now displays a list of bans for ALL channels. (fixes #276)


svn: 2989

Bryan Drewery 20 anni fa
parent
commit
d385fab8e7

+ 1 - 0
doc/UPDATES

@@ -21,6 +21,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fix some minor bugs with cmd_conf. (fixes #284)
 * Made requested changes to cmd_dump to help clear up confusion. (fixes #269)
 * Fix improper notice when doing .set <var> -- (this actually shouldn't say 'not set') (fixes #272)
+* cmd_bans/exempts/invites [global] now displays a list of bans for ALL channels. (fixes #276)
 
 1.2.10 - http://tracker.shatow.net/milestone/1.2.10
 * Removed old references to '+/-manop' and '+/-nomop' for chaninfo in help file.

+ 13 - 4
misc/help.txt

@@ -188,7 +188,7 @@ See also: away
  
 See also: reload, save
 ::bans
-###  $bbans$b [[channel/all]/wildcard]
+###  $bbans$b [[channel/all/global]/wildcard]
    Shows you a list of the global bans active on the current channel, and the
    list of channel-specific bans, as well as any bans that are on the channel
    but weren't placed by the bot.
@@ -217,7 +217,10 @@ See also: reload, save
    every ban in the global ban list and on the channel. If you use 'bans
    <wildcard>', it will list all bans (active or not) that match against your
    wildcard. Consider it a 'bans all' list matched against your wildcard.
- 
+
+   If you use 'bans global', a full list of bans for EVERY channel will be
+   displayed, including inactive/active bans on each channel. 
+
    The ban list may change according to which channel you're currently viewing
    in the console. Different bans may be active on different channels. If you
    specify a channel name, that channel will be used instead of your current
@@ -911,7 +914,7 @@ See also: decrypt, randstring, md5, sha1
    The bot will execute the specified program with each param specified,
    and display the results over DCC.
 ::exempts
-###  $bexempts$b [[channel/all]/wildcard]
+###  $bexempts$b [[channel/all/global]/wildcard]
    Shows you a list of the global exempts active on the current channel, and
    the list of channel-specific exempts, as well as any exempts that are on the
    channel but weren't placed by the bot.
@@ -943,6 +946,9 @@ See also: decrypt, randstring, md5, sha1
    match against your wildcard. Consider it a 'exempts all' list matched
    against your wildcard.
  
+   If you use 'exempts global', a full list of exempts for EVERY channel will be
+   displayed, including inactive/active exempts on each channel.
+
    The exempt list may change according to which channel you're currently
    viewing in the console. Different exempts may be active on different
    channels. If you specify a channel name, that channel will be used instead
@@ -1041,7 +1047,7 @@ See also: +ignore, -ignore
  
 See also: console, iop
 ::invites
-###  $binvites$b [[channel/all]/wildcard]
+###  $binvites$b [[channel/all/global]/wildcard]
    Shows you a list of the global invites active on the current channel, and
    the list of channel-specific invites, as well as any invites that are on the
    channel but weren't placed by the bot.
@@ -1072,6 +1078,9 @@ See also: console, iop
    use 'invites <wildcard>', it will list all invites (active or not) that
    match against your wildcard. Consider it a 'invites all' list matched
    against your wildcard.
+
+   If you use 'invites global', a full list of invites for EVERY channel will be
+   displayed, including inactive/active invites on each channel.
  
    The invite list may change according to which channel you're currently
    viewing in the console. Different invites may be active on different

+ 1 - 1
src/mod/channels.mod/channels.h

@@ -17,7 +17,7 @@
 
 
 static void check_expired_masks(void);
-static void tell_masks(const char type, int idx, bool show_inact, char *match);
+static void tell_masks(const char type, int idx, bool show_inact, char *match, bool all = 0);
 static void get_mode_protect(struct chanset_t *chan, char *s);
 static void set_mode_protect(struct chanset_t *chan, char *set);
 static int count_mask(maskrec *);

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

@@ -317,6 +317,9 @@ static void cmd_masks(const char type, int idx, char *par)
   if (!egg_strcasecmp(par, "all")) {
     putlog(LOG_CMDS, "*", "#%s# %ss all", dcc[idx].nick, str_type);
     tell_masks(type, idx, 1, "");
+  } else if (!egg_strcasecmp(par, "global")) {
+    putlog(LOG_CMDS, "*", "#%s# %ss global", dcc[idx].nick, str_type);
+    tell_masks(type, idx, 1, "", 1);
   } else {
     putlog(LOG_CMDS, "*", "#%s# %ss %s", dcc[idx].nick, str_type, par);
     tell_masks(type, idx, 0, par);

+ 19 - 1
src/mod/channels.mod/userchan.c

@@ -427,7 +427,7 @@ static void display_mask(const char type, int idx, int number, maskrec *mask, st
     dprintf(idx, "        %s\n", dates);
 }
 
-static void tell_masks(const char type, int idx, bool show_inact, char *match)
+static void tell_masks(const char type, int idx, bool show_inact, char *match, bool all)
 {
   int k = 1;
   char *chname = NULL;
@@ -449,15 +449,26 @@ static void tell_masks(const char type, int idx, bool show_inact, char *match)
       match = chname;
   }
 
+  if (all)
+    chan = chanset;
+
   /* don't return here, we want to show global masks even if no chan */
   if (!chan && !(chan = findchan_by_dname(dcc[idx].u.chat->con_chan)) && !(chan = chanset))
     chan = NULL;
+
+  while (chan) {
   get_user_flagrec(dcc[idx].user, &user, chan->dname);
   if (privchan(user, chan, PRIV_OP)) {
+    if (all) goto next;
     dprintf(idx, "No such channel defined.\n");
     return;
+  } else if (!chk_op(user, chan)) {
+    if (all) goto next;
+    dprintf(idx, "You don't have access to view %ss on %s\n", str_type, chan->dname);
+    return;
   }
 
+
   if (chan && show_inact)
     dprintf(idx, "Global %ss:   (! = not active on %s)\n", str_type, chan->dname);
   else
@@ -521,6 +532,13 @@ static void tell_masks(const char type, int idx, bool show_inact, char *match)
       }
     }
   }
+  next:;
+    if (!all)
+      chan = NULL;
+    else
+      chan = chan->next;
+  }
+
   if (k == 1)
     dprintf(idx, "(There are no %ss, permanent or otherwise.)\n", str_type);
   if ((!show_inact) && (!match[0]))