ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 3203
Committed: Mon Mar 24 17:43:50 2014 UTC (11 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 3078 byte(s)
Log Message:
- m_vesion.c: merged mo_version() and ms_version()

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] = command
57 * parv[1] = remote server
58 */
59 static int
60 m_version(struct Client *source_p, int parc, char *parv[])
61 {
62 static time_t last_used = 0;
63
64 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
65 {
66 /* safe enough to give this on a local connect only */
67 sendto_one_numeric(source_p, &me, RPL_LOAD2HI);
68 return 0;
69 }
70
71 last_used = CurrentTime;
72
73 if (!ConfigServerHide.disable_remote_commands)
74 if (hunt_server(source_p, ":%s VERSION :%s",
75 1, parc, parv) != HUNTED_ISME)
76 return 0;
77
78 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
79 me.name, serveropts);
80 show_isupport(source_p);
81 return 0;
82 }
83
84 /*
85 * ms_version - VERSION command handler
86 * parv[0] = command
87 * parv[1] = remote server
88 */
89 static int
90 ms_version(struct Client *source_p, int parc, char *parv[])
91 {
92 if (hunt_server(source_p, ":%s VERSION :%s",
93 1, parc, parv) != HUNTED_ISME)
94 return 0;
95
96 sendto_one_numeric(source_p, &me, RPL_VERSION, ircd_version, serno,
97 me.name, serveropts);
98 show_isupport(source_p);
99 return 0;
100 }
101
102 static struct Message version_msgtab =
103 {
104 "VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
105 { m_unregistered, m_version, ms_version, m_ignore, ms_version, m_ignore }
106 };
107
108 static void
109 module_init(void)
110 {
111 mod_add_cmd(&version_msgtab);
112 }
113
114 static void
115 module_exit(void)
116 {
117 mod_del_cmd(&version_msgtab);
118 }
119
120 struct module module_entry =
121 {
122 .node = { NULL, NULL, NULL },
123 .name = NULL,
124 .version = "$Revision$",
125 .handle = NULL,
126 .modinit = module_init,
127 .modexit = module_exit,
128 .flags = 0
129 };

Properties

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