Index: protocols/msn/Makefile
===================================================================
--- protocols/msn/Makefile	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/Makefile	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -13,5 +13,5 @@
 
 # [SH] Program variables
-objects = msn.o msn_util.o ns.o passport.o sb.o soap.o tables.o
+objects = msn.o msn_util.o ns.o sb.o soap.o tables.o
 
 LFLAGS += -r
Index: protocols/msn/msn.c
===================================================================
--- protocols/msn/msn.c	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/msn.c	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2004 Wilmer van der Gaast and others                *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
   \********************************************************************/
 
Index: protocols/msn/msn.h
===================================================================
--- protocols/msn/msn.h	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/msn.h	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -233,6 +233,3 @@
 void msn_sb_stop_keepalives( struct msn_switchboard *sb );
 
-/* invitation.c */
-void msn_ftp_transfer_request( struct im_connection *ic, file_transfer_t *ft, char *who );
-
 #endif //_MSN_H
Index: protocols/msn/ns.c
===================================================================
--- protocols/msn/ns.c	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/ns.c	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2004 Wilmer van der Gaast and others                *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
   \********************************************************************/
 
Index: otocols/msn/passport.c
===================================================================
--- protocols/msn/passport.c	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/** passport.c
- *
- * Functions to login to Microsoft Passport service for Messenger
- * Copyright (C) 2004-2008 Wilmer van der Gaast <wilmer@gaast.net>
- *
- * This program is free software; you can redistribute it and/or modify             
- * it under the terms of the GNU General Public License version 2                   
- * as published by the Free Software Foundation                                     
- *                                                                                   
- * This program is distributed in the hope that is will be useful,                  
- * bit WITHOU ANY WARRANTY; without even the implied warranty of                   
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    
- * GNU General Public License for more details.                                     
- *                                                                                   
- * You should have received a copy of the GNU General Public License                
- * along with this program; if not, write to the Free Software                      
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA          
- *
- */
-
-#include "http_client.h"
-#include "passport.h"
-#include "msn.h"
-#include "bitlbee.h"
-#include "url.h"
-#include "misc.h"
-#include "xmltree.h"
-#include <ctype.h>
-#include <errno.h>
-
-static int passport_get_token_real( struct msn_auth_data *mad );
-static void passport_get_token_ready( struct http_request *req );
-
-int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie )
-{
-	struct msn_auth_data *mad = g_new0( struct msn_auth_data, 1 );
-	int i;
-	
-	mad->username = g_strdup( username );
-	mad->password = g_strdup( password );
-	mad->cookie = g_strdup( cookie );
-	
-	mad->callback = func;
-	mad->data = data;
-	
-	mad->url = g_strdup( SOAP_AUTHENTICATION_URL );
-	mad->ttl = 3; /* Max. # of redirects. */
-	
-	/* HTTP-escape stuff and s/,/&/ */
-	http_decode( mad->cookie );
-	for( i = 0; mad->cookie[i]; i ++ )
-		if( mad->cookie[i] == ',' )
-			mad->cookie[i] = '&';
-	
-	/* Microsoft doesn't allow password longer than 16 chars and silently
-	   fails authentication if you give the "full version" of your passwd. */
-	if( strlen( mad->password ) > MAX_PASSPORT_PWLEN )
-		mad->password[MAX_PASSPORT_PWLEN] = 0;
-	
-	return passport_get_token_real( mad );
-}
-
-static int passport_get_token_real( struct msn_auth_data *mad )
-{
-	char *post_payload, *post_request;
-	struct http_request *req;
-	url_t url;
-	
-	url_set( &url, mad->url );
-	
-	post_payload = g_markup_printf_escaped( SOAP_AUTHENTICATION_PAYLOAD,
-	                                        mad->username,
-	                                        mad->password,
-	                                        mad->cookie );
-	
-	post_request = g_strdup_printf( SOAP_AUTHENTICATION_REQUEST,
-	                                url.file, url.host,
-	                                (int) strlen( post_payload ),
-	                                post_payload );
-	                                
-	req = http_dorequest( url.host, url.port, 1, post_request,
-	                      passport_get_token_ready, mad );
-	
-	g_free( post_request );
-	g_free( post_payload );
-	
-	return req != NULL;
-}
-
-static xt_status passport_xt_extract_token( struct xt_node *node, gpointer data );
-static xt_status passport_xt_handle_fault( struct xt_node *node, gpointer data );
-
-static const struct xt_handler_entry passport_xt_handlers[] = {
-	{ "wsse:BinarySecurityToken", "wst:RequestedSecurityToken", passport_xt_extract_token },
-	{ "S:Fault",                  "S:Envelope",                 passport_xt_handle_fault  },
-	{ NULL,                       NULL,                         NULL                      }
-};
-
-static void passport_get_token_ready( struct http_request *req )
-{
-	struct msn_auth_data *mad = req->data;
-	struct xt_parser *parser;
-	
-	g_free( mad->url );
-	g_free( mad->error );
-	mad->url = mad->error = NULL;
-	
-	if( req->status_code == 200 )
-	{
-		parser = xt_new( passport_xt_handlers, mad );
-		xt_feed( parser, req->reply_body, req->body_size );
-		xt_handle( parser, NULL, -1 );
-		xt_free( parser );
-	}
-	else
-	{
-		mad->error = g_strdup_printf( "HTTP error %d (%s)", req->status_code,
-		                              req->status_string ? req->status_string : "unknown" );
-	}
-	
-	if( mad->error == NULL && mad->token == NULL )
-		mad->error = g_strdup( "Could not parse Passport server response" );
-	
-	if( mad->url && mad->token == NULL )
-	{
-		passport_get_token_real( mad );
-	}
-	else
-	{
-		mad->callback( mad );
-		
-		g_free( mad->url );
-		g_free( mad->username );
-		g_free( mad->password );
-		g_free( mad->cookie );
-		g_free( mad->token );
-		g_free( mad->error );
-		g_free( mad );
-	}
-}
-
-static xt_status passport_xt_extract_token( struct xt_node *node, gpointer data )
-{
-	struct msn_auth_data *mad = data;
-	char *s;
-	
-	if( ( s = xt_find_attr( node, "Id" ) ) &&
-	    ( strncmp( s, "Compact", 7 ) == 0 ||
-	      strncmp( s, "PPToken", 7 ) == 0 ) )
-		mad->token = g_memdup( node->text, node->text_len + 1 );
-	
-	return XT_HANDLED;
-}
-
-static xt_status passport_xt_handle_fault( struct xt_node *node, gpointer data )
-{
-	struct msn_auth_data *mad = data;
-	struct xt_node *code = xt_find_node( node->children, "faultcode" );
-	struct xt_node *string = xt_find_node( node->children, "faultstring" );
-	struct xt_node *redirect = xt_find_node( node->children, "psf:redirectUrl" );
-	
-	if( redirect && redirect->text_len && mad->ttl-- > 0 )
-		mad->url = g_memdup( redirect->text, redirect->text_len + 1 );
-	
-	if( code == NULL || code->text_len == 0 )
-		mad->error = g_strdup( "Unknown error" );
-	else
-		mad->error = g_strdup_printf( "%s (%s)", code->text, string && string->text_len ?
-		                              string->text : "no description available" );
-	
-	return XT_HANDLED;
-}
Index: otocols/msn/passport.h
===================================================================
--- protocols/msn/passport.h	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ 	(revision )
@@ -1,113 +1,0 @@
-/* passport.h
- *
- * Functions to login to Microsoft Passport service for Messenger
- * Copyright (C) 2004-2008 Wilmer van der Gaast <wilmer@gaast.net>
- *
- * This program is free software; you can redistribute it and/or modify             
- * it under the terms of the GNU General Public License version 2                   
- * as published by the Free Software Foundation                                     
- *                                                                                   
- * This program is distributed in the hope that is will be useful,                  
- * bit WITHOU ANY WARRANTY; without even the implied warranty of                   
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    
- * GNU General Public License for more details.                                     
- *                                                                                   
- * You should have received a copy of the GNU General Public License                
- * along with this program; if not, write to the Free Software                      
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA          
- */
-
-/* Thanks to http://msnpiki.msnfanatic.com/index.php/MSNP13:SOAPTweener
-   for the specs! */
-
-#ifndef __PASSPORT_H__
-#define __PASSPORT_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <unistd.h>
-#endif
-#include "nogaim.h"
-
-#define MAX_PASSPORT_PWLEN 16
-
-struct msn_auth_data
-{
-	char *url;
-	int ttl;
-	
-	char *username;
-	char *password;
-	char *cookie;
-	
-	/* The end result, the only thing we'll really be interested in
-	   once finished. */
-	char *token;
-	char *error; /* Yeah, or that... */
-	
-	void (*callback)( struct msn_auth_data *mad );
-	gpointer data;
-};
-
-#define SOAP_AUTHENTICATION_URL "https://loginnet.passport.com/RST.srf"
-
-#define SOAP_AUTHENTICATION_REQUEST \
-"POST %s HTTP/1.0\r\n" \
-"Accept: text/*\r\n" \
-"User-Agent: BitlBee " BITLBEE_VERSION "\r\n" \
-"Host: %s\r\n" \
-"Content-Length: %d\r\n" \
-"Cache-Control: no-cache\r\n" \
-"\r\n" \
-"%s"
-
-#define SOAP_AUTHENTICATION_PAYLOAD \
-"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" \
-"<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsse=\"http://schemas.xmlsoap.org/ws/2003/06/secext\" xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\" xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2002/12/policy\" xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" xmlns:wsa=\"http://schemas.xmlsoap.org/ws/2004/03/addressing\" xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2004/04/sc\" xmlns:wst=\"http://schemas.xmlsoap.org/ws/2004/04/trust\">" \
-  "<Header>" \
-    "<ps:AuthInfo xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"PPAuthInfo\">" \
-      "<ps:HostingApp>{7108E71A-9926-4FCB-BCC9-9A9D3F32E423}</ps:HostingApp>" \
-      "<ps:BinaryVersion>4</ps:BinaryVersion>" \
-      "<ps:UIVersion>1</ps:UIVersion>" \
-      "<ps:Cookies></ps:Cookies>" \
-      "<ps:RequestParams>AQAAAAIAAABsYwQAAAAzMDg0</ps:RequestParams>" \
-    "</ps:AuthInfo>" \
-    "<wsse:Security>" \
-       "<wsse:UsernameToken Id=\"user\">" \
-         "<wsse:Username>%s</wsse:Username>" \
-         "<wsse:Password>%s</wsse:Password>" \
-       "</wsse:UsernameToken>" \
-    "</wsse:Security>" \
-  "</Header>" \
-  "<Body>" \
-    "<ps:RequestMultipleSecurityTokens xmlns:ps=\"http://schemas.microsoft.com/Passport/SoapServices/PPCRL\" Id=\"RSTS\">" \
-      "<wst:RequestSecurityToken Id=\"RST0\">" \
-        "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
-        "<wsp:AppliesTo>" \
-          "<wsa:EndpointReference>" \
-            "<wsa:Address>http://Passport.NET/tb</wsa:Address>" \
-          "</wsa:EndpointReference>" \
-        "</wsp:AppliesTo>" \
-      "</wst:RequestSecurityToken>" \
-      "<wst:RequestSecurityToken Id=\"RST1\">" \
-       "<wst:RequestType>http://schemas.xmlsoap.org/ws/2004/04/security/trust/Issue</wst:RequestType>" \
-        "<wsp:AppliesTo>" \
-          "<wsa:EndpointReference>" \
-            "<wsa:Address>messenger.msn.com</wsa:Address>" \
-          "</wsa:EndpointReference>" \
-        "</wsp:AppliesTo>" \
-        "<wsse:PolicyReference URI=\"?%s\"></wsse:PolicyReference>" \
-      "</wst:RequestSecurityToken>" \
-    "</ps:RequestMultipleSecurityTokens>" \
-  "</Body>" \
-"</Envelope>"
-
-int passport_get_token( gpointer func, gpointer data, char *username, char *password, char *cookie );
-
-#endif /* __PASSPORT_H__ */
Index: protocols/msn/sb.c
===================================================================
--- protocols/msn/sb.c	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/sb.c	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2005 Wilmer van der Gaast and others                *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
   \********************************************************************/
 
