about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-07 22:38:34 +0000
committerJames Booth <boothj5@gmail.com>2014-11-07 22:38:34 +0000
commit373b3a2d7c493200207201f5bd3ec185a9207fa1 (patch)
tree256f57c3c4f411d7a3acdc058e0e07cb822d4f88 /src/command
parent571db231509577fe1e528595c3aae61e2f8ccf3f (diff)
downloadprofani-tty-373b3a2d7c493200207201f5bd3ec185a9207fa1.tar.gz
Added /presence command to show contacts presence
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c10
-rw-r--r--src/command/commands.c8
-rw-r--r--src/command/commands.h1
3 files changed, 17 insertions, 2 deletions
diff --git a/src/command/command.c b/src/command/command.c
index b87e50e6..c898f4b7 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -570,6 +570,14 @@ static struct cmd_t command_defs[] =
           "If the terminal does not support sounds, it may attempt to flash the screen instead.",
           NULL } } },
 
+    { "/presence",
+        cmd_presence, parse_args, 1, 1, &cons_presence_setting,
+        { "/presence on|off", "Show the contacts presence in the titlebar.",
+        { "/presence on|off",
+          "----------------",
+          "Switch display of the contacts presence on or off.",
+          NULL } } },
+
     { "/notify",
         cmd_notify, parse_args, 2, 3, &cons_notify_setting,
         { "/notify [type value]|[type setting value]", "Control various desktop noficiations.",
@@ -1765,7 +1773,7 @@ _cmd_complete_parameters(char *input, int *size)
     // autocomplete boolean settings
     gchar *boolean_choices[] = { "/beep", "/intype", "/states", "/outtype",
         "/flash", "/splash", "/chlog", "/grlog", "/mouse", "/history", "/titlebar",
-        "/vercheck", "/privileges" };
+        "/vercheck", "/privileges", "/presence" };
 
     for (i = 0; i < ARRAY_SIZE(boolean_choices); i++) {
         result = autocomplete_param_with_func(input, size, boolean_choices[i],
diff --git a/src/command/commands.c b/src/command/commands.c
index e81c1714..45421829 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -620,7 +620,7 @@ cmd_help(gchar **args, struct cmd_help_t help)
             "/chlog", "/flash", "/gone", "/grlog", "/history", "/intype",
             "/log", "/mouse", "/notify", "/outtype", "/prefs", "/priority",
             "/reconnect", "/roster", "/splash", "/states", "/statuses", "/theme",
-            "/titlebar", "/vercheck", "/privileges", "/occupants" };
+            "/titlebar", "/vercheck", "/privileges", "/occupants", "/presence" };
         _cmd_show_filtered_help("Settings commands", filter, ARRAY_SIZE(filter));
 
     } else if (strcmp(args[0], "navigation") == 0) {
@@ -2923,6 +2923,12 @@ cmd_beep(gchar **args, struct cmd_help_t help)
 }
 
 gboolean
+cmd_presence(gchar **args, struct cmd_help_t help)
+{
+    return _cmd_set_boolean_preference(args[0], help, "Contact presence", PREF_PRESENCE);
+}
+
+gboolean
 cmd_states(gchar **args, struct cmd_help_t help)
 {
     gboolean result = _cmd_set_boolean_preference(args[0], help, "Sending chat states",
diff --git a/src/command/commands.h b/src/command/commands.h
index 55f11df1..245a2944 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -132,6 +132,7 @@ gboolean cmd_subject(gchar **args, struct cmd_help_t help);
 gboolean cmd_affiliation(gchar **args, struct cmd_help_t help);
 gboolean cmd_role(gchar **args, struct cmd_help_t help);
 gboolean cmd_privileges(gchar **args, struct cmd_help_t help);
+gboolean cmd_presence(gchar **args, struct cmd_help_t help);
 
 gboolean cmd_form_field(char *tag, gchar **args);