comparison console/gntblist.c @ 14407:2a5ec27c3f0c

[gaim-migrate @ 17115] This should fix the problem. I am not sure why this is necessary though. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 01 Sep 2006 18:29:50 +0000
parents 8375ecb6152b
children 1e00e8245720
comparison
equal deleted inserted replaced
14406:c72f33e14f98 14407:2a5ec27c3f0c
70 static gboolean remove_typing_cb(gpointer null); 70 static gboolean remove_typing_cb(gpointer null);
71 static void remove_peripherals(GGBlist *ggblist); 71 static void remove_peripherals(GGBlist *ggblist);
72 static const char * get_display_name(GaimBlistNode *node); 72 static const char * get_display_name(GaimBlistNode *node);
73 static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old); 73 static void savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old);
74 74
75 static gboolean
76 is_contact_online(GaimContact *contact)
77 {
78 GaimBlistNode *node;
79 for (node = ((GaimBlistNode*)contact)->child; node; node = node->next) {
80 if (GAIM_BUDDY_IS_ONLINE((GaimBuddy*)node))
81 return TRUE;
82 }
83 return FALSE;
84 }
85
86 static gboolean
87 is_group_online(GaimGroup *group)
88 {
89 GaimBlistNode *node;
90 for (node = ((GaimBlistNode*)group)->child; node; node = node->next) {
91 if (GAIM_BLIST_NODE_IS_CHAT(node))
92 return TRUE;
93 else if (is_contact_online((GaimContact*)node))
94 return TRUE;
95 }
96 return FALSE;
97 }
98
75 static void 99 static void
76 new_node(GaimBlistNode *node) 100 new_node(GaimBlistNode *node)
77 { 101 {
78 } 102 }
79 103
109 gnt_tree_remove(GNT_TREE(ggblist->tree), node); 133 gnt_tree_remove(GNT_TREE(ggblist->tree), node);
110 node->ui_data = NULL; 134 node->ui_data = NULL;
111 135
112 if (GAIM_BLIST_NODE_IS_BUDDY(node)) { 136 if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
113 GaimContact *contact = (GaimContact*)node->parent; 137 GaimContact *contact = (GaimContact*)node->parent;
114 if (contact->online < 1) 138 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_contact_online(contact)) ||
139 contact->currentsize < 1)
115 node_remove(list, (GaimBlistNode*)contact); 140 node_remove(list, (GaimBlistNode*)contact);
116 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) { 141 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
117 GaimGroup *group = (GaimGroup*)node->parent; 142 GaimGroup *group = (GaimGroup*)node->parent;
118 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && group->online < 1) || 143 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) ||
119 group->currentsize < 1) 144 group->currentsize < 1)
120 node_remove(list, node->parent); 145 node_remove(list, node->parent);
121 } 146 }
122 draw_tooltip(ggblist); 147 draw_tooltip(ggblist);
123 } 148 }
147 node_remove(gaim_get_blist(), node); 172 node_remove(gaim_get_blist(), node);
148 173
149 node_update(list, node->parent); 174 node_update(list, node->parent);
150 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) { 175 } else if (GAIM_BLIST_NODE_IS_CHAT(node)) {
151 add_chat((GaimChat *)node, list->ui_data); 176 add_chat((GaimChat *)node, list->ui_data);
177 } else if (GAIM_BLIST_NODE_IS_CONTACT(node)) {
178 GaimContact *contact = (GaimContact*)node;
179 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_contact_online(contact)) ||
180 contact->currentsize < 1)
181 node_remove(gaim_get_blist(), node);
182 } else if (GAIM_BLIST_NODE_IS_GROUP(node)) {
183 GaimGroup *group = (GaimGroup*)node;
184 if ((!gaim_prefs_get_bool(PREF_ROOT "/showoffline") && !is_group_online(group)) ||
185 group->currentsize < 1)
186 node_remove(list, node);
152 } 187 }
153 } 188 }
154 189
155 static void 190 static void
156 new_list(GaimBuddyList *list) 191 new_list(GaimBuddyList *list)