diff options
author | James Booth <boothj5@gmail.com> | 2013-01-22 01:39:18 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2013-01-22 01:39:18 +0000 |
commit | 114d251b68de69f6b5aaf5759556d4c6248851cc (patch) | |
tree | 550f00e754cdadecb18f793688f3cae8800ffe99 | |
parent | 134da4d001d1e6fa65b9affb36a85ef7881e97f4 (diff) | |
parent | 5d7022750150eb0e12710a413e18697b64c2ffd1 (diff) | |
download | profani-tty-114d251b68de69f6b5aaf5759556d4c6248851cc.tar.gz |
Merge branch 'master' into caps
-rw-r--r-- | src/command.c | 26 | ||||
-rw-r--r-- | src/preferences.c | 18 | ||||
-rw-r--r-- | src/preferences.h | 2 | ||||
-rw-r--r-- | src/windows.c | 8 |
4 files changed, 53 insertions, 1 deletions
diff --git a/src/command.c b/src/command.c index 6cf8e55f..aa08b9f3 100644 --- a/src/command.c +++ b/src/command.c @@ -120,6 +120,7 @@ static gboolean _cmd_set_autoping(gchar **args, struct cmd_help_t help); static gboolean _cmd_set_titlebar(gchar **args, struct cmd_help_t help); static gboolean _cmd_set_autoaway(gchar **args, struct cmd_help_t help); static gboolean _cmd_set_mouse(gchar **args, struct cmd_help_t help); +static gboolean _cmd_set_statuses(gchar **args, struct cmd_help_t help); static gboolean _cmd_vercheck(gchar **args, struct cmd_help_t help); static gboolean _cmd_away(gchar **args, struct cmd_help_t help); static gboolean _cmd_online(gchar **args, struct cmd_help_t help); @@ -561,6 +562,15 @@ static struct cmd_t setting_commands[] = "---------------", "Set priority for the current session.", "value : Number between -128 and 127. Default value is 0.", + NULL } } }, + + { "/statuses", + _cmd_set_statuses, parse_args, 1, 1, + { "/statuses on|off", "Set notifications for status messages.", + { "/statuses on|off", + "---------------", + "Set notifications for status messages, such as online/offline or join/part channels.", + "When notifications are off status messages, such as online/offline or join/part, are not displayed.", NULL } } } }; @@ -666,6 +676,7 @@ cmd_init(void) p_autocomplete_add(notify_ac, strdup("message")); p_autocomplete_add(notify_ac, strdup("typing")); p_autocomplete_add(notify_ac, strdup("remind")); + p_autocomplete_add(notify_ac, strdup("status")); sub_ac = p_autocomplete_new(); p_autocomplete_add(sub_ac, strdup("request")); @@ -939,6 +950,8 @@ _cmd_complete_parameters(char *input, int *size) prefs_autocomplete_boolean_choice); _parameter_autocomplete(input, size, "/vercheck", prefs_autocomplete_boolean_choice); + _parameter_autocomplete(input, size, "/statuses", + prefs_autocomplete_boolean_choice); if (win_current_is_groupchat()) { PAutocomplete nick_ac = muc_get_roster_ac(win_current_get_recipient()); @@ -2009,7 +2022,8 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help) cons_show("Usage: /notify typing on|off"); } - } else { // remind + // set remind setting + } else if (strcmp(kind, "remind") == 0) { gint period = atoi(value); prefs_set_notify_remind(period); if (period == 0) { @@ -2019,6 +2033,9 @@ _cmd_set_notify(gchar **args, struct cmd_help_t help) } else { cons_show("Message reminder period set to %d seconds.", period); } + + } else { + cons_show("Unknown command: %s.", kind); } return TRUE; @@ -2160,6 +2177,13 @@ _cmd_set_priority(gchar **args, struct cmd_help_t help) } static gboolean +_cmd_set_statuses(gchar **args, struct cmd_help_t help) +{ + return _cmd_set_boolean_preference(args[0], help, + "Status notifications", prefs_set_statuses); +} + +static gboolean _cmd_vercheck(gchar **args, struct cmd_help_t help) { int num_args = g_strv_length(args); diff --git a/src/preferences.c b/src/preferences.c index f8862aa9..574ae223 100644 --- a/src/preferences.c +++ b/src/preferences.c @@ -421,12 +421,30 @@ prefs_get_mouse(void) } } +gboolean +prefs_get_statuses(void) +{ + if (g_key_file_has_key(prefs, "ui", "statuses", NULL)) { + return g_key_file_get_boolean(prefs, "ui", "statuses", NULL); + } else { + return TRUE; + } +} + void prefs_set_mouse(gboolean value) { g_key_file_set_boolean(prefs, "ui", "mouse", value); _save_prefs(); } + +void +prefs_set_statuses(gboolean value) +{ + g_key_file_set_boolean(prefs, "ui", "statuses", value); + _save_prefs(); +} + static void _save_prefs(void) { diff --git a/src/preferences.h b/src/preferences.h index aa748634..e27411c6 100644 --- a/src/preferences.h +++ b/src/preferences.h @@ -70,6 +70,8 @@ gchar * prefs_get_theme(void); void prefs_set_theme(gchar *value); gboolean prefs_get_mouse(void); void prefs_set_mouse(gboolean value); +void prefs_set_statuses(gboolean value); +gboolean prefs_get_statuses(void); void prefs_set_notify_message(gboolean value); gboolean prefs_get_notify_message(void); diff --git a/src/windows.c b/src/windows.c index 74507e06..da4b664f 100644 --- a/src/windows.c +++ b/src/windows.c @@ -1286,6 +1286,11 @@ cons_show_ui_prefs(void) cons_show("Mouse handling (/mouse) : ON"); else cons_show("Mouse handling (/mouse) : OFF"); + + if (prefs_get_statuses()) + cons_show("Status (/statuses) : ON"); + else + cons_show("Status (/statuses) : OFF"); } void @@ -2061,6 +2066,9 @@ _show_status_string(WINDOW *win, const char * const from, GDateTime *last_activity, const char * const pre, const char * const default_show) { + if (!prefs_get_statuses()) + return; + _win_show_time(win, '-'); if (show != NULL) { |