feat(history): nodb backlog — statusbar opt-in, /history off persistence, /privacy runtime switch, /correction fix #116

Manually merged
jabber.developer merged 4 commits from feat/no-db-backlog-114 into master 2026-05-16 15:34:25 +00:00
Collaborator

Closes #114

Implements all open items from the nodb backlog (#114) on top of master.

statusbar

  • New pref PREF_STATUSBAR_SHOW_DBBACKEND (default ON) gates the [sqlite] / [flatfile] indicator next to the JID
  • Toggle via /statusbar show dbbackend / /statusbar hide dbbackend
  • Listed in /statusbar setting view + included in tab autocomplete

/history off|on now actually stops persistence

Before: /history off only hid existing messages on chat-window open — writes continued, only reads were affected. Inconsistent with the user mental model.

Now:

  • /history offPREF_HISTORY=false, PREF_DBLOG=off, PREF_CHLOG=false
  • /history onPREF_HISTORY=true, PREF_CHLOG=true; if PREF_DBLOG was off, it is restored to on (sqlite default)

Help text updated to reflect the new semantics.

/logging cleanup

  • Removed /logging chat on|off — chat-log persistence is now controlled exclusively by /history
  • Kept /logging group on|off (separate concept for MUC text logs)
  • All hints use '/logging chat on' to enable replaced with use '/history on'
  • Autocomplete + help text updated

/privacy logging runtime switch

  • Single-pass validation across {on, off, redact, flatfile}
  • Backend-switching values (on, flatfile) now take effect immediately when connected via log_database_switch_backend() — same UX as /history switch. Previously the user had to reconnect for a backend change to apply
  • off and redact only flip pref bits and keep the live backend open (off = stop writing, redact = [REDACTED] body)
  • Updated help text to drop the misleading "takes effect on next connection" note

/correction off — fix carbon / outgoing path leak

win_print_outgoing and win_print_outgoing_with_receipt were calling _win_correct unconditionally, ignoring PREF_CORRECTION_ALLOW. Result: a peer's correction reflected back via XEP-0280 carbons — or the user's own /correct invocation — was applied in-buffer regardless of the pref.

Now both call sites gate on PREF_CORRECTION_ALLOW, matching the incoming-message paths in win.c:1505,1531,1543. With /correction off, every correction (incoming, outgoing, carbon-reflected) is rendered as a fresh message instead of mutating an existing buffer entry.

Style

Two local g_strndup allocations in src/database_flatfile.c switched from char* + manual g_free to auto_gchar gchar*. A broader sweep is left as a separate pass — many remaining char* declarations in flatfile/parser/verify have transfer-ownership semantics that don't translate cleanly to auto_gchar.

Test plan

  • /statusbar hide dbbackend removes the [sqlite]/[flatfile] indicator; /statusbar show dbbackend restores it; /statusbar listing shows the new toggle
  • /history off → outgoing message → no row added to sqlite, no line appended to flatfile; /history on → restored
  • /logging chat on returns "Unknown command", /logging group off still works
  • /privacy logging flatfile while connected → backend swaps live without reconnect; status bar updates to [flatfile]; same for /privacy logging on[sqlite]
  • /correction off → peer corrects a message → both original and corrected message visible separately. Same for /correct typed by the user
  • Build clean (no -W warnings); /correction on regression unaffected
Closes #114 Implements all open items from the nodb backlog (#114) on top of master. ## statusbar - New pref `PREF_STATUSBAR_SHOW_DBBACKEND` (default **ON**) gates the `[sqlite]` / `[flatfile]` indicator next to the JID - Toggle via `/statusbar show dbbackend` / `/statusbar hide dbbackend` - Listed in `/statusbar` setting view + included in tab autocomplete ## `/history off|on` now actually stops persistence Before: `/history off` only hid existing messages on chat-window open — writes continued, only reads were affected. Inconsistent with the user mental model. Now: - `/history off` → `PREF_HISTORY=false`, `PREF_DBLOG=off`, `PREF_CHLOG=false` - `/history on` → `PREF_HISTORY=true`, `PREF_CHLOG=true`; if `PREF_DBLOG` was `off`, it is restored to `on` (sqlite default) Help text updated to reflect the new semantics. ## `/logging` cleanup - Removed `/logging chat on|off` — chat-log persistence is now controlled exclusively by `/history` - Kept `/logging group on|off` (separate concept for MUC text logs) - All hints `use '/logging chat on' to enable` replaced with `use '/history on'` - Autocomplete + help text updated ## `/privacy logging` runtime switch - Single-pass validation across `{on, off, redact, flatfile}` - Backend-switching values (`on`, `flatfile`) now take effect **immediately when connected** via `log_database_switch_backend()` — same UX as `/history switch`. Previously the user had to reconnect for a backend change to apply - `off` and `redact` only flip pref bits and keep the live backend open (off = stop writing, redact = `[REDACTED]` body) - Updated help text to drop the misleading "takes effect on next connection" note ## `/correction off` — fix carbon / outgoing path leak `win_print_outgoing` and `win_print_outgoing_with_receipt` were calling `_win_correct` unconditionally, ignoring `PREF_CORRECTION_ALLOW`. Result: a peer's correction reflected back via XEP-0280 carbons — or the user's own `/correct` invocation — was applied in-buffer regardless of the pref. Now both call sites gate on `PREF_CORRECTION_ALLOW`, matching the incoming-message paths in `win.c:1505,1531,1543`. With `/correction off`, every correction (incoming, outgoing, carbon-reflected) is rendered as a fresh message instead of mutating an existing buffer entry. ## Style Two local `g_strndup` allocations in `src/database_flatfile.c` switched from `char*` + manual `g_free` to `auto_gchar gchar*`. A broader sweep is left as a separate pass — many remaining `char*` declarations in flatfile/parser/verify have transfer-ownership semantics that don't translate cleanly to `auto_gchar`. ## Test plan - [x] `/statusbar hide dbbackend` removes the `[sqlite]/[flatfile]` indicator; `/statusbar show dbbackend` restores it; `/statusbar` listing shows the new toggle - [x] `/history off` → outgoing message → no row added to sqlite, no line appended to flatfile; `/history on` → restored - [ ] `/logging chat on` returns "Unknown command", `/logging group off` still works - [x] `/privacy logging flatfile` while connected → backend swaps live without reconnect; status bar updates to `[flatfile]`; same for `/privacy logging on` → `[sqlite]` - [ ] `/correction off` → peer corrects a message → both original and corrected message visible separately. Same for `/correct` typed by the user - [ ] Build clean (no -W warnings); `/correction on` regression unaffected
jabber.developer2 added 1 commit 2026-05-08 07:26:12 +00:00
feat(history): nodb backlog (#114)
Some checks failed
CI Code / Check spelling (pull_request) Successful in 22s
CI Code / Check coding style (pull_request) Successful in 37s
CI Code / Linux (debian) (pull_request) Failing after 4m39s
CI Code / Linux (ubuntu) (pull_request) Failing after 4m46s
CI Code / Code Coverage (pull_request) Failing after 5m20s
CI Code / Linux (arch) (pull_request) Failing after 10m11s
5720cd2c4e
Implements all open items from the nodb backlog:

statusbar
- PREF_STATUSBAR_SHOW_DBBACKEND (default ON) gates the [sqlite] /
  [flatfile] indicator; toggle via "/statusbar show|hide dbbackend"

/history off|on
- "/history off" now stops persistence as well as hiding history on
  open: sets PREF_DBLOG=off + PREF_CHLOG=false in addition to
  PREF_HISTORY=false
- "/history on" restores persistence (re-enabling PREF_DBLOG=on if
  it was off) and PREF_CHLOG, in addition to PREF_HISTORY=true

/logging
- Removed the "/logging chat on|off" subcommand — chat-log
  persistence is now controlled exclusively by /history; the
  command kept only "/logging group on|off" for MUC logs
- All "use '/logging chat on' to enable" hints replaced with
  "/history on"

/privacy logging
- Single-pass validation across {on, off, redact, flatfile}
- Backend-switching values (on, flatfile) now take effect
  immediately when connected (via log_database_switch_backend),
  matching "/history switch" behaviour; off/redact only flip
  pref bits and keep the live backend open
- Updated help text to reflect runtime switching

/correction off
- win_print_outgoing and win_print_outgoing_with_receipt now gate
  _win_correct on PREF_CORRECTION_ALLOW, matching incoming-msg
  paths. Previously a peer's correction reflected via XEP-0280
  carbons (or the user's own /correct invocation) was applied
  in-buffer regardless of the pref

style
- Two local g_strndup allocations in database_flatfile.c switched
  from char* with manual g_free to auto_gchar gchar*
jabber.developer2 force-pushed feat/no-db-backlog-114 from 5720cd2c4e to b9a8ba6cfa 2026-05-08 07:46:05 +00:00 Compare
jabber.developer2 force-pushed feat/no-db-backlog-114 from b9a8ba6cfa to 102c32c744 2026-05-16 08:44:25 +00:00 Compare
jabber.developer2 changed title from WIP: feat(history): nodb backlog — statusbar opt-in, /history off persistence, /privacy runtime switch, /correction fix to feat(history): nodb backlog — statusbar opt-in, /history off persistence, /privacy runtime switch, /correction fix 2026-05-16 08:50:50 +00:00
jabber.developer requested changes 2026-05-16 13:37:10 +00:00
Dismissed
jabber.developer left a comment
Owner

Generally LGTM, but certain features require further polishing. Please address the pointed out issues

Generally LGTM, but certain features require further polishing. Please address the pointed out issues
@@ -1665,3 +1666,3 @@
CMD_TAG_CHAT)
CMD_SYN(
"/logging chat|group on|off")
"/logging group on|off")

I suggest we remove this command as well

I suggest we remove this command as well
jabber.developer marked this conversation as resolved
@@ -1887,0 +1889,4 @@
} else {
cons_show("Show database backend (/statusbar) : OFF");
}

