changeset 19828:e45fae8209c3

[gaim-migrate @ 17045] add a MIME encode function,processing utf-8 and base64 encode committed by MaYuan<mayuan2006@gmail.com> committer: Ethan Blanton <elb@pidgin.im>
author Ma Yuan <mayuan2006@gmail.com>
date Sat, 26 Aug 2006 13:03:11 +0000
parents 349b85feaefa
children c590e780b3a0
files src/protocols/msn/contact.c src/protocols/msn/msn-utils.c src/protocols/msn/msn-utils.h src/protocols/msn/msn.c
diffstat 4 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/contact.c	Sat Aug 26 11:30:40 2006 +0000
+++ b/src/protocols/msn/contact.c	Sat Aug 26 13:03:11 2006 +0000
@@ -430,10 +430,6 @@
 
 	xmlnode_free(node);
 	msn_soap_free_read_buf(contact->soapconn);
-
-	msn_notification_dump_contact(session);
-	msn_set_psm(session);
-	msn_session_finish_login(session);
 }
 
 static void
@@ -450,6 +446,11 @@
 
 //	gaim_debug_misc("msn", "soap contact server Reply: {%s}\n", soapconn->read_buf);
 	msn_parse_addressbook(contact);
+
+	msn_notification_dump_contact(session);
+	msn_set_psm(session);
+	msn_session_finish_login(session);
+
 	/*free the read buffer*/
 	msn_soap_free_read_buf(soapconn);
 }
--- a/src/protocols/msn/msn-utils.c	Sat Aug 26 11:30:40 2006 +0000
+++ b/src/protocols/msn/msn-utils.c	Sat Aug 26 13:03:11 2006 +0000
@@ -146,6 +146,18 @@
 		g_free(cur);
 }
 
+/*encode the str to RFC2047 style
+ * Currently only support the UTF-8 and base64 encode
+ */
+char *
+msn_encode_mime(char *str)
+{
+	char *base64;
+	
+	base64 = gaim_base64_encode(str,strlen(str));
+	return g_strdup_printf("=?utf-8?B?%s?=",base64);
+}
+
 /*
  * We need this because we're only supposed to encode spaces in the font
  * names. gaim_url_encode() isn't acceptable.
--- a/src/protocols/msn/msn-utils.h	Sat Aug 26 11:30:40 2006 +0000
+++ b/src/protocols/msn/msn-utils.h	Sat Aug 26 13:03:11 2006 +0000
@@ -24,6 +24,9 @@
 #ifndef _MSN_UTILS_H_
 #define _MSN_UTILS_H_
 
+/*encode the str to RFC2047 style*/
+char * msn_encode_mime(char *str);
+
 /**
  * Generate the Random GUID
  */
--- a/src/protocols/msn/msn.c	Sat Aug 26 11:30:40 2006 +0000
+++ b/src/protocols/msn/msn.c	Sat Aug 26 13:03:11 2006 +0000
@@ -893,7 +893,7 @@
 		gaim_debug_info("MaYuan","prepare to send offline Message\n");		
 		session = gc->proto_data;
 		oim = session->oim;
-		friendname = g_strdup_printf("=?utf-8?B?Y2xpZW50?=");
+		friendname = msn_encode_mime(account->username);
 		msn_oim_prep_send_msg_info(oim,
 			gaim_account_get_username(account),friendname,who,
 			message);