changeset 10275:d9468bd22b7c

[gaim-migrate @ 11428] I reworked Fernando Herrera's patch from September to show who you've blocked and who doesn't have you on their MSN buddy list as emblems. I reworked Evan Schoenberg's patch to more accurately render formatting in messages sent to yourself on MSN Applied part of a patch from Felipe Contreras to fix auto-login to hotmail for new mail (the other part was to make it work on win32, but I think that's no longer needed), and I made sure that the temporary file used is deleted at the end of the session (mentioned in patch 1059682 by Nigel Horne) Applied patch 1073317 by Nigel Horne - even though I think it may not be strictly necessary, it's probably safer like this. I'm committing Felipe's new MSN icon too, I think it's much better, and so does everyone else who's expressed an opinion. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sun, 28 Nov 2004 18:13:18 +0000
parents 3016b1b32339
children edf8c0a8e60b
files pixmaps/status/default/Makefile.am pixmaps/status/default/msn.png pixmaps/status/default/msn.svg src/protocols/msn/msg.c src/protocols/msn/msn.c src/protocols/msn/msn.h src/protocols/msn/notification.c src/protocols/msn/session.c src/protocols/msn/session.h
diffstat 9 files changed, 143 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/pixmaps/status/default/Makefile.am	Sat Nov 27 19:39:25 2004 +0000
+++ b/pixmaps/status/default/Makefile.am	Sun Nov 28 18:13:18 2004 +0000
@@ -4,6 +4,7 @@
 	aim.png \
 	aol.png \
 	away.png \
+	blocked.png \
 	dnd.png \
 	extendedaway.png \
 	female.png \
@@ -26,6 +27,7 @@
 	napster.png \
 	notauthorized.png \
 	novell.png \
+	nr.png \
 	occupied.png \
 	offline.png \
 	op.png \
Binary file pixmaps/status/default/msn.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pixmaps/status/default/msn.svg	Sun Nov 28 18:13:18 2004 +0000
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<svg
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   id="svg602"
+   sodipodi:version="0.34"
+   width="600pt"
+   height="600pt"
+   xml:space="preserve"
+   sodipodi:docname="msn.svg"><defs
+   id="defs604"><linearGradient
+   id="linearGradient610"><stop
+   style="stop-color:#bafaff;stop-opacity:1;"
+   offset="0"
+   id="stop611" /><stop
+   style="stop-color:#1f6d7a;stop-opacity:1;"
+   offset="1"
+   id="stop612" /></linearGradient><radialGradient
+   xlink:href="#linearGradient610"
+   id="radialGradient613"
+   cx="0.23188564"
+   cy="0.21093862"
+   r="1.0678792"
+   fx="0.23188564"
+   fy="0.21093862" /><radialGradient
+   xlink:href="#linearGradient610"
+   id="radialGradient619"
+   cx="0.34507036"
+   cy="0.35937503"
+   r="0.8064121"
+   fx="0.34507036"
+   fy="0.35937503" /><radialGradient
+   xlink:href="#linearGradient610"
+   id="radialGradient620"
+   cx="-0.1746002"
+   cy="1.56248119e-2"
+   r="1.34025764"
+   fx="-0.1746002"
+   fy="1.56248119e-2" /><linearGradient
+   xlink:href="#linearGradient610"
+   id="linearGradient621"
+   x1="0.42741945"
+   y1="0.3671875"
+   x2="0.62903237"
+   y2="0.671875" /></defs><sodipodi:namedview
+   id="base" /><path
+   style="font-size:12;fill:url(#radialGradient620);fill-rule:evenodd;stroke:none;stroke-width:2.206821;"
+   d="M 628.3572 593.587 C 637.8212 606.5863 659.3297 610.4041 671.7511 611.2572 C 706.5579 613.6131 724.829 586.9664 728.463 568.413 C 730.2665 559.4551 736.181 535.4646 723.4461 506.5224 C 710.9531 476.4522 650.0521 423.3676 617.2823 397.8497 C 587.4937 375.7815 523.4702 330.002 464.3709 305.7129 L 435.2424 319.9056 L 628.3572 593.587 z "
+   id="path616"
+   sodipodi:nodetypes="cssssccc" /><path
+   style="font-size:12;fill:url(#linearGradient621);fill-rule:evenodd;stroke:none;stroke-width:1.25;stroke-dasharray:none;opacity:1;"
+   d="M 335.5472 308.8302 C 264.4806 330.3797 187.5258 381.5645 138.9834 425.0029 C 97.82826 460.5888 62.69147 494.5501 36.44296 535.563 C 23.16032 556.317 17.69044 590.4003 26.59756 615.2708 C 35.84246 638.1089 52.58553 655.017 85.88168 658.4644 C 103.5473 660.3283 121.7659 656.0043 136.4999 643.6527 C 148.4276 635.9363 163.7873 617.3516 181.6681 595.3808 L 359.3797 322.2776 L 335.5472 308.8302 z "
+   id="path617"
+   sodipodi:nodetypes="csssssccc" /><path
+   style="fill:url(#radialGradient613);fill-rule:evenodd;stroke:none;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;fill-opacity:1;opacity:1;"
+   d="M 178.8665 626.6381 C 180.5219 600.1512 185.6971 548.656 240.9447 454.0594 C 276.5073 391.9277 317.5093 335.2822 341.5126 318.7278 C 356.8256 262.0293 456.5656 266.1677 463.1869 316.2445 C 488.0181 333.2128 530.304 378.6359 562.5125 436.6771 C 616.0525 531.0942 629.5578 587.7352 632.0413 626.6381 C 623.7642 649.4001 521.069 698.7646 402.3499 699.8908 C 285.153 701.0146 197.9039 653.1249 178.8665 626.6381 z "
+   id="path609"
+   sodipodi:nodetypes="csccscsc" /><path
+   sodipodi:type="arc"
+   style="fill-rule:evenodd;stroke:none;fill:url(#radialGradient619);fill-opacity:1;stroke-opacity:1;stroke-width:1pt;stroke-linejoin:miter;stroke-linecap:butt;opacity:1;"
+   id="path618"
+   d="M 378.8918 580.6047 A 85.77409 80.70866 0 1 0 207.3436 580.6047 A 85.77409 80.70866 0 1 0  378.8918 580.6047 z"
+   sodipodi:cx="293.117737"
+   sodipodi:cy="580.604675"
+   sodipodi:rx="85.7740936"
+   sodipodi:ry="80.7086639"
+   transform="matrix(1.838316,0,0,1.746014,-138.9764,-824.7607)" /><path
+   style="font-size:12;fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:19.52374;"
+   d="M 316.9233 317.9081 C 284.3459 329.5249 191.3267 381.6501 140.2248 422.9068 C 101.5579 454.124 62.69138 491.2126 36.44298 532.2256 C 23.16032 552.9796 17.69017 587.0632 26.59756 611.9334 C 35.84248 634.7715 52.58544 651.6797 85.88156 655.1272 C 103.5473 656.991 121.7658 652.667 136.4999 640.3154 C 148.4275 632.5989 174.9614 600.3569 180.4264 592.0433 L 178.6434 625.6523 C 187.5679 642.2354 266.2461 698.7232 389.7901 698.9913 C 524.2446 699.2817 624.4286 647.9138 632.4894 626.0995 L 630.84 590.2501 C 640.3046 603.2495 659.3293 608.3089 671.7516 609.1621 C 706.5582 611.5178 724.8296 584.8713 728.4633 566.3179 C 730.2667 557.3596 736.1814 533.3696 723.4463 504.4271 C 710.9531 474.357 626.4623 402.6488 617.2828 395.7544 C 587.4003 373.813 540.8525 341.564 485.4769 314.7918 C 516.3918 295.7671 564.1457 265.1669 561.4601 185.7073 C 557.467 104.9184 491.238 45.11145 395.9233 44.87787 C 303.4872 45.85531 234.9411 105.4261 235.3777 186.8741 C 235.8066 265.7192 287.672 303.6138 316.9233 317.9081 z "
+   id="path606"
+   sodipodi:nodetypes="csssssccsccsssscsssc" /></svg>
--- a/src/protocols/msn/msg.c	Sat Nov 27 19:39:25 2004 +0000
+++ b/src/protocols/msn/msg.c	Sun Nov 28 18:13:18 2004 +0000
@@ -214,7 +214,7 @@
 	else
 	{
 		msg->body_len = payload_len - (tmp - tmp_base);
-		msg->body = g_memdup(tmp, msg->body_len);
+		msg->body = g_memdup(tmp, msg->body_len + 1);
 	}
 
 	g_free(tmp_base);
--- a/src/protocols/msn/msn.c	Sat Nov 27 19:39:25 2004 +0000
+++ b/src/protocols/msn/msn.c	Sun Nov 28 18:13:18 2004 +0000
@@ -49,8 +49,6 @@
 
 #define BUDDY_ALIAS_MAXLEN 387
 
-static GaimPlugin *my_protocol = NULL;
-
 typedef struct
 {
 	GaimConnection *gc;
@@ -458,8 +456,15 @@
 	{
 		emblems[0] = "offline";
 	}
-	else if (user->mobile)
-		emblems[i++] = "wireless";
+	else
+	{
+		if (user->mobile)
+			emblems[i++] = "wireless";
+		if (user->list_op & (1 << MSN_LIST_BL))
+			emblems[i++] = "blocked";
+		if (!(user->list_op & (1 << MSN_LIST_RL)))
+			emblems[i++] = "nr";
+	}
 
 	*se = emblems[0];
 	*sw = emblems[1];
@@ -507,6 +512,9 @@
 		g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Has you"),
 							   (user->list_op & (1 << MSN_LIST_RL)) ?
 							   _("Yes") : _("No"));
+		g_string_append_printf(s, _("\n<b>%s:</b> %s"), _("Blocked"),
+							   (user->list_op & (1 << MSN_LIST_BL)) ?
+							   _("Yes") : _("No"));
 	}
 
 	return g_string_free(s, FALSE);
