Added VERSION to zynk.c and a !command to request the program version in IRC.
This commit is contained in:
parent
9b5d8df361
commit
00e2153ee8
2 changed files with 23 additions and 0 deletions
11
CHANGELOG.md
Normal file
11
CHANGELOG.md
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
2026.07.15 – Numerous optimizations and fixes.
|
||||||
|
|
||||||
|
- Fixed DB/TLS resource cleanup on partial startup failures and normal shutdown.
|
||||||
|
- Fixed net_send() stack over-read risk when vsnprintf() truncates.
|
||||||
|
- Fixed curl/opencode pipe readers so oversized output cannot deadlock the bot.
|
||||||
|
- Fixed !code AI agent propagation into the forked child.
|
||||||
|
- Added CR/LF rejection for startup IRC args to prevent local IRC command injection.
|
||||||
|
- Normalized weather/forecast city input before building wttr.in URLs.
|
||||||
|
- Fixed IRC op cache bugs around nick changes and long NAMES entries.
|
||||||
|
- Added !version command to report the bot's version via IRC.
|
||||||
|
- Fixed the malformed VERSION macro definition to ensure successful builds.
|
||||||
12
zynk.c
12
zynk.c
|
|
@ -29,6 +29,7 @@ int asprintf(char **, const char *, ...);
|
||||||
|
|
||||||
/* ---- constants ---- */
|
/* ---- constants ---- */
|
||||||
|
|
||||||
|
#define VERSION "0.30"
|
||||||
#define DEFAULT_SERVER "irc.libera.chat"
|
#define DEFAULT_SERVER "irc.libera.chat"
|
||||||
#define OPENCODE_BIN "/home/hanez/bin/opencode"
|
#define OPENCODE_BIN "/home/hanez/bin/opencode"
|
||||||
#define CLR_RESET "\033[0m"
|
#define CLR_RESET "\033[0m"
|
||||||
|
|
@ -1101,6 +1102,16 @@ static int cmd_ping(Session *s, const char *msg, const char *reply_target, const
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int cmd_version(Session *s, const char *msg, const char *reply_target, const char *src_nick) {
|
||||||
|
if (strncmp(msg, "!version", 8) != 0) return 0;
|
||||||
|
if (msg[8] != ' ' && msg[8] != '\0') return 0;
|
||||||
|
if (rate_limit_check(src_nick) < 0) return 1;
|
||||||
|
char buf[96]; snprintf(buf, sizeof buf, "zynk %s", VERSION);
|
||||||
|
irc_msg(s, reply_target, buf);
|
||||||
|
log_stamp(); fprintf(stderr, CLR_BLUE "VERSION from %s in %s" CLR_RESET "\n", src_nick, reply_target);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int cmd_quit(Session *s, const char *msg, const char *reply_target, const char *src_nick, const char *tgt) {
|
static 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 (strcmp(msg, "!quit") != 0 && strcmp(msg, "!die") != 0) return 0;
|
||||||
if (tgt[0] == '#' && !chan_is_op(tgt, src_nick)) {
|
if (tgt[0] == '#' && !chan_is_op(tgt, src_nick)) {
|
||||||
|
|
@ -1257,6 +1268,7 @@ static void handle_privmsg(Session *s, const char *params, const char *src_nick)
|
||||||
const char *reply_target = (tgt[0] == '#') ? tgt : src_nick;
|
const char *reply_target = (tgt[0] == '#') ? tgt : src_nick;
|
||||||
if (cmd_zynk(s, msg, reply_target, src_nick, tgt)) return;
|
if (cmd_zynk(s, msg, reply_target, src_nick, tgt)) return;
|
||||||
if (cmd_ping(s, msg, reply_target, src_nick)) return;
|
if (cmd_ping(s, msg, reply_target, src_nick)) return;
|
||||||
|
if (cmd_version(s, msg, reply_target, src_nick)) return;
|
||||||
if (cmd_quit(s, msg, reply_target, src_nick, tgt)) return;
|
if (cmd_quit(s, msg, reply_target, src_nick, tgt)) return;
|
||||||
if (cmd_weather(s, msg, reply_target, src_nick)) return;
|
if (cmd_weather(s, msg, reply_target, src_nick)) return;
|
||||||
if (cmd_forecast(s, msg, reply_target, src_nick)) return;
|
if (cmd_forecast(s, msg, reply_target, src_nick)) return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue