33 lines
1,019 B
C
33 lines
1,019 B
C
|
|
#ifndef CMD_RESTART_H
|
||
|
|
#define CMD_RESTART_H
|
||
|
|
|
||
|
|
#include "zynk.h"
|
||
|
|
|
||
|
|
/*
|
||
|
|
* cmd_restart - Handle the "!restart" command.
|
||
|
|
*
|
||
|
|
* Requires channel op. Functionally identical to cmd_reload: sends a
|
||
|
|
* "Restarting..." message then triggers reload_do(). Rate-limited.
|
||
|
|
*
|
||
|
|
* Parameters:
|
||
|
|
* s - The IRC session.
|
||
|
|
* msg - The raw message text.
|
||
|
|
* reply_target - Channel or nick to reply to.
|
||
|
|
* src_nick - The nick of the user who sent the command.
|
||
|
|
* tgt - The message target (channel or nick).
|
||
|
|
*
|
||
|
|
* Returns: 1 if matched, 0 otherwise.
|
||
|
|
*/
|
||
|
|
int cmd_restart(Session *s, const char *msg, const char *reply_target, const char *src_nick, const char *tgt) {
|
||
|
|
if (strcmp(msg, "!restart") != 0) return 0;
|
||
|
|
if (tgt[0] == '#' && !chan_is_op(tgt, src_nick)) {
|
||
|
|
irc_msg(s, reply_target, "You need op to restart me");
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
if (rate_limit_check(src_nick, reply_target) < 0) return 1;
|
||
|
|
irc_msg(s, reply_target, "Restarting...");
|
||
|
|
reload_do(s, reply_target, 0);
|
||
|
|
return 1;
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif
|