comparison src/buddy.c @ 2380:6f83c22d9e70

[gaim-migrate @ 2393] (19:13:52) vanguardist: it's easy mmmkay committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 28 Sep 2001 02:16:34 +0000
parents 2927c2c26fe6
children 569ae9f2bb89
comparison
equal deleted inserted replaced
2379:cacaf7ace3a5 2380:6f83c22d9e70
124 static struct group_show *new_group_show(char *group); 124 static struct group_show *new_group_show(char *group);
125 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm); 125 static struct buddy_show *new_buddy_show(struct group_show *gs, struct buddy *buddy, char **xpm);
126 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs); 126 static void remove_buddy_show(struct group_show *gs, struct buddy_show *bs);
127 static struct group_show *find_gs_by_bs(struct buddy_show *b); 127 static struct group_show *find_gs_by_bs(struct buddy_show *b);
128 static void update_num_group(struct group_show *gs); 128 static void update_num_group(struct group_show *gs);
129 static void redo_buddy_list();
130 129
131 void handle_group_rename(struct group *g, char *prevname) 130 void handle_group_rename(struct group *g, char *prevname)
132 { 131 {
133 struct group_show *gs, *new_gs; 132 struct group_show *gs, *new_gs;
134 struct buddy_show *bs; 133 struct buddy_show *bs;
288 } 287 }
289 } 288 }
290 289
291 void destroy_buddy() 290 void destroy_buddy()
292 { 291 {
292 GSList *s = shows;
293 struct group_show *g;
294 GSList *m;
295 struct buddy_show *b;
296 while (s) {
297 g = (struct group_show *)s->data;
298 debug_printf("group_show still exists: %s\n", g->name);
299 m = g->members;
300 while (m) {
301 b = (struct buddy_show *)m->data;
302 debug_printf("buddy_show still exists: %s\n", b->name);
303 m = g_slist_remove(m, b);
304 if (b->log_timer > 0)
305 gtk_timeout_remove(b->log_timer);
306 b->log_timer = 0;
307 gtk_tree_remove_item(GTK_TREE(g->tree), b->item);
308 g_free(b->show);
309 g_free(b->name);
310 g_free(b);
311 }
312 gtk_tree_remove_item(GTK_TREE(buddies), g->item);
313 s = g_slist_remove(s, g);
314 g_free(g->name);
315 g_free(g);
316 }
317 shows = NULL;
318
293 if (blist) 319 if (blist)
294 gtk_widget_destroy(blist); 320 gtk_widget_destroy(blist);
295 blist = NULL; 321 blist = NULL;
296 imchatbox = NULL; 322 imchatbox = NULL;
297 awaymenu = NULL; 323 awaymenu = NULL;
469 gtk_widget_hide(blist); 495 gtk_widget_hide(blist);
470 return (TRUE); 496 return (TRUE);
471 } 497 }
472 498
473 #endif 499 #endif
474
475
476 void signoff_all(GtkWidget *w, gpointer d)
477 {
478 GSList *c = connections;
479 struct gaim_connection *g = NULL;
480
481 while (c) {
482 g = (struct gaim_connection *)c->data;
483 g->wants_to_die = TRUE;
484 signoff(g);
485 c = connections;
486 }
487 }
488
489 void signoff(struct gaim_connection *gc)
490 {
491 plugin_event(event_signoff, gc, 0, 0, 0);
492 system_log(log_signoff, gc, NULL, OPT_LOG_BUDDY_SIGNON | OPT_LOG_MY_SIGNON);
493 update_keepalive(gc, FALSE);
494 convo_menu_remove(gc);
495 remove_icon_data(gc);
496 serv_close(gc);
497 redo_buddy_list();
498 build_edit_tree();
499 do_away_menu();
500 do_proto_menu();
501 redo_convo_menus();
502 #ifdef USE_APPLET
503 if (connections)
504 set_user_state(online);
505 #endif
506 update_connection_dependent_prefs();
507
508 if (connections)
509 return;
510
511 {
512 GSList *s = shows;
513 struct group_show *g;
514 GSList *m;
515 struct buddy_show *b;
516 while (s) {
517 g = (struct group_show *)s->data;
518 debug_printf("group_show still exists: %s\n", g->name);
519 m = g->members;
520 while (m) {
521 b = (struct buddy_show *)m->data;
522 debug_printf("buddy_show still exists: %s\n", b->name);
523 m = g_slist_remove(m, b);
524 if (b->log_timer > 0)
525 gtk_timeout_remove(b->log_timer);
526 b->log_timer = 0;
527 gtk_tree_remove_item(GTK_TREE(g->tree), b->item);
528 g_free(b->show);
529 g_free(b->name);
530 g_free(b);
531 }
532 gtk_tree_remove_item(GTK_TREE(buddies), g->item);
533 s = g_slist_remove(s, g);
534 g_free(g->name);
535 g_free(g);
536 }
537 shows = NULL;
538 }
539
540 debug_printf("date: %s\n", full_date());
541 destroy_all_dialogs();
542 destroy_buddy();
543 #ifdef USE_APPLET
544 set_user_state(offline);
545 applet_buddy_show = FALSE;
546 applet_widget_unregister_callback(APPLET_WIDGET(applet), "signoff");
547 remove_applet_away();
548 #else
549 show_login();
550 #endif /* USE_APPLET */
551 if (misc_options & OPT_MISC_BUDDY_TICKER)
552 BuddyTickerSignoff();
553 }
554 500
555 void handle_click_group(GtkWidget *widget, GdkEventButton *event, struct group *g) 501 void handle_click_group(GtkWidget *widget, GdkEventButton *event, struct group *g)
556 { 502 {
557 if (event->type == GDK_2BUTTON_PRESS) { 503 if (event->type == GDK_2BUTTON_PRESS) {
558 if (GTK_TREE_ITEM(widget)->expanded) 504 if (GTK_TREE_ITEM(widget)->expanded)
989 935
990 return FALSE; 936 return FALSE;
991 } 937 }
992 938
993 939
994 static void redo_buddy_list() 940 /* you really shouldn't call this function */
941 void redo_buddy_list()
995 { 942 {
996 /* so here we can safely assume that we don't have to add or delete anything, we 943 /* so here we can safely assume that we don't have to add or delete anything, we
997 * just have to go through and reorder everything. remember, nothing is going to 944 * just have to go through and reorder everything. remember, nothing is going to
998 * change connections, so we can assume that we don't have to change any user 945 * change connections, so we can assume that we don't have to change any user
999 * data or anything. this is just a simple reordering. so calm down. */ 946 * data or anything. this is just a simple reordering. so calm down. */