console.c:1957
The following lines are still present

void
cons_logging_setting(void)
{
    if (prefs_get_boolean(PREF_CHLOG))
        cons_show("Chat logging (/logging chat)                : ON");
    else
        cons_show("Chat logging (/logging chat)                : OFF");

    if (prefs_get_boolean(PREF_GRLOG))
        cons_show("Groupchat logging (/logging group)          : ON");
    else
        cons_show("Groupchat logging (/logging group)          : OFF");
}
console.c:1957 The following lines are still present ```c void cons_logging_setting(void) { if (prefs_get_boolean(PREF_CHLOG)) cons_show("Chat logging (/logging chat) : ON"); else cons_show("Chat logging (/logging chat) : OFF"); if (prefs_get_boolean(PREF_GRLOG)) cons_show("Groupchat logging (/logging group) : ON"); else cons_show("Groupchat logging (/logging group) : OFF"); } ```
jabber.developer marked this conversation as resolved
@@ -1601,3 +1601,3 @@
const char* myjid = connection_get_fulljid();
if (!_win_correct(window, message, id, replace_id, myjid)) {
if (!prefs_get_boolean(PREF_CORRECTION_ALLOW) || !_win_correct(window, message, id, replace_id, myjid)) {

Doesn't affect messages fetched from DB though

Doesn't affect messages fetched from DB though
jabber.developer marked this conversation as resolved
jabber.developer2 added 1 commit 2026-05-16 14:16:54 +00:00
fix(history): address PR #116 review feedback
Some checks failed
CI Code / Check spelling (pull_request) Successful in 18s
CI Code / Check coding style (pull_request) Failing after 34s
CI Code / Code Coverage (pull_request) Successful in 2m46s
CI Code / Linux (debian) (pull_request) Successful in 4m40s
CI Code / Linux (ubuntu) (pull_request) Successful in 5m0s
CI Code / Linux (arch) (pull_request) Successful in 5m40s
b670778aa3
- console: drop orphaned `Chat logging (/logging chat)` lines from
  cons_logging_setting() and cons_privacy_setting() — the /logging chat
  subcommand was removed, PREF_CHLOG now tracks PREF_HISTORY implicitly
- command: deprecate /logging command. It now prints a single notice
  pointing to /history; CMD_PREAMBLE trimmed (min_args=0, no
  setting_func, syntax/args/examples dropped); subcommand 'group'
  removed from autocomplete
- sqlite: gate LMC merge in _sqlite_get_previous_chat() on
  PREF_CORRECTION_ALLOW. When /correction is off, return original and
  correction rows as separate messages instead of merging via
  COALESCE/LEFT JOIN — matches the flatfile load path and the PR's
  stated semantics for /correction off
jabber.developer2 force-pushed feat/no-db-backlog-114 from b670778aa3 to d8ce4ca80e 2026-05-16 14:22:13 +00:00 Compare
jabber.developer requested changes 2026-05-16 14:22:32 +00:00
Dismissed
src/ui/console.c Outdated
@@ -1951,4 +1954,2 @@
cons_show("Chat logging (/logging chat) : OFF");
if (prefs_get_boolean(PREF_GRLOG))
cons_show("Groupchat logging (/logging group) : ON");

refers to now-invalid command this method, as well as cons_show_log_prefs, need to be properly dealt with.

refers to now-invalid command this method, as well as `cons_show_log_prefs`, need to be properly dealt with.
jabber.developer2 force-pushed feat/no-db-backlog-114 from d8ce4ca80e to df5b39fa7c 2026-05-16 14:53:25 +00:00 Compare
jabber.developer approved these changes 2026-05-16 15:06:23 +00:00
jabber.developer left a comment
Owner

LGTM

LGTM
jabber.developer added 1 commit 2026-05-16 15:08:06 +00:00
chore(config): add .kilo/ and .roo/ to gitignore
All checks were successful
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Code Coverage (pull_request) Successful in 2m43s
CI Code / Linux (debian) (pull_request) Successful in 4m39s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m57s
CI Code / Linux (arch) (pull_request) Successful in 5m39s
88958c0a37
jabber.developer added 1 commit 2026-05-16 15:25:26 +00:00
fix(command): update logging command argument constraints
All checks were successful
CI Code / Check spelling (pull_request) Successful in 17s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Code Coverage (pull_request) Successful in 2m45s
CI Code / Linux (debian) (pull_request) Successful in 4m39s
CI Code / Linux (ubuntu) (pull_request) Successful in 4m53s
CI Code / Linux (arch) (pull_request) Successful in 5m42s
129eddadd7
jabber.developer manually merged commit 2952466abd into master 2026-05-16 15:34:25 +00:00
Sign in to join this conversation.
No description provided.