mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Merge /chlog and /grlog commands into /logging
Instead of `/chlog on` we now have `/logging chat on`. Instead of `/grlog on` we now have `/logging group on`. Fix https://github.com/profanity-im/profanity/issues/1224
This commit is contained in:
parent
0945a30925
commit
9bc4dc3827
@ -110,6 +110,7 @@ static char* _statusbar_autocomplete(ProfWin *window, const char *const input, g
|
||||
static char* _clear_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
static char* _invite_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
static char* _status_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
static char* _logging_autocomplete(ProfWin *window, const char *const input, gboolean previous);
|
||||
|
||||
static char* _script_autocomplete_func(const char *const prefix, gboolean previous);
|
||||
|
||||
@ -227,6 +228,7 @@ static Autocomplete clear_ac;
|
||||
static Autocomplete invite_ac;
|
||||
static Autocomplete status_ac;
|
||||
static Autocomplete status_state_ac;
|
||||
static Autocomplete logging_ac;
|
||||
|
||||
void
|
||||
cmd_ac_init(void)
|
||||
@ -896,6 +898,10 @@ cmd_ac_init(void)
|
||||
autocomplete_add(status_state_ac, "away");
|
||||
autocomplete_add(status_state_ac, "xa");
|
||||
autocomplete_add(status_state_ac, "dnd");
|
||||
|
||||
logging_ac = autocomplete_new();
|
||||
autocomplete_add(logging_ac, "chat");
|
||||
autocomplete_add(logging_ac, "group");
|
||||
}
|
||||
|
||||
void
|
||||
@ -1197,6 +1203,7 @@ cmd_ac_reset(ProfWin *window)
|
||||
autocomplete_reset(invite_ac);
|
||||
autocomplete_reset(status_ac);
|
||||
autocomplete_reset(status_state_ac);
|
||||
autocomplete_reset(logging_ac);
|
||||
|
||||
autocomplete_reset(script_ac);
|
||||
if (script_show_ac) {
|
||||
@ -1340,6 +1347,7 @@ cmd_ac_uninit(void)
|
||||
autocomplete_free(invite_ac);
|
||||
autocomplete_free(status_ac);
|
||||
autocomplete_free(status_state_ac);
|
||||
autocomplete_free(logging_ac);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1469,7 +1477,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
|
||||
jabber_conn_status_t conn_status = connection_get_status();
|
||||
|
||||
// autocomplete boolean settings
|
||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash", "/chlog", "/grlog",
|
||||
gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype", "/flash", "/splash",
|
||||
"/history", "/vercheck", "/privileges", "/wrap", "/carbons", "/lastactivity" };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
|
||||
@ -1588,6 +1596,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
|
||||
g_hash_table_insert(ac_funcs, "/clear", _clear_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/invite", _invite_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
|
||||
g_hash_table_insert(ac_funcs, "/logging", _logging_autocomplete);
|
||||
|
||||
int len = strlen(input);
|
||||
char parsed[len+1];
|
||||
@ -3576,3 +3585,26 @@ _status_autocomplete(ProfWin *window, const char *const input, gboolean previous
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char*
|
||||
_logging_autocomplete(ProfWin *window, const char *const input, gboolean previous)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
result = autocomplete_param_with_ac(input, "/logging", logging_ac, TRUE, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_func(input, "/logging chat", prefs_autocomplete_boolean_choice, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
result = autocomplete_param_with_func(input, "/logging group", prefs_autocomplete_boolean_choice, previous);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1604,38 +1604,25 @@ static struct cmd_t command_defs[] =
|
||||
"/alias list")
|
||||
},
|
||||
|
||||
{ "/chlog",
|
||||
parse_args, 1, 1, &cons_chlog_setting,
|
||||
{ "/logging",
|
||||
parse_args, 2, 2, &cons_logging_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_chlog)
|
||||
CMD_MAINFUNC(cmd_logging)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_CHAT)
|
||||
CMD_SYN(
|
||||
"/chlog on|off")
|
||||
"/logging chat|group on|off")
|
||||
CMD_DESC(
|
||||
"Switch chat logging on or off. "
|
||||
"This setting will be enabled if /history is set to on. "
|
||||
"When disabling this option, /history will also be disabled. "
|
||||
"See the /grlog setting for enabling logging of chat room (groupchat) messages.")
|
||||
"Switch logging on or off. "
|
||||
"Chat logging will be enabled if /history is set to on. "
|
||||
"When disabling this option, /history will also be disabled. ")
|
||||
CMD_ARGS(
|
||||
{ "on|off", "Enable or disable chat logging." })
|
||||
CMD_NOEXAMPLES
|
||||
},
|
||||
|
||||
{ "/grlog",
|
||||
parse_args, 1, 1, &cons_grlog_setting,
|
||||
CMD_NOSUBFUNCS
|
||||
CMD_MAINFUNC(cmd_grlog)
|
||||
CMD_TAGS(
|
||||
CMD_TAG_GROUPCHAT)
|
||||
CMD_SYN(
|
||||
"/grlog on|off")
|
||||
CMD_DESC(
|
||||
"Switch chat room logging on or off. "
|
||||
"See the /chlog setting for enabling logging of one to one chat.")
|
||||
CMD_ARGS(
|
||||
{ "on|off", "Enable or disable chat room logging." })
|
||||
CMD_NOEXAMPLES
|
||||
{ "chat", "Regular chat logging" },
|
||||
{ "group", "Groupchat (room) logging" },
|
||||
{ "on|off", "Enable or disable logging." })
|
||||
CMD_EXAMPLES(
|
||||
"/logging chat on",
|
||||
"/logging group off" )
|
||||
},
|
||||
|
||||
{ "/states",
|
||||
|
@ -6692,30 +6692,29 @@ cmd_autoconnect(ProfWin *window, const char *const command, gchar **args)
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_chlog(ProfWin *window, const char *const command, gchar **args)
|
||||
cmd_logging(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
if (args[0] == NULL) {
|
||||
return FALSE;
|
||||
cons_logging_setting();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
_cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
|
||||
if (strcmp(args[0], "chat") == 0) {
|
||||
_cmd_set_boolean_preference(args[1], command, "Chat logging", PREF_CHLOG);
|
||||
|
||||
// if set to off, disable history
|
||||
if (strcmp(args[0], "off") == 0) {
|
||||
prefs_set_boolean(PREF_HISTORY, FALSE);
|
||||
// if set to off, disable history
|
||||
if (strcmp(args[1], "off") == 0) {
|
||||
prefs_set_boolean(PREF_HISTORY, FALSE);
|
||||
}
|
||||
} else if (strcmp(args[0], "group") == 0) {
|
||||
_cmd_set_boolean_preference(args[1], command, "Groupchat logging", PREF_GRLOG);
|
||||
} else {
|
||||
cons_bad_cmd_usage(command);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_grlog(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
_cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_history(ProfWin *window, const char *const command, gchar **args)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ gboolean cmd_autoconnect(ProfWin *window, const char *const command, gchar **arg
|
||||
gboolean cmd_autoping(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_beep(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_caps(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_chlog(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_logging(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_clear(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_close(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_connect(ProfWin *window, const char *const command, gchar **args);
|
||||
@ -91,7 +91,6 @@ gboolean cmd_disconnect(ProfWin *window, const char *const command, gchar **args
|
||||
gboolean cmd_flash(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_tray(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_gone(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_grlog(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_group(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_help(ProfWin *window, const char *const command, gchar **args);
|
||||
gboolean cmd_history(ProfWin *window, const char *const command, gchar **args);
|
||||
|
@ -1842,21 +1842,17 @@ cons_log_setting(void)
|
||||
}
|
||||
|
||||
void
|
||||
cons_chlog_setting(void)
|
||||
cons_logging_setting(void)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_CHLOG))
|
||||
cons_show("Chat logging (/chlog) : ON");
|
||||
cons_show("Chat logging (/logging chat) : ON");
|
||||
else
|
||||
cons_show("Chat logging (/chlog) : OFF");
|
||||
}
|
||||
cons_show("Chat logging (/logging chat) : OFF");
|
||||
|
||||
void
|
||||
cons_grlog_setting(void)
|
||||
{
|
||||
if (prefs_get_boolean(PREF_GRLOG))
|
||||
cons_show("Groupchat logging (/grlog) : ON");
|
||||
cons_show("Groupchat logging (/logging group) : ON");
|
||||
else
|
||||
cons_show("Groupchat logging (/grlog) : OFF");
|
||||
cons_show("Groupchat logging (/logging group) : OFF");
|
||||
}
|
||||
|
||||
void
|
||||
@ -1865,8 +1861,7 @@ cons_show_log_prefs(void)
|
||||
cons_show("Logging preferences:");
|
||||
cons_show("");
|
||||
cons_log_setting();
|
||||
cons_chlog_setting();
|
||||
cons_grlog_setting();
|
||||
cons_logging_setting();
|
||||
|
||||
cons_alert();
|
||||
}
|
||||
|
@ -307,8 +307,7 @@ void cons_history_setting(void);
|
||||
void cons_carbons_setting(void);
|
||||
void cons_receipts_setting(void);
|
||||
void cons_log_setting(void);
|
||||
void cons_chlog_setting(void);
|
||||
void cons_grlog_setting(void);
|
||||
void cons_logging_setting(void);
|
||||
void cons_autoaway_setting(void);
|
||||
void cons_reconnect_setting(void);
|
||||
void cons_autoping_setting(void);
|
||||
|
Loading…
Reference in New Issue
Block a user