Message handlers should return void.

Also fix up some return values and stuff to use bool (or void if
nothing). I just did it whilst I was here.

According to jilles, the return value used to signify whether or not the
client had exited. This was error-prone and was fixed a long, long time
ago, but the return value was left int for historical reasons.

Since the return type is not used (and has no clear use case anyway),
it's safe to just get rid of it.
This commit is contained in:
Elizabeth Myers 2016-03-09 01:37:03 -06:00
parent eeabf33a7c
commit 3c7d6fcce7
99 changed files with 1339 additions and 1691 deletions

View file

@ -42,11 +42,11 @@ static const char example_desc[] = "This is an example Charybdis module.";
* parv == an array of the parameters
*/
static int munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
/* Show the commands this module can handle in a msgtab
* and give the msgtab a name, here its test_msgtab
@ -179,7 +179,7 @@ DECLARE_MODULE_AV2(
/* Here we have the functions themselves that we declared above,
* and the fairly normal C coding
*/
static int
static void
munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
@ -193,15 +193,13 @@ munreg_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
return 0;
}
/*
* mclient_test
* parv[1] = parameter
*/
static int
static void
mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
@ -215,15 +213,13 @@ mclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
/* illustration of how to call a hook function */
call_hook(doing_example_hook, NULL);
return 0;
}
/*
* mrclient_test
* parv[1] = parameter
*/
static int
static void
mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
@ -234,14 +230,13 @@ mrclient_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *s
{
sendto_one_notice(source_p, ":You are a remote client, and sent parameters: %s", parv[1]);
}
return 0;
}
/*
* mserver_test
* parv[1] = parameter
*/
static int
static void
mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
@ -252,14 +247,13 @@ mserver_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *so
{
sendto_one_notice(source_p, ":You are a server, and sent parameters: %s", parv[1]);
}
return 0;
}
/*
* moper_test
* parv[1] = parameter
*/
static int
static void
moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(parc < 2)
@ -270,7 +264,6 @@ moper_test(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{
sendto_one_notice(source_p, ":You are an operator, and sent parameters: %s", parv[1]);
}
return 0;
}
static void

View file

@ -22,9 +22,9 @@ static void h_hdl_new_remote_user(struct Client *client_p);
static void h_hdl_client_exit(hook_data_client_exit *hdata);
static void h_hdl_umode_changed(hook_data_umode_changed *hdata);
static void h_hdl_whois(hook_data_client *hdata);
static int mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int do_dehelper(struct Client *source_p, struct Client *target_p);
static void mo_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void me_dehelper(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void do_dehelper(struct Client *source_p, struct Client *target_p);
mapi_hfn_list_av1 helpops_hfnlist[] = {
{ "doing_stats", (hookfn) h_hdl_stats_request },
@ -45,20 +45,21 @@ struct Message dehelper_msgtab = {
mapi_clist_av1 helpops_clist[] = { &dehelper_msgtab, NULL };
static int mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
static void
mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
struct Client *target_p;
if (!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
return;
}
if(!(target_p = find_named_person(parv[1])))
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
return;
}
if(MyClient(target_p))
@ -66,31 +67,30 @@ static int mo_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
else
sendto_one(target_p, ":%s ENCAP %s DEHELPER %s",
use_id(source_p), target_p->servptr->name, use_id(target_p));
return 0;
}
static int me_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
static void
me_dehelper(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char **parv)
{
struct Client *target_p = find_person(parv[1]);
if(!target_p)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
return;
}
if(!MyClient(target_p))
return 0;
return;
do_dehelper(source_p, target_p);
return 0;
}
static int do_dehelper(struct Client *source_p, struct Client *target_p)
static void
do_dehelper(struct Client *source_p, struct Client *target_p)
{
const char *fakeparv[4];
if(!(target_p->umodes & UMODE_HELPOPS))
return 0;
return;
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s is using DEHELPER on %s",
source_p->name, target_p->name);
@ -100,7 +100,6 @@ static int do_dehelper(struct Client *source_p, struct Client *target_p)
fakeparv[2] = "-H";
fakeparv[3] = NULL;
user_mode(target_p, target_p, 3, fakeparv);
return 0;
}
static int

