X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/03dba44854f964bdd0a7b2d059e81083051de710..25f673bfde1c316aa0c5af551f6c0aa601b53e51:/modules/m_accept.c diff --git a/modules/m_accept.c b/modules/m_accept.c index 7fbf584a..cd3074b5 100644 --- a/modules/m_accept.c +++ b/modules/m_accept.c @@ -20,8 +20,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA - * - * $Id: m_accept.c 254 2005-09-21 23:35:12Z nenolod $ */ #include "stdinc.h" @@ -34,32 +32,34 @@ #include "send.h" #include "msg.h" #include "parse.h" -#include "sprintf_irc.h" #include "modules.h" -static int m_accept(struct Client *, struct Client *, int, const char **); +static const char accept_desc[] = + "Provides the ACCEPT command for use with Caller ID/user mode +g"; + +static void m_accept(struct MsgBuf *, struct Client *, struct Client *, int, const char **); static void build_nicklist(struct Client *, char *, char *, const char *); static void add_accept(struct Client *, struct Client *); static void list_accepts(struct Client *); struct Message accept_msgtab = { - "ACCEPT", 0, 0, 0, MFLG_SLOW | MFLG_UNREG, + "ACCEPT", 0, 0, 0, 0, {mg_unreg, {m_accept, 2}, mg_ignore, mg_ignore, mg_ignore, {m_accept, 2}} }; mapi_clist_av1 accept_clist[] = { &accept_msgtab, NULL }; -DECLARE_MODULE_AV1(accept, NULL, NULL, accept_clist, NULL, NULL, "$Revision: 254 $"); + +DECLARE_MODULE_AV2(accept, NULL, NULL, accept_clist, NULL, NULL, NULL, NULL, accept_desc); /* * m_accept - ACCEPT command handler - * parv[0] = sender prefix * parv[1] = servername */ -static int -m_accept(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +static void +m_accept(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { char *nick; char *p = NULL; @@ -71,13 +71,13 @@ m_accept(struct Client *client_p, struct Client *source_p, int parc, const char if(*parv[1] == '*') { list_accepts(source_p); - return 0; + return; } build_nicklist(source_p, addbuf, delbuf, parv[1]); /* parse the delete list */ - for (nick = strtoken(&p, delbuf, ","); nick != NULL; nick = strtoken(&p, NULL, ",")) + for (nick = rb_strtok_r(delbuf, ",", &p); nick != NULL; nick = rb_strtok_r(NULL, ",", &p)) { /* shouldnt happen, but lets be paranoid */ if((target_p = find_named_person(nick)) == NULL) @@ -103,7 +103,7 @@ m_accept(struct Client *client_p, struct Client *source_p, int parc, const char accept_num = rb_dlink_list_length(&source_p->localClient->allow_list); /* parse the add list */ - for (nick = strtoken(&p, addbuf, ","); nick; nick = strtoken(&p, NULL, ",")) + for (nick = rb_strtok_r(addbuf, ",", &p); nick; nick = rb_strtok_r(NULL, ",", &p), accept_num++) { /* shouldnt happen, but lets be paranoid */ if((target_p = find_named_person(nick)) == NULL) @@ -124,16 +124,13 @@ m_accept(struct Client *client_p, struct Client *source_p, int parc, const char if(accept_num >= ConfigFileEntry.max_accept) { sendto_one(source_p, form_str(ERR_ACCEPTFULL), me.name, source_p->name); - return 0; + return; } /* why is this here? */ /* del_from accept(target_p, source_p); */ add_accept(source_p, target_p); - accept_num++; } - - return 0; } /* @@ -143,7 +140,7 @@ m_accept(struct Client *client_p, struct Client *source_p, int parc, const char * - pointer to addbuffer * - pointer to remove buffer * - pointer to list of nicks - * output - + * output - * side effects - addbuf/delbuf are modified to give valid nicks */ static void @@ -154,14 +151,13 @@ build_nicklist(struct Client *source_p, char *addbuf, char *delbuf, const char * int lenadd; int lendel; int del; - struct Client *target_p; char *n = LOCAL_COPY(nicks); *addbuf = *delbuf = '\0'; del = lenadd = lendel = 0; /* build list of clients to add into addbuf, clients to remove in delbuf */ - for (name = strtoken(&p, n, ","); name; name = strtoken(&p, NULL, ","), del = 0) + for (name = rb_strtok_r(n, ",", &p); name; name = rb_strtok_r(NULL, ",", &p), del = 0) { if(*name == '-') { @@ -169,9 +165,9 @@ build_nicklist(struct Client *source_p, char *addbuf, char *delbuf, const char * name++; } - if((target_p = find_named_person(name)) == NULL) + if(find_named_person(name) == NULL) { - sendto_one_numeric(source_p, ERR_NOSUCHNICK, + sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), name); continue; } @@ -249,16 +245,16 @@ list_accepts(struct Client *source_p) *nicks = '\0'; } - len += rb_snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name); + len += snprintf(nicks + len, sizeof(nicks) - len, "%s ", target_p->name); count++; } } if(*nicks) - sendto_one(source_p, form_str(RPL_ACCEPTLIST), + sendto_one(source_p, form_str(RPL_ACCEPTLIST), me.name, source_p->name, nicks); - sendto_one(source_p, form_str(RPL_ENDOFACCEPT), + sendto_one(source_p, form_str(RPL_ENDOFACCEPT), me.name, source_p->name); }