Dealing with mulitple contact resources, work in progress

This commit is contained in:
James Booth
2013-02-14 23:24:00 +00:00
parent e33ccb07a4
commit 6794fb8101
4 changed files with 113 additions and 38 deletions

View File

@@ -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;