@@ -27,5 +27,4 @@
 #include "nogaim.h"
 #include "msn.h"
-#include "passport.h"
 #include "md5.h"
 #include "soap.h"
Index: protocols/msn/soap.c
===================================================================
--- protocols/msn/soap.c	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/soap.c	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -1,24 +1,29 @@
-/** soap.c
- *
- * SOAP-related functions. Some manager at Microsoft apparently thought
- * MSNP wasn't XMLy enough so someone stepped up and changed that. This
- * is the result.
- *
- * Copyright (C) 2010 Wilmer van der Gaast <wilmer@gaast.net>
- *
- * This program is free software; you can redistribute it and/or modify             
- * it under the terms of the GNU General Public License version 2                   
- * as published by the Free Software Foundation                                     
- *                                                                                   
- * This program is distributed in the hope that is will be useful,                  
- * bit WITHOU ANY WARRANTY; without even the implied warranty of                   
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                    
- * GNU General Public License for more details.                                     
- *                                                                                   
- * You should have received a copy of the GNU General Public License                
- * along with this program; if not, write to the Free Software                      
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA          
- *
- */
+  /********************************************************************\
+  * BitlBee -- An IRC to other IM-networks gateway                     *
+  *                                                                    *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
+  \********************************************************************/
+
+/* MSN module - All the SOAPy XML stuff.
+   Some manager at Microsoft apparently thought MSNP wasn't XMLy enough so
+   someone stepped up and changed that. This is the result. Kilobytes and
+   more kilobytes of XML vomit to transfer tiny bits of informaiton. */
+
+/*
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License with
+  the Debian GNU/Linux distribution in /usr/share/common-licenses/GPL;
+  if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+  Suite 330, Boston, MA  02111-1307  USA
+*/
 
 #include "http_client.h"