@@ -679,7 +687,6 @@
 	}
 
 	session = msn_session_new(account, host, port, http_method);
-	session->prpl = my_protocol;
 
 	if (session->http_method)
 		msn_http_session_init(session);
@@ -720,37 +727,36 @@
 			GaimConvImFlags flags)
 {
 	GaimAccount *account;
+	MsnMessage *msg;
+	char *msgformat;
+	char *msgtext;
 
 	account = gaim_connection_get_account(gc);
 
+	msn_import_html(message, &msgformat, &msgtext);
+
+	if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564)
+	{
+		g_free(msgformat);
+		g_free(msgtext);
+
+		return -E2BIG;
+	}
+
+	msg = msn_message_new_plain(msgtext);
+	msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
+
+	g_free(msgformat);
+	g_free(msgtext);
+
 	if (g_ascii_strcasecmp(who, gaim_account_get_username(account)))
 	{
 		MsnSession *session;
 		MsnSwitchBoard *swboard;
-		MsnMessage *msg;
-		char *msgformat;
-		char *msgtext;
 
 		session = gc->proto_data;
 		swboard = msn_session_get_swboard(session, who);
 
-		msn_import_html(message, &msgformat, &msgtext);
-
-		if (strlen(msgtext) + strlen(msgformat) + strlen(VERSION) > 1564)
-		{
-			g_free(msgformat);
-			g_free(msgtext);
-
-			return -E2BIG;
-		}
-
-		msg = msn_message_new_plain(msgtext);
-		msn_message_set_attr(msg, "X-MMS-IM-Format", msgformat);
-
-		g_free(msgformat);
-		g_free(msgtext);
-
-		swboard = msn_session_get_swboard(session, who);
 
 		if (!g_queue_is_empty(swboard->im_queue) ||
 			!swboard->user_joined)
@@ -762,18 +768,32 @@
 			msn_switchboard_send_msg(swboard, msg);
 		}
 
