pidgin.2.x.y: 7eb1f6d5: Salvage incoming SILC text if necessary.

elb at pidgin.im elb at pidgin.im
Thu Sep 29 21:35:58 EDT 2011


----------------------------------------------------------------------
Revision: 7eb1f6d56cc58bbb5b56b7df53955d36b9b419b8
Parent:   be5e66abad2af29604bc794cc4c6600ab12751f3
Author:   elb at pidgin.im
Date:     09/29/11 21:31:04
Branch:   im.pidgin.pidgin.2.x.y
URL: http://d.pidgin.im/viewmtn/revision/info/7eb1f6d56cc58bbb5b56b7df53955d36b9b419b8

Changelog: 

Salvage incoming SILC text if necessary.

Fixes #14636

Changes against parent be5e66abad2af29604bc794cc4c6600ab12751f3

  patched  libpurple/protocols/silc/ops.c

-------------- next part --------------
============================================================
--- libpurple/protocols/silc/ops.c	30ab18780af11a53b6564a44c4e8ebfc1a296d78
+++ libpurple/protocols/silc/ops.c	80bd9a7d3faf9e5ef28438647159fe19847e9839
@@ -408,9 +408,16 @@ silc_private_message(SilcClient client, 
 	}
 
 	if (flags & SILC_MESSAGE_FLAG_UTF8) {
-		tmp = g_markup_escape_text((const char *)message, -1);
+		const char *msg = (const char *)message;
+		char *salvaged = NULL;
+		if (!g_utf8_validate((const char *)message, -1, NULL)) {
+			salvaged = purple_utf8_salvage((const char *)message);
+			msg = salvaged;
+		}
+		tmp = g_markup_escape_text(msg, -1);
 		/* Send to Purple */
 		serv_got_im(gc, sender->nickname, tmp, 0, time(NULL));
+		g_free(salvaged);
 		g_free(tmp);
 	}
 }


More information about the Commits mailing list