ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 4565
Committed: Sun Aug 24 10:27:40 2014 UTC (11 years ago) by michael
Content type: text/x-csrc
File size: 3798 byte(s)
Log Message:
- Update GPL 2 license headers

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
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 "server.h"
33 #include "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 /*! \brief VERSION command handler
55 *
56 * \param source_p Pointer to allocated Client struct from which the message
57 * originally comes from. This can be a local or remote client.
58 * \param parc Integer holding the number of supplied arguments.
59 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
60 * pointers.
61 * \note Valid arguments for this command are:
62 * - parv[0] = command
63 * - parv[1] = nickname/servername
64 */
65 static int
66 m_version(struct Client *source_p, int parc, char *parv[])
67 {
68 static time_t last_used = 0;
69
70 if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
71 {
72 sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
73 return 0;
74 }
75
76 last_used = CurrentTime;
77
78 if (!ConfigServerHide.disable_remote_commands)
79 if (hunt_server(source_p, ":%s VERSION :%s",
80 1, parc, parv) != HUNTED_ISME)
81 return 0;
82
83 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
84 me.name, serveropts);
85 show_isupport(source_p);
86 return 0;
87 }
88
89 /*! \brief VERSION command handler
90 *
91 * \param source_p Pointer to allocated Client struct from which the message
92 * originally comes from. This can be a local or remote client.
93 * \param parc Integer holding the number of supplied arguments.
94 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
95 * pointers.
96 * \note Valid arguments for this command are:
97 * - parv[0] = command
98 * - parv[1] = nickname/servername
99 */
100 static int
101 ms_version(struct Client *source_p, int parc, char *parv[])
102 {
103 if (hunt_server(source_p, ":%s VERSION :%s",
104 1, parc, parv) != HUNTED_ISME)
105 return 0;
106
107 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
108 me.name, serveropts);
109 show_isupport(source_p);
110 return 0;
111 }
112
113 static struct Message version_msgtab =
114 {
115 "VERSION", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
116 { m_unregistered, m_version, ms_version, m_ignore, ms_version, m_ignore }
117 };
118
119 static void
120 module_init(void)
121 {
122 mod_add_cmd(&version_msgtab);
123 }
124
125 static void
126 module_exit(void)
127 {
128 mod_del_cmd(&version_msgtab);
129 }
130
131 struct module module_entry =
132 {
133 .node = { NULL, NULL, NULL },
134 .name = NULL,
135 .version = "$Revision$",
136 .handle = NULL,
137 .modinit = module_init,
138 .modexit = module_exit,
139 .flags = 0
140 };

Properties

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