-		msn_message_destroy(msg);
 	}
 	else
 	{
+		char *body_str, *body_enc, *pre, *post;
+		const char *format;
 		/*
 		 * In MSN, you can't send messages to yourself, so
 		 * we'll fake like we received it ;)
 		 */
+		body_str = msn_message_to_string(msg);
+		body_enc = gaim_escape_html(body_str);
+		g_free(body_str);
+
+		format = msn_message_get_attr(msg, "X-MMS-IM-Format");
+		msn_parse_format(format, &pre, &post);
+		body_str = g_strdup_printf("%s%s%s", pre, body_enc, post);
+		g_free(pre);
+		g_free(post);
+
 		serv_got_typing_stopped(gc, who);
-		serv_got_im(gc, who, message, flags, time(NULL));
+		serv_got_im(gc, who, body_str, flags, time(NULL));
+		g_free(body_str);
 	}
 
+	msn_message_destroy(msg);
+
 	return 1;
 }
 
@@ -1949,8 +1969,6 @@
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
 											   option);
 
-	my_protocol = plugin;
-
 	gaim_prefs_add_none("/plugins/prpl/msn");
 	gaim_prefs_add_bool("/plugins/prpl/msn/conv_close_notice",   TRUE);
 	gaim_prefs_add_bool("/plugins/prpl/msn/conv_timeout_notice", TRUE);