View file

@ -47,10 +47,10 @@ typedef struct _hurt {
/* }}} */
/* {{{ Prototypes */
static int mo_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int me_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int mo_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int me_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static void mo_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static void me_hurt(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static void mo_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static void me_heal(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static int modinit(void);
static void modfini(void);
@ -70,7 +70,7 @@ static hurt_t *hurt_find_exact(const char *ip);
static void hurt_remove(const char *ip);
static void hurt_destroy(void *hurt);
static int heal_nick(struct Client *, struct Client *);
static void heal_nick(struct Client *, struct Client *);
/* }}} */
@ -173,7 +173,7 @@ modfini(void)
* Message handlers.
*/
/* {{{ static int mo_hurt()
/* {{{ static void mo_hurt()
*
* HURT [<expire>] <ip> <reason>
*
@ -181,7 +181,7 @@ modfini(void)
* parv[2] - ip or reason
* parv[3] - reason or NULL
*/
static int
static void
mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
{
@ -193,7 +193,7 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (!IsOperK(source_p)) {
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
source_p->name, "kline");
return 0;
return;
}
if (parc == 3)
@ -205,11 +205,11 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
expire_time = HURT_DEFAULT_EXPIRE;
if (expire && (expire_time = valid_temp_time(expire)) < 1) {
sendto_one_notice(source_p, ":Permanent HURTs are not supported");
return 0;
return;
}
if (EmptyString(reason)) {
sendto_one_notice(source_p, ":Empty HURT reasons are bad for business");
return 0;
return;
}
/* Is this a client? */
@ -220,7 +220,7 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), ip);
return 0;
return;
}
ip = target_p->orighost;
}
@ -232,13 +232,13 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{
sendto_one_notice(source_p, ":Invalid HURT mask [%s]",
ip);
return 0;
return;
}
}
if (hurt_find(ip) != NULL) {
sendto_one(source_p, ":[%s] already HURT", ip);
return 0;
return;
}
/*
@ -252,12 +252,10 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
hurt = hurt_new(expire_time, ip, reason);
hurt_add(hurt);
hurt_propagate(NULL, source_p, hurt);
return 0;
}
/* }}} */
/* {{{ static int me_hurt()
/* {{{ static void me_hurt()
*
* [ENCAP mask] HURT <target> <expire> <ip> <reason>
*
@ -265,7 +263,7 @@ mo_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* parv[2] - ip
* parv[3] - reason
*/
static int
static void
me_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
{
@ -278,31 +276,29 @@ me_hurt(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* dropping a server over.
*/
if (parc < 4 || !IsPerson(source_p))
return 0;
return;
if ((expire_time = atoi(parv[1])) < 1)
return 0;
return;
if (hurt_find(parv[2]) != NULL)
return 0;
return;
if (EmptyString(parv[3]))
return 0;
return;
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"%s added HURT on [%s] for %ld minutes with reason [%s]",
get_oper_name(source_p), parv[2], (long) expire_time / 60, parv[3]);
hurt = hurt_new(expire_time, parv[2], parv[3]);
hurt_add(hurt);
return 0;
}
/* }}} */
/* {{{ static int mo_heal()
/* {{{ static void mo_heal()
*
* HURT <nick>|<ip>
*
* parv[1] - nick or ip
*/
static int
static void
mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
{
@ -312,7 +308,7 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "unkline");
return 0;
return;
}
if (clean_nick(parv[1], 0))
@ -322,7 +318,7 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK,
form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
return;
}
if (MyConnect(target_p))
heal_nick(source_p, target_p);
@ -337,7 +333,7 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if (hurt_find_exact(parv[1]) == NULL)
{
sendto_one_notice(source_p, ":Mask [%s] is not HURT", parv[1]);
return 0;
return;
}
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
@ -348,14 +344,12 @@ mo_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else
{
sendto_one(source_p, ":[%s] is not a valid IP address/nick", parv[1]);
return 0;
return;
}
return 0;
}
/* }}} */
static int
static void
me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char **parv)
{
@ -365,7 +359,7 @@ me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
* *poof*, it's dropped...
*/
if (parc < 2)
return 0;
return;
if (clean_nick(parv[1], 0))
{
@ -376,16 +370,12 @@ me_heal(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
else if (strchr(parv[1], '.')) /* host or mask to remove ban for */
{
if (hurt_find_exact(parv[1]) == NULL)
return 0;
return;
hurt_remove(parv[1]);
sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s removed HURT on %s",
get_oper_name(source_p), parv[1]);
}
else
return 0;
return 0;
}
/*
@ -499,7 +489,6 @@ doing_stats_hook(hook_data_int *hdata)
sendto_one_numeric(source_p, RPL_STATSKLINE,
form_str(RPL_STATSKLINE), 's',
"*", hurt->ip, hurt->reason, "", "");
return;
}
return;
}
@ -620,8 +609,8 @@ hurt_remove(const char *ip)
hurt_destroy(hurt);
}
/* {{{ static int heal_nick() */
static int
/* {{{ static void heal_nick() */
static void
heal_nick(struct Client *source_p, struct Client *target_p)
{
if (rb_dlinkFindDestroy(target_p, &hurt_state.hurt_clients))
@ -631,12 +620,10 @@ heal_nick(struct Client *source_p, struct Client *target_p)
sendto_one_notice(target_p, ":HURT restriction temporarily removed by operator");
sendto_one_notice(source_p, ":HURT restriction on %s temporarily removed", target_p->name);
target_p->localClient->target_last = rb_current_time(); /* don't ask --nenolod */
return 1;
}
else
{
sendto_one_notice(source_p, ":%s was not hurt", target_p->name);
return 0;
}
}
/* }}} */

