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

* 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 година
родитељ
комит
d385fab8e7
5 измењених фајлова са 37 додато и 6 уклоњено
  1. 1 0
      doc/UPDATES
  2. 13 4
      misc/help.txt
  3. 1 1
      src/mod/channels.mod/channels.h
  4. 3 0
      src/mod/channels.mod/cmdschan.c
  5. 19 1
      src/mod/channels.mod/userchan.c

+ 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)
 * Fix some minor bugs with cmd_conf. (fixes #284)
 * Made requested changes to cmd_dump to help clear up confusion. (fixes #269)
 * 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)
 * 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
 1.2.10 - http://tracker.shatow.net/milestone/1.2.10
 * Removed old references to '+/-manop' and '+/-nomop' for chaninfo in help file.
 * 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
 See also: reload, save
 ::bans
 ::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
    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
    list of channel-specific bans, as well as any bans that are on the channel
    but weren't placed by the bot.
    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
    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>', it will list all bans (active or not) that match against your
    wildcard. Consider it a 'bans all' list matched against your wildcard.
    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
    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
    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
    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,
    The bot will execute the specified program with each param specified,
    and display the results over DCC.
    and display the results over DCC.
 ::exempts
 ::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
    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
    the list of channel-specific exempts, as well as any exempts that are on the
    channel but weren't placed by the bot.
    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
    match against your wildcard. Consider it a 'exempts all' list matched
    against your wildcard.
    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
    The exempt list may change according to which channel you're currently
    viewing in the console. Different exempts may be active on different
    viewing in the console. Different exempts may be active on different
    channels. If you specify a channel name, that channel will be used instead
    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
 See also: console, iop
 ::invites
 ::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
    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
    the list of channel-specific invites, as well as any invites that are on the
    channel but weren't placed by the bot.
    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
    use 'invites <wildcard>', it will list all invites (active or not) that
    match against your wildcard. Consider it a 'invites all' list matched
    match against your wildcard. Consider it a 'invites all' list matched
    against your wildcard.
    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
    The invite list may change according to which channel you're currently
    viewing in the console. Different invites may be active on different
    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 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 get_mode_protect(struct chanset_t *chan, char *s);
 static void set_mode_protect(struct chanset_t *chan, char *set);
 static void set_mode_protect(struct chanset_t *chan, char *set);
 static int count_mask(maskrec *);
 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")) {
   if (!egg_strcasecmp(par, "all")) {
     putlog(LOG_CMDS, "*", "#%s# %ss all", dcc[idx].nick, str_type);
     putlog(LOG_CMDS, "*", "#%s# %ss all", dcc[idx].nick, str_type);
     tell_masks(type, idx, 1, "");
     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 {
   } else {
     putlog(LOG_CMDS, "*", "#%s# %ss %s", dcc[idx].nick, str_type, par);
     putlog(LOG_CMDS, "*", "#%s# %ss %s", dcc[idx].nick, str_type, par);
     tell_masks(type, idx, 0, 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);
     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;
   int k = 1;
   char *chname = NULL;
   char *chname = NULL;
@@ -449,15 +449,26 @@ static void tell_masks(const char type, int idx, bool show_inact, char *match)
       match = chname;
       match = chname;
   }
   }
 
 
+  if (all)
+    chan = chanset;
+
   /* don't return here, we want to show global masks even if no chan */
   /* 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))
   if (!chan && !(chan = findchan_by_dname(dcc[idx].u.chat->con_chan)) && !(chan = chanset))
     chan = NULL;
     chan = NULL;
+
+  while (chan) {
   get_user_flagrec(dcc[idx].user, &user, chan->dname);
   get_user_flagrec(dcc[idx].user, &user, chan->dname);
   if (privchan(user, chan, PRIV_OP)) {
   if (privchan(user, chan, PRIV_OP)) {
+    if (all) goto next;
     dprintf(idx, "No such channel defined.\n");
     dprintf(idx, "No such channel defined.\n");
     return;
     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)
   if (chan && show_inact)
     dprintf(idx, "Global %ss:   (! = not active on %s)\n", str_type, chan->dname);
     dprintf(idx, "Global %ss:   (! = not active on %s)\n", str_type, chan->dname);
   else
   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)
   if (k == 1)
     dprintf(idx, "(There are no %ss, permanent or otherwise.)\n", str_type);
     dprintf(idx, "(There are no %ss, permanent or otherwise.)\n", str_type);
   if ((!show_inact) && (!match[0]))
   if ((!show_inact) && (!match[0]))