mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Free resource lists
This commit is contained in:
parent
50601d4db3
commit
1a98f1404b
@ -650,8 +650,6 @@ win_show_info(ProfWin *window, PContact contact)
|
|||||||
const char *name = p_contact_name(contact);
|
const char *name = p_contact_name(contact);
|
||||||
const char *presence = p_contact_presence(contact);
|
const char *presence = p_contact_presence(contact);
|
||||||
const char *sub = p_contact_subscription(contact);
|
const char *sub = p_contact_subscription(contact);
|
||||||
GList *resources = p_contact_get_available_resources(contact);
|
|
||||||
GList *ordered_resources = NULL;
|
|
||||||
GDateTime *last_activity = p_contact_last_activity(contact);
|
GDateTime *last_activity = p_contact_last_activity(contact);
|
||||||
|
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
theme_item_t presence_colour = theme_main_presence_attrs(presence);
|
||||||
@ -687,20 +685,25 @@ win_show_info(ProfWin *window, PContact contact)
|
|||||||
g_date_time_unref(now);
|
g_date_time_unref(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GList *resources = p_contact_get_available_resources(contact);
|
||||||
|
GList *ordered_resources = NULL;
|
||||||
if (resources != NULL) {
|
if (resources != NULL) {
|
||||||
win_save_print(window, '-', NULL, 0, 0, "", "Resources:");
|
win_save_print(window, '-', NULL, 0, 0, "", "Resources:");
|
||||||
|
|
||||||
// sort in order of availabiltiy
|
// sort in order of availabiltiy
|
||||||
while (resources != NULL) {
|
GList *curr = resources;
|
||||||
Resource *resource = resources->data;
|
while (curr != NULL) {
|
||||||
|
Resource *resource = curr->data;
|
||||||
ordered_resources = g_list_insert_sorted(ordered_resources,
|
ordered_resources = g_list_insert_sorted(ordered_resources,
|
||||||
resource, (GCompareFunc)resource_compare_availability);
|
resource, (GCompareFunc)resource_compare_availability);
|
||||||
resources = g_list_next(resources);
|
curr = g_list_next(curr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_list_free(resources);
|
||||||
|
|
||||||
while (ordered_resources != NULL) {
|
GList *curr = ordered_resources;
|
||||||
Resource *resource = ordered_resources->data;
|
while (curr != NULL) {
|
||||||
|
Resource *resource = curr->data;
|
||||||
const char *resource_presence = string_from_resource_presence(resource->presence);
|
const char *resource_presence = string_from_resource_presence(resource->presence);
|
||||||
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
|
theme_item_t presence_colour = theme_main_presence_attrs(resource_presence);
|
||||||
win_save_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
win_save_vprint(window, '-', NULL, NO_EOL, presence_colour, "", " %s (%d), %s", resource->name, resource->priority, resource_presence);
|
||||||
@ -755,8 +758,9 @@ win_show_info(ProfWin *window, PContact contact)
|
|||||||
caps_destroy(caps);
|
caps_destroy(caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
ordered_resources = g_list_next(ordered_resources);
|
curr = g_list_next(curr);
|
||||||
}
|
}
|
||||||
|
g_list_free(ordered_resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user