diff options
Diffstat (limited to 'protocols/msn/soap.c')
-rw-r--r-- | protocols/msn/soap.c | 144 |
1 files changed, 0 insertions, 144 deletions
diff --git a/protocols/msn/soap.c b/protocols/msn/soap.c index d9804f49..da32c291 100644 --- a/protocols/msn/soap.c +++ b/protocols/msn/soap.c @@ -473,150 +473,6 @@ int msn_soap_passport_sso_request( struct im_connection *ic, const char *nonce ) } -/* oim_send: Sending offline messages */ - -struct msn_soap_oim_send_data -{ - char *to; - char *msg; - int number; - msn_soap_result_t need_retry; -}; - -static int msn_soap_oim_build_request( struct msn_soap_req_data *soap_req ) -{ - struct msn_soap_oim_send_data *oim = soap_req->data; - struct im_connection *ic = soap_req->ic; - struct msn_data *md = ic->proto_data; - char *display_name_b64; - - display_name_b64 = tobase64( set_getstr( &ic->acc->set, "display_name" ) ); - - soap_req->url = g_strdup( SOAP_OIM_SEND_URL ); - soap_req->action = g_strdup( SOAP_OIM_SEND_ACTION ); - soap_req->payload = g_markup_printf_escaped( SOAP_OIM_SEND_PAYLOAD, - ic->acc->user, display_name_b64, MSNP_VER, MSNP_BUILD, - oim->to, md->tokens[2], - MSNP11_PROD_ID, md->lock_key ? md->lock_key : "", - oim->number, oim->number, oim->msg ); - - g_free( display_name_b64 ); - oim->need_retry = MSN_SOAP_OK; - - return MSN_SOAP_OK; -} - -static xt_status msn_soap_oim_reauth( struct xt_node *node, gpointer data ) -{ - struct msn_soap_req_data *soap_req = data; - struct msn_soap_oim_send_data *oim = soap_req->data; - struct im_connection *ic = soap_req->ic; - struct msn_data *md = ic->proto_data; - struct xt_node *c; - - if( ( c = xt_find_node( node->children, "LockKeyChallenge" ) ) && c->text_len > 0 ) - { - g_free( md->lock_key ); - md->lock_key = msn_p11_challenge( c->text ); - oim->need_retry = MSN_SOAP_RETRY; - } - if( xt_find_node( node->children, "RequiredAuthPolicy" ) ) - { - oim->need_retry = MSN_SOAP_REAUTH; - } - - return XT_HANDLED; -} - -static const struct xt_handler_entry msn_soap_oim_send_parser[] = { - { "detail", "soap:Fault", msn_soap_oim_reauth }, - { NULL, NULL, NULL } -}; - -static int msn_soap_oim_handle_response( struct msn_soap_req_data *soap_req ) -{ - struct msn_soap_oim_send_data *oim = soap_req->data; - - if( soap_req->http_req->status_code == 500 && oim->need_retry && soap_req->ttl > 0 ) - { - return oim->need_retry; - } - else if( soap_req->http_req->status_code == 200 ) - { - /* Noise.. - imcb_log( soap_req->ic, "Offline message successfully delivered to %s", oim->to ); - */ - return MSN_SOAP_OK; - } - else - { - char *dec = frombase64( oim->msg ); - imcb_log( soap_req->ic, "Failed to deliver offline message to %s:\n%s", oim->to, dec ); - g_free( dec ); - return MSN_SOAP_ABORT; - } -} - -static int msn_soap_oim_free_data( struct msn_soap_req_data *soap_req ) -{ - struct msn_soap_oim_send_data *oim = soap_req->data; - - g_free( oim->to ); - g_free( oim->msg ); - g_free( oim ); - - return MSN_SOAP_OK; -} - -int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg ) -{ - struct msn_soap_oim_send_data *data; - - /* Don't send any of the special messages since they creep people out. :-) */ - if( strncmp( msg, "\r\r", 2 ) == 0 ) - return 0; - - data = g_new0( struct msn_soap_oim_send_data, 1 ); - data->to = g_strdup( to ); - data->msg = tobase64( msg ); - data->number = 1; - - return msn_soap_start( ic, data, msn_soap_oim_build_request, - msn_soap_oim_send_parser, - msn_soap_oim_handle_response, - msn_soap_oim_free_data ); -} - -int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq ) -{ - GSList *l; - char *n = NULL; - - for( l = *msgq; l; l = l->next ) - { - struct msn_message *m = l->data; - - if( n == NULL ) - n = m->who; - if( strcmp( n, m->who ) == 0 ) - msn_soap_oim_send( ic, m->who, m->text ); - } - - while( *msgq != NULL ) - { - struct msn_message *m = (*msgq)->data; - - g_free( m->who ); - g_free( m->text ); - g_free( m ); - - *msgq = g_slist_remove( *msgq, m ); - } - - return 1; -} - - /* memlist: Fetching the membership list (NOT address book) */ static int msn_soap_memlist_build_request( struct msn_soap_req_data *soap_req ) |