1 /* {{{ irc-seven: Cows like it.
3 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center.
4 * Copyright (C) 1996-2002 Hybrid Development Team.
5 * Copyright (C) 2002-2005 ircd-ratbox development team.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to:
20 * Free Software Foundation, Inc.
21 * 51 Franklin St - Fifth Floor
22 * Boston, MA 02110-1301
30 #include "irc_string.h"
38 static int mr_capab (struct Client
*, struct Client
*, int, const char **);
39 static int me_gcap (struct Client
*, struct Client
*, int, const char **);
41 /* {{{ static struct Message capab_msgtab = { ... } */
42 static struct Message capab_msgtab
=
44 "CAPAB", 0, 0, 0, MFLG_SLOW
| MFLG_UNREG
,
46 {mr_capab
, 0}, mg_ignore
, mg_ignore
,
47 mg_ignore
, mg_ignore
, mg_ignore
,
52 /* {{{ static struct Message gcap_msgtab = { ... } */
53 static struct Message gcap_msgtab
=
55 "GCAP", 0, 0, 0, MFLG_SLOW
,
57 mg_ignore
, mg_ignore
, mg_ignore
,
58 mg_ignore
, {me_gcap
, 2}, mg_ignore
,
63 /* {{{ static mapi_clist_av1 capab_clist[] = { ... } */
64 static mapi_clist_av1 capab_clist
[] =
72 /* {{{ DECLARE_MODULE_AV1(...) */
85 /* {{{ static int mr_capab()
87 * CAPAB message handler.
96 mr_capab (struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
98 struct Capability
*cap
= NULL
;
103 if (!client_p
->localClient
|| client_p
->user
)
106 if ((client_p
->localClient
->caps
& ~CAP_TS6
) != 0)
108 exit_client(client_p
, client_p
, client_p
,
109 "CAPAB TS6 is specified via PASS not CAPAB");
113 client_p
->localClient
->caps
|= CAP_CAP
;
114 MyFree(client_p
->localClient
->fullcaps
);
115 DupString(client_p
->localClient
->fullcaps
, parv
[1]);
117 for (i
= 1; i
< parc
; ++i
)
119 char *t
= LOCAL_COPY(parv
[i
]);
120 for (s
= strtoken(&p
, t
, " "); s
; s
= strtoken(&p
, NULL
, " "))
122 for (cap
= captab
; cap
->name
; cap
++)
124 if (!irccmp(cap
->name
, s
))
126 client_p
->localClient
->caps
|= cap
->cap
;
137 /* {{{ static int me_gcap()
139 * GCAP ENCAP message handler.
148 me_gcap (struct Client
*client_p
, struct Client
*source_p
, int parc
, const char **parv
)
150 struct Capability
*cap
= NULL
;
151 char *t
= LOCAL_COPY(parv
[1]);
155 if (!IsServer(source_p
) || !EmptyString(source_p
->serv
->fullcaps
))
158 DupString(source_p
->serv
->fullcaps
, parv
[1]);
159 for (s
= strtoken(&p
, t
, " "); s
; s
= strtoken(&p
, NULL
, " "))
161 for (cap
= captab
; cap
->name
; cap
++)
163 if (!irccmp(cap
->name
, s
))
165 source_p
->serv
->caps
|= cap
->cap
;
176 * vim: ts=8 sw=8 noet fdm=marker tw=80