]> jfr.im git - solanum.git/blobdiff - modules/core/m_ban.c
Unify oper:{global,local}_kill
[solanum.git] / modules / core / m_ban.c
index 1de160fa6065d3cf6ce6e78fed22a1a518a16e23..897a40b02d2babbe469c4486983a2b17db26ece2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * charybdis: An advanced ircd.
+ * Solanum: a slightly advanced ircd
  * m_ban.c: Propagates network bans across servers.
  *
  *  Copyright (C) 2010 Jilles Tjoelker
@@ -31,8 +31,7 @@
 #include "send.h"
 #include "channel.h"
 #include "client.h"
-#include "common.h"
-#include "config.h"
+#include "defaults.h"
 #include "ircd.h"
 #include "match.h"
 #include "s_conf.h"
 #include "hostmask.h"
 #include "logger.h"
 
-static int m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
-static int ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static const char ban_desc[] = "Provides the TS6 BAN command for propagating network-wide bans";
+
+static void m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
+static void ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
 
 struct Message ban_msgtab = {
        "BAN", 0, 0, 0, 0,
@@ -55,16 +56,16 @@ struct Message ban_msgtab = {
 };
 
 mapi_clist_av1 ban_clist[] =  { &ban_msgtab, NULL };
-DECLARE_MODULE_AV2(ban, NULL, NULL, ban_clist, NULL, NULL, NULL, NULL, NULL);
 
-static int
+DECLARE_MODULE_AV2(ban, NULL, NULL, ban_clist, NULL, NULL, NULL, NULL, ban_desc);
+
+static void
 m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        sendto_one_notice(source_p, ":The BAN command is not user-accessible.");
        sendto_one_notice(source_p, ":To ban a user from a channel, see /QUOTE HELP CMODE");
-       if (IsOper(source_p))
+       if (IsOperGeneral(source_p))
                sendto_one_notice(source_p, ":To ban a user from a server or from the network, see /QUOTE HELP KLINE");
-       return 0;
 }
 
 /* ms_ban()
@@ -78,7 +79,7 @@ m_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
  * parv[7] - oper or *
  * parv[8] - reason (possibly with |operreason)
  */
-static int
+static void
 ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
 {
        rb_dlink_node *ptr;
@@ -96,7 +97,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                "Unknown BAN type %s from %s",
                                parv[1], source_p->name);
-               return 0;
+               return;
        }
        switch (parv[1][0])
        {
@@ -117,7 +118,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                        sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
                                        "Unknown BAN type %s from %s",
                                        parv[1], source_p->name);
-                       return 0;
+                       return;
        }
        created = atol(parv[4]);
        hold = created + atoi(parv[5]);
@@ -142,7 +143,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                                                aconf->user ? aconf->user : "",
                                                aconf->user ? "@" : "",
                                                aconf->host);
-                       return 0;
+                       return;
                }
                /* act indicates if something happened (from the oper's
                 * point of view). This is the case if the ban was
@@ -155,7 +156,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                        aconf->lifetime = lifetime;
                /* already expired, hmm */
                if (aconf->lifetime <= now)
-                       return 0;
+                       return;
                /* Deactivate, it will be reactivated later if appropriate. */
                deactivate_conf(aconf, ptr, now);
                rb_free(aconf->user);
@@ -285,20 +286,7 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                        else
                        {
                                add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf);
-                               if(ConfigFileEntry.kline_delay ||
-                                               (IsServer(source_p) &&
-                                                !HasSentEob(source_p)))
-                               {
-                                       if(kline_queued == 0)
-                                       {
-                                               rb_event_addonce("check_klines", check_klines_event, NULL,
-                                                       ConfigFileEntry.kline_delay ?
-                                                               ConfigFileEntry.kline_delay : 1);
-                                               kline_queued = 1;
-                                       }
-                               }
-                               else
-                                       check_klines();
+                               check_one_kline(aconf);
                        }
                        break;
                case CONF_XLINE:
@@ -333,5 +321,4 @@ ms_ban(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p
                        parv[6],
                        parv[7],
                        parv[parc - 1]);
-       return 0;
 }