View file

@ -40,8 +40,8 @@
static const char adminwall_desc[] =
"Provides the ADMINWALL command to send a message to all administrators";
static int mo_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void mo_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void me_adminwall(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message adminwall_msgtab = {
"ADMINWALL", 0, 0, 0, 0,
@ -57,23 +57,21 @@ DECLARE_MODULE_AV2(adminwall, NULL, NULL, adminwall_clist, NULL, NULL, NULL, NUL
* parv[1] = message text
*/
static int
static void
mo_adminwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
if(!IsAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "adminwall");
return 0;
return;
}
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ADMINWALL :%s", parv[1]);
return 0;
}
static int
static void
me_adminwall(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
sendto_wallops_flags(UMODE_ADMIN, source_p, "ADMINWALL - %s", parv[1]);
return 0;
}

View file

@ -4,7 +4,7 @@
#include "ircd.h"
#include "send.h"
static int m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message echotags_msgtab = {
"ECHOTAGS", 0, 0, 0, 0,
@ -17,7 +17,7 @@ static const char echotags_desc[] = "A test module for tags";
DECLARE_MODULE_AV2(echotags, NULL, NULL, echotags_clist, NULL, NULL, NULL, NULL, echotags_desc);
static int
static void
m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
int i;
@ -33,8 +33,6 @@ m_echotags(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
else
sendto_one_notice(source_p, ":*** %d: %s", i, tag->key);
}
return 0;
}

View file

@ -34,8 +34,8 @@
static const char extendchans_desc[] =
"Allow an oper or service to let a given user join more channels";
static int mo_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static int me_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void mo_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void me_extendchans(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message extendchans_msgtab = {
"EXTENDCHANS", 0, 0, 0, 0,
@ -46,7 +46,7 @@ mapi_clist_av1 extendchans_clist[] = { &extendchans_msgtab, NULL };
DECLARE_MODULE_AV2(extendchans, NULL, NULL, extendchans_clist, NULL, NULL, NULL, NULL, extendchans_desc);
static int
static void
mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
@ -54,17 +54,17 @@ mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
if(!HasPrivilege(source_p, "oper:extendchans"))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "extendchans");
return 0;
return;
}
if(EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "EXTENDCHANS");
return 0;
return;
}
if((target_p = find_chasing(source_p, parv[1], NULL)) == NULL)
return 0;
return;
/* Is the target user local? */
if(MyClient(target_p))
@ -82,11 +82,9 @@ mo_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
sendto_one_notice(source_p, ":You have extended the channel limit on: %s (%s@%s)",
target_p->name, target_p->username, target_p->orighost);
return 0;
}
static int
static void
me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *target_p;
@ -95,7 +93,7 @@ me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
if(target_p == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), parv[1]);
return 0;
return;
}
/* Is the target user local? If not, pass it on. */
@ -104,12 +102,10 @@ me_extendchans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
struct Client *cptr = target_p->servptr;
sendto_one(cptr, ":%s ENCAP %s EXTENDCHANS %s",
get_id(source_p, cptr), cptr->name, get_id(target_p, cptr));
return 0;
return;
}
sendto_one_notice(target_p, ":*** %s (%s@%s) is extending your channel limit",
source_p->name, source_p->username, source_p->host);
SetExtendChans(target_p);
return 0;
}

