about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-11-03 21:27:41 +0000
committerJames Booth <boothj5@gmail.com>2014-11-03 21:27:41 +0000
commit74a2d4601f2f3cf47eda17647a39482ad3a3b667 (patch)
tree1bfedd8a8041cf4adf63ce78c0e61d93bae46673 /src/command
parent7a03dd7641d97a4f44bd78e82e7132213c88bd54 (diff)
downloadprofani-tty-74a2d4601f2f3cf47eda17647a39482ad3a3b667.tar.gz
Removed hash_table_iter usage for room roster
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index a4808b8a..e81c1714 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -769,22 +769,22 @@ _who_room(gchar **args, struct cmd_help_t help)
             (g_strcmp0(args[0], "any") == 0)) {
 
         char *presence = args[0];
-        GList *list = muc_roster(room);
+        GList *occupants = muc_roster(room);
 
         // no arg, show all contacts
         if ((presence == NULL) || (g_strcmp0(presence, "any") == 0)) {
-            ui_room_roster(room, list, NULL);
+            ui_room_roster(room, occupants, NULL);
 
         // available
         } else if (strcmp("available", presence) == 0) {
             GList *filtered = NULL;
 
-            while (list != NULL) {
-                Occupant *occupant = list->data;
+            while (occupants != NULL) {
+                Occupant *occupant = occupants->data;
                 if (muc_occupant_available(occupant)) {
                     filtered = g_list_append(filtered, occupant);
                 }
-                list = g_list_next(list);
+                occupants = g_list_next(occupants);
             }
 
             ui_room_roster(room, filtered, "available");
@@ -793,12 +793,12 @@ _who_room(gchar **args, struct cmd_help_t help)
         } else if (strcmp("unavailable", presence) == 0) {
             GList *filtered = NULL;
 
-            while (list != NULL) {
-                Occupant *occupant = list->data;
+            while (occupants != NULL) {
+                Occupant *occupant = occupants->data;
                 if (!muc_occupant_available(occupant)) {
                     filtered = g_list_append(filtered, occupant);
                 }
-                list = g_list_next(list);
+                occupants = g_list_next(occupants);
             }
 
             ui_room_roster(room, filtered, "unavailable");
@@ -807,18 +807,20 @@ _who_room(gchar **args, struct cmd_help_t help)
         } else {
             GList *filtered = NULL;
 
-            while (list != NULL) {
-                Occupant *occupant = list->data;
+            while (occupants != NULL) {
+                Occupant *occupant = occupants->data;
                 const char *presence_str = string_from_resource_presence(occupant->presence);
                 if (strcmp(presence_str, presence) == 0) {
                     filtered = g_list_append(filtered, occupant);
                 }
-                list = g_list_next(list);
+                occupants = g_list_next(occupants);
             }
 
             ui_room_roster(room, filtered, presence);
         }
 
+        g_list_free(occupants);
+
     // role or affiliation filter
     } else {
         ProfWin *window = wins_get_by_recipient(room);