--- a/src/protocols/msn/msn.h	Sat Nov 27 19:39:25 2004 +0000
+++ b/src/protocols/msn/msn.h	Sun Nov 28 18:13:18 2004 +0000
@@ -85,14 +85,15 @@
 
 typedef enum
 {
-	MSN_CLIENT_CAP_WIN_MOBILE = 0x01,
-	MSN_CLIENT_CAP_UNKNOWN_1  = 0x02,
-	MSN_CLIENT_CAP_VIEW_INK   = 0x04,
-	MSN_CLIENT_CAP_SEND_INK   = 0x08,
-	MSN_CLIENT_CAP_VIDEO_CHAT = 0x10,
-	MSN_CLIENT_CAP_BASE       = 0x20,
-	MSN_CLIENT_CAP_UNKNOWN_2  = 0x40,
-	MSN_CLIENT_CAP_UNKNOWN_3  = 0x80
+	MSN_CLIENT_CAP_WIN_MOBILE = 0x001,
+	MSN_CLIENT_CAP_UNKNOWN_1  = 0x002,
+	MSN_CLIENT_CAP_VIEW_INK   = 0x004,
+	MSN_CLIENT_CAP_SEND_INK   = 0x008,
+	MSN_CLIENT_CAP_VIDEO_CHAT = 0x010,
+	MSN_CLIENT_CAP_BASE       = 0x020,
+	MSN_CLIENT_CAP_MSNMOBILE  = 0x040,
+	MSN_CLIENT_CAP_MSNDIRECT  = 0x080,
+	MSN_CLIENT_CAP_WEBMSGR    = 0x100
 
 } MsnClientCaps;
 
@@ -100,7 +101,9 @@
 {
 	MSN_CLIENT_VER_5_0 = 0x00,
 	MSN_CLIENT_VER_6_0 = 0x10,
-	MSN_CLIENT_VER_6_1 = 0x20
+	MSN_CLIENT_VER_6_1 = 0x20,
+	MSN_CLIENT_VER_6_2 = 0x30,
+	MSN_CLIENT_VER_7_0 = 0x40
 
 } MsnClientVerId;
 
--- a/src/protocols/msn/notification.c	Sat Nov 27 19:39:25 2004 +0000
+++ b/src/protocols/msn/notification.c	Sun Nov 28 18:13:18 2004 +0000
@@ -960,6 +960,9 @@
 
 	if ((value = msn_message_get_attr(msg, "ClientPort")) != NULL)
 		session->passport_info.client_port = ntohs(atoi(value));
+
+	if ((value = msn_message_get_attr(msg, "LoginTime")) != NULL)
+		session->passport_info.sl = atol(value);
 }
 
 static void
--- a/src/protocols/msn/session.c	Sat Nov 27 19:39:25 2004 +0000
+++ b/src/protocols/msn/session.c	Sun Nov 28 18:13:18 2004 +0000
@@ -88,7 +88,10 @@
 		g_free(session->passport_info.mspauth);
 
 	if (session->passport_info.file != NULL)
+	{
+		unlink(session->passport_info.file);
 		g_free(session->passport_info.file);
+	}
 
 	if (session->sync != NULL)
 		msn_sync_destroy(session->sync);
--- a/src/protocols/msn/session.h	Sat Nov 27 19:39:25 2004 +0000
+++ b/src/protocols/msn/session.h	Sun Nov 28 18:13:18 2004 +0000
@@ -83,8 +83,6 @@
 	/* You have no idea how much I hate all that is below. */
 	/* shx: What? ;) */
 
-	GaimPlugin *prpl;
-
 	MsnSync *sync;
 
 	GList *slplinks;