]> jfr.im git - solanum.git/blobdiff - modules/core/m_squit.c
Can IGNORE_BOGUS_TS at the behest of @kaniini and @jilest
[solanum.git] / modules / core / m_squit.c
index 7840c4ba017632e48563a6d3f0497334b3c892c1..fb2ce5cced8acfbef1bde07fadae0d7ae027630a 100644 (file)
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  *  USA
- *
- *  $Id: m_squit.c 3161 2007-01-25 07:23:01Z nenolod $
  */
 
 #include "stdinc.h"
 #include "client.h"
-#include "common.h"            /* FALSE bleah */
-#include "irc_string.h"
+#include "common.h"
+#include "match.h"
 #include "ircd.h"
 #include "numeric.h"
 #include "s_conf.h"
-#include "s_log.h"
+#include "logger.h"
 #include "s_serv.h"
 #include "send.h"
 #include "msg.h"
 #include "hash.h"
 #include "s_newconf.h"
 
-static int ms_squit(struct Client *, struct Client *, int, const char **);
-static int mo_squit(struct Client *, struct Client *, int, const char **);
+static const char squit_desc[] = "Provides the SQUIT command to cause a server to quit";
+
+static void ms_squit(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
+static void mo_squit(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
 
 struct Message squit_msgtab = {
-       "SQUIT", 0, 0, 0, MFLG_SLOW,
+       "SQUIT", 0, 0, 0, 0,
        {mg_unreg, mg_not_oper, {ms_squit, 0}, {ms_squit, 0}, mg_ignore, {mo_squit, 2}}
 };
 
 mapi_clist_av1 squit_clist[] = { &squit_msgtab, NULL };
 
-DECLARE_MODULE_AV1(squit, NULL, NULL, squit_clist, NULL, NULL, "$Revision: 3161 $");
+DECLARE_MODULE_AV2(squit, NULL, NULL, squit_clist, NULL, NULL, NULL, NULL, squit_desc);
 
 struct squit_parms
 {
@@ -64,12 +64,11 @@ static struct squit_parms *find_squit(struct Client *client_p,
 
 /*
  * mo_squit - SQUIT message handler
- *      parv[0] = sender prefix
  *      parv[1] = server name
  *      parv[2] = comment
  */
-static int
-mo_squit(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+mo_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        struct squit_parms *found_squit;
        const char *comment = (parc > 2 && parv[2]) ? parv[2] : client_p->name;
@@ -90,28 +89,25 @@ mo_squit(struct Client *client_p, struct Client *source_p, int parc, const char
                {
                        sendto_one(source_p, form_str(ERR_NOPRIVS),
                                   me.name, source_p->name, "remote");
-                       return 0;
+                       return;
                }
 
                exit_client(client_p, found_squit->target_p, source_p, comment);
-               return 0;
+               return;
        }
        else
        {
                sendto_one_numeric(source_p, ERR_NOSUCHSERVER, form_str(ERR_NOSUCHSERVER), parv[1]);
        }
-
-       return 0;
 }
 
 /*
  * ms_squit - SQUIT message handler
- *      parv[0] = sender prefix
  *      parv[1] = server name
  *      parv[2] = comment
  */
-static int
-ms_squit(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
+static void
+ms_squit(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        struct Client *target_p;
        const char *comment = (parc > 2 && parv[2]) ? parv[2] : client_p->name;
@@ -121,12 +117,12 @@ ms_squit(struct Client *client_p, struct Client *source_p, int parc, const char
        else
        {
                if((target_p = find_server(NULL, parv[1])) == NULL)
-                       return 0;
+                       return;
 
                if(IsMe(target_p))
                        target_p = client_p;
                if(!IsServer(target_p))
-                       return 0;
+                       return;
        }
 
        /* Server is closing its link */
@@ -148,15 +144,9 @@ ms_squit(struct Client *client_p, struct Client *source_p, int parc, const char
                              ":%s WALLOPS :Remote SQUIT %s from %s (%s)",
                              me.id, target_p->name, source_p->name, comment);
 
-               sendto_server(NULL, NULL, NOCAPS, CAP_TS6,
-                             ":%s WALLOPS :Remote SQUIT %s from %s (%s)",
-                             me.name, target_p->name, source_p->name, comment);
-
-               ilog(L_SERVER, "SQUIT From %s : %s (%s)", parv[0], target_p->name, comment);
-
+               ilog(L_SERVER, "SQUIT From %s : %s (%s)", source_p->name, target_p->name, comment);
        }
        exit_client(client_p, target_p, source_p, comment);
-       return 0;
 }
 
 
@@ -174,7 +164,7 @@ find_squit(struct Client *client_p, struct Client *source_p, const char *server)
        static struct squit_parms found_squit;
        struct Client *target_p = NULL;
        struct Client *p;
-       dlink_node *ptr;
+       rb_dlink_node *ptr;
 
        /* must ALWAYS be reset */
        found_squit.target_p = NULL;
@@ -186,7 +176,7 @@ find_squit(struct Client *client_p, struct Client *source_p, const char *server)
         ** when the command is issued by an oper.
         */
 
-       DLINK_FOREACH(ptr, global_serv_list.head)
+       RB_DLINK_FOREACH(ptr, global_serv_list.head)
        {
                p = ptr->data;
                if(IsServer(p) || IsMe(p))