about summary refs log tree commit diff stats
path: root/command.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-03-08 00:46:24 +0000
committerJames Booth <boothj5@gmail.com>2012-03-08 00:46:24 +0000
commit78bd151c486626f79ea7dcb9189591d121e822b6 (patch)
treea014d2b6587579380c7b0300fe54c10a14b7dc2f /command.c
parent03b0c018491b7b49343c1a7c260b3a725b8a659e (diff)
downloadprofani-tty-78bd151c486626f79ea7dcb9189591d121e822b6.tar.gz
Added basic online list
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 c3113e44..41792315 100644
--- a/command.c
+++ b/command.c
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <ncurses.h>
 #include "command.h"
+#include "contact_list.h"
 #include "history.h"
 #include "jabber.h"
 #include "windows.h"
@@ -33,6 +34,7 @@ static int _handle_command(char *command, char *inp);
 static int _cmd_quit(void);
 static int _cmd_help(void);
 static int _cmd_who(void);
+static int _cmd_pres(void);
 static int _cmd_connect(char *inp);
 static int _cmd_msg(char *inp);
 static int _cmd_close(char *inp);
@@ -72,6 +74,8 @@ static int _handle_command(char *command, char *inp)
         result = _cmd_help();
     } else if (strcmp(command, "/who") == 0) {
         result = _cmd_who();
+    } else if (strcmp(command, "/pres") == 0) {
+        result = _cmd_pres();
     } else if (strcmp(command, "/msg") == 0) {
         result = _cmd_msg(inp);
     } else if (strcmp(command, "/close") == 0) {
@@ -142,6 +146,19 @@ static int _cmd_who(void)
     return TRUE;
 }
 
+static int _cmd_pres(void)
+{
+    struct contact_list *list = get_contact_list();
+
+    int i;
+    for (i = 0; i < list->size; i++) {
+        char *contact = list->contacts[i];
+        cons_show(contact);
+    }
+
+    return TRUE;
+}
+
 static int _cmd_msg(char *inp)
 {
     char *usr = NULL;