ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/branches/newio/modules/m_capab.c
Revision: 2527
Committed: Sat Nov 2 17:08:10 2013 UTC (11 years, 9 months ago) by michael
Content type: text/x-csrc
File size: 2305 byte(s)
Log Message:
- Style corrections

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_capab.c: Negotiates capabilities with a remote server.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
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.
11 *
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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "client.h"
27 #include "irc_string.h"
28 #include "s_serv.h"
29 #include "conf.h"
30 #include "parse.h"
31 #include "modules.h"
32
33
34 /*
35 * mr_capab - CAPAB message handler
36 * parv[0] = sender prefix
37 * parv[1] = space-separated list of capabilities
38 *
39 */
40 static int
41 mr_capab(struct Client *client_p, struct Client *source_p,
42 int parc, char *parv[])
43 {
44 int i = 0;
45 unsigned int cap = 0;
46 char *p = NULL;
47 char *s = NULL;
48
49 assert(client_p == source_p);
50
51 if (source_p->localClient->caps && !(IsCapable(source_p, CAP_TS6)))
52 return exit_client(source_p, source_p, source_p, "CAPAB received twice");
53
54 SetCapable(source_p, CAP_CAP);
55
56 for (i = 1; i < parc; ++i)
57 for (s = strtoken(&p, parv[i], " "); s;
58 s = strtoken(&p, NULL, " "))
59 if ((cap = find_capability(s)))
60 SetCapable(source_p, cap);
61 return 0;
62 }
63
64 static struct Message capab_msgtab =
65 {
66 "CAPAB", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
67 { mr_capab, m_ignore, m_ignore, m_ignore, m_ignore, m_ignore }
68 };
69
70 static void
71 module_init(void)
72 {
73 mod_add_cmd(&capab_msgtab);
74 }
75
76 static void
77 module_exit(void)
78 {
79 mod_del_cmd(&capab_msgtab);
80 }
81
82 struct module module_entry =
83 {
84 .node = { NULL, NULL, NULL },
85 .name = NULL,
86 .version = "$Revision$",
87 .handle = NULL,
88 .modinit = module_init,
89 .modexit = module_exit,
90 .flags = 0
91 };

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision