about summary refs log tree commit diff stats
path: root/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-05-27 19:53:16 +0100
committerJames Booth <boothj5@gmail.com>2012-05-27 19:53:16 +0100
commitf5eab875884feda2b1e40e0dcd76150ca1b0763f (patch)
treea6d4ea12830f68f1ab99efabae35d7d20fb60247 /command.c
parent11ce116a850cd22bea991496a418eef8100717cb (diff)
downloadprofani-tty-f5eab875884feda2b1e40e0dcd76150ca1b0763f.tar.gz
Added _cmd_away
Not yet sending message to server
Diffstat (limited to 'command.c')
-rw-r--r--command.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/command.c b/command.c
index 1cde6293..f8f7eb7d 100644
--- a/command.c
+++ b/command.c
@@ -44,6 +44,7 @@ static gboolean _cmd_msg(const char * const inp);
 static gboolean _cmd_close(const char * const inp);
 static gboolean _cmd_set_beep(const char * const inp);
 static gboolean _cmd_set_flash(const char * const inp);
+static gboolean _cmd_away(const char * const inp);
 static gboolean _cmd_default(const char * const inp);
 
 gboolean process_input(char *inp)
@@ -100,6 +101,8 @@ static gboolean _handle_command(const char * const command, const char * const i
         result = _cmd_set_beep(inp);
     } else if (strcmp(command, "/flash") == 0) {
         result = _cmd_set_flash(inp);
+    } else if (strcmp(command, "/away") == 0) {
+        result = _cmd_away(inp);
     } else {
         result = _cmd_default(inp);
     }
@@ -250,6 +253,20 @@ static gboolean _cmd_set_flash(const char * const inp)
     return TRUE;
 }
 
+static gboolean _cmd_away(const char * const inp)
+{
+    jabber_conn_status_t conn_status = jabber_connection_status();
+
+    if (conn_status != JABBER_CONNECTED) {
+        cons_show("You are not currently connected.");
+    } else {
+        jabber_update_presence(PRESENCE_AWAY);
+        cons_show("Status set to \"away\"");
+    }
+
+    return TRUE;
+}
+
 static gboolean _cmd_default(const char * const inp)
 {
     if (win_in_chat()) {