View file

@ -36,7 +36,7 @@
static const char findfowards_desc[] = "Allows operators to find forwards to a given channel";
static int m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
static void m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
struct Message findforwards_msgtab = {
@ -52,7 +52,7 @@ DECLARE_MODULE_AV2(findforwards, NULL, NULL, findforwards_clist, NULL, NULL, NUL
** mo_findforwards
** parv[1] = channel
*/
static int
static void
m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
@ -70,21 +70,21 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), parv[1]);
return 0;
return;
}
if(!is_chanop(msptr))
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, parv[1]);
return 0;
return;
}
if((last_used + ConfigFileEntry.pace_wait) > rb_current_time())
{
sendto_one(source_p, form_str(RPL_LOAD2HI),
me.name, source_p->name, "FINDFORWARDS");
return 0;
return;
}
else
last_used = rb_current_time();
@ -111,6 +111,4 @@ m_findforwards(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *
*(--p) = '\0';
sendto_one_notice(source_p, ":Forwards for %s: %s", parv[1], buf);
return 0;
}

View file

@ -49,7 +49,7 @@
static const char identify_desc[] = "Adds the IDENTIFY alias that forwards to NickServ or ChanServ";
static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message identify_msgtab = {
"IDENTIFY", 0, 0, 0, 0,
@ -61,11 +61,10 @@ mapi_clist_av1 identify_clist[] = {
NULL
};
static const char identify_desc[] = "Adds the IDENTIFY alias that forwards to NickServ or ChanServ";
DECLARE_MODULE_AV2(identify, NULL, NULL, identify_clist, NULL, NULL, NULL, NULL, identify_desc);
static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
static void
m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
const char *nick;
struct Client *target_p;
@ -73,7 +72,7 @@ static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct C
if (parc < 2 || EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name);
return 0;
return;
}
nick = parv[1][0] == '#' ? SVS_chanserv_NICK : SVS_nickserv_NICK;
@ -85,5 +84,4 @@ static int m_identify(struct MsgBuf *msgbuf_p, struct Client *client_p, struct C
{
sendto_one_numeric(source_p, ERR_SERVICESDOWN, form_str(ERR_SERVICESDOWN), nick);
}
return 0;
}

View file

