From 3b863d581d0bf8b8d17f5d82cb667e877cd55cdf Mon Sep 17 00:00:00 2001 From: hanez Date: Fri, 24 Jul 2026 01:42:13 +0200 Subject: [PATCH] Strip trailing space from wttr.in weather descriptions. (0.40.6) - Fixed trailing space in weather descriptions from wttr.in (e.g. 'Partly Cloudy ' -> 'Partly Cloudy'), which caused a stray space before the closing parenthesis in !forecast full output (e.g. '(Partly Cloudy )' instead of '(Partly Cloudy)'). - Applied the same trailing-space fix to the cond field used by non-full !forecast and !weather. - Updated CHANGELOG.md with 0.40.6 entry. --- CHANGELOG.md | 4 ++++ CMakeLists.txt | 2 +- README.md | 6 ++++++ cmd_forecast.h | 4 ++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e4e72e..5d997f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +2026.07.24 - Strip trailing space from wttr.in weather descriptions. (0.40.6) + +- Fixed trailing space in weather descriptions from wttr.in (e.g. `"Partly Cloudy "` → `"Partly Cloudy"`), which caused a stray space before the closing parenthesis in `!forecast full` output (e.g. `(Partly Cloudy )` instead of `(Partly Cloudy)`). Applied the same fix to the non-full `cond` field used by `!forecast` and `!weather`. + 2026.07.23 - Full forecast mode, 24h sunrise/moon times, startup version. (0.40.5) - 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. diff --git a/CMakeLists.txt b/CMakeLists.txt index 3713340..8d700d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13) -project(zynk VERSION 0.40.5 LANGUAGES C) +project(zynk VERSION 0.40.6 LANGUAGES C) # Prefer C99; the code is compatible with C99/C11 set(CMAKE_C_STANDARD 99) diff --git a/README.md b/README.md index 45ae054..c2f1b14 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,12 @@ An IRC bot in C. Features a key-value store backed by SQLite3, weather lookups via wttr.in, stock quotes, calculator, time, user tracking, and AI-powered replies. +## This is a fork! + +This is a fork from my good friend Armin's [calc](https://codeberg.org/armin/calc) bot. He started the project, but he is working on a lot of awesome other things like plugins (VST and AU) for your DAW right now. So, I forked this awesome code, and I am working on this now. + +I want to thank Armin for his work and for sharing his code with me. Take a look at [his profile here to see his awesome work](https://codeberg.org/armin). + ## Features - **Key-Value Store**: Persist facts, notes, or any data with `!zynk key = value`; Overwrite existing keys with `!zynk! key = value` diff --git a/cmd_forecast.h b/cmd_forecast.h index 4b6afe0..36fcc07 100644 --- a/cmd_forecast.h +++ b/cmd_forecast.h @@ -34,7 +34,7 @@ static int parse_forecast_day(const char *p, const char *obj_end, if (hb && hb < obj_end) { hb++; const char *vb = strstr(hb, "\"value\": \""); - if (vb && vb < obj_end) { vb += 9; const char *vq = strchr(vb, '"'); if (vq && vb < obj_end) { size_t l = vq - vb; if (l >= cond_sz) l = cond_sz - 1; memcpy(cond_out, vb, l); cond_out[l] = 0; } } + if (vb && vb < obj_end) { vb += 9; const char *vq = strchr(vb, '"'); if (vq && vb < obj_end) { size_t l = vq - vb; if (l >= cond_sz) l = cond_sz - 1; memcpy(cond_out, vb, l); cond_out[l] = 0; while (l > 0 && cond_out[l-1] == ' ') cond_out[--l] = 0; } } } } return (date_out[0] != 0) ? 1 : 0; @@ -258,7 +258,7 @@ char *fetch_forecast_full(const char *city_url, const char *city_display) { if (db && db < obj_end) { db++; char *vb = strstr(db, "\"value\": \""); - if (vb && vb < obj_end) { vb += 10; char *vq = strchr(vb, '"'); if (vq && vq < obj_end) { size_t l = vq - vb; if (l > sizeof desc - 1) l = sizeof desc - 1; memcpy(desc, vb, l); desc[l] = 0; } } + if (vb && vb < obj_end) { vb += 10; char *vq = strchr(vb, '"'); if (vq && vq < obj_end) { size_t l = vq - vb; if (l > sizeof desc - 1) l = sizeof desc - 1; memcpy(desc, vb, l); desc[l] = 0; while (l > 0 && desc[l-1] == ' ') desc[--l] = 0; } } } } }