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: 8728
Committed: Sat Dec 15 12:54:47 2018 UTC (7 years, 7 months ago) by michael
Content type: text/x-csrc
File size: 3898 byte(s)
Log Message:
- Get rid of version.c

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2018 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 #include "isupport.h"
38 #include "patchlevel.h"
39 #include "serno.h"
40
41
42 /* Option string. */
43 static const char serveropts[] =
44 {
45 'T',
46 'S',
47 #ifdef TS_CURRENT
48 '0' + TS_CURRENT,
49 #endif
50 /* ONLY do TS */
51 /* ALWAYS do TS_WARNINGS */
52 'o',
53 'w',
54 '\0'
55 };
56
57 /*! \brief VERSION command handler
58 *
59 * \param source_p Pointer to allocated Client struct from which the message
60 * originally comes from. This can be a local or remote client.
61 * \param parc Integer holding the number of supplied arguments.
62 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
63 * pointers.
64 * \note Valid arguments for this command are:
65 * - parv[0] = command
66 * - parv[1] = nickname/servername
67 */
68 static int
69 m_version(struct Client *source_p, int parc, char *parv[])
70 {
71 static uintmax_t last_used = 0;
72
73 if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
74 {
75 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "VERSION");
76 return 0;
77 }
78
79 last_used = CurrentTime;
80
81 if (ConfigServerHide.disable_remote_commands == 0)
82 if (server_hunt(source_p, ":%s VERSION :%s", 1, parc, parv)->ret != HUNTED_ISME)
83 return 0;
84
85 sendto_one_numeric(source_p, &me, RPL_VERSION, PATCHLEVEL, SERIALNUM,
86 me.name, serveropts);
87 isupport_show(source_p);
88 return 0;
89 }
90
91 /*! \brief VERSION command handler
92 *
93 * \param source_p Pointer to allocated Client struct from which the message
94 * originally comes from. This can be a local or remote client.
95 * \param parc Integer holding the number of supplied arguments.
96 * \param parv Argument vector where parv[0] .. parv[parc-1] are non-NULL
97 * pointers.
98 * \note Valid arguments for this command are:
99 * - parv[0] = command
100 * - parv[1] = nickname/servername
101 */
102 static int
103 ms_version(struct Client *source_p, int parc, char *parv[])
104 {
105 if (server_hunt(source_p, ":%s VERSION :%s", 1, parc, parv)->ret != HUNTED_ISME)
106 return 0;
107
108 sendto_one_numeric(source_p, &me, RPL_VERSION, PATCHLEVEL, SERIALNUM,
109 me.name, serveropts);
110 isupport_show(source_p);
111 return 0;
112 }
113
114 static struct Message version_msgtab =
115 {
116 .cmd = "VERSION",
117 .args_max = MAXPARA,
118 .handlers[UNREGISTERED_HANDLER] = m_unregistered,
119 .handlers[CLIENT_HANDLER] = m_version,
120 .handlers[SERVER_HANDLER] = ms_version,
121 .handlers[ENCAP_HANDLER] = m_ignore,
122 .handlers[OPER_HANDLER] = ms_version
123 };
124
125 static void
126 module_init(void)
127 {
128 mod_add_cmd(&version_msgtab);
129 }
130
131 static void
132 module_exit(void)
133 {
134 mod_del_cmd(&version_msgtab);
135 }
136
137 struct module module_entry =
138 {
139 .version = "$Revision$",
140 .modinit = module_init,
141 .modexit = module_exit,
142 };

Properties

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