fix(review): address PR #94 reviewer comments

Blockers:
- SPDX/CProof copyright headers (7 files)
- stanza-id non-uniqueness: warn-only, don't skip (matches SQLite)
- fopen → open(O_EXCL|O_NOFOLLOW, 0600) + fdopen in export

Medium:
- log_info → log_warning for SQLite fallback
- remove prefs_save() auto-save from backend switch
- vtable null → log_warning in 4 dispatch functions
- log_debug → log_warning + null error handling in export
- rename failure → cons_show_error to user
- remove unused total_skipped variable
- LMC respects PREF_CORRECTION_ALLOW

Low nits:
- man page .SS fix + jabber.space URL
- profrc.example simplified
- show flatfile path on /logging flatfile
- EXPORT_PROGRESS_INTERVAL constant (magic 500)
- FF_META_PREFIX_ID/AID constants + FF_INDEX_STEP comment
- buffer overflow guard on close[1]/close[2]
- for-loop → memchr for JID resource scan
- BOM check extracted to ff_skip_bom() (DRY)
- index building extracted to _ff_maybe_index_line()
- O_APPEND+O_EXCL comment rewritten
- Makefile.am spaces → tabs
This commit is contained in:
2026-03-28 12:38:39 +03:00
parent 58002409ff
commit a96a4ad41e
12 changed files with 192 additions and 196 deletions

View File

@@ -75,7 +75,7 @@ log_database_init(ProfAccount* account)
active_db_backend = db_backend_sqlite();
log_info("Using SQLite database backend");
#else
log_info("SQLite not compiled in, falling back to flat-file backend");
log_warning("SQLite not compiled in, falling back to flat-file backend");
active_db_backend = db_backend_flatfile();
#endif
}
@@ -103,9 +103,8 @@ log_database_switch_backend(const char* new_backend)
// Close current backend
log_database_close();
// Update preference
// Update preference (user must /save to persist across restarts)
prefs_set_string(PREF_DBLOG, new_backend);
prefs_save();
// Get current account to reinitialize
const char* account_name = session_get_account_name();
@@ -130,6 +129,8 @@ log_database_add_incoming(ProfMessage* message)
{
if (active_db_backend && active_db_backend->add_incoming) {
active_db_backend->add_incoming(message);
} else {
log_warning("log_database_add_incoming: no backend or method available");
}
}
@@ -138,6 +139,8 @@ log_database_add_outgoing_chat(const char* const id, const char* const barejid,
{
if (active_db_backend && active_db_backend->add_outgoing_chat) {
active_db_backend->add_outgoing_chat(id, barejid, message, replace_id, enc);
} else {
log_warning("log_database_add_outgoing_chat: no backend or method available");
}
}
@@ -146,6 +149,8 @@ log_database_add_outgoing_muc(const char* const id, const char* const barejid, c
{
if (active_db_backend && active_db_backend->add_outgoing_muc) {
active_db_backend->add_outgoing_muc(id, barejid, message, replace_id, enc);
} else {
log_warning("log_database_add_outgoing_muc: no backend or method available");
}
}
@@ -154,6 +159,8 @@ log_database_add_outgoing_muc_pm(const char* const id, const char* const barejid
{
if (active_db_backend && active_db_backend->add_outgoing_muc_pm) {
active_db_backend->add_outgoing_muc_pm(id, barejid, message, replace_id, enc);
} else {
log_warning("log_database_add_outgoing_muc_pm: no backend or method available");
}
}