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 "common.h"
00029 #include "irc_string.h"
00030 #include "sprintf_irc.h"
00031 #include "ircd.h"
00032 #include "numeric.h"
00033 #include "s_conf.h"
00034 #include "restart.h"
00035 #include "send.h"
00036 #include "msg.h"
00037 #include "parse.h"
00038 #include "modules.h"
00039
00040 static void mo_restart(struct Client *, struct Client *, int, char *[]);
00041
00042 struct Message restart_msgtab = {
00043 "RESTART", 0, 0, 0, 0, MFLG_SLOW, 0,
00044 { m_unregistered, m_not_oper, m_ignore, m_ignore, mo_restart, m_ignore }
00045 };
00046
00047 #ifndef STATIC_MODULES
00048 void
00049 _modinit(void)
00050 {
00051 mod_add_cmd(&restart_msgtab);
00052 }
00053
00054 void
00055 _moddeinit(void)
00056 {
00057 mod_del_cmd(&restart_msgtab);
00058 }
00059
00060 const char *_version = "$Revision: 588 $";
00061 #endif
00062
00063
00064
00065
00066
00067 static void
00068 mo_restart(struct Client *client_p, struct Client *source_p,
00069 int parc, char *parv[])
00070 {
00071 char buf[IRCD_BUFSIZE];
00072
00073 if (!IsOperDie(source_p))
00074 {
00075 sendto_one(source_p, form_str(ERR_NOPRIVS),
00076 me.name, source_p->name, "restart");
00077 return;
00078 }
00079
00080 if (EmptyString(parv[1]))
00081 {
00082 sendto_one(source_p, ":%s NOTICE %s :Need server name /restart %s",
00083 me.name, source_p->name, me.name);
00084 return;
00085 }
00086
00087 if (irccmp(parv[1], me.name))
00088 {
00089 sendto_one(source_p, ":%s NOTICE %s :Mismatch on /restart %s",
00090 me.name, source_p->name, me.name);
00091 return;
00092 }
00093
00094 ircsprintf(buf, "received RESTART command from %s",
00095 get_oper_name(source_p));
00096 server_die(buf, YES);
00097 }