aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--protocols/msn/msn.c3
-rw-r--r--protocols/msn/msn.h1
-rw-r--r--protocols/msn/ns.c23
3 files changed, 24 insertions, 3 deletions
diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c
index b05a2b85..59adec62 100644
--- a/protocols/msn/msn.c
+++ b/protocols/msn/msn.c
@@ -1,7 +1,7 @@
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
- * Copyright 2002-2010 Wilmer van der Gaast and others *
+ * Copyright 2002-2012 Wilmer van der Gaast and others *
\********************************************************************/
/* MSN module - Main file; functions to be called from BitlBee */
@@ -97,6 +97,7 @@ static void msn_logout( struct im_connection *ic )
g_free( md->tokens[i] );
g_free( md->lock_key );
g_free( md->pp_policy );
+ g_free( md->uuid );
while( md->groups )
{
diff --git a/protocols/msn/msn.h b/protocols/msn/msn.h
index f3e5b9b9..4d2d0fdd 100644
--- a/protocols/msn/msn.h
+++ b/protocols/msn/msn.h
@@ -122,6 +122,7 @@ struct msn_data
int trId;
char *tokens[4];
char *lock_key, *pp_policy;
+ char *uuid;
GSList *msgq, *grpq, *soapq;
GSList *switchboards;
diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c
index 4dac75c5..b613b557 100644
--- a/protocols/msn/ns.c
+++ b/protocols/msn/ns.c
@@ -1,7 +1,7 @@
/********************************************************************\
* BitlBee -- An IRC to other IM-networks gateway *
* *
- * Copyright 2002-2010 Wilmer van der Gaast and others *
+ * Copyright 2002-2012 Wilmer van der Gaast and others *
\********************************************************************/
/* MSN module - Notification server callbacks */
@@ -24,9 +24,11 @@
*/
#include <ctype.h>
+#include <sys/utsname.h>
#include "nogaim.h"
#include "msn.h"
#include "md5.h"
+#include "sha1.h"
#include "soap.h"
#include "xmltree.h"
@@ -110,6 +112,23 @@ static gboolean msn_ns_connected( gpointer data, gint source, b_input_condition
handler->rxlen = 0;
handler->rxq = g_new0( char, 1 );
+ if( md->uuid == NULL )
+ {
+ struct utsname name;
+ sha1_state_t sha[1];
+
+ /* UUID == SHA1("BitlBee" + my hostname + MSN username) */
+ sha1_init( sha );
+ sha1_append( sha, (void*) "BitlBee", 7 );
+ if( uname( &name ) == 0 )
+ {
+ sha1_append( sha, (void*) name.nodename, strlen( name.nodename ) );
+ }
+ sha1_append( sha, (void*) ic->acc->user, strlen( ic->acc->user ) );
+ md->uuid = sha1_random_uuid( sha );
+ memcpy( md->uuid, "b171be3e", 8 ); /* :-P */
+ }
+
if( msn_ns_write( ic, source, "VER %d %s CVR0\r\n", ++md->trId, MSNP_VER ) )
{
handler->inpa = b_input_add( handler->fd, B_EV_IO_READ, msn_ns_callback, handler );
@@ -756,7 +775,7 @@ void msn_auth_got_passport_token( struct im_connection *ic, const char *token, c
if( token )
{
- msn_ns_write( ic, -1, "USR %d SSO S %s %s {7535ef7c-ff92-11e1-8069-50e5493b06de}\r\n", ++md->trId, md->tokens[0], token );
+ msn_ns_write( ic, -1, "USR %d SSO S %s %s {%s}\r\n", ++md->trId, md->tokens[0], token, md->uuid );
}
else
{