mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-07 11:43:11 +02:00
Make types future-proof. Fix ~m case for +M.
BypassMessageRestrictionType -> BypassChannelMessageRestrictionType BYPASS_MSG_* -> BYPASS_CHANMSG_*
This commit is contained in:
+8
-8
@@ -159,13 +159,13 @@ struct _moddatainfo {
|
||||
#define EXCHK_PARAM 2 /* Check parameter and send error if needed */
|
||||
|
||||
/* Can bypass message restriction - Types */
|
||||
typedef enum BypassMessageRestrictionType {
|
||||
BYPASS_MSG_EXTERNAL = 1,
|
||||
BYPASS_MSG_MODERATED = 2,
|
||||
BYPASS_MSG_COLOR = 3,
|
||||
BYPASS_MSG_CENSOR = 4,
|
||||
BYPASS_MSG_NOTICE = 5,
|
||||
} BypassMessageRestrictionType;
|
||||
typedef enum BypassChannelMessageRestrictionType {
|
||||
BYPASS_CHANMSG_EXTERNAL = 1,
|
||||
BYPASS_CHANMSG_MODERATED = 2,
|
||||
BYPASS_CHANMSG_COLOR = 3,
|
||||
BYPASS_CHANMSG_CENSOR = 4,
|
||||
BYPASS_CHANMSG_NOTICE = 5,
|
||||
} BypassChannelMessageRestrictionType;
|
||||
|
||||
#define EXSJ_SAME 0 /* Parameters are the same */
|
||||
#define EXSJ_WEWON 1 /* We won! w00t */
|
||||
@@ -902,7 +902,7 @@ int hooktype_dcc_denied(aClient *sptr, aClient *target, char *realfile, char *di
|
||||
int hooktype_server_handshake_out(aClient *sptr);
|
||||
int hooktype_server_synched(aClient *sptr);
|
||||
int hooktype_secure_connect(aClient *sptr);
|
||||
int hooktype_can_bypass_channel_message_restriction(aClient *sptr, aChannel *chptr, BypassMessageRestrictionType bypass_type);
|
||||
int hooktype_can_bypass_channel_message_restriction(aClient *sptr, aChannel *chptr, BypassChannelMessageRestrictionType bypass_type);
|
||||
|
||||
#ifdef GCC_TYPECHECKING
|
||||
#define ValidateHook(validatefunc, func) __builtin_types_compatible_p(__typeof__(func), __typeof__(validatefunc))
|
||||
|
||||
+2
-2
@@ -710,7 +710,7 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice)
|
||||
*/
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_MSG_EXTERNAL);
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_CHANMSG_EXTERNAL);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
@@ -729,7 +729,7 @@ int can_send(aClient *cptr, aChannel *chptr, char *msgtext, int notice)
|
||||
*/
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_MSG_MODERATED);
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_CHANMSG_MODERATED);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ char *censor_pre_chanmsg(aClient *sptr, aChannel *chptr, char *text, int notice)
|
||||
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_MSG_CENSOR);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_CENSOR);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ DLLFUNC char *nocolor_prechanmsg(aClient *sptr, aChannel *chptr, char *text, int
|
||||
{
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_MSG_COLOR);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_COLOR);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ int nonotice_check_can_send(aClient *cptr, aChannel *chptr, char *msgtext, Membe
|
||||
{
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_MSG_NOTICE);
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_CHANMSG_NOTICE);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -83,13 +83,25 @@ DLLFUNC char *regonlyspeak_part_message (aClient *sptr, aChannel *chptr, char *c
|
||||
|
||||
DLLFUNC int regonlyspeak_can_send (aClient *cptr, aChannel *chptr, char *message, Membership *lp, int notice)
|
||||
{
|
||||
Hook *h;
|
||||
int i;
|
||||
|
||||
if (IsRegOnlySpeak(chptr) && !op_can_override("override:message:regonlyspeak",cptr,chptr,NULL) && !IsLoggedIn(cptr) &&
|
||||
(!lp
|
||||
|| !(lp->flags & (CHFL_CHANOP | CHFL_VOICE | CHFL_CHANOWNER |
|
||||
CHFL_HALFOP | CHFL_CHANPROT))))
|
||||
return CANNOT_SEND_MODREG;
|
||||
{
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(cptr, chptr, BYPASS_CHANMSG_MODERATED);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
if (i == HOOK_ALLOW)
|
||||
return HOOK_CONTINUE; /* bypass +M restriction */
|
||||
|
||||
return CANNOT_SEND_MODREG; /* BLOCK message */
|
||||
}
|
||||
|
||||
return HOOK_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ DLLFUNC char *stripcolor_prechanmsg(aClient *sptr, aChannel *chptr, char *text,
|
||||
{
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_MSG_COLOR);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_COLOR);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ ModuleHeader MOD_HEADER(msgbypass)
|
||||
|
||||
/* Forward declarations */
|
||||
int extban_msgbypass_is_banned(aClient *sptr, aChannel *chptr, char *banin, int type);
|
||||
int msgbypass_can_bypass(aClient *sptr, aChannel *chptr, BypassMessageRestrictionType bypass_type);
|
||||
int msgbypass_can_bypass(aClient *sptr, aChannel *chptr, BypassChannelMessageRestrictionType bypass_type);
|
||||
int msgbypass_extban_is_ok(aClient* sptr, aChannel* chptr, char* para, int checkt, int what, int what2);
|
||||
char *msgbypass_extban_conv_param(char *para);
|
||||
|
||||
@@ -74,7 +74,7 @@ int extban_msgbypass_is_banned(aClient *sptr, aChannel *chptr, char *banin, int
|
||||
}
|
||||
|
||||
/** Can the user bypass restrictions? */
|
||||
int msgbypass_can_bypass(aClient *sptr, aChannel *chptr, BypassMessageRestrictionType bypass_type)
|
||||
int msgbypass_can_bypass(aClient *sptr, aChannel *chptr, BypassChannelMessageRestrictionType bypass_type)
|
||||
{
|
||||
Ban *ban;
|
||||
char *p;
|
||||
@@ -86,11 +86,11 @@ int msgbypass_can_bypass(aClient *sptr, aChannel *chptr, BypassMessageRestrictio
|
||||
char *type = ban->banstr + 3;
|
||||
char *matchby;
|
||||
|
||||
if (((bypass_type == BYPASS_MSG_EXTERNAL) && !strncmp(type, "external:", 9)) ||
|
||||
((bypass_type == BYPASS_MSG_MODERATED) && !strncmp(type, "moderated:", 10)) ||
|
||||
((bypass_type == BYPASS_MSG_COLOR) && !strncmp(type, "color:", 6)) ||
|
||||
((bypass_type == BYPASS_MSG_CENSOR) && !strncmp(type, "censor:", 7)) ||
|
||||
((bypass_type == BYPASS_MSG_NOTICE) && !strncmp(type, "notice:", 7)))
|
||||
if (((bypass_type == BYPASS_CHANMSG_EXTERNAL) && !strncmp(type, "external:", 9)) ||
|
||||
((bypass_type == BYPASS_CHANMSG_MODERATED) && !strncmp(type, "moderated:", 10)) ||
|
||||
((bypass_type == BYPASS_CHANMSG_COLOR) && !strncmp(type, "color:", 6)) ||
|
||||
((bypass_type == BYPASS_CHANMSG_CENSOR) && !strncmp(type, "censor:", 7)) ||
|
||||
((bypass_type == BYPASS_CHANMSG_NOTICE) && !strncmp(type, "notice:", 7)))
|
||||
{
|
||||
matchby = strchr(type, ':');
|
||||
if (!matchby)
|
||||
|
||||
@@ -67,7 +67,7 @@ char *nocodes_pre_chanmsg(aClient *sptr, aChannel *chptr, char *text, int notice
|
||||
{
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_MSG_COLOR);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_COLOR);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ char *nocodes_pre_chanmsg(aClient *sptr, aChannel *chptr, char *text, int notice
|
||||
{
|
||||
for (h = Hooks[HOOKTYPE_CAN_BYPASS_CHANNEL_MESSAGE_RESTRICTION]; h; h = h->next)
|
||||
{
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_MSG_COLOR);
|
||||
i = (*(h->func.intfunc))(sptr, chptr, BYPASS_CHANMSG_COLOR);
|
||||
if (i != HOOK_CONTINUE)
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user