ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/modules/m_version.c
Revision: 5863
Committed: Tue Apr 28 12:23:14 2015 UTC (8 years, 11 months ago) by michael
Content type: text/x-csrc
File size: 3683 byte(s)
Log Message:
- Removed useless zero initializers from the module_entry as suggested by Adam

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2015 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, "VERSION");
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", 1, parc, parv) != HUNTED_ISME)
80 return 0;
81
82 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
83 me.name, serveropts);
84 show_isupport(source_p);
85 return 0;
86 }
87
88 /*! \brief VERSION command handler
89 *
90 * \param source_p Pointer to allocated Client struct from which the message
91 * originally comes from. This can be a local or remote client.
92 * \param parc Integer holding the number of supplied arguments.
93 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
94 * pointers.
95 * \note Valid arguments for this command are:
96 * - parv[0] = command
97 * - parv[1] = nickname/servername
98 */
99 static int
100 ms_version(struct Client *source_p, int parc, char *parv[])
101 {
102 if (hunt_server(source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
103 return 0;
104
105 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
106 me.name, serveropts);
107 show_isupport(source_p);
108 return 0;
109 }
110
111 static struct Message version_msgtab =
112 {
113 "VERSION", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
114 { m_unregistered, m_version, ms_version, m_ignore, ms_version, m_ignore }
115 };
116
117 static void
118 module_init(void)
119 {
120 mod_add_cmd(&version_msgtab);
121 }
122
123 static void
124 module_exit(void)
125 {
126 mod_del_cmd(&version_msgtab);
127 }
128
129 struct module module_entry =
130 {
131 .version = "$Revision$",
132 .modinit = module_init,
133 .modexit = module_exit,
134 };

Properties

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