ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/modules/m_version.c
Revision: 1592
Committed: Sat Oct 27 21:02:32 2012 UTC (12 years, 10 months ago) by michael
Content type: text/x-csrc
File size: 4433 byte(s)
Log Message:
- Second time's the charm? Moving svnroot/ircd-hybrid-8 to
  svnroot/ircd-hybrid/trunk

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

Properties

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