@ -17,9 +17,9 @@
const char mkpasswd_desc[] = "Hash a password for use in ircd.conf";
static int m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
static void m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
static int mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
static void mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
int parc, const char *parv[]);
static char *make_md5_salt(int);
@ -45,7 +45,7 @@ DECLARE_MODULE_AV2(mkpasswd, NULL, NULL, mkpasswd_clist, NULL, NULL, NULL, NULL,
* parv[1] = password
* parv[2] = type
*/
static int
static void
m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
static time_t last_used = 0;
@ -57,7 +57,7 @@ m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
if(EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
return;
}
if(parc < 3)
@ -69,7 +69,7 @@ m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{
/* safe enough to give this on a local connect only */
sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "MKPASSWD");
return 0;
return;
}
else
last_used = rb_current_time();
@ -84,19 +84,18 @@ m_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sour
{
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
return;
}
crypted = rb_crypt(parv[1], salt);
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???");
return 0;
}
/* mo_mkpasswd - mkpasswd message handler
* parv[1] = password
* parv[2] = type
*/
static int
static void
mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
char *salt;
@ -107,7 +106,7 @@ mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
if(EmptyString(parv[1]))
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "MKPASSWD");
return 0;
return;
}
if(parc < 3)
@ -125,12 +124,11 @@ mo_mkpasswd(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
{
sendto_one_notice(source_p,
":MKPASSWD syntax error: MKPASSWD pass [SHA256|SHA512|MD5]");
return 0;
return;
}
crypted = rb_crypt(parv[1], salt);
sendto_one_notice(source_p, ":Hash [%s] for %s: %s", hashtype, parv[1], crypted ? crypted : "???");
return 0;
}
char *

View file

@ -37,7 +37,7 @@
static const char ojoin_desc[] = "Allow admins to forcibly join channels with the OJOIN command";
static int mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message ojoin_msgtab = {
"OJOIN", 0, 0, 0, 0,
@ -52,7 +52,7 @@ DECLARE_MODULE_AV2(ojoin, NULL, NULL, ojoin_clist, NULL, NULL, NULL, NULL, ojoin
** mo_ojoin
** parv[1] = channel
*/
static int
static void
mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
@ -62,7 +62,7 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
return;
}
if(*parv[1] == '@' || *parv[1] == '+')
@ -75,13 +75,13 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
return;
}
if(IsMember(source_p, chptr))
{
sendto_one_notice(source_p, ":Please part %s before using OJOIN", parv[1]);
return 0;
return;
}
if(move_me == 1)
@ -139,6 +139,4 @@ mo_ojoin(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
source_p->localClient->last_join_time = rb_current_time();
channel_member_names(chptr, source_p, 1);
return 0;
}

View file

@ -40,7 +40,7 @@
static const char okick_desc[] = "Allow admins to forcibly kick users from channels with the OKICK command";
static int mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message okick_msgtab = {
"OKICK", 0, 0, 0, 0,
@ -57,7 +57,7 @@ DECLARE_MODULE_AV2(okick, NULL, NULL, okick_clist, NULL, NULL, NULL, NULL, okick
** parv[2] = client to kick
** parv[3] = kick comment
*/
static int
static void
mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Client *who;
@ -74,7 +74,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(*parv[2] == '\0')
{
sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), me.name, source_p->name, "KICK");
return 0;
return;
}
if(MyClient(source_p) && !IsFloodDone(source_p))
@ -94,7 +94,7 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!chptr)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
return;
}
@ -103,19 +103,19 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
user = LOCAL_COPY(parv[2]); // strtoken(&p2, parv[2], ",");
if(!(who = find_chasing(source_p, user, &chasing)))
{
return 0;
return;
}
if((target_p = find_client(user)) == NULL)
{
sendto_one(source_p, form_str(ERR_NOSUCHNICK), user);
return 0;
return;
}
if((msptr = find_channel_membership(chptr, target_p)) == NULL)
{
sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL), parv[1], parv[2]);
return 0;
return;
}
sendto_wallops_flags(UMODE_WALLOP, &me,
@ -136,5 +136,4 @@ mo_okick(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
sendto_server(&me, chptr, CAP_TS6, NOCAPS,
":%s KICK %s %s :%s", me.id, chptr->chname, who->id, comment);
remove_user_from_channel(msptr);
return 0;
}

View file

@ -44,7 +44,7 @@
static const char omode_desc[] = "Allow admins to forcibly change modes on channels with the OMODE command";
static int mo_omode(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void mo_omode(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
struct Message omode_msgtab = {
"OMODE", 0, 0, 0, 0,
@ -59,7 +59,7 @@ DECLARE_MODULE_AV2(omode, NULL, NULL, omode_clist, NULL, NULL, NULL, NULL, omode
* mo_omode - MODE command handler
* parv[1] - channel
*/
static int
static void
mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr = NULL;
@ -72,7 +72,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
return;
}
/* Now, try to find the channel in question */
@ -80,7 +80,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one_numeric(source_p, ERR_BADCHANNAME,
form_str(ERR_BADCHANNAME), parv[1]);
return 0;
return;
}
chptr = find_channel(parv[1]);
@ -89,7 +89,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
return;
}
/* Now know the channel exists */
@ -99,7 +99,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if (is_chanop(msptr))
{
sendto_one_notice(source_p, ":Use a normal MODE you idiot");
return 0;
return;
}
params[0] = '\0';
@ -133,7 +133,7 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), parv[3], chptr->chname);
return 0;
return;
}
sendto_channel_local(ALL_MEMBERS, chptr, ":%s MODE %s +o %s",
me.name, parv[1], source_p->name);
@ -164,5 +164,4 @@ mo_omode(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
remove_user_from_channel(msptr);
}
#endif
return 0;
}

