| 1 |
|
/* |
| 2 |
< |
* ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd). |
| 2 |
> |
* ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd) |
| 3 |
|
* |
| 4 |
< |
* Copyright (C) 2002 by the past and present ircd coders, and others. |
| 4 |
> |
* Copyright (c) 2000-2014 ircd-hybrid development team |
| 5 |
|
* |
| 6 |
|
* This program is free software; you can redistribute it and/or modify |
| 7 |
|
* it under the terms of the GNU General Public License as published by |
| 25 |
|
*/ |
| 26 |
|
|
| 27 |
|
#include "stdinc.h" |
| 28 |
– |
#include "handlers.h" |
| 28 |
|
#include "client.h" |
| 29 |
|
#include "irc_string.h" |
| 31 |
– |
#include "sprintf_irc.h" |
| 30 |
|
#include "ircd.h" |
| 31 |
|
#include "list.h" |
| 32 |
|
#include "numeric.h" |
| 33 |
< |
#include "s_conf.h" |
| 33 |
> |
#include "conf.h" |
| 34 |
|
#include "s_serv.h" |
| 35 |
|
#include "send.h" |
| 38 |
– |
#include "msg.h" |
| 36 |
|
#include "parse.h" |
| 37 |
|
#include "modules.h" |
| 38 |
< |
|
| 42 |
< |
static void m_accept(struct Client *, struct Client *, int, char *[]); |
| 43 |
< |
|
| 44 |
< |
struct Message accept_msgtab = { |
| 45 |
< |
"ACCEPT", 0, 0, 0, 0, MFLG_SLOW, 0, |
| 46 |
< |
{ m_unregistered, m_accept, m_ignore, m_ignore, m_accept, m_ignore } |
| 47 |
< |
}; |
| 48 |
< |
|
| 49 |
< |
#ifndef STATIC_MODULES |
| 50 |
< |
void |
| 51 |
< |
_modinit(void) |
| 52 |
< |
{ |
| 53 |
< |
mod_add_cmd(&accept_msgtab); |
| 54 |
< |
} |
| 55 |
< |
|
| 56 |
< |
void |
| 57 |
< |
_moddeinit(void) |
| 58 |
< |
{ |
| 59 |
< |
mod_del_cmd(&accept_msgtab); |
| 60 |
< |
} |
| 61 |
< |
|
| 62 |
< |
const char *_version = "$Revision$"; |
| 63 |
< |
#endif |
| 38 |
> |
#include "memory.h" |
| 39 |
|
|
| 40 |
|
|
| 41 |
|
/*! \brief Creates and sends a list of nick!user\@host masks a Client |
| 68 |
|
t = nicks; |
| 69 |
|
} |
| 70 |
|
|
| 71 |
< |
t += ircsprintf(t, "%s!%s@%s ", |
| 72 |
< |
accept_p->nickptr, |
| 73 |
< |
accept_p->userptr, accept_p->hostptr); |
| 71 |
> |
t += sprintf(t, "%s!%s@%s ", |
| 72 |
> |
accept_p->nickptr, |
| 73 |
> |
accept_p->userptr, accept_p->hostptr); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
if (nicks[0] != '\0') |
| 95 |
|
{ |
| 96 |
|
struct split_nuh_item *accept_p = MyMalloc(sizeof(*accept_p)); |
| 97 |
|
|
| 98 |
< |
DupString(accept_p->nickptr, nuh->nickptr); |
| 99 |
< |
DupString(accept_p->userptr, nuh->userptr); |
| 100 |
< |
DupString(accept_p->hostptr, nuh->hostptr); |
| 98 |
> |
accept_p->nickptr = xstrdup(nuh->nickptr); |
| 99 |
> |
accept_p->userptr = xstrdup(nuh->userptr); |
| 100 |
> |
accept_p->hostptr = xstrdup(nuh->hostptr); |
| 101 |
|
|
| 102 |
|
dlinkAdd(accept_p, &accept_p->node, &source_p->localClient->acceptlist); |
| 103 |
|
|
| 114 |
|
* \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL |
| 115 |
|
* pointers. |
| 116 |
|
* \note Valid arguments for this command are: |
| 117 |
< |
* - parv[0] = sender prefix |
| 117 |
> |
* - parv[0] = command |
| 118 |
|
* - parv[1] = list of masks to be accepted or removed (optional) |
| 119 |
|
*/ |
| 120 |
< |
static void |
| 120 |
> |
static int |
| 121 |
|
m_accept(struct Client *client_p, struct Client *source_p, |
| 122 |
|
int parc, char *parv[]) |
| 123 |
|
{ |
| 132 |
|
if (EmptyString(parv[1]) || !irccmp(parv[1], "*")) |
| 133 |
|
{ |
| 134 |
|
list_accepts(source_p); |
| 135 |
< |
return; |
| 135 |
> |
return 0; |
| 136 |
|
} |
| 137 |
|
|
| 138 |
|
for (mask = strtoken(&p, parv[1], ","); mask != NULL; |
| 151 |
|
|
| 152 |
|
split_nuh(&nuh); |
| 153 |
|
|
| 154 |
< |
if ((accept_p = find_accept(nick, user, host, source_p, 0)) == NULL) |
| 154 |
> |
if ((accept_p = find_accept(nick, user, host, source_p, irccmp)) == NULL) |
| 155 |
|
{ |
| 156 |
|
sendto_one(source_p, form_str(ERR_ACCEPTNOT), |
| 157 |
|
me.name, source_p->name, nick, user, host); |
| 167 |
|
{ |
| 168 |
|
sendto_one(source_p, form_str(ERR_ACCEPTFULL), |
| 169 |
|
me.name, source_p->name); |
| 170 |
< |
return; |
| 170 |
> |
return 0; |
| 171 |
|
} |
| 172 |
|
|
| 173 |
|
nuh.nuhmask = mask; |
| 181 |
|
|
| 182 |
|
split_nuh(&nuh); |
| 183 |
|
|
| 184 |
< |
if ((accept_p = find_accept(nick, user, host, source_p, 0)) != NULL) |
| 184 |
> |
if ((accept_p = find_accept(nick, user, host, source_p, irccmp)) != NULL) |
| 185 |
|
{ |
| 186 |
|
sendto_one(source_p, form_str(ERR_ACCEPTEXIST), |
| 187 |
|
me.name, source_p->name, nick, user, host); |
| 191 |
|
add_accept(&nuh, source_p); |
| 192 |
|
} |
| 193 |
|
} |
| 194 |
+ |
|
| 195 |
+ |
return 0; |
| 196 |
+ |
} |
| 197 |
+ |
|
| 198 |
+ |
static struct Message accept_msgtab = |
| 199 |
+ |
{ |
| 200 |
+ |
"ACCEPT", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
| 201 |
+ |
{ m_unregistered, m_accept, m_ignore, m_ignore, m_accept, m_ignore } |
| 202 |
+ |
}; |
| 203 |
+ |
|
| 204 |
+ |
static void |
| 205 |
+ |
module_init(void) |
| 206 |
+ |
{ |
| 207 |
+ |
mod_add_cmd(&accept_msgtab); |
| 208 |
|
} |
| 209 |
+ |
|
| 210 |
+ |
static void |
| 211 |
+ |
module_exit(void) |
| 212 |
+ |
{ |
| 213 |
+ |
mod_del_cmd(&accept_msgtab); |
| 214 |
+ |
} |
| 215 |
+ |
|
| 216 |
+ |
struct module module_entry = |
| 217 |
+ |
{ |
| 218 |
+ |
.node = { NULL, NULL, NULL }, |
| 219 |
+ |
.name = NULL, |
| 220 |
+ |
.version = "$Revision$", |
| 221 |
+ |
.handle = NULL, |
| 222 |
+ |
.modinit = module_init, |
| 223 |
+ |
.modexit = module_exit, |
| 224 |
+ |
.flags = 0 |
| 225 |
+ |
}; |