# HG changeset patch # User Yoshiki Yazawa # Date 1201855844 0 # Node ID 96934545f5be6af2cb6bc06919f9813da471f1e5 # Parent 1200e0d4f2aa973877d7cb35951ce20a827cfcf3# Parent 31863f2d7c3cb29b18f8a8c80d0dcd88c61a9a5e propagate from branch 'im.pidgin.pidgin' (head ba2fcd0ff9b6309bdae42ab4c25a628916a5cb6c) to branch 'im.pidgin.pidgin.yaz' (head 62d8abdcbf199e6ed97092269404020f21afe60b) diff -r 1200e0d4f2aa -r 96934545f5be libpurple/privacy.c --- a/libpurple/privacy.c Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/privacy.c Fri Feb 01 08:50:44 2008 +0000 @@ -202,7 +202,10 @@ return TRUE; } -/* This makes sure that only all the buddies are in the permit list. */ +/** + * This makes sure your permit list contains all buddies from your + * buddy list and ONLY buddies from your buddy list. + */ static void add_buddies_in_permit(PurpleAccount *account, gboolean local) { diff -r 1200e0d4f2aa -r 96934545f5be libpurple/protocols/qq/login_logout.c --- a/libpurple/protocols/qq/login_logout.c Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/protocols/qq/login_logout.c Fri Feb 01 08:50:44 2008 +0000 @@ -485,11 +485,15 @@ PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Incorrect password.")); break; case QQ_LOGIN_REPLY_MISC_ERROR: - purple_connection_error_reason(gc, - PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to login, check debug log")); + if (purple_debug_is_enabled()) + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to login. Check debug log.")); + else + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Unable to login")); break; case QQ_LOGIN_REPLY_OK: - purple_debug(PURPLE_DEBUG_INFO, "QQ", "Login replys OK, everything is fine\n"); + purple_debug(PURPLE_DEBUG_INFO, "QQ", "Login repliess OK; everything is fine\n"); break; case QQ_LOGIN_REPLY_REDIRECT: /* the redirect has been done in _qq_process_login_reply */ diff -r 1200e0d4f2aa -r 96934545f5be libpurple/protocols/silc10/ops.c --- a/libpurple/protocols/silc10/ops.c Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/protocols/silc10/ops.c Fri Feb 01 08:50:44 2008 +0000 @@ -1697,27 +1697,32 @@ return; break; case SILC_CLIENT_CONN_ERROR: - purple_connection_error(gc, _("Error during connecting to SILC Server")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Error during connecting to SILC Server")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_KE: - purple_connection_error(gc, _("Key Exchange failed")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_ENCRYPTION_ERROR, + _("Key Exchange failed")); break; case SILC_CLIENT_CONN_ERROR_AUTH: - purple_connection_error(gc, _("Authentication failed")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, + _("Authentication failed")); break; case SILC_CLIENT_CONN_ERROR_RESUME: - purple_connection_error(gc, - _("Resuming detached session failed. " - "Press Reconnect to create new connection.")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Resuming detached session failed. " + "Press Reconnect to create new connection.")); g_unlink(silcpurple_session_file(purple_account_get_username(sg->account))); break; case SILC_CLIENT_CONN_ERROR_TIMEOUT: - purple_connection_error(gc, _("Connection Timeout")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Connection Timeout")); break; } @@ -1746,7 +1751,8 @@ /* Close the connection */ if (!sg->detaching) - purple_connection_error(gc, _("Disconnected by server")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Disconnected by server")); else /* TODO: Does this work correctly? Maybe we need to set wants_to_die? */ purple_account_disconnect(purple_connection_get_account(gc)); diff -r 1200e0d4f2aa -r 96934545f5be libpurple/protocols/silc10/silc.c --- a/libpurple/protocols/silc10/silc.c Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/protocols/silc10/silc.c Fri Feb 01 08:50:44 2008 +0000 @@ -158,7 +158,9 @@ sg = gc->proto_data; if (source < 0) { - purple_connection_error(gc, _("Connection failed")); + purple_connection_error_reason(gc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Connection failed")); return; } @@ -179,7 +181,8 @@ "silc.silcnet.org"), purple_account_get_int(account, "port", 706), sg); if (!conn) { - purple_connection_error(gc, _("Cannot initialize SILC Client connection")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Cannot initialize SILC Client connection")); gc->proto_data = NULL; return; } @@ -264,7 +267,8 @@ /* Allocate SILC client */ client = silc_client_alloc(&ops, ¶ms, gc, NULL); if (!client) { - purple_connection_error(gc, _("Out of memory")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Out of memory")); return; } @@ -309,15 +313,15 @@ /* Init SILC client */ if (!silc_client_init(client)) { - gc->wants_to_die = TRUE; - purple_connection_error(gc, _("Cannot initialize SILC protocol")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Cannot initialize SILC protocol")); return; } /* Check the ~/.silc dir and create it, and new key pair if necessary. */ if (!silcpurple_check_silc_dir(gc)) { - gc->wants_to_die = TRUE; - purple_connection_error(gc, _("Cannot find/access ~/.silc directory")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Error loading SILC key pair")); return; } @@ -332,7 +336,8 @@ (gc->password == NULL) ? "" : gc->password, &client->pkcs, &client->public_key, &client->private_key)) { g_snprintf(pkd, sizeof(pkd), _("Could not load SILC key pair: %s"), g_strerror(errno)); - purple_connection_error(gc, pkd); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_OTHER_ERROR, + _("Could not load SILC key pair")); return; } @@ -352,7 +357,8 @@ purple_account_get_int(account, "port", 706), silcpurple_login_connected, gc) == NULL) { - purple_connection_error(gc, _("Unable to create connection")); + purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Unable to create connection")); return; } diff -r 1200e0d4f2aa -r 96934545f5be libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Fri Feb 01 08:50:44 2008 +0000 @@ -61,58 +61,6 @@ #endif static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); -static void -yahoo_add_permit(PurpleConnection *gc, const char *who) -{ - purple_debug_info("yahoo", - "Permitting ID %s local contact rights for account %s\n", who, gc->account); - purple_privacy_permit_add(gc->account,who,TRUE); -} - -static void -yahoo_rem_permit(PurpleConnection *gc, const char *who) -{ - purple_debug_info("yahoo", - "Denying ID %s local contact rights for account %s\n", who, gc->account); - purple_privacy_permit_remove(gc->account,who,TRUE); -} - -gboolean -yahoo_privacy_check(PurpleConnection *gc, const char *who) -{ - /* returns TRUE if allowed through, FALSE otherwise */ - gboolean permitted; - - permitted = purple_privacy_check(gc->account, who); - - /* print some debug info */ - if (!permitted) { - char *deb = NULL; - switch (gc->account->perm_deny) - { - case PURPLE_PRIVACY_DENY_ALL: - deb = "PURPLE_PRIVACY_DENY_ALL"; - break; - case PURPLE_PRIVACY_DENY_USERS: - deb = "PURPLE_PRIVACY_DENY_USERS"; - break; - case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - deb = "PURPLE_PRIVACY_ALLOW_BUDDYLIST"; - break; - } - if(deb) - purple_debug_info("yahoo", - "%s blocked data received from %s (%s)\n", - gc->account->username,who, deb); - } else if (gc->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { - purple_debug_info("yahoo", - "%s allowed data received from %s (PURPLE_PRIVACY_ALLOW_USERS)\n", - gc->account->username,who); - } - - return permitted; -} - static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) { char *status = NULL; @@ -700,7 +648,7 @@ for (bud = buddies; bud && *bud; bud++) { /* The server is already ignoring the user */ got_serv_list = TRUE; - purple_privacy_deny_add(gc->account, *bud, 1); + purple_privacy_deny_add(account, *bud, 1); } g_strfreev(buddies); @@ -709,13 +657,13 @@ } if (got_serv_list && - ((gc->account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && - (gc->account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && - (gc->account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) + ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && + (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && + (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) { - gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; + account->perm_deny = PURPLE_PRIVACY_DENY_USERS; purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", - gc->account->username); + account->username); } if (yd->tmp_serv_plist) { @@ -724,7 +672,7 @@ f = yahoo_friend_find(gc, *bud); if (f) { purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", - gc->account->username, *bud); + account->username, *bud); f->presence = YAHOO_PRESENCE_PERM_OFFLINE; } } @@ -739,6 +687,7 @@ static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; char *msg = NULL; char *from = NULL; char *stat = NULL; @@ -746,6 +695,8 @@ YahooFriend *f = NULL; GSList *l = pkt->hash; + account = purple_connection_get_account(gc); + while (l) { struct yahoo_pair *pair = l->data; if (pair->key == 4) @@ -763,13 +714,14 @@ return; if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) - && (yahoo_privacy_check(gc, from))) { + && (purple_privacy_check(account, from))) + { if (*stat == '1') serv_got_typing(gc, from, 0, PURPLE_TYPING); else serv_got_typing_stopped(gc, from); } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { - PurpleBuddy *bud = purple_find_buddy(gc->account, from); + PurpleBuddy *bud = purple_find_buddy(account, from); if (!bud) { purple_debug(PURPLE_DEBUG_WARNING, "yahoo", @@ -789,7 +741,7 @@ yahoo_update_status(gc, from, f); } } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) { - PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, gc->account); + PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from); purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); g_free(buf); @@ -808,13 +760,15 @@ static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; struct yahoo_data *yd = gc->proto_data; GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; - const char *imv = NULL; + account = purple_connection_get_account(gc); + if (pkt->status <= 1 || pkt->status == 5) { while (l != NULL) { struct yahoo_pair *pair = l->data; @@ -859,20 +813,20 @@ { PurpleWhiteboard *wb; - if (!yahoo_privacy_check(gc, im->from)) { + if (!purple_privacy_check(account, im->from)) { purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); return; } /* I'm not sure the following ever happens -DAA */ - wb = purple_whiteboard_get_session(gc->account, im->from); + wb = purple_whiteboard_get_session(account, im->from); /* If a Doodle session doesn't exist between this user */ if(wb == NULL) { doodle_session *ds; - wb = purple_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); + wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED); ds = wb->proto_data; ds->imv_key = g_strdup(imv); @@ -892,7 +846,7 @@ continue; } - if (!yahoo_privacy_check(gc, im->from)) { + if (!purple_privacy_check(account, im->from)) { purple_debug_info("yahoo", "Message from %s dropped.\n", im->from); return; } @@ -908,11 +862,9 @@ purple_util_chrreplace(m, '\r', '\n'); if (!strcmp(m, "")) { - PurpleAccount *account; PurpleConversation *c; char *username; - account = purple_connection_get_account(gc); c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->from, account); if (c == NULL) c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, im->from); @@ -1067,9 +1019,12 @@ } static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; GSList *l = pkt->hash; const char *msg = NULL; + account = purple_connection_get_account(gc); + /* Buddy authorized/declined our addition */ if (pkt->status == 1) { const char *who = NULL; @@ -1139,7 +1094,8 @@ if (add_req->id && add_req->who) { char *alias = NULL, *dec_msg = NULL; - if (!yahoo_privacy_check(gc, add_req->who)) { + if (!purple_privacy_check(account, add_req->who)) + { purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", add_req->who); yahoo_buddy_add_deny_cb(add_req, NULL); @@ -1159,11 +1115,12 @@ /* DONE! this is almost exactly the same as what MSN does, * this should probably be moved to the core. */ - purple_account_request_authorization(purple_connection_get_account(gc), add_req->who, add_req->id, - alias, dec_msg, purple_find_buddy(purple_connection_get_account(gc), add_req->who) != NULL, - yahoo_buddy_add_authorize_cb, - yahoo_buddy_add_deny_reason_cb, - add_req); + purple_account_request_authorization(account, add_req->who, add_req->id, + alias, dec_msg, + purple_find_buddy(account, add_req->who) != NULL, + yahoo_buddy_add_authorize_cb, + yahoo_buddy_add_deny_reason_cb, + add_req); g_free(alias); g_free(dec_msg); } else { @@ -1178,10 +1135,13 @@ /* I don't think this happens anymore in Version 15 */ static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; struct yahoo_add_request *add_req; char *msg = NULL; GSList *l = pkt->hash; + account = purple_connection_get_account(gc); + add_req = g_new0(struct yahoo_add_request, 1); add_req->gc = gc; @@ -1207,7 +1167,7 @@ if (add_req->id && add_req->who) { char *dec_msg = NULL; - if (!yahoo_privacy_check(gc, add_req->who)) { + if (!purple_privacy_check(account, add_req->who)) { purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", add_req->who); yahoo_buddy_add_deny_cb(add_req, NULL); @@ -1220,11 +1180,11 @@ /* DONE! this is almost exactly the same as what MSN does, * this should probably be moved to the core. */ - purple_account_request_authorization(purple_connection_get_account(gc), add_req->who, add_req->id, - NULL, dec_msg, purple_find_buddy(purple_connection_get_account(gc),add_req->who) != NULL, - yahoo_buddy_add_authorize_cb, - yahoo_buddy_add_deny_reason_cb, - add_req); + purple_account_request_authorization(account, add_req->who, add_req->id, + NULL, dec_msg, + purple_find_buddy(account,add_req->who) != NULL, + yahoo_buddy_add_authorize_cb, + yahoo_buddy_add_deny_reason_cb, add_req); g_free(dec_msg); } else { g_free(add_req->id); @@ -2287,9 +2247,12 @@ static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; char *who = NULL, *msg = NULL, *id = NULL; GSList *l = pkt->hash; + account = purple_connection_get_account(gc); + while (l) { struct yahoo_pair *pair = l->data; @@ -2325,9 +2288,9 @@ purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); return; } - if (!yahoo_privacy_check(gc, who)) { + if (!purple_privacy_check(account, who)) { purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", - gc->account->username, who); + purple_account_get_username(account), who); return; } if (id) { @@ -3883,12 +3846,10 @@ yahoo_packet_send_and_free(pkt, yd); } -/* XXX - What's the deal with PurpleGroup *foo? */ -static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *foo) +static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) { struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; struct yahoo_packet *pkt; - PurpleGroup *g; const char *group = NULL; char *group2; YahooFriend *f; @@ -3896,20 +3857,17 @@ if (!yd->logged_in) return; - if (!yahoo_privacy_check(gc, purple_buddy_get_name(buddy))) + if (!purple_privacy_check(purple_connection_get_account(gc), + purple_buddy_get_name(buddy))) return; f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); - if (foo) - group = foo->name; - if (!group) { - g = purple_buddy_get_group(buddy); - if (g) - group = g->name; - else - group = "Buddies"; - } + g = purple_buddy_get_group(buddy); + if (g) + group = g->name; + else + group = "Buddies"; group2 = yahoo_string_encode(gc, group, NULL); pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); @@ -3971,10 +3929,6 @@ if (!yd->logged_in) return; - /* It seems to work better without this */ - - /* if (gc->account->perm_deny != 4) - return; */ if (!who || who[0] == '\0') return; @@ -4000,34 +3954,27 @@ yahoo_packet_send_and_free(pkt, yd); } -static void yahoo_set_permit_deny(PurpleConnection *gc) { - PurpleAccount *acct; +static void yahoo_set_permit_deny(PurpleConnection *gc) +{ + PurpleAccount *account; GSList *deny; - acct = gc->account; - - switch (acct->perm_deny) { - /* privacy 1 */ + account = purple_connection_get_account(gc); + + switch (account->perm_deny) + { case PURPLE_PRIVACY_ALLOW_ALL: - for (deny = acct->deny;deny;deny = deny->next) + for (deny = account->deny; deny; deny = deny->next) yahoo_rem_deny(gc, deny->data); break; - /* privacy 3 */ - case PURPLE_PRIVACY_ALLOW_USERS: - for (deny = acct->deny;deny;deny = deny->next) - yahoo_rem_deny(gc, deny->data); - break; - /* privacy 5 */ + case PURPLE_PRIVACY_ALLOW_BUDDYLIST: - /* privacy 4 */ + case PURPLE_PRIVACY_ALLOW_USERS: case PURPLE_PRIVACY_DENY_USERS: - for (deny = acct->deny;deny;deny = deny->next) + case PURPLE_PRIVACY_DENY_ALL: + for (deny = account->deny; deny; deny = deny->next) yahoo_add_deny(gc, deny->data); break; - /* privacy 2 */ - case PURPLE_PRIVACY_DENY_ALL: - default: - break; } } @@ -4357,9 +4304,9 @@ NULL, /* add_buddies */ yahoo_remove_buddy, NULL, /*remove_buddies */ - yahoo_add_permit, + NULL, /* add_permit */ yahoo_add_deny, - yahoo_rem_permit, + NULL, /* rem_permit */ yahoo_rem_deny, yahoo_set_permit_deny, yahoo_c_join, diff -r 1200e0d4f2aa -r 96934545f5be libpurple/protocols/yahoo/yahoo.h --- a/libpurple/protocols/yahoo/yahoo.h Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoo.h Fri Feb 01 08:50:44 2008 +0000 @@ -232,15 +232,6 @@ */ gchar* yahoo_get_cookies(PurpleConnection *gc); -/** - * Check to see whether the sender is permitted to send - * - * @param gc The gc handle. - * @param who The sender of the packet to check -*/ -gboolean yahoo_privacy_check - (PurpleConnection *gc, const char *who); - gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type); GList *yahoo_attention_types(PurpleAccount *account); diff -r 1200e0d4f2aa -r 96934545f5be libpurple/protocols/yahoo/yahoochat.c --- a/libpurple/protocols/yahoo/yahoochat.c Thu Jan 31 15:56:44 2008 +0000 +++ b/libpurple/protocols/yahoo/yahoochat.c Fri Feb 01 08:50:44 2008 +0000 @@ -114,6 +114,7 @@ void yahoo_process_conference_invite(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; GSList *l; char *room = NULL; char *who = NULL; @@ -124,6 +125,8 @@ if (pkt->status == 2) return; /* XXX */ + account = purple_connection_get_account(gc); + members = g_string_sized_new(512); for (l = pkt->hash; l; l = l->next) { @@ -159,8 +162,9 @@ return; } - if (!yahoo_privacy_check(gc, who) || - (purple_account_get_bool(purple_connection_get_account(gc), "ignore_invites", FALSE))) { + if (!purple_privacy_check(account, who) || + (purple_account_get_bool(account, "ignore_invites", FALSE))) + { purple_debug_info("yahoo", "Invite to conference %s from %s has been dropped.\n", room, who); g_free(room); @@ -203,7 +207,8 @@ break; } } - if (!yahoo_privacy_check(gc, who)) { + if (!purple_privacy_check(purple_connection_get_account(gc), who)) + { g_free(room); g_free(msg); return; @@ -664,11 +669,14 @@ void yahoo_process_chat_addinvite(PurpleConnection *gc, struct yahoo_packet *pkt) { + PurpleAccount *account; GSList *l; char *room = NULL; char *msg = NULL; char *who = NULL; + account = purple_connection_get_account(gc); + for (l = pkt->hash; l; l = l->next) { struct yahoo_pair *pair = l->data; @@ -696,8 +704,9 @@ if (room && who) { GHashTable *components; - if (!yahoo_privacy_check(gc, who) || - (purple_account_get_bool(purple_connection_get_account(gc), "ignore_invites", FALSE))) { + if (!purple_privacy_check(account, who) || + (purple_account_get_bool(account, "ignore_invites", FALSE))) + { purple_debug_info("yahoo", "Invite to room %s from %s has been dropped.\n", room, who); g_free(room); g_free(msg); diff -r 1200e0d4f2aa -r 96934545f5be pidgin/gtkcertmgr.c --- a/pidgin/gtkcertmgr.c Thu Jan 31 15:56:44 2008 +0000 +++ b/pidgin/gtkcertmgr.c Fri Feb 01 08:50:44 2008 +0000 @@ -84,10 +84,10 @@ GtkTreeView *listview = tpm_dat->listview; PurpleCertificatePool *tls_peers; GList *idlist, *l; - + GtkListStore *store = GTK_LIST_STORE( gtk_tree_view_get_model(GTK_TREE_VIEW(listview))); - + /* First, delete everything in the list */ gtk_list_store_clear(store); @@ -199,7 +199,7 @@ NULL, NULL, NULL, /* No account/who/conv*/ crt /* Pass cert instance to callback*/ ); - + g_free(default_hostname); } else { /* Errors! Oh no! */ @@ -235,7 +235,7 @@ PurpleCertificate *crt = (PurpleCertificate *) data; g_assert(filename); - + if (!purple_certificate_export(filename, crt)) { /* Errors! Oh no! */ /* TODO: Perhaps find a way to be specific about what just @@ -260,7 +260,7 @@ /* Pressing cancel just frees the duplicated certificate */ purple_certificate_destroy(crt); } - + static void tls_peers_mgmt_export_cb(GtkWidget *button, gpointer data) { @@ -293,7 +293,6 @@ } g_free(id); - /* TODO: inform user that it will be a PEM? */ purple_request_file(tpm_dat, _("PEM X.509 Certificate Export"), @@ -327,10 +326,10 @@ /* Now retrieve the certificate */ crt = purple_certificate_pool_retrieve(tpm_dat->tls_peers, id); g_return_if_fail(crt); - + /* Fire the notification */ purple_certificate_display_x509(crt); - + g_free(id); purple_certificate_destroy(crt); } @@ -350,7 +349,7 @@ g_free(id); } - + static void tls_peers_mgmt_delete_cb(GtkWidget *button, gpointer data) { @@ -370,7 +369,7 @@ /* Prompt to confirm deletion */ primary = g_strdup_printf( _("Really delete certificate for %s?"), id ); - + purple_request_yes_no(tpm_dat, _("Confirm certificate delete"), primary, NULL, /* Can this be NULL? */ 1, /* NO is default action */ @@ -378,9 +377,9 @@ id, /* id ownership passed to callback */ tls_peers_mgmt_delete_confirm_cb, tls_peers_mgmt_delete_confirm_cb ); - + g_free(primary); - + } else { purple_debug_warning("gtkcertmgr/tls_peers_mgmt", "Delete clicked with no selection?\n"); @@ -406,7 +405,7 @@ /* Create a struct to store context information about this window */ tpm_dat = g_new0(tls_peers_mgmt_data, 1); - + tpm_dat->mgmt_widget = mgmt_widget = gtk_hbox_new(FALSE, /* Non-homogeneous */ PIDGIN_HIG_BORDER); @@ -419,11 +418,11 @@ /* List view */ store = gtk_list_store_new(TPM_N_COLUMNS, G_TYPE_STRING); - + tpm_dat->listview = listview = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(store))); g_object_unref(G_OBJECT(store)); - + { GtkCellRenderer *renderer; GtkTreeViewColumn *column; @@ -440,11 +439,11 @@ gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store), TPM_HOSTNAME_COLUMN, GTK_SORT_ASCENDING); } - + /* Get the treeview selector into the struct */ tpm_dat->listselect = select = gtk_tree_view_get_selection(GTK_TREE_VIEW(listview)); - + /* Force the selection mode */ gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE); @@ -452,7 +451,7 @@ something is selected */ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(tls_peers_mgmt_select_chg_cb), NULL); - + gtk_box_pack_start(GTK_BOX(mgmt_widget), GTK_WIDGET(listview), TRUE, TRUE, /* Take up lots of space */ 0); /* TODO: this padding is wrong */ @@ -460,7 +459,7 @@ /* Fill the list for the first time */ tls_peers_mgmt_repopulate_list(); - + /* Right-hand side controls box */ bbox = gtk_vbutton_box_new(); gtk_box_pack_end(GTK_BOX(mgmt_widget), bbox, @@ -513,7 +512,7 @@ /* Bind us to the tls_peers pool */ tpm_dat->tls_peers = purple_certificate_find_pool("x509", "tls_peers"); - + /**** libpurple signals ****/ /* Respond to certificate add/remove by just reloading everything */ purple_signal_connect(tpm_dat->tls_peers, "certificate-stored", @@ -522,7 +521,7 @@ purple_signal_connect(tpm_dat->tls_peers, "certificate-deleted", tpm_dat, PURPLE_CALLBACK(tls_peers_mgmt_mod_cb), NULL); - + return mgmt_widget; } @@ -571,7 +570,7 @@ poollist = poollist->next ) { PurpleCertificatePool *pool = poollist->data; GList *l; - + purple_debug_info("gtkcertmgr", "Pool %s found for scheme %s -" "Enumerating certificates:\n", @@ -588,7 +587,7 @@ } /* poollist */ } - + /* If the manager is already open, bring it to the front */ if (certmgr_dialog != NULL) { gtk_window_present(GTK_WINDOW(certmgr_dialog->window)); @@ -607,7 +606,7 @@ g_signal_connect(G_OBJECT(win), "delete_event", G_CALLBACK(certmgr_close_cb), dlg); - + /* TODO: Retrieve the user-set window size and use it */ gtk_window_set_default_size(GTK_WINDOW(win), 400, 400); diff -r 1200e0d4f2aa -r 96934545f5be pidgin/gtkprivacy.c --- a/pidgin/gtkprivacy.c Thu Jan 31 15:56:44 2008 +0000 +++ b/pidgin/gtkprivacy.c Fri Feb 01 08:50:44 2008 +0000 @@ -44,7 +44,7 @@ GtkWidget *add_button; GtkWidget *remove_button; - GtkWidget *clear_button; + GtkWidget *removeall_button; GtkWidget *close_button; GtkWidget *button_box; @@ -117,23 +117,6 @@ } } -static const char * -find_permit_block_by_name(GSList *list, const char *name) -{ - const char *temp_name; - GSList *l; - - for (l = list; l != NULL; l = l->next) { - temp_name = (const char *)l->data; - - /* Should this use purple_normalize()? */ - if (!purple_utf8_strcasecmp(name, temp_name)) - return temp_name; - } - - return NULL; -} - static void user_selected_cb(GtkTreeSelection *sel, PidginPrivacyDialog *dialog) { @@ -317,19 +300,16 @@ else return; - if (dialog->in_allow_list) { - if (find_permit_block_by_name(dialog->account->permit, name)) - purple_privacy_permit_remove(dialog->account, name, FALSE); - } - else { - if (find_permit_block_by_name(dialog->account->deny, name)) - purple_privacy_deny_remove(dialog->account, name, FALSE); - } + if (dialog->in_allow_list) + purple_privacy_permit_remove(dialog->account, name, FALSE); + else + purple_privacy_deny_remove(dialog->account, name, FALSE); + g_free(name); } static void -clear_cb(GtkWidget *button, PidginPrivacyDialog *dialog) +removeall_cb(GtkWidget *button, PidginPrivacyDialog *dialog) { GSList *l; if (dialog->in_allow_list) @@ -420,7 +400,7 @@ dialog->block_widget = build_block_list(dialog); gtk_box_pack_start(GTK_BOX(vbox), dialog->block_widget, TRUE, TRUE, 0); - /* Add the button box for Add, Remove, Clear */ + /* Add the button box for Add, Remove, Remove All */ dialog->button_box = pidgin_dialog_get_action_area(GTK_DIALOG(dialog->win)); /* Add button */ @@ -432,9 +412,9 @@ dialog->remove_button = button; gtk_widget_set_sensitive(button, FALSE); - /* Clear button */ - button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLEAR, G_CALLBACK(clear_cb), dialog); - dialog->clear_button = button; + /* Remove All button */ + button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), _("Remove Al_l"), G_CALLBACK(removeall_cb), dialog); + dialog->removeall_button = button; /* Close button */ button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLOSE, G_CALLBACK(close_cb), dialog);