]> jfr.im git - solanum.git/blobdiff - ircd/chmode.c
m_cap: simplify cap_req, remove multiline
[solanum.git] / ircd / chmode.c
index cab538fb1fb393fd29bee8bedcfd48698466b7cc..6416a8c9107476c068b853e4e3eec0543081cae0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  charybdis: A slightly useful ircd.
+ *  Solanum: a slightly advanced ircd
  *  chmode.c: channel mode management
  *
  * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
@@ -660,7 +660,7 @@ chm_hidden(struct Client *source_p, struct Channel *chptr,
          int alevel, int parc, int *parn,
          const char **parv, int *errors, int dir, char c, long mode_type)
 {
-       if(!IsOperGeneral(source_p) && !IsServer(source_p))
+       if(MyClient(source_p) && !IsOperGeneral(source_p))
        {
                if(!(*errors & SM_ERR_NOPRIVS))
                        sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES));
@@ -707,7 +707,7 @@ chm_staff(struct Client *source_p, struct Channel *chptr,
          int alevel, int parc, int *parn,
          const char **parv, int *errors, int dir, char c, long mode_type)
 {
-       if(!IsOper(source_p) && !IsServer(source_p))
+       if(MyClient(source_p) && !IsOper(source_p))
        {
                if(!(*errors & SM_ERR_NOPRIVS))
                        sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES));
@@ -1742,7 +1742,13 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
 
        for(j = 0; j < 3; j++)
        {
-               flags = flags_list[j];
+               int send_flags = flags = flags_list[j];
+               const char *priv = NULL;
+               if (flags == ONLY_OPERS)
+               {
+                       send_flags = ALL_MEMBERS;
+                       priv = "auspex:cmodes";
+               }
                cur_len = mlen;
                mbuf = modebuf + mlen;
                pbuf = parabuf;
@@ -1775,8 +1781,8 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                                *mbuf = '\0';
 
                                if(cur_len > mlen)
-                                       sendto_channel_local(IsServer(source_p) ? fakesource_p : source_p,
-                                                       flags, chptr, "%s %s", modebuf, parabuf);
+                                       sendto_channel_local_priv(IsServer(source_p) ? fakesource_p : source_p,
+                                                       send_flags, priv, chptr, "%s %s", modebuf, parabuf);
                                else
                                        continue;
 
@@ -1812,8 +1818,8 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
 
                *mbuf = '\0';
                if(cur_len > mlen)
-                       sendto_channel_local(IsServer(source_p) ? fakesource_p : source_p,
-                               flags, chptr, "%s %s", modebuf, parabuf);
+                       sendto_channel_local_priv(IsServer(source_p) ? fakesource_p : source_p,
+                               send_flags, priv, chptr, "%s %s", modebuf, parabuf);
        }
 
        /* only propagate modes originating locally, or if we're hubbing */