View file

@ -36,7 +36,7 @@
static const char opme_desc[] = "Allow admins to op themselves on opless channels";
static int mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message opme_msgtab = {
"OPME", 0, 0, 0, 0,
@ -51,7 +51,7 @@ DECLARE_MODULE_AV2(opme, NULL, NULL, opme_clist, NULL, NULL, NULL, NULL, opme_de
** mo_opme
** parv[1] = channel
*/
static int
static void
mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
@ -62,14 +62,14 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(!IsOperAdmin(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS), me.name, source_p->name, "admin");
return 0;
return;
}
if((chptr = find_channel(parv[1])) == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), parv[1]);
return 0;
return;
}
RB_DLINK_FOREACH(ptr, chptr->members.head)
@ -79,14 +79,14 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
if(is_chanop(msptr))
{
sendto_one_notice(source_p, ":%s Channel is not opless", parv[1]);
return 0;
return;
}
}
msptr = find_channel_membership(chptr, source_p);
if(msptr == NULL)
return 0;
return;
msptr->flags |= CHFL_CHANOP;
@ -110,6 +110,4 @@ mo_opme(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
sendto_channel_local(ALL_MEMBERS, chptr,
":%s MODE %s +o %s", me.name, parv[1], source_p->name);
return 0;
}

View file

@ -41,7 +41,7 @@
static const char description[] = "Provides the REMOVE command, an alternative to KICK";
static int m_remove(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void m_remove(struct MsgBuf *, struct Client *, struct Client *, int, const char **);
static void remove_quote_part(hook_data_privmsg_channel *);
unsigned int CAP_REMOVE;
@ -64,7 +64,7 @@ mapi_cap_list_av2 remove_cap_list[] = {
DECLARE_MODULE_AV2(remove, NULL, NULL, remove_clist, NULL, remove_hfnlist, remove_cap_list, NULL, description);
static int
static void
m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct membership *msptr;
@ -90,7 +90,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(chptr == NULL)
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, form_str(ERR_NOSUCHCHANNEL), name);
return 0;
return;
}
if(!IsServer(source_p))
@ -101,7 +101,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), name);
return 0;
return;
}
if(get_channel_access(source_p, chptr, msptr, MODE_ADD, NULL) < CHFL_CHANOP)
@ -110,7 +110,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
me.name, source_p->name, name);
return 0;
return;
}
/* If its a TS 0 channel, do it the old way */
@ -118,7 +118,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED),
get_id(&me, source_p), get_id(source_p, source_p), name);
return 0;
return;
}
}
@ -151,7 +151,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(!(who = find_chasing(source_p, user, &chasing)))
{
return 0;
return;
}
msptr = find_channel_membership(chptr, who);
@ -162,7 +162,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{
sendto_one(source_p, form_str(ERR_ISCHANSERVICE),
me.name, source_p->name, who->name, chptr->chname);
return 0;
return;
}
if(MyClient(source_p))
@ -179,7 +179,7 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
call_hook(h_can_kick, &hookdata);
if (!hookdata.approved)
return 0;
return;
}
comment = LOCAL_COPY((EmptyString(parv[3])) ? who->name : parv[3]);
@ -210,8 +210,6 @@ m_remove(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
else if (MyClient(source_p))
sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL,
form_str(ERR_USERNOTINCHANNEL), user, name);
return 0;
}
static void

