From: Eric W. <war...@us...> - 2001-09-21 00:14:15
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv4284/src Modified Files: buddy.c conversation.c dialogs.c gaim.h prpl.h server.c Log Message: i feel like everyone's watching me Index: buddy.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/buddy.c,v retrieving revision 1.243 retrieving revision 1.244 diff -u -d -r1.243 -r1.244 --- buddy.c 2001/09/20 01:20:29 1.243 +++ buddy.c 2001/09/21 00:14:11 1.244 @@ -869,7 +869,6 @@ delb = (struct buddy *)mem->data; delg->members = g_slist_remove(delg->members, delb); - serv_remove_buddy(gc, delb->name); gs = find_group_show(rem_g->name); if (gs) { @@ -906,10 +905,9 @@ if (c) update_buttons_by_protocol(c); g_free(delb); - - /* flush buddy list to cache */ - do_export(gc); + /* we don't flush buddy list to cache because in the case of remove_group that would + * mean writing to the buddy list file once for each buddy, plus one more time */ } void remove_group(struct gaim_connection *gc, struct group *rem_g) @@ -917,6 +915,7 @@ GSList *grp; GSList *mem; struct group_show *gs; + GList *tmp = NULL; struct group *delg; struct buddy *delb; @@ -930,6 +929,7 @@ while(delg->members) { delb = (struct buddy *)delg->members->data; + tmp = g_list_append(tmp, g_strdup(delb->name)); remove_buddy(gc, delg, delb); /* this should take care of removing the group_show if necessary */ } @@ -944,9 +944,14 @@ } g_free(delg); - /* flush buddy list to cache */ + serv_remove_buddies(gc, tmp); + while (tmp) { + g_free(tmp->data); + tmp = g_list_remove(tmp, tmp->data); + } - do_export(gc); + /* don't flush buddy list to cache in order to be consistent with remove_buddy, + * mostly. remove_group is only called from one place, so we'll let it handle it. */ } @@ -1386,6 +1391,7 @@ b = (struct buddy *)type; g = find_group_by_buddy(b->gc, b->name); gct = b->gc; + serv_remove_buddy(b->gc, b->name); remove_buddy(b->gc, g, b); gtk_ctree_remove_node(GTK_CTREE(edittree), node); do_export(gct); Index: conversation.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/conversation.c,v retrieving revision 1.259 retrieving revision 1.260 diff -u -d -r1.259 -r1.260 --- conversation.c 2001/09/20 09:12:29 1.259 +++ conversation.c 2001/09/21 00:14:11 1.260 @@ -532,7 +532,9 @@ { if (c->gc && find_buddy(c->gc, c->name) != NULL) { debug_printf(_("Removing '%s' from buddylist.\n"), c->name); + serv_remove_buddy(c->gc, c->name); remove_buddy(c->gc, find_group_by_buddy(c->gc, c->name), find_buddy(c->gc, c->name)); + do_export(c->gc); build_edit_tree(); update_convo_add_button(c); } else { Index: dialogs.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/dialogs.c,v retrieving revision 1.246 retrieving revision 1.247 diff -u -d -r1.246 -r1.247 --- dialogs.c 2001/09/20 08:33:42 1.246 +++ dialogs.c 2001/09/21 00:14:11 1.247 @@ -454,107 +454,6 @@ -void show_error_dialog(char *d) -{ - - int no = atoi(d); - char *w; - char buf[256]; - char buf2[32]; - - plugin_event(event_error, (void *)no, 0, 0, 0); - - w = strtok(NULL, ":"); - - - switch(no) { - case 69: - g_snprintf(buf, sizeof(buf), _("Unable to write file %s."), w); - break; - case 169: - g_snprintf(buf, sizeof(buf), _("Unable to read file %s."), w); - break; - case 269: - g_snprintf(buf, sizeof(buf), _("Message too long, last %s bytes truncated."), w); - break; - case 901: - g_snprintf(buf, sizeof(buf), _("%s not currently logged in."), w); - break; - case 902: - g_snprintf(buf, sizeof(buf), _("Warning of %s not allowed."), w); - break; - case 903: - g_snprintf(buf, sizeof(buf), _("A message has been dropped, you are exceeding the server speed limit.")); - break; - case 950: - g_snprintf(buf, sizeof(buf), _("Chat in %s is not available."), w); - break; - case 960: - g_snprintf(buf, sizeof(buf), _("You are sending messages too fast to %s."), w); - break; - case 961: - g_snprintf(buf, sizeof(buf), _("You missed an IM from %s because it was too big."), w); - break; - case 962: - g_snprintf(buf, sizeof(buf), _("You missed an IM from %s because it was sent too fast."), w); - break; - case 970: - g_snprintf(buf, sizeof(buf), _("Failure.")); - break; - case 971: - g_snprintf(buf, sizeof(buf), _("Too many matches.")); - break; - case 972: - g_snprintf(buf, sizeof(buf), _("Need more qualifiers.")); - break; - case 973: - g_snprintf(buf, sizeof(buf), _("Dir service temporarily unavailable.")); - break; - case 974: - g_snprintf(buf, sizeof(buf), _("Email lookup restricted.")); - break; - case 975: - g_snprintf(buf, sizeof(buf), _("Keyword ignored.")); - break; - case 976: - g_snprintf(buf, sizeof(buf), _("No keywords.")); - break; - case 977: - g_snprintf(buf, sizeof(buf), _("User has no directory information.")); - /* g_snprintf(buf, sizeof(buf), "Language not supported."); */ - break; - case 978: - g_snprintf(buf, sizeof(buf), _("Country not supported.")); - break; - case 979: - g_snprintf(buf, sizeof(buf), _("Failure unknown: %s."), w); - break; - case 980: - g_snprintf(buf, sizeof(buf), _("Incorrect nickname or password.")); - break; - case 981: - g_snprintf(buf, sizeof(buf), _("The service is temporarily unavailable.")); - break; - case 982: - g_snprintf(buf, sizeof(buf), _("Your warning level is currently too high to log in.")); - break; - case 983: - g_snprintf(buf, sizeof(buf), _("You have been connecting and disconnecting too frequently. Wait ten minutes and try again. If you continue to try, you will need to wait even longer.")); - break; - case 989: - g_snprintf(buf, sizeof(buf), _("An unknown signon error has occurred: %s."), w); - break; - default: - g_snprintf(buf, sizeof(buf), _("An unknown error, %d, has occured. Info: %s"), no, w); - } - - g_snprintf(buf2, sizeof(buf2), _("Gaim - Error %d"), no); - - - do_error_dialog(buf, buf2); - return; -} - static void do_im(GtkWidget *widget, GtkWidget *imentry) { char *who; Index: gaim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaim.h,v retrieving revision 1.259 retrieving revision 1.260 diff -u -d -r1.259 -r1.260 --- gaim.h 2001/09/20 19:09:42 1.259 +++ gaim.h 2001/09/21 00:14:12 1.260 @@ -664,6 +664,7 @@ extern void serv_add_buddy(struct gaim_connection *, char *); extern void serv_add_buddies(struct gaim_connection *, GList *); extern void serv_remove_buddy(struct gaim_connection *, char *); +extern void serv_remove_buddies(struct gaim_connection *, GList *); extern void serv_add_permit(struct gaim_connection *, char *); extern void serv_add_deny(struct gaim_connection *, char *); extern void serv_rem_permit(struct gaim_connection *, char *); @@ -843,7 +844,6 @@ extern void do_export(struct gaim_connection *); extern void show_warn_dialog(struct gaim_connection *, char *); extern GtkWidget *do_error_dialog(char *, char *); -extern void show_error_dialog(char *); extern void show_im_dialog(); extern void some_name(char *); extern void show_info_dialog(); Index: prpl.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/prpl.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- prpl.h 2001/09/19 06:09:15 1.47 +++ prpl.h 2001/09/21 00:14:12 1.48 @@ -116,6 +116,7 @@ void (* add_buddy) (struct gaim_connection *, char *name); void (* add_buddies) (struct gaim_connection *, GList *buddies); void (* remove_buddy) (struct gaim_connection *, char *name); + void (* remove_buddies) (struct gaim_connection *, GList *buddies); void (* add_permit) (struct gaim_connection *, char *name); void (* add_deny) (struct gaim_connection *, char *name); void (* rem_permit) (struct gaim_connection *, char *name); Index: server.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/server.c,v retrieving revision 1.189 retrieving revision 1.190 diff -u -d -r1.189 -r1.190 --- server.c 2001/09/20 01:20:29 1.189 +++ server.c 2001/09/21 00:14:12 1.190 @@ -234,6 +234,20 @@ (*g->prpl->remove_buddy)(g, name); } +void serv_remove_buddies(struct gaim_connection *gc, GList *g) +{ + if (!gc->prpl) + return; /* how the hell did that happen? */ + if (gc->prpl->remove_buddies) + (*gc->prpl->remove_buddies)(gc, g); + else { + while (g) { + serv_remove_buddy(gc, g->data); + g = g->next; + } + } +} + void serv_add_permit(struct gaim_connection *g, char *name) { if (g->prpl && g->prpl->add_permit) |