Support /LIST M to show modes in channels (using the list_chan privilege).
[ircu2.10.12-pk.git] / ircd / m_list.c
index e634caa9ba2edccadb9cbf31aa536aee575559e7..b43ab1575762b3330d2886a6327169d43a8d9cec 100644 (file)
@@ -168,9 +168,12 @@ show_usage(struct Client *sptr)
              "matching \037pattern\037. ");
   send_reply(sptr, RPL_LISTUSAGE, "Note: Patterns may contain * and ?. "
              "You may only give one pattern match constraint.");
-  if (IsAnOper(sptr))
+  if (IsAnOper(sptr)) {
     send_reply(sptr, RPL_LISTUSAGE,
                " \002S\002             ; Show secret channels.");
+    send_reply(sptr, RPL_LISTUSAGE,
+               " \002M\002             ; Show channel modes.");
+  }
   send_reply(sptr, RPL_LISTUSAGE,
             "Example: LIST <3,>1,C<10,T>0,#a*  ; 2 users, younger than 10 "
             "min., topic set., starts with #a");
@@ -262,6 +265,18 @@ param_parse(struct Client *sptr, const char *param, struct ListingArgs *args,
         return show_usage(sptr);
       break;
 
+    case 'M':
+    case 'm':
+      if (!IsAnOper(sptr) || !HasPriv(sptr, PRIV_LIST_CHAN))
+        return show_usage(sptr);
+
+      args->flags |= LISTARG_SHOWMODES;
+      param++;
+
+      if (*param != ',' && *param != ' ' && *param != '\0') /* check syntax */
+        return show_usage(sptr);
+      break;
+
     default:
       /* It might be a wildcard... */
       if (strchr(param, '*') ||