Commit graph

67 commits

Author SHA1 Message Date
52b1627d69 Full mode for !gitlog/!changelog, optional pull for !rebuild. (0.38.2)
- 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.
2026-07-21 14:08:53 +02:00
6ad57cc263 Exempt ops from rate limiting. (0.38.1)
- 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.
2026-07-21 03:16:19 +02:00
cf5ca7ff21 CHANGELOG.md date fix and added the version to the headlines of each change. (0.38.0) 2026-07-21 02:53:25 +02:00
e254b64745 Add !changelog command, reduce GITLOG_MAX and CHANGELOG_MAX (0.38.0)
- 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.
2026-07-21 02:44:54 +02:00
caa70ee448 feat: add !rebuild command for git pull + make + restart (0.37.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.
2026-07-20 23:14:26 +02:00
a260a93eb1 fix: use localtime for !seen timestamps instead of UTC
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.
2026-07-20 22:24:21 +02:00
b17e1ae1c2 docs: add doc comment to cmd_gitlog()
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.
2026-07-20 18:36:46 +02:00
01a51c17e5 feat: add !gitlog command to display recent git commits
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
2026-07-20 18:28:06 +02:00
cce110f7f5 changelog: add v0.35.6 entry for !time timezone abbreviation removal 2026-07-20 07:01:19 +02:00
9ba0601f5a feat: remove timezone abbreviation from !time response
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.
2026-07-20 06:59:46 +02:00
c3e92b27b1 readme: add tzdata as optional requirement for full timezone support 2026-07-20 06:50:35 +02:00
7ea36abf66 changelog: reorder v0.35.3/v0.35.4 entries to descending version order
The CHANGELOG lists versions from newest to oldest. v0.35.4 (README
update for pi() docs and date requirement) was accidentally placed after
v0.35.3 (pi() support in !calc). Fixed so entries read:
  0.35.5 -> 0.35.4 -> 0.35.3 -> 0.35.2 -> ...
2026-07-20 06:43:11 +02:00
e06d425760 changelog: add missing v0.35.4 entry for README update 2026-07-20 05:42:59 +02:00
18dfa64acc docs: document all undocumented functions, add built-in timezone table to README
- 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.
2026-07-20 05:06:50 +02:00
12e9e51967 fix !time: fall back to built-in timezone table when system lacks tzdata 2026-07-20 03:56:25 +02:00
9ab428ef9a update README with !calc pi() docs and date requirement 2026-07-20 03:37:17 +02:00
db809715d2 add pi() to !calc, bump to 0.35.3 2026-07-20 03:32:44 +02:00
f6431b02a5 fix !time timezone conversion: use TZ=date via popen instead of broken localtime approach 2026-07-20 03:16:01 +02:00
0906d825d3 v0.35.1: fix !calc not working (bc stdin not connected)
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
2026-07-20 02:58:11 +02:00
8dd4e35332 Fix !calc: pipe expression to bc stdin
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.
2026-07-20 02:49:53 +02:00
c554ed60d9 v0.35.0: add !calc, !time, !seen, !tell commands
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
2026-07-20 02:43:21 +02:00
ce8360111f Update CHANGELOG for v0.34.4 and v0.34.5 2026-07-20 01:44:21 +02:00
3851825370 Disabled stripping feature from 0.34.4 because it needs more testing. 2026-07-20 00:53:17 +02:00
319d49d439 Small AI response header striping fix. 2026-07-20 00:19:27 +02:00
c4d9011bdb Show full AI error output instead of generic error message
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.
2026-07-19 23:01:55 +02:00
335d35a7b8 Collapse double spaces in !forecast and !stock responses
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.
2026-07-19 19:54:36 +02:00
3727a5f72b Fix !forecast showing all days as Sunday on musl libc
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.
2026-07-19 18:39:30 +02:00
61a6a95801 Fix !weather returning HTML instead of weather data
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.
2026-07-19 16:47:49 +02:00
5d308750e1 Add !uptime command, remove !hello, bump to v0.34.0 (0.34.0) 2026-07-19 02:06:32 +02:00
476554d2cb v0.33.1: fix hot reload re-registration, add !hello, comprehensive docs
- 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).
2026-07-19 01:29:22 +02:00
76ae9cc1ef Reuse SSL sessions, added !reload and !restart command and some fixes. 2026-07-19 00:14:30 +02:00
02d73e0af6 Added !command and fixed the !forecast command. 2026-07-18 23:26:57 +02:00
0b6df45fb8 Just typo fixes. 2026-07-16 03:47:09 +02:00
a6ee428f7b Some more security fixes. 2026-07-16 03:43:00 +02:00
a3774da4ee Some fixes. 2026-07-16 03:07:33 +02:00
10c45492bc Added -opencode command-line option to set the path to the opencode binary, overriding OPENCODE_BIN. 2026-07-15 21:19:28 +02:00
999814e5df Added !help command to list available bot commands. 2026-07-15 21:12:29 +02:00
00e2153ee8 Added VERSION to zynk.c and a !command to request the program version in IRC. 2026-07-15 21:03:42 +02:00
9b5d8df361 Numerous optimizations and fixes. 2026-07-15 19:49:37 +02:00
19329f1201 zynk is removing double spaces in responses now. 2026-07-15 16:10:09 +02:00
2247b9a480 Renamed calc to zynk and refactored all relevant parts. 2026-07-14 23:52:56 +02:00
37db8d4d9b Some read/write-mode permission fixes. 2026-07-14 23:04:48 +02:00
e5ccc4ae14 Added copyright header to calc.c. 2026-07-14 22:37:37 +02:00
23404bdc49 Automatically switch to act/build mode when running code instructions. 2026-07-14 22:25:56 +02:00
56a733ddfa Added function to make changes to calc.c itself and increased the timeout by adding a constant AI_TIMEOUT to the enum. 2026-07-14 22:07:18 +02:00
3989d49c0b Set MAX_HISTORY to 100. 2026-07-14 21:53:14 +02:00
b39e1bfe50 Merge remote-tracking branch 'refs/remotes/origin/main' 2026-07-14 21:46:51 +02:00
a4f86c08f4 Some AI request and answer optimizations. 2026-07-14 21:44:07 +02:00
48986a3bf3 .gitgnore update. 2026-06-29 22:00:18 +02:00
9b6bc29ea8 Fixed multiple critical bugs including race conditions, buffer overflows, and memory visibility issues. Redesigned AI task pipeline for concurrency and improved IRC parsing security. Verified fixes by compiling and manual analysis. 2026-06-29 18:38:05 +02:00