View file

@ -32,13 +32,13 @@
static const char roleplay_desc[] =
"Adds a roleplaying system that allows faked nicknames to talk in a channel set +N";
static int m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static int m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text);
static int me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text);
static void me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static unsigned int mymode;
static int
@ -100,42 +100,37 @@ mapi_clist_av1 roleplay_clist[] = { &scene_msgtab, &ambiance_msgtab, &fsay_msgta
DECLARE_MODULE_AV2(roleplay, _modinit, _moddeinit, roleplay_clist, NULL, NULL, NULL, NULL, roleplay_desc);
static int
static void
m_scene(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(msgbuf_p, source_p, parv[1], 0, 0, "=Scene=", parv[2]);
return 0;
}
static int
static void
m_fsay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(msgbuf_p, source_p, parv[1], 0, 0, parv[2], parv[3]);
return 0;
}
static int
static void
m_faction(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(msgbuf_p, source_p, parv[1], 0, 1, parv[2], parv[3]);
return 0;
}
static int
static void
m_npc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(msgbuf_p, source_p, parv[1], 1, 0, parv[2], parv[3]);
return 0;
}
static int
static void
m_npca(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
m_displaymsg(msgbuf_p, source_p, parv[1], 1, 1, parv[2], parv[3]);
return 0;
}
static int
static void
m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *channel, int underline, int action, const char *nick, const char *text)
{
struct Channel *chptr;
@ -154,38 +149,38 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
{
sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL,
form_str(ERR_NOSUCHCHANNEL), channel);
return 0;
return;
}
if(!(msptr = find_channel_membership(chptr, source_p)))
{
sendto_one_numeric(source_p, ERR_NOTONCHANNEL,
form_str(ERR_NOTONCHANNEL), chptr->chname);
return 0;
return;
}
if(!(chptr->mode.mode & chmode_flags['N']))
{
sendto_one_numeric(source_p, 573, "%s :Roleplay commands are not enabled on this channel.", chptr->chname);
return 0;
return;
}
if(!can_send(chptr, source_p, msptr))
{
sendto_one_numeric(source_p, 573, "%s :Cannot send to channel.", chptr->chname);
return 0;
return;
}
/* enforce flood stuff on roleplay commands */
if(flood_attack_channel(0, source_p, chptr, chptr->chname))
return 0;
return;
/* enforce target change on roleplay commands */
if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr))
{
sendto_one(source_p, form_str(ERR_TARGCHANGE),
me.name, source_p->name, chptr->chname);
return 0;
return;
}
if(underline)
@ -198,7 +193,7 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
if(EmptyString(nick3))
{
sendto_one_numeric(source_p, 573, "%s :No visible non-stripped characters in nick.", chptr->chname);
return 0;
return;
}
snprintf(text3, sizeof(text3), "%s (%s)", text, source_p->name);
@ -211,10 +206,9 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", nick2, source_p->name, channel, text2);
sendto_match_servs(source_p, "*", CAP_ENCAP, NOCAPS, "ENCAP * ROLEPLAY %s %s :%s",
channel, nick2, text2);
return 0;
}
static int
static void
me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct Channel *chptr;
@ -222,8 +216,7 @@ me_roleplay(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sou
/* Don't segfault if we get ROLEPLAY with an invalid channel.
* This shouldn't happen but it's best to be on the safe side. */
if((chptr = find_channel(parv[1])) == NULL)
return 0;
return;
sendto_channel_local(ALL_MEMBERS, chptr, ":%s!%s@npc.fakeuser.invalid PRIVMSG %s :%s", parv[2], source_p->name, parv[1], parv[3]);
return 0;
}

