2 * IRC - Internet Relay Chat, ircd/opercmds.c (formerly ircd/s_serv.c)
3 * Copyright (C) 1990 Jarkko Oikarinen and
4 * University of Oulu, Computing Center
6 * See file AUTHORS in IRC package for additional names of
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 1, or (at your option)
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., 675 Mass Ave, Cambridge, MA 02139, USA.
30 #include "ircd_chattr.h"
31 #include "ircd_reply.h"
32 #include "ircd_string.h"
49 * Report N/C-configuration lines from this server. This could
50 * report other configuration lines too, but converting the
51 * status back to "char" is a bit akward--not worth the code
54 * Note: The info is reported in the order the server uses
55 * it--not reversed as in ircd.conf!
58 static unsigned int report_array[17][3] = {
59 {CONF_SERVER, RPL_STATSCLINE, 'C'},
60 {CONF_CLIENT, RPL_STATSILINE, 'I'},
61 {CONF_KILL, RPL_STATSKLINE, 'K'},
62 {CONF_IPKILL, RPL_STATSKLINE, 'k'},
63 {CONF_LEAF, RPL_STATSLLINE, 'L'},
64 {CONF_OPERATOR, RPL_STATSOLINE, 'O'},
65 {CONF_HUB, RPL_STATSHLINE, 'H'},
66 {CONF_LOCOP, RPL_STATSOLINE, 'o'},
67 {CONF_CRULEALL, RPL_STATSDLINE, 'D'},
68 {CONF_CRULEAUTO, RPL_STATSDLINE, 'd'},
69 {CONF_UWORLD, RPL_STATSULINE, 'U'},
70 {CONF_TLINES, RPL_STATSTLINE, 'T'},
74 void report_configured_links(struct Client *sptr, int mask)
76 static char null[] = "<NULL>";
79 unsigned short int port;
80 char c, *host, *pass, *name;
82 for (tmp = GlobalConfList; tmp; tmp = tmp->next) {
83 if ((tmp->status & mask))
85 for (p = &report_array[0][0]; *p; p += 3)
86 if (*p == tmp->status)
91 host = BadPtr(tmp->host) ? null : tmp->host;
92 pass = BadPtr(tmp->passwd) ? null : tmp->passwd;
93 name = BadPtr(tmp->name) ? null : tmp->name;
96 * On K line the passwd contents can be
97 * displayed on STATS reply. -Vesa
99 /* Special-case 'k' or 'K' lines as appropriate... -Kev */
100 if ((tmp->status & CONF_KLINE))
101 sendto_one(sptr, rpl_str(p[1]), me.name,
102 sptr->name, c, host, pass, name, port, get_conf_class(tmp));
104 * connect rules are classless
106 else if ((tmp->status & CONF_CRULE))
107 sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, name);
108 else if ((tmp->status & CONF_TLINES))
109 sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, pass);
110 else if ((tmp->status & CONF_UWORLD))
111 sendto_one(sptr, rpl_str(p[1]),
112 me.name, sptr->name, c, host, pass, name, port,
113 get_conf_class(tmp));
114 else if ((tmp->status & CONF_SERVER))
115 sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, "*", name,
116 port, get_conf_class(tmp));
118 sendto_one(sptr, rpl_str(p[1]), me.name, sptr->name, c, host, name,
119 port, get_conf_class(tmp));
124 char *militime(char* sec, char* usec)
127 static char timebuf[18];
129 gettimeofday(&tv, NULL);
131 sprintf(timebuf, "%ld",
132 (tv.tv_sec - atoi(sec)) * 1000 + (tv.tv_usec - atoi(usec)) / 1000);
134 sprintf(timebuf, "%ld %ld", tv.tv_sec, tv.tv_usec);