ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-8/modules/m_version.c
Revision: 1243
Committed: Fri Sep 30 10:47:53 2011 UTC (12 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 4573 byte(s)
Log Message:
- move content of msg.h, ircd_handler.h and handlers.h into parse.h and
  remove headers accordingly
- killed common.h
- remove m_killhost.c and m_flags.c from contrib/
- sort out unused header includes here and there

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_version.c: Shows ircd version information.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "client.h"
27 #include "ircd.h"
28 #include "numeric.h"
29 #include "s_conf.h"
30 #include "s_serv.h"
31 #include "s_user.h"
32 #include "send.h"
33 #include "parse.h"
34 #include "modules.h"
35
36
37 /* Option string. */
38 static const char serveropts[] = {
39 ' ',
40 'T',
41 'S',
42 #ifdef TS_CURRENT
43 '0' + TS_CURRENT,
44 #endif
45 /* ONLY do TS */
46 /* ALWAYS do TS_WARNINGS */
47 'o',
48 'w',
49 '\0'
50 };
51
52 /* confopts()
53 *
54 * input - client pointer
55 * output - ircd.conf option string
56 * side effects - none
57 */
58 static char *
59 confopts(struct Client *source_p)
60 {
61 static char result[12];
62 char *p = result;
63
64 if (ConfigChannel.use_except)
65 *p++ = 'e';
66 if (ConfigFileEntry.glines)
67 *p++ = 'G';
68 *p++ = 'g';
69
70 /* might wanna hide this :P */
71 if (ServerInfo.hub &&
72 (!ConfigFileEntry.disable_remote || HasUMode(source_p, UMODE_OPER)))
73 {
74 *p++ = 'H';
75 }
76
77 if (ConfigChannel.use_invex)
78 *p++ = 'I';
79 if (ConfigChannel.use_knock)
80 *p++ = 'K';
81 *p++ = 'M';
82
83 if (ConfigFileEntry.ignore_bogus_ts)
84 *p++ = 'T';
85 #ifdef USE_SYSLOG
86 *p++ = 'Y';
87 #endif
88 #ifdef HAVE_LIBZ
89 *p++ = 'Z';
90 #endif
91 *p++ = '6';
92
93 *p = '\0';
94
95 return result;
96 }
97
98 /*
99 * m_version - VERSION command handler
100 * parv[0] = sender prefix
101 * parv[1] = remote server
102 */
103 static void
104 m_version(struct Client *client_p, struct Client *source_p,
105 int parc, char *parv[])
106 {
107 static time_t last_used = 0;
108
109 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
110 {
111 /* safe enough to give this on a local connect only */
112 sendto_one(source_p, form_str(RPL_LOAD2HI),
113 me.name, source_p->name);
114 return;
115 }
116
117 last_used = CurrentTime;
118
119 if (!ConfigFileEntry.disable_remote)
120 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
121 1, parc, parv) != HUNTED_ISME)
122 return;
123
124 sendto_one(source_p, form_str(RPL_VERSION),
125 me.name, source_p->name, ircd_version, serno,
126 me.name, confopts(source_p), serveropts);
127 show_isupport(source_p);
128 }
129
130 /*
131 * mo_version - VERSION command handler
132 * parv[0] = sender prefix
133 * parv[1] = remote server
134 */
135 static void
136 mo_version(struct Client *client_p, struct Client *source_p,
137 int parc, char *parv[])
138 {
139
140 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
141 1, parc, parv) != HUNTED_ISME)
142 return;
143
144 sendto_one(source_p, form_str(RPL_VERSION), me.name,
145 source_p->name, ircd_version,
146 serno, me.name, confopts(source_p), serveropts);
147
148 show_isupport(source_p);
149 }
150
151 /*
152 * ms_version - VERSION command handler
153 * parv[0] = sender prefix
154 * parv[1] = remote server
155 */
156 static void
157 ms_version(struct Client *client_p, struct Client *source_p,
158 int parc, char *parv[])
159 {
160 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
161 1, parc, parv) == HUNTED_ISME)
162 {
163 sendto_one(source_p, form_str(RPL_VERSION),
164 ID_or_name(&me, client_p),
165 ID_or_name(source_p, client_p),
166 ircd_version, serno,
167 me.name, confopts(source_p), serveropts);
168 show_isupport(source_p);
169 }
170 }
171
172 static struct Message version_msgtab = {
173 "VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
174 { m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore }
175 };
176
177 static void
178 module_init(void)
179 {
180 mod_add_cmd(&version_msgtab);
181 }
182
183 static void
184 module_exit(void)
185 {
186 mod_del_cmd(&version_msgtab);
187 }
188
189 struct module module_entry = {
190 .node = { NULL, NULL, NULL },
191 .name = NULL,
192 .version = "$Revision$",
193 .handle = NULL,
194 .modinit = module_init,
195 .modexit = module_exit,
196 .flags = 0
197 };

Properties

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