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.
This commit is contained in:
parent
d4c1b7cfcf
commit
3b863d581d
4 changed files with 13 additions and 3 deletions
|
|
@ -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)
|
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.
|
- 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.
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 3.13)
|
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
|
# Prefer C99; the code is compatible with C99/C11
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
|
|
||||||
|
|
@ -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.
|
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
|
## Features
|
||||||
|
|
||||||
- **Key-Value Store**: Persist facts, notes, or any data with `!zynk key = value`; Overwrite existing keys with `!zynk! key = value`
|
- **Key-Value Store**: Persist facts, notes, or any data with `!zynk key = value`; Overwrite existing keys with `!zynk! key = value`
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ static int parse_forecast_day(const char *p, const char *obj_end,
|
||||||
if (hb && hb < obj_end) {
|
if (hb && hb < obj_end) {
|
||||||
hb++;
|
hb++;
|
||||||
const char *vb = strstr(hb, "\"value\": \"");
|
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;
|
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) {
|
if (db && db < obj_end) {
|
||||||
db++;
|
db++;
|
||||||
char *vb = strstr(db, "\"value\": \"");
|
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; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue