ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 1997
Committed: Sat May 11 17:35:07 2013 UTC (13 years, 5 months ago) by michael
Content type: text/x-csrc
File size: 4421 byte(s)
Log Message:
- Mostly style cleanups & whitespace changes

File Contents

# User Rev Content
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     ' ',
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 michael 1230 /* 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 adx 30 {
61 michael 1230 static char result[12];
62     char *p = result;
63 adx 30
64 michael 1495 *p++ = 'e'; /* excepts */
65    
66 michael 1230 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     *p++ = 'H';
74    
75 michael 1495 *p++ = 'I'; /* invex */
76     *p++ = 'K'; /* knock */
77 michael 1230 *p++ = 'M';
78    
79     if (ConfigFileEntry.ignore_bogus_ts)
80     *p++ = 'T';
81     *p++ = '6';
82    
83     *p = '\0';
84    
85     return result;
86 adx 30 }
87    
88     /*
89     * m_version - VERSION command handler
90     * parv[0] = sender prefix
91     * parv[1] = remote server
92     */
93     static void
94     m_version(struct Client *client_p, struct Client *source_p,
95     int parc, char *parv[])
96     {
97     static time_t last_used = 0;
98    
99 adx 269 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
100 adx 30 {
101     /* safe enough to give this on a local connect only */
102 michael 1834 sendto_one(source_p, form_str(RPL_LOAD2HI),
103 adx 30 me.name, source_p->name);
104     return;
105     }
106    
107 michael 1121 last_used = CurrentTime;
108    
109 adx 30 if (!ConfigFileEntry.disable_remote)
110     if (hunt_server(client_p, source_p, ":%s VERSION :%s",
111     1, parc, parv) != HUNTED_ISME)
112     return;
113    
114 michael 1997 sendto_one(source_p, form_str(RPL_VERSION), me.name,
115     source_p->name, ircd_version, serno,
116 adx 30 me.name, confopts(source_p), serveropts);
117     show_isupport(source_p);
118     }
119    
120     /*
121     * mo_version - VERSION command handler
122     * parv[0] = sender prefix
123     * parv[1] = remote server
124     */
125     static void
126     mo_version(struct Client *client_p, struct Client *source_p,
127     int parc, char *parv[])
128     {
129    
130     if (hunt_server(client_p, source_p, ":%s VERSION :%s",
131     1, parc, parv) != HUNTED_ISME)
132     return;
133    
134 michael 1834 sendto_one(source_p, form_str(RPL_VERSION), me.name,
135 michael 1997 source_p->name, ircd_version, serno,
136     me.name, confopts(source_p), serveropts);
137 adx 30 show_isupport(source_p);
138     }
139    
140     /*
141     * ms_version - VERSION command handler
142     * parv[0] = sender prefix
143     * parv[1] = remote server
144     */
145     static void
146     ms_version(struct Client *client_p, struct Client *source_p,
147     int parc, char *parv[])
148     {
149     if (hunt_server(client_p, source_p, ":%s VERSION :%s",
150 michael 1997 1, parc, parv) != HUNTED_ISME)
151     return;
152    
153     sendto_one(source_p, form_str(RPL_VERSION),
154     ID_or_name(&me, client_p),
155     ID_or_name(source_p, client_p),
156     ircd_version, serno,
157     me.name, confopts(source_p), serveropts);
158     show_isupport(source_p);
159 adx 30 }
160    
161 michael 1230 static struct Message version_msgtab = {
162     "VERSION", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
163     { m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore }
164     };
165    
166     static void
167     module_init(void)
168 adx 30 {
169 michael 1230 mod_add_cmd(&version_msgtab);
170     }
171 adx 30
172 michael 1230 static void
173     module_exit(void)
174     {
175     mod_del_cmd(&version_msgtab);
176     }
177 adx 30
178 michael 1230 struct module module_entry = {
179     .node = { NULL, NULL, NULL },
180     .name = NULL,
181     .version = "$Revision$",
182     .handle = NULL,
183     .modinit = module_init,
184     .modexit = module_exit,
185     .flags = 0
186     };

Properties

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