added basic ssl support to ircu
[ircu2.10.12-pk.git] / ircd / m_quit.c
index 3c45f887fd322f5e087e989d5e0c5ae4851fc9ba..9ccc361566d6e0078a7766ad4ab7551b79c53e29 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.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);
 
-  if (sptr->user) {
+  if (cli_user(sptr)) {
     struct Membership* chan;
-    for (chan = sptr->user->channel; chan; chan = chan->next_channel) {
-      if (!IsZombie(chan) && !member_can_send_to_channel(chan))
+    for (chan = cli_user(sptr)->channel; chan; chan = chan->next_channel) {
+        if (!IsZombie(chan) && !IsDelayedJoin(chan) && !member_can_send_to_channel(chan, 0))
         return exit_client(cptr, sptr, sptr, "Signed off");
     }
   }
-  comment = cptr->name;
-
-  if (parc > 1) {
-    comment = parv[parc - 1];
-
-    if (0 == strncmp("Local kill", comment, 10) || 0 == strncmp(comment, "Killed", 6))
-       comment = cptr->name;
-    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
@@ -150,33 +138,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 */