]> jfr.im git - solanum.git/commitdiff
extensions/override: display mode-change string in override messages
authorWilliam Pitcock <redacted>
Tue, 12 Jan 2016 04:40:32 +0000 (22:40 -0600)
committerWilliam Pitcock <redacted>
Tue, 12 Jan 2016 04:40:32 +0000 (22:40 -0600)
extensions/m_remove.c
extensions/override.c
include/channel.h
include/hook.h
ircd/chmode.c
modules/core/m_kick.c
modules/m_topic.c

index e9a3e6460c551d4f7145c28ce3f3d63091b228c2..9321e37a0ad96aca5ecc60f1e0470bd64f625b98 100644 (file)
@@ -114,7 +114,7 @@ m_remove(struct Client *client_p, struct Client *source_p, int parc, const char
                        return 0;
                }
 
-               if(get_channel_access(source_p, msptr, MODE_ADD) < CHFL_CHANOP)
+               if(get_channel_access(source_p, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
                {
                        if(MyConnect(source_p))
                        {
index 3bdf4bd393b1f6c09a800586c2bc47b8ae7c322e..36ed1dc8eb46fe1dc589205d5417a802733f21c4 100644 (file)
@@ -164,8 +164,10 @@ hack_channel_access(void *vdata)
                update_session_deadline(data->client, NULL);
                data->approved = CHFL_CHANOP;
 
-               sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (modehacking)",
-                                      get_oper_name(data->client), data->chptr->chname);
+               /* we only want to report modehacks, which are always non-NULL */
+               if (data->modestr)
+                       sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using oper-override on %s (modehacking: %s)",
+                                              get_oper_name(data->client), data->chptr->chname, data->modestr);
        }
 }
 
index 2297bf360a55b7b69f42f310db9584457c392e41..9cf000238e800cc136fc933852683494a75d1f66 100644 (file)
@@ -275,7 +275,7 @@ extern int match_extban(const char *banstr, struct Client *client_p, struct Chan
 extern int valid_extban(const char *banstr, struct Client *client_p, struct Channel *chptr, long mode_type);
 const char * get_extban_string(void);
 
-extern int get_channel_access(struct Client *source_p, struct membership *msptr, int dir);
+extern int get_channel_access(struct Client *source_p, struct membership *msptr, int dir, const char *modestr);
 
 extern void send_channel_join(struct Channel *chptr, struct Client *client_p);
 
index 70d1b5ad1b540a15b53bd2404c6a43fde216f131..5d768c8d502c5b522940c9ded442a57ba905fb33 100644 (file)
@@ -85,6 +85,7 @@ typedef struct
        struct Client *target;
        int approved;
        int dir;
+       const char *modestr;
 } hook_data_channel_approval;
 
 typedef struct
index 4cf3cb5c698a35f8a6650671610d5d91f92b99af..f63e74e5fd61b653eadbb4f341d83de0f7aadee5 100644 (file)
@@ -43,6 +43,7 @@
 #include "logger.h"
 #include "chmode.h"
 #include "s_assert.h"
+#include "parse.h"
 
 /* bitmasks for error returns, so we send once per call */
 #define SM_ERR_NOTS             0x00000001     /* No TS on channel */
@@ -179,7 +180,7 @@ cflag_orphan(char c_)
 }
 
 int
-get_channel_access(struct Client *source_p, struct membership *msptr, int dir)
+get_channel_access(struct Client *source_p, struct membership *msptr, int dir, const char *modestr)
 {
        hook_data_channel_approval moduledata;
 
@@ -195,6 +196,7 @@ get_channel_access(struct Client *source_p, struct membership *msptr, int dir)
        moduledata.target = NULL;
        moduledata.approved = is_chanop(msptr) ? CHFL_CHANOP : CHFL_PEON;
        moduledata.dir = dir;
+       moduledata.modestr = modestr;
 
        call_hook(h_get_channel_access, &moduledata);
 
@@ -519,7 +521,7 @@ check_forward(struct Client *source_p, struct Channel *chptr,
        if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET))
        {
                if((msptr = find_channel_membership(targptr, source_p)) == NULL ||
-                       get_channel_access(source_p, msptr, MODE_QUERY) != CHFL_CHANOP)
+                       get_channel_access(source_p, msptr, MODE_QUERY, NULL) != CHFL_CHANOP)
                {
                        sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
                                   me.name, source_p->name, targptr->chname);
@@ -1655,7 +1657,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
        else
                fakesource_p = source_p;
 
-       alevel = get_channel_access(source_p, msptr, dir);
+       alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
 
        for(; (c = *ml) != 0; ml++)
        {
@@ -1665,7 +1667,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                        dir = MODE_ADD;
                        if (!reauthorized)
                        {
-                               alevel = get_channel_access(source_p, msptr, dir);
+                               alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
                                reauthorized = 1;
                        }
                        break;
@@ -1673,7 +1675,7 @@ set_channel_mode(struct Client *client_p, struct Client *source_p,
                        dir = MODE_DEL;
                        if (!reauthorized)
                        {
-                               alevel = get_channel_access(source_p, msptr, dir);
+                               alevel = get_channel_access(source_p, msptr, dir, reconstruct_parv(parc, parv));
                                reauthorized = 1;
                        }
                        break;
index 387534612a55a0800d06fd86722c109cc259fbfb..8473ae3789dbab963d16893ece2f6255f6397158 100644 (file)
@@ -97,7 +97,7 @@ m_kick(struct Client *client_p, struct Client *source_p, int parc, const char *p
                        return 0;
                }
 
-               if(get_channel_access(source_p, msptr, MODE_ADD) < CHFL_CHANOP)
+               if(get_channel_access(source_p, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
                {
                        if(MyConnect(source_p))
                        {
index b59378a3e3842df18d9e7e1459338c6e933559c8..c2c37f855b373e8c1df2e3abc14e7f2414001ae1 100644 (file)
@@ -119,7 +119,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char *
                }
 
                if(((chptr->mode.mode & MODE_TOPICLIMIT) == 0 ||
-                                       get_channel_access(source_p, msptr, MODE_ADD) >= CHFL_CHANOP) &&
+                                       get_channel_access(source_p, msptr, MODE_ADD, NULL) >= CHFL_CHANOP) &&
                                (!MyClient(source_p) ||
                                 can_send(chptr, source_p, msptr)))
                {