@@ -34,4 +39,9 @@
 #include <errno.h>
 
+/* This file tries to make SOAP stuff pretty simple to do by letting you just
+   provide a function to build a request, a few functions to parse various
+   parts of the response, and a function to run when the full response was
+   received and parsed. See the various examples below. */
+
 typedef enum
 {
@@ -41,8 +51,4 @@
 } msn_soap_result_t;
 
-struct msn_soap_req_data;
-
-typedef int (*msn_soap_func) ( struct msn_soap_req_data * );
-
 struct msn_soap_req_data
 {
@@ -57,4 +63,6 @@
 	msn_soap_func build_request, handle_response, free_data;
 };
+
+typedef int (*msn_soap_func) ( struct msn_soap_req_data * );
 
 static int msn_soap_send_request( struct msn_soap_req_data *req );
Index: protocols/msn/tables.c
===================================================================
--- protocols/msn/tables.c	(revision 50b8978f0662fc83aa2e3db1d40081c315c9e6cf)
+++ protocols/msn/tables.c	(revision 4e4af1b0fe073fd2d43f4ea0d55f8deadbeb974d)
@@ -2,5 +2,5 @@
   * BitlBee -- An IRC to other IM-networks gateway                     *
   *                                                                    *
-  * Copyright 2002-2004 Wilmer van der Gaast and others                *
+  * Copyright 2002-2010 Wilmer van der Gaast and others                *
   \********************************************************************/
 
