aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2012-02-11 17:26:41 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2012-02-11 17:26:41 +0000
commitdcf155d79a41a747ae73e51e028c6085f28dc30f (patch)
tree7398e653c28d3993737c7cf6b75b035985a5a44d
parent4f37a98fe518297822ac47c09e6c034dbcd49540 (diff)
Drop dead support for MSN offline messages (that SOAP server isn't even in
DNS anymore). Bug #874 for adding support for the new (much simpler, for a change) way.
-rw-r--r--protocols/msn/sb.c3
-rw-r--r--protocols/msn/soap.c144
-rw-r--r--protocols/msn/soap.h34
3 files changed, 3 insertions, 178 deletions
diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c
index f2a20a5b..45e74cb0 100644
--- a/protocols/msn/sb.c
+++ b/protocols/msn/sb.c
@@ -628,9 +628,12 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num
/* If the person is offline, send an offline message instead,
and don't report an error. */
+ /* TODO: Support for OIMs that works. (#874) */
+ /*
if( num == 217 )
msn_soap_oim_send_queue( ic, &sb->msgq );
else
+ */
imcb_error( ic, "Error reported by switchboard server: %s", err->text );
if( err->flags & STATUS_SB_FATAL )
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 )
diff --git a/protocols/msn/soap.h b/protocols/msn/soap.h
index a767e00d..d6a1f75e 100644
--- a/protocols/msn/soap.h
+++ b/protocols/msn/soap.h
@@ -145,40 +145,6 @@ int msn_soapq_flush( struct im_connection *ic, gboolean resend );
int msn_soap_passport_sso_request( struct im_connection *ic, const char *nonce );
-#define SOAP_OIM_SEND_URL "https://ows.messenger.msn.com/OimWS/oim.asmx"
-#define SOAP_OIM_SEND_ACTION "http://messenger.live.com/ws/2006/09/oim/Store2"
-
-#define SOAP_OIM_SEND_PAYLOAD \
-"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
-"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \
-"<soap:Header>" \
- "<From memberName=\"%s\" friendlyName=\"=?utf-8?B?%s?=\" xml:lang=\"nl-nl\" proxy=\"MSNMSGR\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\" msnpVer=\"%s\" buildVer=\"%s\"/>" \
- "<To memberName=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
- "<Ticket passport=\"%s\" appid=\"%s\" lockkey=\"%s\" xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\"/>" \
- "<Sequence xmlns=\"http://schemas.xmlsoap.org/ws/2003/03/rm\">" \
- "<Identifier xmlns=\"http://schemas.xmlsoap.org/ws/2002/07/utility\">http://messenger.msn.com</Identifier>" \
- "<MessageNumber>%d</MessageNumber>" \
- "</Sequence>" \
-"</soap:Header>" \
-"<soap:Body>" \
- "<MessageType xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">text</MessageType>" \
- "<Content xmlns=\"http://messenger.msn.com/ws/2004/09/oim/\">" \
- "MIME-Version: 1.0\r\n" \
- "Content-Type: text/plain; charset=UTF-8\r\n" \
- "Content-Transfer-Encoding: base64\r\n" \
- "X-OIM-Message-Type: OfflineMessage\r\n" \
- "X-OIM-Run-Id: {F9A6C9DD-0D94-4E85-9CC6-F9D118CC1CAF}\r\n" \
- "X-OIM-Sequence-Num: %d\r\n" \
- "\r\n" \
- "%s" \
- "</Content>" \
-"</soap:Body>" \
-"</soap:Envelope>"
-
-int msn_soap_oim_send( struct im_connection *ic, const char *to, const char *msg );
-int msn_soap_oim_send_queue( struct im_connection *ic, GSList **msgq );
-
-
#define SOAP_ABSERVICE_PAYLOAD \
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" \
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" \