Mercurial > pidgin
comparison src/buddy.c @ 1049:749e25dc90cb
[gaim-migrate @ 1059]
removing buddies when appropriate, and a bad fix for a bug
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Wed, 01 Nov 2000 23:44:30 +0000 |
parents | ece2d1543b20 |
children | bde34730789c |
comparison
equal
deleted
inserted
replaced
1048:49799527aebf | 1049:749e25dc90cb |
---|---|
167 } | 167 } |
168 | 168 |
169 #endif | 169 #endif |
170 | 170 |
171 | 171 |
172 static void destroy_buddies(struct gaim_connection *gc) { | |
173 GSList *s = shows; | |
174 struct group_show *g; | |
175 GSList *m; | |
176 struct buddy_show *b; | |
177 | |
178 while (s) { | |
179 gboolean remove_group = FALSE; | |
180 g = (struct group_show *)s->data; | |
181 m = g->members; | |
182 while (m) { | |
183 b = (struct buddy_show *)m->data; | |
184 if (g_slist_length(b->connlist) == 1 && b->connlist->data == gc) { | |
185 if (b->log_timer > 0) | |
186 gtk_timeout_remove(b->log_timer); | |
187 b->connlist = g_slist_remove(b->connlist, gc); | |
188 gtk_widget_destroy(b->item); | |
189 g->members = g_slist_remove(g->members, b); | |
190 if (g->members == NULL) { | |
191 shows = g_slist_remove(shows, g); | |
192 gtk_widget_destroy(g->item); | |
193 g_free(g->name); | |
194 g_free(g); | |
195 m = NULL; | |
196 remove_group = TRUE; | |
197 } else | |
198 m = g->members; | |
199 g_free(b->name); | |
200 g_free(b->show); | |
201 g_free(b); | |
202 } else { | |
203 b->connlist = g_slist_remove(b->connlist, gc); | |
204 m = g_slist_next(m); | |
205 } | |
206 } | |
207 if (remove_group) | |
208 s = shows; | |
209 else | |
210 s = g_slist_next(s); | |
211 } | |
212 } | |
213 | |
214 | |
172 void signoff_all(GtkWidget *w, gpointer d) | 215 void signoff_all(GtkWidget *w, gpointer d) |
173 { | 216 { |
174 GSList *c = connections; | 217 GSList *c = connections; |
175 struct gaim_connection *g = NULL; | 218 struct gaim_connection *g = NULL; |
176 | 219 |
181 } | 224 } |
182 } | 225 } |
183 | 226 |
184 void signoff(struct gaim_connection *gc) | 227 void signoff(struct gaim_connection *gc) |
185 { | 228 { |
229 destroy_buddies(gc); | |
186 plugin_event(event_signoff, gc, 0, 0, 0); | 230 plugin_event(event_signoff, gc, 0, 0, 0); |
187 serv_close(gc); | 231 serv_close(gc); |
188 | 232 |
189 if (connections) return; | 233 if (connections) return; |
190 | 234 |
1262 struct group_show *gs = find_group_show(group); | 1306 struct group_show *gs = find_group_show(group); |
1263 | 1307 |
1264 while (c) { | 1308 while (c) { |
1265 g = (struct gaim_connection *)c->data; | 1309 g = (struct gaim_connection *)c->data; |
1266 p = find_group(g, group); | 1310 p = find_group(g, group); |
1311 if (!p) { | |
1312 c = c->next; | |
1313 continue; | |
1314 } | |
1267 z = p->members; | 1315 z = p->members; |
1268 while (z) { | 1316 while (z) { |
1269 b = (struct buddy *)z->data; | 1317 b = (struct buddy *)z->data; |
1270 if (!strcmp(tmp1, normalize(b->name))) { | 1318 if (!strcmp(tmp1, normalize(b->name))) { |
1271 g_free(tmp1); | 1319 g_free(tmp1); |