1 |
adx |
30 |
/* |
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 |
knight |
31 |
* $Id$ |
23 |
adx |
30 |
*/ |
24 |
|
|
|
25 |
|
|
#include "stdinc.h" |
26 |
|
|
#include "client.h" |
27 |
|
|
#include "ircd.h" |
28 |
|
|
#include "numeric.h" |
29 |
michael |
1309 |
#include "conf.h" |
30 |
adx |
30 |
#include "s_serv.h" |
31 |
|
|
#include "s_user.h" |
32 |
|
|
#include "send.h" |
33 |
|
|
#include "parse.h" |
34 |
|
|
#include "modules.h" |
35 |
|
|
|
36 |
michael |
1243 |
|
37 |
adx |
30 |
/* Option string. */ |
38 |
|
|
static const char serveropts[] = { |
39 |
|
|
'T', |
40 |
|
|
'S', |
41 |
|
|
#ifdef TS_CURRENT |
42 |
|
|
'0' + TS_CURRENT, |
43 |
|
|
#endif |
44 |
|
|
/* ONLY do TS */ |
45 |
|
|
/* ALWAYS do TS_WARNINGS */ |
46 |
|
|
'o', |
47 |
|
|
'w', |
48 |
|
|
'\0' |
49 |
|
|
}; |
50 |
|
|
|
51 |
|
|
/* |
52 |
|
|
* m_version - VERSION command handler |
53 |
|
|
* parv[0] = sender prefix |
54 |
|
|
* parv[1] = remote server |
55 |
|
|
*/ |
56 |
|
|
static void |
57 |
|
|
m_version(struct Client *client_p, struct Client *source_p, |
58 |
|
|
int parc, char *parv[]) |
59 |
|
|
{ |
60 |
|
|
static time_t last_used = 0; |
61 |
|
|
|
62 |
adx |
269 |
if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime) |
63 |
adx |
30 |
{ |
64 |
|
|
/* safe enough to give this on a local connect only */ |
65 |
michael |
1834 |
sendto_one(source_p, form_str(RPL_LOAD2HI), |
66 |
adx |
30 |
me.name, source_p->name); |
67 |
|
|
return; |
68 |
|
|
} |
69 |
|
|
|
70 |
michael |
1121 |
last_used = CurrentTime; |
71 |
|
|
|
72 |
adx |
30 |
if (!ConfigFileEntry.disable_remote) |
73 |
|
|
if (hunt_server(client_p, source_p, ":%s VERSION :%s", |
74 |
|
|
1, parc, parv) != HUNTED_ISME) |
75 |
|
|
return; |
76 |
|
|
|
77 |
michael |
1997 |
sendto_one(source_p, form_str(RPL_VERSION), me.name, |
78 |
|
|
source_p->name, ircd_version, serno, |
79 |
michael |
2120 |
me.name, serveropts); |
80 |
adx |
30 |
show_isupport(source_p); |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
/* |
84 |
|
|
* mo_version - VERSION command handler |
85 |
|
|
* parv[0] = sender prefix |
86 |
|
|
* parv[1] = remote server |
87 |
|
|
*/ |
88 |
|
|
static void |
89 |
|
|
mo_version(struct Client *client_p, struct Client *source_p, |
90 |
|
|
int parc, char *parv[]) |
91 |
|
|
{ |
92 |
|
|
|
93 |
|
|
if (hunt_server(client_p, source_p, ":%s VERSION :%s", |
94 |
|
|
1, parc, parv) != HUNTED_ISME) |
95 |
|
|
return; |
96 |
|
|
|
97 |
michael |
1834 |
sendto_one(source_p, form_str(RPL_VERSION), me.name, |
98 |
michael |
1997 |
source_p->name, ircd_version, serno, |
99 |
michael |
2120 |
me.name, serveropts); |
100 |
adx |
30 |
show_isupport(source_p); |
101 |
|
|
} |
102 |
|
|
|
103 |
|
|
/* |
104 |
|
|
* ms_version - VERSION command handler |
105 |
|
|
* parv[0] = sender prefix |
106 |
|
|
* parv[1] = remote server |
107 |
|
|
*/ |
108 |
|
|
static void |
109 |
|
|
ms_version(struct Client *client_p, struct Client *source_p, |
110 |
|
|
int parc, char *parv[]) |
111 |
|
|
{ |
112 |
|
|
if (hunt_server(client_p, source_p, ":%s VERSION :%s", |
113 |
michael |
1997 |
1, parc, parv) != HUNTED_ISME) |
114 |
|
|
return; |
115 |
|
|
|
116 |
|
|
sendto_one(source_p, form_str(RPL_VERSION), |
117 |
|
|
ID_or_name(&me, client_p), |
118 |
|
|
ID_or_name(source_p, client_p), |
119 |
|
|
ircd_version, serno, |
120 |
michael |
2120 |
me.name, serveropts); |
121 |
michael |
1997 |
show_isupport(source_p); |
122 |
adx |
30 |
} |
123 |
|
|
|
124 |
michael |
1230 |
static struct Message version_msgtab = { |
125 |
|
|
"VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0, |
126 |
|
|
{ m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore } |
127 |
|
|
}; |
128 |
|
|
|
129 |
|
|
static void |
130 |
|
|
module_init(void) |
131 |
adx |
30 |
{ |
132 |
michael |
1230 |
mod_add_cmd(&version_msgtab); |
133 |
|
|
} |
134 |
adx |
30 |
|
135 |
michael |
1230 |
static void |
136 |
|
|
module_exit(void) |
137 |
|
|
{ |
138 |
|
|
mod_del_cmd(&version_msgtab); |
139 |
|
|
} |
140 |
adx |
30 |
|
141 |
michael |
1230 |
struct module module_entry = { |
142 |
|
|
.node = { NULL, NULL, NULL }, |
143 |
|
|
.name = NULL, |
144 |
|
|
.version = "$Revision$", |
145 |
|
|
.handle = NULL, |
146 |
|
|
.modinit = module_init, |
147 |
|
|
.modexit = module_exit, |
148 |
|
|
.flags = 0 |
149 |
|
|
}; |