# HG changeset patch # User Daniel Atallah # Date 1189128139 0 # Node ID 55c47f7ab2a2ecd63b6d3ecfadac86cb6e48a254 # Parent c59e7cd277970b3d8ef40976ba98fea286eefea3 The cyrus SASL password prompt dialogs don't get disposed if the account disconnects. This fixes the callbacks not to assume that the connection is still valid. diff -r c59e7cd27797 -r 55c47f7ab2a2 libpurple/protocols/jabber/auth.c --- a/libpurple/protocols/jabber/auth.c Thu Sep 06 20:07:51 2007 +0000 +++ b/libpurple/protocols/jabber/auth.c Fri Sep 07 01:22:19 2007 +0000 @@ -203,8 +203,15 @@ return TRUE; } -static void auth_pass_cb(JabberStream *js, PurpleRequestFields *fields) +static void auth_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields) { + JabberStream *js; + + /* The password prompt dialog doesn't get disposed if the account disconnects */ + if (!PURPLE_CONNECTION_IS_VALID(conn)) + return; + + js = conn->proto_data; if (!auth_pass_generic(js, fields)) return; @@ -217,8 +224,16 @@ } static void -auth_old_pass_cb(JabberStream *js, PurpleRequestFields *fields) +auth_old_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields) { + JabberStream *js; + + /* The password prompt dialog doesn't get disposed if the account disconnects */ + if (!PURPLE_CONNECTION_IS_VALID(conn)) + return; + + js = conn->proto_data; + if (!auth_pass_generic(js, fields)) return; @@ -228,9 +243,17 @@ static void -auth_no_pass_cb(JabberStream *js, PurpleRequestFields *fields) +auth_no_pass_cb(PurpleConnection *conn, PurpleRequestFields *fields) { - purple_connection_error(js->gc, _("Password is required to sign on.")); + JabberStream *js; + + /* The password prompt dialog doesn't get disposed if the account disconnects */ + if (!PURPLE_CONNECTION_IS_VALID(conn)) + return; + + js = conn->proto_data; + + purple_connection_error(conn, _("Password is required to sign on.")); } static void jabber_auth_start_cyrus(JabberStream *js) @@ -283,7 +306,7 @@ */ if (!purple_account_get_password(js->gc->account)) { - purple_account_request_password(js->gc->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js); + purple_account_request_password(js->gc->account, G_CALLBACK(auth_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); return; /* If we've got a password, but aren't sending @@ -597,7 +620,7 @@ */ if (!purple_account_get_password(js->gc->account)) { - purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js); + purple_account_request_password(js->gc->account, G_CALLBACK(auth_old_pass_cb), G_CALLBACK(auth_no_pass_cb), js->gc); return; } #endif