Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / m_quit.c
index 45a3a95c73e46c1c5067c0490d24b3523f19abee..38d47e29d5c74ae74bc63cb65557b3cc9a7a20d1 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 "ircd_string.h"
  */
 int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
-  char* comment;
+  char comment[TOPICLEN];
   assert(0 != cptr);
   assert(0 != sptr);
   assert(cptr == sptr);
@@ -117,15 +111,14 @@ int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
         return exit_client(cptr, sptr, sptr, "Signed off");
     }
   }
-  comment = cli_name(cptr);
 
   if (parc > 1) {
-    comment = parv[parc - 1];
-
-    if (0 == strncmp("Local kill", comment, 10) || 0 == strncmp(comment, "Killed", 6))
-       comment = cli_name(cptr);
-    else if (strlen(comment) > TOPICLEN)
-      comment[TOPICLEN] = '\0';
+    strcpy(comment,"Quit: ");
+    strncat(comment,parv[parc-1],sizeof(comment)-strlen("Quit: "));
+    comment[sizeof(comment)] = '\0';
+  }
+  else {
+    strncpy(comment,cli_name(cptr),sizeof(comment));
   }
   return exit_client(cptr, sptr, sptr, comment);
 }
@@ -150,33 +143,3 @@ int ms_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    */
   return exit_client(cptr, sptr, sptr, parv[parc - 1]);
 }
-
-#if 0
-/*
- * m_quit
- *
- * parv[0] = sender prefix
- * parv[parc-1] = comment
- */
-int m_quit(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  char *comment = (parc > 1 && parv[parc - 1]) ? parv[parc - 1] : cptr->name;
-
-  if (MyUser(sptr))
-  {
-    if (!strncmp("Local Kill", comment, 10) || !strncmp(comment, "Killed", 6))
-      comment = parv[0];
-    if (sptr->user)
-    {
-      struct Membership* chan;
-      for (chan = sptr->user->channel; chan; chan = chan->next_channel)
-        if (!IsZombie(chan) && !member_can_send_to_channel(chan))
-          return exit_client(cptr, sptr, sptr, "Signed off");
-    }
-  }
-  if (strlen(comment) > TOPICLEN)
-    comment[TOPICLEN] = '\0';
-  return IsServer(sptr) ? 0 : exit_client(cptr, sptr, sptr, comment);
-}
-
-#endif /* 0 */