ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 2820
Committed: Wed Jan 15 23:10:26 2014 UTC (11 years, 7 months ago) by michael
Content type: text/x-csrc
File size: 3856 byte(s)
Log Message:
- Clean up all files in modules/ (fixed indentation, removed whitespaces/tabs)
- Fixed copyright years
- Made module handlers int type for later use

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-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
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22 /*! \file m_version.c
23 * \brief Includes required functions for processing the VERSION command.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "client.h"
29 #include "ircd.h"
30 #include "numeric.h"
31 #include "conf.h"
32 #include "s_serv.h"
33 #include "s_user.h"
34 #include "send.h"
35 #include "parse.h"
36 #include "modules.h"
37
38
39 /* Option string. */
40 static const char serveropts[] =
41 {
42 'T',
43 'S',
44 #ifdef TS_CURRENT
45 '0' + TS_CURRENT,
46 #endif
47 /* ONLY do TS */
48 /* ALWAYS do TS_WARNINGS */
49 'o',
50 'w',
51 '\0'
52 };
53
54 /*
55 * m_version - VERSION command handler
56 * parv[0] = sender prefix
57 * parv[1] = remote server
58 */
59 static int
60 m_version(struct Client *client_p, struct Client *source_p,
61 int parc, char *parv[])
62 {
63 static time_t last_used = 0;
64
65 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
66 {
67 /* safe enough to give this on a local connect only */
68 sendto_one(source_p, form_str(RPL_LOAD2HI),
69 me.name, source_p->name);
70 return 0;
71 }
72
73 last_used = CurrentTime;
74
75 if (!ConfigServerHide.disable_remote_commands)
76 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
77 1, parc, parv) != HUNTED_ISME)
78 return 0;
79
80 sendto_one(source_p, form_str(RPL_VERSION), me.name,
81 source_p->name, ircd_version, serno,
82 me.name, serveropts);
83 show_isupport(source_p);
84 return 0;
85 }
86
87 /*
88 * mo_version - VERSION command handler
89 * parv[0] = sender prefix
90 * parv[1] = remote server
91 */
92 static int
93 mo_version(struct Client *client_p, struct Client *source_p,
94 int parc, char *parv[])
95 {
96
97 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
98 1, parc, parv) != HUNTED_ISME)
99 return 0;
100
101 sendto_one(source_p, form_str(RPL_VERSION), me.name,
102 source_p->name, ircd_version, serno,
103 me.name, serveropts);
104 show_isupport(source_p);
105 return 0;
106 }
107
108 /*
109 * ms_version - VERSION command handler
110 * parv[0] = sender prefix
111 * parv[1] = remote server
112 */
113 static int
114 ms_version(struct Client *client_p, struct Client *source_p,
115 int parc, char *parv[])
116 {
117 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
118 1, parc, parv) != HUNTED_ISME)
119 return 0;
120
121 sendto_one(source_p, form_str(RPL_VERSION),
122 ID_or_name(&me, client_p),
123 ID_or_name(source_p, client_p),
124 ircd_version, serno,
125 me.name, serveropts);
126 show_isupport(source_p);
127 return 0;
128 }
129
130 static struct Message version_msgtab =
131 {
132 "VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
133 { m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore }
134 };
135
136 static void
137 module_init(void)
138 {
139 mod_add_cmd(&version_msgtab);
140 }
141
142 static void
143 module_exit(void)
144 {
145 mod_del_cmd(&version_msgtab);
146 }
147
148 struct module module_entry =
149 {
150 .node = { NULL, NULL, NULL },
151 .name = NULL,
152 .version = "$Revision$",
153 .handle = NULL,
154 .modinit = module_init,
155 .modexit = module_exit,
156 .flags = 0
157 };

Properties

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