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:
parent
feccad5853
commit
8861e3201a
6 changed files with 34 additions and 10 deletions
|
|
@ -1,3 +1,10 @@
|
|||
24.07.24 - 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.
|
||||
|
||||
26.07.24 - Nick-prefixed channel replies for all non-admin commands. (0.40.8)
|
||||
|
||||
- Added `irc_reply()`: a new IRC response helper that automatically prepends the sender's nick to channel messages (e.g. `"nick: pong!"`), while leaving private-message responses unmodified. This makes it clear which user the bot is addressing in busy channels.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(zynk VERSION 0.40.8 LANGUAGES C)
|
||||
project(zynk VERSION 0.40.9 LANGUAGES C)
|
||||
|
||||
# Prefer C99; the code is compatible with C99/C11
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
|
|
|
|||
6
db.h
6
db.h
|
|
@ -22,6 +22,12 @@ int (*db_bind_int64)(void*,int,long long);
|
|||
long long (*db_last_rowid)(void*);
|
||||
void *db_handle;
|
||||
|
||||
#define LOAD_FUNC(var, name) do { \
|
||||
union { void *p; typeof(var) f; } _u; \
|
||||
_u.p = dlsym(sqlite_lib, name); \
|
||||
var = _u.f; \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
* sqlite_init_lib - Dynamically load libsqlite3 and resolve function symbols.
|
||||
*
|
||||
|
|
|
|||
17
irc.h
17
irc.h
|
|
@ -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];
|
||||
|
|
|
|||
4
zynk.c
4
zynk.c
|
|
@ -4,10 +4,10 @@
|
|||
* Licensed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include "zynk.h"
|
||||
#include "net.h"
|
||||
#include "ai.h"
|
||||
#include "net.h"
|
||||
#include "tls.h"
|
||||
#include "zynk.h"
|
||||
|
||||
int tls_verify = 1;
|
||||
|
||||
|
|
|
|||
8
zynk.h
8
zynk.h
|
|
@ -47,7 +47,7 @@ enum {
|
|||
MAX_CHAN_OPS = 64,
|
||||
RATE_LIMIT_WINDOW = 10,
|
||||
RATE_LIMIT_MAX = 8,
|
||||
MAX_HISTORY = 100,
|
||||
MAX_HISTORY = 12,
|
||||
GITLOG_COUNT = 1,
|
||||
GITLOG_MAX = 10,
|
||||
CHANGELOG_COUNT = 1,
|
||||
|
|
@ -86,12 +86,6 @@ extern void (*db_free)(void*);
|
|||
extern int (*db_bind_int64)(void*,int,long long);
|
||||
extern long long (*db_last_rowid)(void*);
|
||||
|
||||
#define LOAD_FUNC(var, name) do { \
|
||||
union { void *p; typeof(var) f; } _u; \
|
||||
_u.p = dlsym(sqlite_lib, name); \
|
||||
var = _u.f; \
|
||||
} while(0)
|
||||
|
||||
#define SQLITE_OK 0
|
||||
#define SQLITE_ERROR 1
|
||||
#define SQLITE_DONE 101
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue