about summary refs log tree commit diff stats
path: root/src/command/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/command/command.c')
-rw-r--r--src/command/command.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 73c8b07a..648ab64c 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1561,7 +1561,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     win_show_room_roster(room, filtered, "unavailable");
 
-                // online, show all status that indicate online
+                // online, available resources
                 } else if (strcmp("online", presence) == 0) {
                     GList *filtered = NULL;
 
@@ -1575,7 +1575,7 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     win_show_room_roster(room, filtered, "online");
 
-                // online, show all status that indicate online
+                // offline, no available resources
                 } else if (strcmp("offline", presence) == 0) {
                     GList *filtered = NULL;
 
@@ -1621,9 +1621,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_slist_append(filtered, contact);
                         }
                         list = g_slist_next(list);
@@ -1638,11 +1636,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_slist_append(filtered, contact);
                         }
                         list = g_slist_next(list);
@@ -1650,19 +1644,29 @@ _cmd_who(gchar **args, struct cmd_help_t help)
 
                     cons_show_contacts(filtered);
 
-                // online, show all status that indicate online
+                // online, available resources
                 } else if (strcmp("online", presence) == 0) {
                     cons_show("Contacts (%s):", presence);
                     GSList *filtered = NULL;
 
                     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_slist_append(filtered, contact);
+                        }
+                        list = g_slist_next(list);
+                    }
+
+                    cons_show_contacts(filtered);
+
+                // offline, no available resources
+                } else if (strcmp("online", presence) == 0) {
+                    cons_show("Contacts (%s):", presence);
+                    GSList *filtered = NULL;
+
+                    while (list != NULL) {
+                        PContact contact = list->data;
+                        if (!p_contact_has_available_resource(contact)) {
                             filtered = g_slist_append(filtered, contact);
                         }
                         list = g_slist_next(list);
'>281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358