- !gitlog now shows a link to each commit in the repository, using the git remote URL converted from SSH/SCP to HTTPS - !changelog now shows a 'Full changelog: <url>' link to CHANGELOG.md in the repository as the last message after all entries - Removed 'full' keyword from !gitlog and !changelog (previously showed full commit messages and complete changelog entries) - Switched build system from Make to CMake with feature toggles (-DWITH_<FEATURE>=ON/OFF) - Refactored single-file codebase into dedicated header files: each command now lives in its own cmd_*.h file, with separate modules for database (db.h), IRC protocol (irc.h), networking (net.h), TLS (tls.h), and AI (ai.h) - Updated README.md to reflect the simplified !gitlog and !changelog syntax and the new CMake build instructions (0.40.0)
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
|