added basic ssl support to ircu
[ircu2.10.12-pk.git] / ircd / m_quit.c
index 7d6015ac5839ad096e1af9166bce4119ec4f3355..9ccc361566d6e0078a7766ad4ab7551b79c53e29 100644 (file)
 
 #include "channel.h"
 #include "client.h"
+#include "ircd.h"
+#include "ircd_log.h"
 #include "ircd_string.h"
 #include "struct.h"
 #include "s_misc.h"
 #include "ircd_reply.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 #include <string.h>
 
 /*
  */
 int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
-  char* comment;
   assert(0 != cptr);
   assert(0 != sptr);
   assert(cptr == sptr);
@@ -107,26 +108,19 @@ int m_quit(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (cli_user(sptr)) {
     struct Membership* chan;
     for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) {
-      if (!IsZombie(chan) && !member_can_send_to_channel(chan))
+        if (!IsZombie(chan) && !IsDelayedJoin(chan) && !member_can_send_to_channel(chan, 0))
         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';
-  }
-  return exit_client(cptr, sptr, sptr, comment);
+  if (parc > 1 && !BadPtr(parv[parc - 1]))
+    return exit_client_msg(cptr, sptr, sptr, "Quit: %s", parv[parc - 1]);
+  else
+    return exit_client(cptr, sptr, sptr, "Quit");
 }
 
 
 /*
- * ms_quit - server message handler template
+ * ms_quit - server message handler
  *
  * parv[0] = sender prefix
  * parv[parc - 1] = comment