- Add !wp <search terms> command: searches Wikipedia via MediaWiki API
(action=query&list=search), displays article titles, snippets, and links.
Single-result mode fetches the first chapter via Extracts API (exchars=800);
multi-result mode shows a numbered list with short snippets and per-result
Read full article links.
- Add self-contained JSON parser helpers: wp_json_get_string(),
wp_json_next_array_item(), wp_decode_json_string() with \uXXXX Unicode
support.
- Add wp_url_encode() (RFC 3986), wp_codepoint_to_utf8(), wp_strip_html(),
wp_collapse_spaces(), wp_hex_digit().
- Add WITH_WP CMake feature toggle (ON by default, HAS_CMD_WP compile def).
- Add !wp to the !help command listing.
- Add doc comments to all 9 functions in cmd_wp.h.
- Update CHANGELOG.md with 0.43.0 entry.
- Update README.md: add Wikipedia to features list, feature toggles table,
IRC commands utilities table, and minimal build command.
Phase 1: Incoming Protocol-Level Protection
- Added MAX_LINES_PER_POLL = 50 constant to limit lines processed per
poll iteration in irc_feed(), preventing burst flooding.
- Added poll_lines_left counter to Session struct, reset each poll cycle.
- Changed RateLimitEntry to track by user@host instead of nick, preventing
trivial bypass via nick cycling.
- Parse userhost from IRC prefix (nick!user@host) in irc_handle().
- Added violation tracking to RateLimitEntry for escalating penalties.
Phase 2: Outgoing Message Throttling
- Added OUTGOING_DELAY_MS = 100 constant for minimum delay between sends.
- Modified net_send() with timestamp-based throttling using clock_gettime().
- Added 200ms delay between lines in !gitlog output (cmd_gitlog.h).
- Added 150ms delay between AI response chunks (ai.h).
Phase 3: Rate Limit Improvements
- Increased RATE_LIMIT_MAX from 8 to 32 for larger tracking buffer.
- Added TELL_DELIVER_MAX = 5 to limit messages per nick delivery.
- Added AI_COOLDOWN_SECS = 5 to prevent rapid AI query re-submission.
Phase 4: Command-Specific Fixes
- Added rate_limit_check() to cmd_greeting_or_chat.h for casual chat.
- Limited tell_deliver() to 5 messages per nick, excess stays queued.
- Added 5-second cooldown after AI query completion before next query.
Files modified: zynk.h, zynk.c, irc.h, net.h, ai.h, db.h, and all
19 command header files to pass current_userhost to rate_limit_check().
- Moved doc comment block for yt_url_encode() from top of cmd_yt.h
to immediately before the function definition for better readability.
- Added doc comments to volatile sig_atomic_t running variable describing
its purpose as main loop control flag and async-signal-safety.
- Added doc comments to start_time variable explaining its role in
uptime calculation.
- Updated CHANGELOG.md to reflect yt_url_encode() doc comment move.
Added new !yt command (cmd_yt.h) that fetches the title and channel name
of a YouTube video using the YouTube oEmbed API. The video URL is
percent-encoded via a new yt_url_encode() helper before being passed as a
query parameter. The JSON response is parsed for 'title' and 'author_name'
fields using the existing json_find() helper, and the result is formatted
as 'Title - Channel'.
- New file: cmd_yt.h with yt_url_encode() and cmd_yt() command handler
- CMakeLists.txt: added WITH_YT feature toggle (ON by default)
- zynk.c: added conditional #include for cmd_yt.h
- irc.h: added cmd_yt() dispatch in handle_privmsg()
- cmd_help.h: added !yt <url> to the help listing
- zynk.c: added doc comments to json_find() function
- cmd_yt.h: added doc comments to yt_url_encode() and cmd_yt()
- CHANGELOG.md: added 0.41.0 entry documenting all changes
- README.md: updated feature summary, features list, feature toggles
table, minimal build command, and IRC commands utilities table
- 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.
- Added 'full' keyword to !forecast: '!forecast frankfurt full' shows
per-day detail lines with weather description, sunrise/sunset, and
moonrise/moonset in 24-hour format, sent as separate IRC messages.
- Added to_24h() helper to convert wttr.in's 12-hour AM/PM astronomy
times to 24-hour format (e.g. '05:20 AM' -> '05:20').
- Fixed missing first letter of weather descriptions in full mode
('value' offset was 11 instead of 10, skipping the first char).
- Startup message now includes the version: '[zynk 0.40.5] starting up'.
- Added doc comments to to_24h(), find_day_obj(), and other forecast
helper functions with full parameter documentation.
- Fixed 'Not implemented...' fallback to only trigger when ! is
followed by a letter (e.g. !foo), so bare ! or !!! no longer
produce the message.
- Updated README.md to document !forecast [city] [full] syntax.
- Updated CHANGELOG.md with 0.40.5 entry.
- !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)
- Added strip_opencode_header(): removes the opencode header line (e.g. '> plan · big-pickle') and any trailing blank lines from AI responses before sending to IRC.
- Previous strip_before_double_space() approach failed because ANSI escape codes in the raw opencode output prevented strstr() from matching literal double spaces.
- New approach runs strip_formatting() first to clean up ANSI codes, then detects the '> ' prefix and strips the header line plus blank lines after it.
- Pipeline order: format strip -> header strip -> phrase strip.
- Version bumped to 0.38.3.
- Added optional full keyword to !gitlog and !changelog for showing
full commit messages and changelog entries instead of just headers.
- !gitlog full uses git log (without --oneline) and strips leading
indentation from commit blocks, collapses multiple spaces.
- !changelog full collects full entry text with bullet points and
shows the newest entries (first N in file, not last N).
- Added optional pull argument to !rebuild: !rebuild pull runs git
pull before make clean/make, plain !rebuild only rebuilds.
- Added collapse_spaces() call in !gitlog oneline path to remove
double spaces in compact output.
- Changed default GITLOG_COUNT and CHANGELOG_COUNT from 5 to 1.
- Reduced GITLOG_MAX from 10 to 5.
- Updated !help text to document [full] and [pull] options.
- Updated README.md with full option for !gitlog/!changelog and
pull option for !rebuild.
- Added CHANGELOG.md entry for v0.38.2.
- Op users in channels are now exempt from rate limiting: rate_limit_check()
calls chan_is_op() and allows ops through immediately, so ops can use
commands without being throttled.
- Updated rate_limit_check() signature to accept a channel parameter;
all 20 call sites now pass reply_target so the exemption works for
both channel and DM contexts.
- Removed unused AI_REPLY_MAX constant from the enum.
- Removed stale commented-out #include <sys/utsname.h>.
- Version bumped to 0.38.1.
- Added !changelog [count] command: displays the latest changelog entries
from CHANGELOG.md. Defaults to 5 entries (CHANGELOG_COUNT), accepts 1-10
as count. Each entry title is sent as a separate IRC message with a
200ms delay to avoid IRC server flood protection.
- Reduced GITLOG_MAX and CHANGELOG_MAX from 20 to 10.
- Rewrote cmd_changelog to use getline() for robust line reading and
isdigit() checks for reliable date pattern detection.
- Updated !help to list !changelog.
- Updated README.md with !changelog documentation and corrected max values.
- Added CHANGELOG.md entry for v0.38.0.
- Version bumped to 0.38.0.
Added !rebuild op-only command that runs git pull, make clean, and make
in sequence, then triggers hot reload on success. Reports build errors
from stderr if any step fails. Updated !help and README.md docs.
seen_update() used SQLite's datetime('now') which returns UTC, causing
!seen to show wrong times (e.g. 16:00 instead of 18:00 on UTC+2).
Changed to datetime('now','localtime') so seen timestamps match the
system's local time.
Version bumped to 0.36.1.
Add detailed function documentation for cmd_gitlog() matching the
existing style used throughout zynk.c. Describes the fork/exec
pattern for running git log, output handling, rate limiting, and
clamping behavior for the count argument.
Updated CHANGELOG.md 0.36.0 entry to reflect this addition.
Add !gitlog [count] IRC command that runs 'git log --oneline' and
sends each commit as a separate PRIVMSG. Defaults to GITLOG_COUNT (5)
commits when no argument is provided; accepts 1-20 as count.
- Fork/exec pattern consistent with existing !calc command
- Rate-limited per-nick like all other commands
- Listed in !help output
- Added git to README.md requirements
- Documented in README.md utilities section
- Added changelog entry for v0.36.0
The !time command now outputs only date and time (YYYY-MM-DD HH:MM:SS)
without the timezone abbreviation. This keeps responses shorter and
cleaner in IRC. Removed the dead abbreviation-matching code from
tz_format() which previously mapped 45 IANA timezone names to their
respective abbreviations (CEST, EDT, JST, etc.). Updated README to
reflect the new output format.
- Added doc comments (/* ... */) to all 14 undocumented static functions in
zynk.c matching the existing documentation style (function name, description,
Parameters, Returns sections):
* DB ops: seen_update, seen_lookup, tell_add, tell_deliver
* String utils: valid_irc_word, normalize_city, collapse_spaces
* Command handlers: cmd_reload, cmd_time, cmd_seen, cmd_tell, cmd_greeting_or_chat
* Timezone helpers: tz_lookup, tz_format
- Added complete reference table of all 45 built-in timezones to README.md
with region, UTC offset, and DST support status, so users know which
timezones work without tzdata installed.
- Updated CHANGELOG.md v0.35.5 entry to reflect these additions.
- Clean build, zero warnings.
The !calc command was broken because the expression was never piped to
bc's stdin - only stdout was set up via a pipe. Added a second pipe
to feed the expression into bc before reading the result.
- Bumped version to 0.35.1
bc reads from stdin but the child process never wrote the expression
to it, causing empty output. Added a second pipe to feed the expression
into bc's stdin before reading the result from stdout.
New IRC commands:
- !calc <expr>: evaluate math via bc -l (arithmetic, powers, trig, log, vars)
- !time [tz]: show current time in any IANA timezone
- !seen <nick>: track/query last-seen activity (auto-updated on speak/part/quit)
- !tell <nick> <msg>: leave offline messages, delivered when target speaks
Database:
- Added 'seen' table for user activity tracking (nick, timestamp, channel, action)
- Added 'tell' table for pending offline messages
Other changes:
- Updated !help to list all new commands
- Updated README.md with detailed docs for all commands including !calc
expression syntax and !time timezone examples
- Bumped version to 0.35.0
When an AI query fails (opencode exits non-zero), the bot previously
sent a generic 'AI query failed (opencode exited with error)' message
to IRC, discarding all useful output. Users had no way to diagnose why
the query failed.
Changes:
- Redirect opencode's stderr into the capture pipe instead of /dev/null,
so error messages that go to stderr are no longer lost.
- On non-zero exit, include the actual captured output in the error
message sent to IRC: 'AI error (exit N): <output>' (truncated to
4000 chars). If no output was captured, show 'AI error (exit N, no
output)' instead.
- Applied strip_formatting() to the error output before sending so
ANSI codes and markdown don't leak into IRC.
- Bumped VERSION to 0.34.3.
Add collapse_spaces() utility that reduces runs of whitespace to a
single space. Applied to fetch_forecast() output and the !stock
response buffer before sending to IRC, fixing double spaces that
appeared when wttr.in returned an empty weather condition string
(e.g. "15°C / Sun 20 Jul" instead of "15°C / Sun 20 Jul").
Bump version to 0.34.2.
strptime on musl (Alpine Linux) does not compute tm_wday from the
parsed date, unlike glibc. Call mktime() after strptime to normalize
the struct tm and reliably compute the day of week on all platforms.
wttr.in now serves a full HTML page when it detects a browser-like
User-Agent string. Replaced the fake Firefox UA in run_curl with
"zynk/VERSION" so weather, forecast, and stock requests all return
the expected format again.
- Fixed hot reload: after TLS session restore, the bot now does a fresh
IRC connection and re-sends PASS/NICK/USER to re-register with the
server, fixing the issue where channels were never re-joined after
!reload or !restart.
- Removed ZYNK_RESTORE_FD env var approach; reload_try_restore now
restores settings and returns 1 to trigger a fresh connect.
- Added !hello command for casual greeting.
- Added atomic build rule in Makefile (compile to .tmp, then mv).
- Added comprehensive function-level documentation across the entire
codebase (~80 new doc comments).