View file

@ -48,7 +48,7 @@
static const char sendbands_desc[] =
"Adds the ability to send all permanent RESVs and XLINEs to given server";
static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
static void mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
struct Message sendbans_msgtab = {
"SENDBANS", 0, 0, 0, 0,
@ -86,7 +86,8 @@ static const char *expand_xline(const char *mask)
return buf;
}
static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
static void
mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct ConfItem *aconf;
rb_dlink_node *ptr;
@ -99,19 +100,19 @@ static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "remoteban");
return 0;
return;
}
if (!IsOperXline(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "xline");
return 0;
return;
}
if (!IsOperResv(source_p))
{
sendto_one(source_p, form_str(ERR_NOPRIVS),
me.name, source_p->name, "resv");
return 0;
return;
}
target = parv[1];
@ -128,7 +129,7 @@ static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
{
sendto_one_numeric(source_p, ERR_NOSUCHSERVER,
form_str(ERR_NOSUCHSERVER), target);
return 0;
return;
}
sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
@ -174,6 +175,4 @@ static int mo_sendbans(struct MsgBuf *msgbuf_p, struct Client *client_p, struct
"ENCAP %s XLINE 0 %s 2 :%s",
target, mask2, aconf->passwd);
}
return 0;
}

View file

@ -55,7 +55,7 @@
static const char webirc_desc[] = "Adds support for the WebIRC system";
static int mr_webirc(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
static void mr_webirc(struct MsgBuf *msgbuf_p, struct Client *, struct Client *, int, const char **);
struct Message webirc_msgtab = {
"WEBIRC", 0, 0, 0, 0,
@ -73,7 +73,7 @@ DECLARE_MODULE_AV2(webirc, NULL, NULL, webirc_clist, NULL, NULL, NULL, NULL, web
* parv[3] = fake hostname
* parv[4] = fake ip
*/
static int
static void
mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
{
struct ConfItem *aconf;
@ -85,7 +85,7 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
sizeof(source_p->sockhost))
{
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
return;
}
aconf = find_address_conf(client_p->host, client_p->sockhost,
@ -94,17 +94,17 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
(struct sockaddr *) &client_p->localClient->ip,
client_p->localClient->ip.ss_family, NULL);
if (aconf == NULL || !(aconf->status & CONF_CLIENT))
return 0;
return;
if (!IsConfDoSpoofIp(aconf) || irccmp(aconf->info.name, "webirc."))
{
/* XXX */
sendto_one(source_p, "NOTICE * :Not a CGI:IRC auth block");
return 0;
return;
}
if (EmptyString(aconf->passwd))
{
sendto_one(source_p, "NOTICE * :CGI:IRC auth blocks must have a password");
return 0;
return;
}
if (EmptyString(parv[1]))
@ -117,13 +117,13 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if (encr == NULL || strcmp(encr, aconf->passwd))
{
sendto_one(source_p, "NOTICE * :CGI:IRC password incorrect");
return 0;
return;
}
if (rb_inet_pton_sock(parv[4], (struct sockaddr *)&addr) <= 0)
{
sendto_one(source_p, "NOTICE * :Invalid IP");
return 0;
return;
}
if (*parv[4] == ':')
@ -150,10 +150,9 @@ mr_webirc(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
if(!(aconf->status & CONF_EXEMPTDLINE))
{
exit_client(client_p, source_p, &me, "D-lined");
return 0;
return;
}
}
sendto_one(source_p, "NOTICE * :CGI:IRC host/IP set to %s %s", parv[3], parv[4]);
return 0;
}