2
0
Fork 0
forked from zynk/zynk

Reduced MAX_HISTORY, moved LOAD_FUNC macro, added irc_reply docs. (0.40.9)

- Reduced MAX_HISTORY from 100 to 12 to decrease AI context memory usage.
- Moved LOAD_FUNC macro from zynk.h to db.h for better code organization (closer to its usage in sqlite_init_lib).
- Added comprehensive doc comment to irc_reply() function describing its nick-prefixing behavior for channel messages.
- Reordered includes in zynk.c to alphabetical order.
This commit is contained in:
Johannes Findeisen 2026-07-24 19:55:36 +02:00
commit 8861e3201a
6 changed files with 34 additions and 10 deletions

17
irc.h
View file

@ -242,6 +242,23 @@ void irc_msg(Session *s, const char *t, const char *txt) {
free(clean);
}
/*
* irc_reply - Send a PRIVMSG with an automatic nick prefix for channels.
*
* Wraps irc_msg() to provide consistent addressing in channel conversations.
* When the target is a channel (starts with '#'), prepends "nick: " to the
* message so other users can see which user the bot is replying to. When the
* target is a private message (does not start with '#'), sends the text as-is
* without a prefix. Handles NULL and empty text safely.
*
* Parameters:
* s - The IRC session.
* target - The target channel name or nick.
* nick - The nick of the user who triggered the response.
* txt - The message text to send.
*
* Returns: void.
*/
void irc_reply(Session *s, const char *target, const char *nick, const char *txt) {
if (target && target[0] == '#' && nick && *nick) {
char prefixed[2048];