Mercurial > pidgin
changeset 657:4bbc103a3294
[gaim-migrate @ 667]
merge buddy lists instead of overwrite them
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 10 Aug 2000 08:14:00 +0000 |
parents | 732ee4f6f541 |
children | ae4457892810 |
files | src/dialogs.c src/toc.c |
diffstat | 2 files changed, 98 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dialogs.c Thu Aug 10 07:25:08 2000 +0000 +++ b/src/dialogs.c Thu Aug 10 08:14:00 2000 +0000 @@ -1722,11 +1722,31 @@ } if (d) { - deny = g_list_append(deny, name); - serv_add_deny(name); + GList *d = deny; + while (d) { + char *n = g_strdup(normalize(name)); + if (!strcmp(n, normalize(d->data))) + break; + d = d->next; + g_free(n); + } + if (!d) { + deny = g_list_append(deny, name); + serv_add_deny(name); + } } else { - permit = g_list_append(permit, name); - serv_add_permit(name); + GList *d = permit; + while (d) { + char *n = g_strdup(normalize(name)); + if (!strcmp(n, normalize(d->data))) + break; + d = d->next; + g_free(n); + } + if (!d) { + permit = g_list_append(permit, name); + serv_add_permit(name); + } } @@ -2285,6 +2305,9 @@ /* Color Selection Dialog */ /*------------------------------------------------------*/ +static GtkWidget *fgcseld = NULL; +static GtkWidget *bgcseld = NULL; + void cancel_color(GtkWidget *widget, struct conversation *c) { if (c->palette && widget) @@ -2324,11 +2347,58 @@ cancel_color(NULL, c); } +static void destroy_colorsel(GtkWidget *w, gpointer d) +{ + if (d) { + gtk_widget_destroy(fgcseld); + fgcseld = NULL; + } else { + gtk_widget_destroy(bgcseld); + bgcseld = NULL; + } +} + +static void apply_color_dlg(GtkWidget *w, gpointer d) +{ + gdouble color[3]; + if ((int)d == 1) { + gtk_color_selection_get_color(GTK_COLOR_SELECTION(fgcseld), color); + destroy_colorsel(NULL, (void *)1); + } else { + gtk_color_selection_get_color(GTK_COLOR_SELECTION(bgcseld), color); + destroy_colorsel(NULL, (void *)2); + } + /* FIXME ! here we need to set the preferences, etc */ +} void show_color_dialog(struct conversation *c, GtkWidget *color) { GtkWidget *colorsel; + if ((int)color == 1) { /* foreground */ + if (fgcseld) return; + fgcseld = gtk_color_selection_dialog_new(_("Select Text Color")); + gtk_signal_connect(GTK_OBJECT(fgcseld), "delete_event", GTK_SIGNAL_FUNC(destroy_colorsel), (void *)1); + gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_colorsel), (void *)1); + gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(fgcseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_color_dlg), (void *)1); + gtk_widget_realize(fgcseld); + aol_icon(fgcseld->window); + gtk_widget_show(fgcseld); + gdk_window_raise(fgcseld->window); + return; + } else if ((int)color == 2) { /* background */ + if (bgcseld) return; + bgcseld = gtk_color_selection_dialog_new(_("Select Background Color")); + gtk_signal_connect(GTK_OBJECT(bgcseld), "delete_event", GTK_SIGNAL_FUNC(destroy_colorsel), NULL); + gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->cancel_button), "clicked", GTK_SIGNAL_FUNC(destroy_colorsel), NULL); + gtk_signal_connect(GTK_OBJECT(GTK_COLOR_SELECTION_DIALOG(bgcseld)->ok_button), "clicked", GTK_SIGNAL_FUNC(apply_color_dlg), (void *)2); + gtk_widget_realize(bgcseld); + aol_icon(bgcseld->window); + gtk_widget_show(bgcseld); + gdk_window_raise(bgcseld->window); + return; + } + if (!c->color_dialog) { c->color_dialog = gtk_color_selection_dialog_new(_("Select Text Color")); @@ -2659,11 +2729,13 @@ grp = groups; + /* why is this being done? if we merge them than this shouldn't happen while(grp) { grp2 = grp->next; remove_group((struct group *)grp->data); grp = grp2; } + */ parse_toc_buddy_list(buf, 1);
--- a/src/toc.c Thu Aug 10 07:25:08 2000 +0000 +++ b/src/toc.c Thu Aug 10 08:14:00 2000 +0000 @@ -872,10 +872,12 @@ int how_many = 0; /* Clean out the permit/deny list!*/ + /* why? if we're going to merge things, then these should stay g_list_free(permit); g_list_free(deny); permit = NULL; deny = NULL; + */ bud = NULL; /* skip "CONFIG:" (if it exists)*/ @@ -897,13 +899,31 @@ how_many++; bud = g_list_append(bud, c+2); } else if (*c == 'p') { + GList *d = deny; name = g_malloc(strlen(c+2) + 2); g_snprintf(name, strlen(c+2) + 1, "%s", c+2); - permit = g_list_append(permit, name); + while (d) { + char *n = g_strdup(normalize(name)); + if (!strcmp(n, normalize(d->data))) + break; + d = d->next; + g_free(n); + } + if (!d) + permit = g_list_append(permit, name); } else if (*c == 'd') { + GList *d = permit; name = g_malloc(strlen(c+2) + 2); g_snprintf(name, strlen(c+2) + 1, "%s", c+2); - deny = g_list_append(deny, name); + while (d) { + char *n = g_strdup(normalize(name)); + if (!strcmp(n, normalize(d->data))) + break; + d = d->next; + g_free(n); + } + if (!d) + deny = g_list_append(deny, name); } else if (*c == 'm') { sscanf(c + strlen(c) - 1, "%d", &permdeny); if (permdeny == 0)