diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-09-04 18:23:46 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-09-04 18:23:46 +0100 |
commit | 4e1be76617060e89795e381d356f81cd2cbf32dc (patch) | |
tree | 900872afc0962e741aced4d0e4631ab529d4930a | |
parent | 27053b516db4d0e648d666e6d9e36856af428775 (diff) |
Clean up any stuff stuck in the soap queue at disconnect time.
-rw-r--r-- | protocols/msn/msn.c | 1 | ||||
-rw-r--r-- | protocols/msn/soap.c | 25 | ||||
-rw-r--r-- | protocols/msn/soap.h | 3 |
3 files changed, 21 insertions, 8 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 65bdd9a6..1584efa4 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -91,6 +91,7 @@ static void msn_logout( struct im_connection *ic ) msn_sb_destroy( md->switchboards->data ); msn_msgq_purge( ic, &md->msgq ); + msn_soapq_flush( ic, FALSE ); for( i = 0; i < sizeof( md->tokens ) / sizeof( md->tokens[0] ); i ++ ) g_free( md->tokens[i] ); diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index 2c26271b..05d91109 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -68,6 +68,7 @@ struct msn_soap_req_data }; static int msn_soap_send_request( struct msn_soap_req_data *req ); +static void msn_soap_free( struct msn_soap_req_data *soap_req ); static void msn_soap_debug_print( const char *headers, const char *payload ); static int msn_soap_start( struct im_connection *ic, @@ -126,11 +127,7 @@ static void msn_soap_handle_response( struct http_request *http_req ) if( g_slist_find( msn_connections, soap_req->ic ) == NULL ) { - soap_req->free_data( soap_req ); - g_free( soap_req->url ); - g_free( soap_req->action ); - g_free( soap_req->payload ); - g_free( soap_req ); + msn_soap_free( soap_req ); return; } @@ -231,19 +228,31 @@ static void msn_soap_debug_print( const char *headers, const char *payload ) #endif } -static int msn_soapq_empty( struct im_connection *ic ) +int msn_soapq_flush( struct im_connection *ic, gboolean resend ) { struct msn_data *md = ic->proto_data; while( md->soapq ) { - msn_soap_send_request( (struct msn_soap_req_data*) md->soapq->data ); + if( resend ) + msn_soap_send_request( (struct msn_soap_req_data*) md->soapq->data ); + else + msn_soap_free( (struct msn_soap_req_data*) md->soapq->data ); md->soapq = g_slist_remove( md->soapq, md->soapq->data ); } return MSN_SOAP_OK; } +static void msn_soap_free( struct msn_soap_req_data *soap_req ) +{ + soap_req->free_data( soap_req ); + g_free( soap_req->url ); + g_free( soap_req->action ); + g_free( soap_req->payload ); + g_free( soap_req ); +} + /* passport_sso: Authentication MSNP15+ */ @@ -369,7 +378,7 @@ static int msn_soap_passport_sso_handle_response( struct msn_soap_req_data *soap }; if( md->soapq ) - return msn_soapq_empty( ic ); + return msn_soapq_flush( ic, TRUE ); if( sd->secret == NULL ) { diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h index bd3e0245..b13238a4 100644 --- a/protocols/msn/soap.h +++ b/protocols/msn/soap.h @@ -44,6 +44,9 @@ #include "nogaim.h" +int msn_soapq_flush( struct im_connection *ic, gboolean resend ); + + #define SOAP_HTTP_REQUEST \ "POST %s HTTP/1.0\r\n" \ "Host: %s\r\n" \ |