Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / m_clearmode.c
index c99d46ec0591a69f4f81f26bdb4b84255b50e16d..aeb2e9e3e793c81a5050edfb60ef85c68a1a16bf 100644 (file)
 #include "numeric.h"
 #include "numnicks.h"
 #include "send.h"
+#include "support.h"
 
 #include <assert.h>
 
@@ -223,9 +224,11 @@ do_clearmode(struct Client *cptr, struct Client *sptr, struct Channel *chptr,
   if (del_mode & MODE_KEY)
     chptr->mode.key[0] = '\0';
 
+#ifndef OPATH
   /* Don't propagate CLEARMODE if it's a local channel */
   if (IsLocalChannel(chptr->chname))
     return 0;
+#endif
 
   /* Ok, build control string again */
   for (flag_p = flags; flag_p[0]; flag_p += 2)
@@ -234,13 +237,25 @@ do_clearmode(struct Client *cptr, struct Client *sptr, struct Channel *chptr,
 
   control_buf[control_buf_i] = '\0';
 
-  /* Then send it */
+#ifdef OPATH
   if (IsServer(sptr))
-    sendto_serv_butone(cptr, "%s " TOK_CLEARMODE " %s %s", NumServ(sptr),
-                      chptr->chname, control_buf);
+    write_log(OPATH, TIME_T_FMT " %s CLEARMODE %s %s\n", TStime(), sptr->name,
+             chptr->chname, control_buf);
   else
-    sendto_serv_butone(cptr, "%s%s " TOK_CLEARMODE " %s %s", NumNick(sptr),
-                      chptr->chname, control_buf);
+    write_log(OPATH, TIME_T_FMT " %s!%s@%s CLEARMODE %s %s\n", TStime(),
+             sptr->name, sptr->user->username, sptr->user->host,
+             chptr->chname, control_buf);
+#endif
+
+  /* Then send it */
+  if (!IsLocalChannel(chptr->chname)) {
+    if (IsServer(sptr))
+      sendto_serv_butone(cptr, "%s " TOK_CLEARMODE " %s %s", NumServ(sptr),
+                        chptr->chname, control_buf);
+    else
+      sendto_serv_butone(cptr, "%s%s " TOK_CLEARMODE " %s %s", NumNick(sptr),
+                        chptr->chname, control_buf);
+  }
 
   return 0;
 }
@@ -280,6 +295,9 @@ ms_clearmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 int
 mo_clearmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
+#ifndef CONFIG_OPERCMDS
+  return send_error_to_client(sptr, ERR_DISABLED, "CLEARMODE");
+#else
   struct Channel *chptr;
   char *control = "ovpsmikbl"; /* default control string */
 
@@ -298,4 +316,5 @@ mo_clearmode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return send_error_to_client(sptr, ERR_NOSUCHCHANNEL, parv[1]);
 
   return do_clearmode(cptr, sptr, chptr, control);
+#endif /* CONFIG_OPERCMDS */
 }