Merge pull request #1835 from H3rnand3zzz/fix/message-logging
Fix crash, add consistency to logging
This commit is contained in:
@@ -6516,12 +6516,17 @@ cmd_log(ProfWin* window, const char* const command, gchar** args)
|
||||
char* subcmd = args[0];
|
||||
char* value = args[1];
|
||||
|
||||
if (strcmp(subcmd, "maxsize") == 0) {
|
||||
if (value == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
if (strcmp(subcmd, "where") == 0) {
|
||||
cons_show("Log file: %s", get_log_file_location());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (value == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "maxsize") == 0) {
|
||||
int intval = 0;
|
||||
char* err_msg = NULL;
|
||||
gboolean res = strtoi_range(value, &intval, PREFS_MIN_LOG_SIZE, INT_MAX, &err_msg);
|
||||
@@ -6536,29 +6541,16 @@ cmd_log(ProfWin* window, const char* const command, gchar** args)
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "rotate") == 0) {
|
||||
if (value == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
_cmd_set_boolean_preference(value, command, "Log rotate", PREF_LOG_ROTATE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "shared") == 0) {
|
||||
if (value == NULL) {
|
||||
cons_bad_cmd_usage(command);
|
||||
return TRUE;
|
||||
}
|
||||
_cmd_set_boolean_preference(value, command, "Shared log", PREF_LOG_SHARED);
|
||||
cons_show("Setting only takes effect after saving and restarting Profanity.");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "where") == 0) {
|
||||
cons_show("Log file: %s", get_log_file_location());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (strcmp(subcmd, "level") == 0) {
|
||||
log_level_t prof_log_level;
|
||||
if (log_level_from_string(value, &prof_log_level) == 0) {
|
||||
|
||||
@@ -433,7 +433,7 @@ sv_ev_incoming_private_message(ProfMessage* message)
|
||||
|
||||
_clean_incoming_message(message);
|
||||
privwin_incoming_msg(privatewin, message);
|
||||
log_database_add_incoming(message);
|
||||
// Intentionally skipping log to DB because we can't authenticate the sender
|
||||
chat_log_msg_in(message);
|
||||
|
||||
plugins_post_priv_message_display(message->from_jid->fulljid, message->plain);
|
||||
@@ -457,6 +457,7 @@ sv_ev_delayed_private_message(ProfMessage* message)
|
||||
|
||||
_clean_incoming_message(message);
|
||||
privwin_incoming_msg(privatewin, message);
|
||||
// Intentionally skipping log to DB because we can't authenticate the sender
|
||||
chat_log_msg_in(message);
|
||||
|
||||
plugins_post_priv_message_display(message->from_jid->fulljid, message->plain);
|
||||
|
||||
Reference in New Issue
Block a user