feat(history): nodb backlog — statusbar opt-in, /history off persistence, /privacy runtime switch, /correction fix #116
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/no-db-backlog-114"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #114
Implements all open items from the nodb backlog (#114) on top of master.
statusbar
PREF_STATUSBAR_SHOW_DBBACKEND(default ON) gates the[sqlite]/[flatfile]indicator next to the JID/statusbar show dbbackend//statusbar hide dbbackend/statusbarsetting view + included in tab autocomplete/history off|onnow actually stops persistenceBefore:
/history offonly 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; ifPREF_DBLOGwasoff, it is restored toon(sqlite default)Help text updated to reflect the new semantics.
/loggingcleanup/logging chat on|off— chat-log persistence is now controlled exclusively by/history/logging group on|off(separate concept for MUC text logs)use '/logging chat on' to enablereplaced withuse '/history on'/privacy loggingruntime switch{on, off, redact, flatfile}on,flatfile) now take effect immediately when connected vialog_database_switch_backend()— same UX as/history switch. Previously the user had to reconnect for a backend change to applyoffandredactonly flip pref bits and keep the live backend open (off = stop writing, redact =[REDACTED]body)/correction off— fix carbon / outgoing path leakwin_print_outgoingandwin_print_outgoing_with_receiptwere calling_win_correctunconditionally, ignoringPREF_CORRECTION_ALLOW. Result: a peer's correction reflected back via XEP-0280 carbons — or the user's own/correctinvocation — was applied in-buffer regardless of the pref.Now both call sites gate on
PREF_CORRECTION_ALLOW, matching the incoming-message paths inwin.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_strndupallocations insrc/database_flatfile.cswitched fromchar*+ manualg_freetoauto_gchar gchar*. A broader sweep is left as a separate pass — many remainingchar*declarations in flatfile/parser/verify have transfer-ownership semantics that don't translate cleanly toauto_gchar.Test plan
/statusbar hide dbbackendremoves the[sqlite]/[flatfile]indicator;/statusbar show dbbackendrestores it;/statusbarlisting shows the new toggle/history off→ outgoing message → no row added to sqlite, no line appended to flatfile;/history on→ restored/logging chat onreturns "Unknown command",/logging group offstill works/privacy logging flatfilewhile 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/correcttyped by the user/correction onregression unaffectedImplements 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*5720cd2c4etob9a8ba6cfab9a8ba6cfato102c32c744WIP: feat(history): nodb backlog — statusbar opt-in, /history off persistence, /privacy runtime switch, /correction fixto feat(history): nodb backlog — statusbar opt-in, /history off persistence, /privacy runtime switch, /correction fixGenerally 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
@@ -1887,0 +1889,4 @@} else {cons_show("Show database backend (/statusbar) : OFF");}console.c:1957
The following lines are still present
@@ -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
b670778aa3tod8ce4ca80e@@ -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.d8ce4ca80etodf5b39fa7cLGTM