- !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,012 B
C
33 lines
1,012 B
C
#ifndef CMD_QUIT_H
|
|
#define CMD_QUIT_H
|
|
|
|
#include "zynk.h"
|
|
|
|
/*
|
|
* cmd_quit - Handle the "!quit" and "!die" shutdown commands.
|
|
*
|
|
* Requires channel op if used in a channel. Sets the global running flag
|
|
* to 0, causing the main loop to exit gracefully. Sends a farewell
|
|
* message before shutting down.
|
|
*
|
|
* 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_quit(Session *s, const char *msg, const char *reply_target, const char *src_nick, const char *tgt) {
|
|
if (strcmp(msg, "!quit") != 0 && strcmp(msg, "!die") != 0) return 0;
|
|
if (tgt[0] == '#' && !chan_is_op(tgt, src_nick)) {
|
|
irc_msg(s, reply_target, "You need op to shut me down");
|
|
return 1;
|
|
}
|
|
irc_msg(s, reply_target, "pffffff, bye. :(");
|
|
running = 0;
|
|
return 1;
|
|
}
|
|
|
|
#endif
|