ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 4759
Committed: Sun Oct 19 10:54:43 2014 UTC (11 years, 9 months ago) by michael
Content type: text/x-csrc
File size: 3771 byte(s)
Log Message:
- Improved RPL_LOAD2HI numeric

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2820 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 2820 * Copyright (c) 1997-2014 ircd-hybrid development team
5 adx 30 *
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 michael 4565 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2820 /*! \file m_version.c
23     * \brief Includes required functions for processing the VERSION command.
24     * \version $Id$
25     */
26    
27 adx 30 #include "stdinc.h"
28     #include "client.h"
29     #include "ircd.h"
30     #include "numeric.h"
31 michael 1309 #include "conf.h"
32 michael 3347 #include "server.h"
33     #include "user.h"
34 adx 30 #include "send.h"
35     #include "parse.h"
36     #include "modules.h"
37    
38 michael 1243
39 adx 30 /* Option string. */
40 michael 2820 static const char serveropts[] =
41     {
42 adx 30 '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 michael 3275 /*! \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 michael 3300 * - parv[1] = nickname/servername
64 adx 30 */
65 michael 2820 static int
66 michael 3156 m_version(struct Client *source_p, int parc, char *parv[])
67 adx 30 {
68     static time_t last_used = 0;
69    
70 michael 4340 if ((last_used + ConfigGeneral.pace_wait_simple) > CurrentTime)
71 adx 30 {
72 michael 4759 sendto_one_numeric(source_p, &me, RPL_LOAD2HI, "VERSION");
73 michael 2820 return 0;
74 adx 30 }
75    
76 michael 1121 last_used = CurrentTime;
77    
78 michael 2196 if (!ConfigServerHide.disable_remote_commands)
79 michael 4690 if (hunt_server(source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
80 michael 2820 return 0;
81 adx 30
82 michael 3109 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
83     me.name, serveropts);
84 adx 30 show_isupport(source_p);
85 michael 2820 return 0;
86 adx 30 }
87    
88 michael 3275 /*! \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 michael 3300 * - parv[1] = nickname/servername
98 adx 30 */
99 michael 2820 static int
100 michael 3156 ms_version(struct Client *source_p, int parc, char *parv[])
101 adx 30 {
102 michael 4690 if (hunt_server(source_p, ":%s VERSION :%s", 1, parc, parv) != HUNTED_ISME)
103 michael 2820 return 0;
104 michael 1997
105 michael 3109 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
106     me.name, serveropts);
107 michael 1997 show_isupport(source_p);
108 michael 2820 return 0;
109 adx 30 }
110    
111 michael 2820 static struct Message version_msgtab =
112     {
113 michael 4545 "VERSION", NULL, 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
114 michael 3203 { m_unregistered, m_version, ms_version, m_ignore, ms_version, m_ignore }
115 michael 1230 };
116    
117     static void
118     module_init(void)
119 adx 30 {
120 michael 1230 mod_add_cmd(&version_msgtab);
121     }
122 adx 30
123 michael 1230 static void
124     module_exit(void)
125     {
126     mod_del_cmd(&version_msgtab);
127     }
128 adx 30
129 michael 2820 struct module module_entry =
130     {
131 michael 1230 .node = { NULL, NULL, NULL },
132     .name = NULL,
133     .version = "$Revision$",
134     .handle = NULL,
135     .modinit = module_init,
136     .modexit = module_exit,
137     .flags = 0
138     };

Properties

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