00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "stdinc.h"
00026 #include "handlers.h"
00027 #include "client.h"
00028 #include "ircd.h"
00029 #include "numeric.h"
00030 #include "s_conf.h"
00031 #include "s_serv.h"
00032 #include "s_user.h"
00033 #include "send.h"
00034 #include "msg.h"
00035 #include "parse.h"
00036 #include "modules.h"
00037
00038 static char *confopts(struct Client *);
00039 static void m_version(struct Client *, struct Client *, int, char *[]);
00040 static void ms_version(struct Client *, struct Client *, int, char *[]);
00041 static void mo_version(struct Client *, struct Client *, int, char *[]);
00042
00043
00044 static const char serveropts[] = {
00045 ' ',
00046 'T',
00047 'S',
00048 #ifdef TS_CURRENT
00049 '0' + TS_CURRENT,
00050 #endif
00051
00052
00053 'o',
00054 'w',
00055 '\0'
00056 };
00057
00058 struct Message version_msgtab = {
00059 "VERSION", 0, 0, 0, 0, MFLG_SLOW, 0,
00060 { m_unregistered, m_version, ms_version, m_ignore, mo_version, m_ignore }
00061 };
00062
00063 #ifndef STATIC_MODULES
00064 void
00065 _modinit(void)
00066 {
00067 mod_add_cmd(&version_msgtab);
00068 }
00069
00070 void
00071 _moddeinit(void)
00072 {
00073 mod_del_cmd(&version_msgtab);
00074 }
00075
00076 const char *_version = "$Revision: 269 $";
00077 #endif
00078
00079
00080
00081
00082
00083
00084 static void
00085 m_version(struct Client *client_p, struct Client *source_p,
00086 int parc, char *parv[])
00087 {
00088 static time_t last_used = 0;
00089
00090 if ((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime)
00091 {
00092
00093 sendto_one(source_p, form_str(RPL_LOAD2HI),
00094 me.name, source_p->name);
00095 return;
00096 }
00097 else
00098 last_used = CurrentTime;
00099
00100 if (!ConfigFileEntry.disable_remote)
00101 {
00102 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
00103 1, parc, parv) != HUNTED_ISME)
00104 return;
00105 }
00106
00107 sendto_one(source_p, form_str(RPL_VERSION),
00108 me.name, source_p->name, ircd_version, serno,
00109 me.name, confopts(source_p), serveropts);
00110 show_isupport(source_p);
00111 }
00112
00113
00114
00115
00116
00117
00118 static void
00119 mo_version(struct Client *client_p, struct Client *source_p,
00120 int parc, char *parv[])
00121 {
00122
00123 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
00124 1, parc, parv) != HUNTED_ISME)
00125 return;
00126
00127 sendto_one(source_p, form_str(RPL_VERSION), me.name, parv[0], ircd_version,
00128 serno, me.name, confopts(source_p), serveropts);
00129
00130 show_isupport(source_p);
00131 }
00132
00133
00134
00135
00136
00137
00138 static void
00139 ms_version(struct Client *client_p, struct Client *source_p,
00140 int parc, char *parv[])
00141 {
00142 if (hunt_server(client_p, source_p, ":%s VERSION :%s",
00143 1, parc, parv) == HUNTED_ISME)
00144 {
00145 sendto_one(source_p, form_str(RPL_VERSION),
00146 ID_or_name(&me, client_p),
00147 ID_or_name(source_p, client_p),
00148 ircd_version, serno,
00149 me.name, confopts(source_p), serveropts);
00150 show_isupport(source_p);
00151 }
00152 }
00153
00154
00155
00156
00157
00158
00159
00160 static char *
00161 confopts(struct Client *source_p)
00162 {
00163 static char result[12];
00164 char *p = result;
00165
00166 if (ConfigChannel.use_except)
00167 *p++ = 'e';
00168 if (ConfigFileEntry.glines)
00169 *p++ = 'G';
00170 *p++ = 'g';
00171
00172
00173 if (ServerInfo.hub &&
00174 (!ConfigFileEntry.disable_remote || IsOper(source_p)))
00175 {
00176 *p++ = 'H';
00177 }
00178
00179 if (ConfigChannel.use_invex)
00180 *p++ = 'I';
00181 if (ConfigChannel.use_knock)
00182 *p++ = 'K';
00183 *p++ = 'M';
00184
00185 if (ConfigFileEntry.ignore_bogus_ts)
00186 *p++ = 'T';
00187 #ifdef USE_SYSLOG
00188 *p++ = 'Y';
00189 #endif
00190 #ifdef HAVE_LIBZ
00191 *p++ = 'Z';
00192 #endif
00193 *p++ = '6';
00194
00195 *p = '\0';
00196
00197 return result;
00198 }