X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/f30a5ee4c43ea0893b77925e1cca8f94e7e295fe..b5bf3505123e6667643af92563f2d14d6ab3b7c1:/modules/chm_noctcp.c diff --git a/modules/chm_noctcp.c b/modules/chm_noctcp.c index 0e2a9438..b1f8a7e5 100644 --- a/modules/chm_noctcp.c +++ b/modules/chm_noctcp.c @@ -1,8 +1,8 @@ /* - * charybdis: an advanced ircd. + * Solanum: a slightly advanced ircd * chm_noctcp: block non-action CTCP (+C mode). * - * Copyright (c) 2012 William Pitcock + * Copyright (c) 2012 Ariadne Conill * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -34,23 +34,27 @@ #include "chmode.h" #include "inline/stringops.h" +static const char chm_noctcp_desc[] = + "Adds channel mode +C, which blocks CTCP messages from a channel (except ACTION)"; + static unsigned int mode_noctcp; -static void chm_noctcp_process(hook_data_privmsg_channel *); +static void chm_noctcp_process(void *); mapi_hfn_list_av1 chm_noctcp_hfnlist[] = { - { "privmsg_channel", (hookfn) chm_noctcp_process }, + { "privmsg_channel", chm_noctcp_process }, { NULL, NULL } }; static void -chm_noctcp_process(hook_data_privmsg_channel *data) +chm_noctcp_process(void *data_) { + hook_data_privmsg_channel *data = data_; /* don't waste CPU if message is already blocked */ if (data->approved || data->msgtype == MESSAGE_TYPE_NOTICE) return; - if (*data->text == '\001' && strncasecmp(data->text + 1, "ACTION ", 7) && data->chptr->mode.mode & mode_noctcp) + if (*data->text == '\001' && rb_strncasecmp(data->text + 1, "ACTION ", 7) && data->chptr->mode.mode & mode_noctcp) { sendto_one_numeric(data->source_p, ERR_CANNOTSENDTOCHAN, form_str(ERR_CANNOTSENDTOCHAN), data->chptr->chname); data->approved = ERR_CANNOTSENDTOCHAN; @@ -76,4 +80,4 @@ _moddeinit(void) cflag_orphan('C'); } -DECLARE_MODULE_AV1(chm_noctcp, _modinit, _moddeinit, NULL, NULL, chm_noctcp_hfnlist, "$Revision$"); +DECLARE_MODULE_AV2(chm_noctcp, _modinit, _moddeinit, NULL, NULL, chm_noctcp_hfnlist, NULL, NULL, chm_noctcp_desc);