Author: Michael Poole <mdpoole@troilus.org>
[ircu2.10.12-pk.git] / ircd / m_wallchops.c
index 6fa55c140b3d579508c94307b2510470e745f7d6..5b609590cb48c9651efa612d38c54b5e6e5a2bcf 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
+#include "config.h"
+
 #include "channel.h"
 #include "client.h"
 #include "hash.h"
 #include "ircd.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "msg.h"
@@ -99,7 +94,7 @@
 #include "s_user.h"
 #include "send.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 
 /*
  * m_wallchops - local generic message handler
@@ -111,7 +106,7 @@ int m_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
   assert(0 != cptr);
   assert(cptr == sptr);
 
-  cli_flags(sptr) &= ~FLAGS_TS8;
+  ClrFlag(sptr, FLAG_TS8);
 
   if (parc < 2 || EmptyString(parv[1]))
     return send_reply(sptr, ERR_NORECIPIENT, "WALLCHOPS");
@@ -120,13 +115,13 @@ int m_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[]
     return send_reply(sptr, ERR_NOTEXTTOSEND);
 
   if (IsChannelName(parv[1]) && (chptr = FindChannel(parv[1]))) {
-    if (client_can_send_to_channel(sptr, chptr)) {
+    if (client_can_send_to_channel(sptr, chptr, 1)) {
       if ((chptr->mode.mode & MODE_NOPRIVMSGS) &&
           check_target_limit(sptr, chptr, chptr->chname, 0))
         return 0;
       sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
                               SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
-                              "%H :%s", chptr, parv[parc - 1]);
+                              "%H :%s", chptr, parv[parc - 1]);
     }
     else
       send_reply(sptr, ERR_CANNOTSENDTOCHAN, parv[1]);
@@ -149,8 +144,8 @@ int ms_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[
   if (parc < 3 || !IsUser(sptr))
     return 0;
 
-  if ((chptr = FindChannel(parv[1]))) {
-    if (client_can_send_to_channel(sptr, chptr)) {
+  if (!IsLocalChannel(parv[1]) && (chptr = FindChannel(parv[1]))) {
+    if (client_can_send_to_channel(sptr, chptr, 1)) {
       sendcmdto_channel_butone(sptr, CMD_WALLCHOPS, chptr, cptr,
                               SKIP_DEAF | SKIP_BURST | SKIP_NONOPS,
                               "%H :%s", chptr, parv[parc - 1]);
@@ -159,60 +154,3 @@ int ms_wallchops(struct Client* cptr, struct Client* sptr, int parc, char* parv[
   }
   return 0;
 }
-
-#if 0
-/*
- * m_wallchops
- *
- * parv[0] = sender prefix
- * parv[1] = target channel
- * parv[parc - 1] = wallchops text
- */
-int m_wallchops(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  struct Channel *chptr;
-
-  sptr->flags &= ~FLAGS_TS8;
-
-  if (parc < 2 || *parv[1] == '\0')
-  {
-    sendto_one(sptr, err_str(ERR_NORECIPIENT), me.name, parv[0], "WALLCHOPS"); /* XXX DEAD */
-    return -1;
-  }
-
-  if (parc < 3 || *parv[parc - 1] == '\0')
-  {
-    sendto_one(sptr, err_str(ERR_NOTEXTTOSEND), me.name, parv[0]); /* XXX DEAD */
-    return -1;
-  }
-
-  if (MyUser(sptr))
-    parv[1] = canonize(parv[1]);
-
-  if (IsChannelName(parv[1]))
-  {
-    if ((chptr = FindChannel(parv[1])))
-    {
-      if (client_can_send_to_channel(sptr, chptr))
-      {
-        if (MyUser(sptr) && (chptr->mode.mode & MODE_NOPRIVMSGS) &&
-            check_target_limit(sptr, chptr, chptr->chname, 0))
-          return 0;
-        /* Send to local clients: */
-        sendto_lchanops_butone(cptr, sptr, chptr, /* XXX DEAD */
-            ":%s NOTICE @%s :%s", parv[0], parv[1], parv[parc - 1]);
-        /* And to other servers: */
-        sendto_chanopsserv_butone(cptr, sptr, chptr, /* XXX DEAD */
-            ":%s WC %s :%s", parv[0], parv[1], parv[parc - 1]);
-      }
-      else
-        sendto_one(sptr, err_str(ERR_CANNOTSENDTOCHAN), /* XXX DEAD */
-            me.name, parv[0], parv[1]);
-    }
-  }
-  else
-    sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL), me.name, parv[0], parv[1]); /* XXX DEAD */
-
-  return 0;
-}
-#endif /* 0 */