Add /privacy logging command

Add ability to completely turn logs off,
Needed since `/logging` and `/history` didn't stop history logging
in the DB, only in files.
Command might break something on usage,
hence it was primarily introduced for privacy geeks.
Privacy command discussion #1836
This commit is contained in:
John Hernandez
2023-07-03 16:06:24 +02:00
parent f67d548ebf
commit 1c102fec27
8 changed files with 112 additions and 5 deletions

View File

@@ -47,6 +47,7 @@
#include "common.h"
#include "config/files.h"
#include "database.h"
#include "config/preferences.h"
#include "xmpp/xmpp.h"
#include "xmpp/message.h"
@@ -373,6 +374,17 @@ _get_message_enc_type(const char* const encstr)
static void
_add_to_db(ProfMessage* message, char* type, const Jid* const from_jid, const Jid* const to_jid)
{
auto_gchar gchar* pref_dblog = prefs_get_string(PREF_DBLOG);
if (g_strcmp0(pref_dblog, "off") == 0) {
return;
} else if (g_strcmp0(pref_dblog, "redact") == 0) {
if (message->plain) {
free(message->plain);
}
message->plain = strdup("[REDACTED]");
}
if (!g_chatlog_database) {
log_debug("log_database_add() called but db is not initialized");
return;