about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-02-14 23:24:00 +0000
committerJames Booth <boothj5@gmail.com>2013-02-14 23:24:00 +0000
commit6794fb8101e9947be44644ce7c525f264f16a11a (patch)
tree24360b504b120b52d4f4e3c57ac2a28246faa237 /src/command
parente33ccb07a4c0803119b6b6f293a527f294b6dd48 (diff)
downloadprofani-tty-6794fb8101e9947be44644ce7c525f264f16a11a.tar.gz
Dealing with mulitple contact resources, work in progress
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/command/command.c b/src/command/command.c
index ae3d51d6..73c8b07a 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1539,9 +1539,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     while (list != NULL) {
                         PContact contact = list->data;
-                        const char * const contact_presence = (p_contact_presence(contact));
-                        if ((strcmp(contact_presence, "online") == 0)
-                                || (strcmp(contact_presence, "chat") == 0)) {
+                        if (p_contact_is_available(contact)) {
                             filtered = g_list_append(filtered, contact);
                         }
                         list = g_list_next(list);
@@ -1555,11 +1553,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     while (list != NULL) {
                         PContact contact = list->data;
-                        const char * const contact_presence = (p_contact_presence(contact));
-                        if ((strcmp(contact_presence, "offline") == 0)
-                                || (strcmp(contact_presence, "away") == 0)
-                                || (strcmp(contact_presence, "dnd") == 0)
-                                || (strcmp(contact_presence, "xa") == 0)) {
+                        if (!p_contact_is_available(contact)) {
                             filtered = g_list_append(filtered, contact);
                         }
                         list = g_list_next(list);
@@ -1573,12 +1567,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     while (list != NULL) {
                         PContact contact = list->data;
-                        const char * const contact_presence = (p_contact_presence(contact));
-                        if ((strcmp(contact_presence, "online") == 0)
-                                || (strcmp(contact_presence, "away") == 0)
-                                || (strcmp(contact_presence, "dnd") == 0)
-                                || (strcmp(contact_presence, "xa") == 0)
-                                || (strcmp(contact_presence, "chat") == 0)) {
+                        if (p_contact_has_available_resource(contact)) {
                             filtered = g_list_append(filtered, contact);
                         }
                         list = g_list_next(list);
@@ -1586,6 +1575,20 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     win_show_room_roster(room, filtered, "online");
 
+                // online, show all status that indicate online
+                } else if (strcmp("offline", presence) == 0) {
+                    GList *filtered = NULL;
+
+                    while (list != NULL) {
+                        PContact contact = list->data;
+                        if (!p_contact_has_available_resource(contact)) {
+                            filtered = g_list_append(filtered, contact);
+                        }
+                        list = g_list_next(list);
+                    }
+
+                    win_show_room_roster(room, filtered, "offline");
+
                 // show specific status
                 } else {
                     GList *filtered = NULL;