# HG changeset patch # User Christian Hammond # Date 1060109997 0 # Node ID 01289157fc374510c0cd63b693e63fa3f1a92f5e # Parent 8cbf38789734b12dfb1bdb3f65c008068b65b62c [gaim-migrate @ 6883] This solves the problem of 50 billion dialogs on your screen and server requests to re-authorize or re-deny everybody on every privacy list in your protocol. "Oops." committer: Tailor Script diff -r 8cbf38789734 -r 01289157fc37 src/blist.c --- a/src/blist.c Tue Aug 05 18:31:00 2003 +0000 +++ b/src/blist.c Tue Aug 05 18:59:57 2003 +0000 @@ -1013,9 +1013,9 @@ bud = g_list_append(bud, g_strdup(nm)); } } else if (*c == 'p') { - gaim_privacy_permit_add(account, c + 2); + gaim_privacy_permit_add(account, c + 2, TRUE); } else if (*c == 'd') { - gaim_privacy_deny_add(account, c + 2); + gaim_privacy_deny_add(account, c + 2, TRUE); } else if (!strncmp("toc", c, 3)) { sscanf(c + strlen(c) - 1, "%d", &account->perm_deny); gaim_debug(GAIM_DEBUG_MISC, "toc blist", @@ -1603,7 +1603,7 @@ GaimAccount *account = gaim_accounts_find(blist_parser_account_name, blist_parser_account_protocol); if(account) { - gaim_privacy_permit_add(account, blist_parser_buddy_name); + gaim_privacy_permit_add(account, blist_parser_buddy_name, TRUE); } g_free(blist_parser_buddy_name); blist_parser_buddy_name = NULL; @@ -1612,7 +1612,7 @@ GaimAccount *account = gaim_accounts_find(blist_parser_account_name, blist_parser_account_protocol); if(account) { - gaim_privacy_deny_add(account, blist_parser_buddy_name); + gaim_privacy_deny_add(account, blist_parser_buddy_name, TRUE); } g_free(blist_parser_buddy_name); blist_parser_buddy_name = NULL; diff -r 8cbf38789734 -r 01289157fc37 src/gtkprivacy.c --- a/src/gtkprivacy.c Tue Aug 05 18:31:00 2003 +0000 +++ b/src/gtkprivacy.c Tue Aug 05 18:59:57 2003 +0000 @@ -311,11 +311,11 @@ if (dialog->in_allow_list) { if (find_permit_block_by_name(dialog->account->permit, name)) - gaim_privacy_permit_remove(dialog->account, name); + gaim_privacy_permit_remove(dialog->account, name, FALSE); } else { if (find_permit_block_by_name(dialog->account->deny, name)) - gaim_privacy_deny_remove(dialog->account, name); + gaim_privacy_deny_remove(dialog->account, name, FALSE); } } @@ -520,9 +520,9 @@ confirm_permit_block_cb(GaimGtkPrivacyRequestData *data, int option) { if (data->block) - gaim_privacy_deny_add(data->account, data->name); + gaim_privacy_deny_add(data->account, data->name, FALSE); else - gaim_privacy_permit_add(data->account, data->name); + gaim_privacy_permit_add(data->account, data->name, FALSE); destroy_request_data(data); } diff -r 8cbf38789734 -r 01289157fc37 src/privacy.c --- a/src/privacy.c Tue Aug 05 18:31:00 2003 +0000 +++ b/src/privacy.c Tue Aug 05 18:59:57 2003 +0000 @@ -28,7 +28,8 @@ static GaimPrivacyUiOps *privacy_ops = NULL; gboolean -gaim_privacy_permit_add(GaimAccount *account, const char *who) +gaim_privacy_permit_add(GaimAccount *account, const char *who, + gboolean local_only) { GSList *l; char *name; @@ -50,7 +51,7 @@ account->permit = g_slist_append(account->permit, g_strdup(who)); - if (gaim_account_is_connected(account)) + if (!local_only && gaim_account_is_connected(account)) serv_add_permit(gaim_account_get_connection(account), who); gaim_blist_save(); @@ -62,7 +63,8 @@ } gboolean -gaim_privacy_permit_remove(GaimAccount *account, const char *who) +gaim_privacy_permit_remove(GaimAccount *account, const char *who, + gboolean local_only) { GSList *l; char *name; @@ -85,7 +87,7 @@ account->permit = g_slist_remove(account->permit, l->data); g_free(l->data); - if (gaim_account_is_connected(account)) + if (!local_only && gaim_account_is_connected(account)) serv_rem_deny(gaim_account_get_connection(account), who); gaim_blist_save(); @@ -97,7 +99,8 @@ } gboolean -gaim_privacy_deny_add(GaimAccount *account, const char *who) +gaim_privacy_deny_add(GaimAccount *account, const char *who, + gboolean local_only) { GSList *l; char *name; @@ -119,7 +122,7 @@ account->deny = g_slist_append(account->deny, g_strdup(who)); - if (gaim_account_is_connected(account)) + if (!local_only && gaim_account_is_connected(account)) serv_add_deny(gaim_account_get_connection(account), who); gaim_blist_save(); @@ -131,7 +134,8 @@ } gboolean -gaim_privacy_deny_remove(GaimAccount *account, const char *who) +gaim_privacy_deny_remove(GaimAccount *account, const char *who, + gboolean local_only) { GSList *l; char *name; @@ -154,7 +158,7 @@ account->deny = g_slist_remove(account->deny, l->data); g_free(l->data); - if (gaim_account_is_connected(account)) { + if (!local_only && gaim_account_is_connected(account)) { gaim_debug(GAIM_DEBUG_INFO, "privacy", "Removing %s from server-side deny list\n", who); serv_rem_deny(gaim_account_get_connection(account), who); diff -r 8cbf38789734 -r 01289157fc37 src/privacy.h --- a/src/privacy.h Tue Aug 05 18:31:00 2003 +0000 +++ b/src/privacy.h Tue Aug 05 18:59:57 2003 +0000 @@ -44,42 +44,54 @@ /** * Adds a user to the account's permit list. * - * @param account The account. - * @Param name The name of the user to add to the list. + * @param account The account. + * @Param name The name of the user to add to the list. + * @param local_only If TRUE, only the local list is updated, and not + * the server. * * @return TRUE if the user was added successfully, or @c FALSE otherwise. */ -gboolean gaim_privacy_permit_add(GaimAccount *account, const char *name); +gboolean gaim_privacy_permit_add(GaimAccount *account, const char *name, + gboolean local_only); /** * Removes a user from the account's permit list. * - * @param account The account. - * @Param name The name of the user to add to the list. + * @param account The account. + * @Param name The name of the user to add to the list. + * @param local_only If TRUE, only the local list is updated, and not + * the server. * * @return TRUE if the user was removed successfully, or @c FALSE otherwise. */ -gboolean gaim_privacy_permit_remove(GaimAccount *account, const char *name); +gboolean gaim_privacy_permit_remove(GaimAccount *account, const char *name, + gboolean local_only); /** * Adds a user to the account's deny list. * - * @param account The account. - * @Param name The name of the user to add to the list. + * @param account The account. + * @Param name The name of the user to add to the list. + * @param local_only If TRUE, only the local list is updated, and not + * the server. * * @return TRUE if the user was added successfully, or @c FALSE otherwise. */ -gboolean gaim_privacy_deny_add(GaimAccount *account, const char *name); +gboolean gaim_privacy_deny_add(GaimAccount *account, const char *name, + gboolean local_only); /** * Removes a user from the account's deny list. * - * @param account The account. - * @Param name The name of the user to add to the list. + * @param account The account. + * @Param name The name of the user to add to the list. + * @param local_only If TRUE, only the local list is updated, and not + * the server. * * @return TRUE if the user was removed successfully, or @c FALSE otherwise. */ -gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *name); +gboolean gaim_privacy_deny_remove(GaimAccount *account, const char *name, + gboolean local_only); /** * Sets the UI operations structure for the privacy subsystem. diff -r 8cbf38789734 -r 01289157fc37 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Tue Aug 05 18:31:00 2003 +0000 +++ b/src/protocols/msn/msn.c Tue Aug 05 18:59:57 2003 +0000 @@ -699,14 +699,14 @@ "to your allow list."), who); gaim_notify_error(gc, NULL, _("Invalid MSN screenname"), buf); - gaim_privacy_permit_remove(gc->account, who); + gaim_privacy_permit_remove(gc->account, who, TRUE); return; } if (g_slist_find_custom(gc->account->deny, who, (GCompareFunc)strcmp)) { gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from BL to AL\n", who); - gaim_privacy_deny_remove(gc->account, who); + gaim_privacy_deny_remove(gc->account, who, TRUE); g_snprintf(buf, sizeof(buf), "BL %s", who); @@ -740,14 +740,14 @@ gaim_notify_error(gc, NULL, _("Invalid MSN screenname"), buf); - gaim_privacy_deny_remove(gc->account, who); + gaim_privacy_deny_remove(gc->account, who, TRUE); return; } if (g_slist_find_custom(gc->account->permit, who, (GCompareFunc)strcmp)) { gaim_debug(GAIM_DEBUG_INFO, "msn", "Moving %s from AL to BL\n", who); - gaim_privacy_permit_remove(gc->account, who); + gaim_privacy_permit_remove(gc->account, who, TRUE); g_snprintf(buf, sizeof(buf), "AL %s", who); @@ -780,7 +780,7 @@ return; } - gaim_privacy_deny_add(gc->account, who); + gaim_privacy_deny_add(gc->account, who, TRUE); g_snprintf(buf, sizeof(buf), "BL %s %s", who, who); @@ -803,14 +803,7 @@ return; } - gaim_privacy_permit_add(gc->account, who); - - g_snprintf(buf, sizeof(buf), "AL %s %s", who, who); - - if (!msn_servconn_send_command(session->notification_conn, "ADD", buf)) { - gaim_connection_error(gc, _("Write error")); - return; - } + gaim_privacy_permit_add(gc->account, who, TRUE); } static void @@ -886,7 +879,7 @@ } for (; t != NULL; t = t->next) - gaim_privacy_permit_remove(gc->account, t->data); + gaim_privacy_permit_remove(gc->account, t->data, TRUE); if (t != NULL) g_slist_free(t); @@ -924,7 +917,7 @@ } for (; t != NULL; t = t->next) - gaim_privacy_deny_remove(gc->account, t->data); + gaim_privacy_deny_remove(gc->account, t->data, TRUE); if (t != NULL) g_slist_free(t); @@ -1031,8 +1024,6 @@ old_group = msn_groups_find_with_name(session->groups, old_group_name); new_group = msn_groups_find_with_name(session->groups, new_group_name); - gaim_debug(GAIM_DEBUG_MISC, "msn", "new_group = %p\n", new_group); - if (new_group == NULL) { g_snprintf(outparams, sizeof(outparams), "%s 0", msn_url_encode(new_group_name)); diff -r 8cbf38789734 -r 01289157fc37 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Tue Aug 05 18:31:00 2003 +0000 +++ b/src/protocols/oscar/oscar.c Tue Aug 05 18:59:57 2003 +0000 @@ -4887,7 +4887,7 @@ if (!list) { gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: adding permit buddy %s to local list\n", curitem->name); - gaim_privacy_permit_add(account, curitem->name); + gaim_privacy_permit_add(account, curitem->name, FALSE); export = TRUE; } } @@ -4900,7 +4900,7 @@ if (!list) { gaim_debug(GAIM_DEBUG_INFO, "oscar", "ssi: adding deny buddy %s to local list\n", curitem->name); - gaim_privacy_deny_add(account, curitem->name); + gaim_privacy_deny_add(account, curitem->name, FALSE); export = TRUE; } }