changeset 6310:f14718d7082e

[gaim-migrate @ 6809] Robot101 is a fancy bastard. Regarding my fix for "Make Gaim not crash when you unload the system tray icon when there are messages queued," he writes: The correct fix for this is to use &handle as the function data, I have a function that removes callbacks with that data pointer that gets called at unload. Fancy. In other news, we now send a BR tag instead of \n for newlines for AIM. And for ICQ we send CR/LF instead of \n. This is more correct, and should make messages with new lines sent from Gaim to Miranda show up correctly for Miranda users. ICQ Lite sends CR/LF to Gaim for newlines, but I would rather use a BR tag, and it seems to work with no problems. In still other news, de purk und beans mit sauerkrauten. In yet still other news, I don't have anything else to add. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 26 Jul 2003 20:40:44 +0000
parents bf63ddea431f
children eaeac660c17c
files plugins/docklet/docklet.c src/protocols/oscar/oscar.c
diffstat 2 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/docklet/docklet.c	Sat Jul 26 18:05:25 2003 +0000
+++ b/plugins/docklet/docklet.c	Sat Jul 26 20:40:44 2003 +0000
@@ -54,7 +54,6 @@
 GaimPlugin *handle = NULL;
 static struct docklet_ui_ops *ui_ops = NULL;
 static enum docklet_status status = offline;
-static guint blinktimer = 0;
 #ifdef _WIN32
 __declspec(dllimport) GSList *unread_message_queue;
 __declspec(dllimport) GSList *away_messages;
@@ -264,7 +263,7 @@
 
 		/* and schedule the blinker function if messages are pending */
 		if (status == online_pending || status == away_pending) {
-			blinktimer = g_timeout_add(500, docklet_blink_icon, NULL);
+			g_timeout_add(500, docklet_blink_icon, &handle);
 		}
 	}
 
@@ -440,9 +439,6 @@
 static gboolean
 plugin_unload(GaimPlugin *plugin)
 {
-	if (blinktimer != 0)
-		g_source_remove(blinktimer);
-
 	if (ui_ops->destroy)
 		ui_ops->destroy();
 
--- a/src/protocols/oscar/oscar.c	Sat Jul 26 18:05:25 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Sat Jul 26 20:40:44 2003 +0000
@@ -4255,6 +4255,7 @@
 	int ret = 0;
 	GError *err = NULL;
 	const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc));
+	char *tmpmsg;
 
 	if (dim && dim->connected) {
 		/* If we're directly connected, send a direct IM */
@@ -4329,13 +4330,19 @@
 
 		args.destsn = name;
 
-		len = strlen(message);
-		args.flags |= oscar_encoding_check(message);
+		/* For ICQ send newlines as CR/LF, for AIM send newlines as <BR> */
+		if (isdigit(name[0]))
+			tmpmsg = add_cr(message);
+		else
+			tmpmsg = strdup_withhtml(message);
+		len = strlen(tmpmsg);
+
+		args.flags |= oscar_encoding_check(tmpmsg);
 		if (args.flags & AIM_IMFLAGS_UNICODE) {
 			gaim_debug(GAIM_DEBUG_INFO, "oscar", "Sending Unicode IM\n");
 			args.charset = 0x0002;
 			args.charsubset = 0x0000;
-			args.msg = g_convert(message, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
+			args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF-8", NULL, &len, &err);
 			if (err) {
 				gaim_debug(GAIM_DEBUG_ERROR, "oscar",
 						   "Error converting a unicode message: %s\n", err->message);
@@ -4350,16 +4357,16 @@
 					   "Sending ISO-8859-1 IM\n");
 			args.charset = 0x0003;
 			args.charsubset = 0x0000;
-			args.msg = g_convert(message, len, "ISO-8859-1", "UTF-8", NULL, &len, &err);
+			args.msg = g_convert(tmpmsg, len, "ISO-8859-1", "UTF-8", NULL, &len, &err);
 			if (err) {
 				gaim_debug(GAIM_DEBUG_ERROR, "oscar",
 						   "conversion error: %s\n", err->message);
 				gaim_debug(GAIM_DEBUG_ERROR, "oscar",
 						   "Someone tell Ethan his 8859-1 detection is wrong\n");
 				args.flags ^= AIM_IMFLAGS_ISO_8859_1 | AIM_IMFLAGS_UNICODE;
-				len = strlen(message);
+				len = strlen(tmpmsg);
 				g_error_free(err);
-				args.msg = g_convert(message, len, "UCS-2BE", "UTF8", NULL, &len, &err);
+				args.msg = g_convert(tmpmsg, len, "UCS-2BE", "UTF8", NULL, &len, &err);
 				if (err) {
 					gaim_debug(GAIM_DEBUG_ERROR, "oscar",
 							   "Error in unicode fallback: %s\n", err->message);
@@ -4369,15 +4376,18 @@
 		} else {
 			args.charset = 0x0000;
 			args.charsubset = 0x0000;
-			args.msg = message;
+			args.msg = tmpmsg;
 		}
 		args.msglen = len;
 
 		ret = aim_im_sendch1_ext(od->sess, &args);
 	}
 
+	g_free(tmpmsg);
+
 	if (ret >= 0)
 		return 1;
+
 	return ret;
 }