X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/161f040940ad8422dfc03fadcb3a07ccd60201df..ea41b24fd4807e3565bf5f8f293e2efc4c20b62d:/modules/m_capab.c diff --git a/modules/m_capab.c b/modules/m_capab.c index 3e7de45d..56732e23 100644 --- a/modules/m_capab.c +++ b/modules/m_capab.c @@ -1,6 +1,6 @@ /* * ircd-ratbox: A slightly useful ircd. - * m_away.c: Negotiates capabilities with a remote server. + * m_capab.c: Negotiates capabilities with a remote server. * * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center * Copyright (C) 1996-2002 Hybrid Development Team @@ -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_capab.c 1295 2006-05-08 13:05:25Z nenolod $ */ #include "stdinc.h" @@ -33,46 +31,47 @@ #include "parse.h" #include "modules.h" -static int mr_capab(struct Client *, struct Client *, int, const char **); -static int me_gcap(struct Client *, struct Client *, int, const char **); +static const char capab_desc[] = "Provides the commands used for server-to-server capability negotiation"; + +static void mr_capab(struct MsgBuf *, struct Client *, struct Client *, int, const char **); +static void me_gcap(struct MsgBuf *, struct Client *, struct Client *, int, const char **); struct Message capab_msgtab = { - "CAPAB", 0, 0, 0, MFLG_SLOW | MFLG_UNREG, - {{mr_capab, 0}, mg_ignore, mg_ignore, mg_ignore, mg_ignore, mg_ignore} + "CAPAB", 0, 0, 0, 0, + {{mr_capab, 2}, mg_ignore, mg_ignore, mg_ignore, mg_ignore, mg_ignore} }; struct Message gcap_msgtab = { - "GCAP", 0, 0, 0, MFLG_SLOW, + "GCAP", 0, 0, 0, 0, {mg_ignore, mg_ignore, mg_ignore, mg_ignore, {me_gcap, 2}, mg_ignore} }; mapi_clist_av1 capab_clist[] = { &capab_msgtab, &gcap_msgtab, NULL }; -DECLARE_MODULE_AV1(capab, NULL, NULL, capab_clist, NULL, NULL, "$Revision: 1295 $"); + +DECLARE_MODULE_AV2(capab, NULL, NULL, capab_clist, NULL, NULL, NULL, NULL, capab_desc); /* * mr_capab - CAPAB message handler * parv[1] = space-separated list of capabilities - * */ -static int -mr_capab(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +static void +mr_capab(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - struct Capability *cap; int i; char *p; char *s; /* ummm, this shouldn't happen. Could argue this should be logged etc. */ if(client_p->localClient == NULL) - return 0; + return; if(client_p->user) - return 0; + return; /* CAP_TS6 is set in PASS, so is valid.. */ if((client_p->localClient->caps & ~CAP_TS6) != 0) { exit_client(client_p, client_p, client_p, "CAPAB received twice"); - return 0; + return; } else client_p->localClient->caps |= CAP_CAP; @@ -84,32 +83,20 @@ mr_capab(struct Client *client_p, struct Client *source_p, int parc, const char { char *t = LOCAL_COPY(parv[i]); for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p)) - { - for (cap = captab; cap->name; cap++) - { - if(!irccmp(cap->name, s)) - { - client_p->localClient->caps |= cap->cap; - break; - } - } - } + client_p->localClient->caps |= capability_get(serv_capindex, s, NULL); } - - return 0; } -static int -me_gcap(struct Client *client_p, struct Client *source_p, +static void +me_gcap(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { - struct Capability *cap; char *t = LOCAL_COPY(parv[1]); char *s; char *p; if(!IsServer(source_p)) - return 0; + return; /* already had GCAPAB?! */ if(!EmptyString(source_p->serv->fullcaps)) @@ -121,16 +108,5 @@ me_gcap(struct Client *client_p, struct Client *source_p, source_p->serv->fullcaps = rb_strdup(parv[1]); for (s = rb_strtok_r(t, " ", &p); s; s = rb_strtok_r(NULL, " ", &p)) - { - for (cap = captab; cap->name; cap++) - { - if(!irccmp(cap->name, s)) - { - source_p->serv->caps |= cap->cap; - break; - } - } - } - - return 0; + source_p->serv->caps |= capability_get(serv_capindex, s, NULL); }