Remove cruft left behind by removed stats_p_hook.
[seven-1.x.git] / modules / m_svinfo.c
blobe59c78f080f564d9a4bbb8314694087fdb93f212
1 /*
2 * ircd-ratbox: A slightly useful ircd.
3 * m_svinfo.c: Sends TS information for clock & compatibility checks.
5 * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
6 * Copyright (C) 1996-2002 Hybrid Development Team
7 * Copyright (C) 2002-2005 ircd-ratbox development team
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
24 #include "stdinc.h"
25 #include "client.h"
26 #include "common.h" /* TRUE bleah */
27 #include "irc_string.h"
28 #include "ircd.h"
29 #include "numeric.h"
30 #include "send.h"
31 #include "s_conf.h"
32 #include "s_log.h"
33 #include "msg.h"
34 #include "parse.h"
35 #include "modules.h"
37 static int ms_svinfo(struct Client *, struct Client *, int, const char **);
39 struct Message svinfo_msgtab = {
40 "SVINFO", 0, 0, 0, MFLG_SLOW,
41 {mg_unreg, mg_ignore, mg_ignore, {ms_svinfo, 5}, mg_ignore, mg_ignore}
44 mapi_clist_av1 svinfo_clist[] = { &svinfo_msgtab, NULL };
45 DECLARE_MODULE_AV1(svinfo, NULL, NULL, svinfo_clist, NULL, NULL, "$Revision: 108 $");
48 * ms_svinfo - SVINFO message handler
49 * parv[0] = sender prefix
50 * parv[1] = TS_CURRENT for the server
51 * parv[2] = TS_MIN for the server
52 * parv[3] = unused, send 0
53 * parv[4] = server's idea of UTC time
55 static int
56 ms_svinfo(struct Client *client_p, struct Client *source_p, int parc, const char *parv[])
58 signed int deltat;
59 time_t theirtime;
61 /* SVINFO isnt remote. */
62 if(source_p != client_p)
63 return 0;
65 if(TS_CURRENT < atoi(parv[2]) || atoi(parv[1]) < TS_MIN)
67 /* TS version is too low on one of the sides, drop the link */
68 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
69 "Link %s dropped, wrong TS protocol version (%s,%s)",
70 get_server_name(source_p, SHOW_IP), parv[1], parv[2]);
71 exit_client(source_p, source_p, source_p, "Incompatible TS version");
72 return 0;
76 * since we're here, might as well set CurrentTime while we're at it
78 set_time();
79 theirtime = atol(parv[4]);
80 deltat = abs(theirtime - CurrentTime);
82 if(deltat > ConfigFileEntry.ts_max_delta)
84 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
85 "Link %s dropped, excessive TS delta"
86 " (my TS=%ld, their TS=%ld, delta=%d)",
87 get_server_name(source_p, SHOW_IP),
88 (long) CurrentTime, (long) theirtime, deltat);
89 ilog(L_SERVER,
90 "Link %s dropped, excessive TS delta"
91 " (my TS=%ld, their TS=%ld, delta=%d)",
92 log_client_name(source_p, SHOW_IP), (long) CurrentTime, (long) theirtime, deltat);
93 exit_client(source_p, source_p, source_p, "Excessive TS delta");
94 return 0;
97 if(deltat > ConfigFileEntry.ts_warn_delta)
99 sendto_realops_snomask(SNO_GENERAL, L_NETWIDE,
100 "Link %s notable TS delta"
101 " (my TS=%ld, their TS=%ld, delta=%d)",
102 source_p->name, (long) CurrentTime, (long) theirtime, deltat);
105 return 0;