changeset 24482:0f7a248848ed

Properly escape the status message. Fixes #7630.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 26 Nov 2008 00:41:53 +0000
parents 15db3067a5ac
children f48bfb88c7cb db414e4b966b
files finch/gntblist.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntblist.c	Tue Nov 25 22:06:06 2008 +0000
+++ b/finch/gntblist.c	Wed Nov 26 00:41:53 2008 +0000
@@ -2207,6 +2207,7 @@
 {
 	PurpleSavedStatus *current;
 	const char *message, *newmessage;
+	char *escnewmessage;
 	PurpleStatusPrimitive prim, newprim;
 	StatusBoxItem *item;
 
@@ -2216,6 +2217,7 @@
 
 	newmessage = gnt_entry_get_text(GNT_ENTRY(ggblist->statustext));
 	item = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(ggblist->status));
+	escnewmessage = newmessage ? g_markup_escape_text(newmessage, -1) : NULL;
 
 	switch (item->type) {
 		case STATUS_PRIMITIVE:
@@ -2228,16 +2230,16 @@
 			goto end;  /* 'New' or 'Saved' is selected, but this should never happen. */
 	}
 
-	if (newprim != prim || ((message && !newmessage) ||
-				(!message && newmessage) ||
-				(message && newmessage && g_utf8_collate(message, newmessage) != 0)))
+	if (newprim != prim || ((message && !escnewmessage) ||
+				(!message && escnewmessage) ||
+				(message && escnewmessage && g_utf8_collate(message, escnewmessage) != 0)))
 	{
-		PurpleSavedStatus *status = purple_savedstatus_find_transient_by_type_and_message(newprim, newmessage);
+		PurpleSavedStatus *status = purple_savedstatus_find_transient_by_type_and_message(newprim, escnewmessage);
 									/* Holy Crap! That's a LAWNG function name */
 		if (status == NULL)
 		{
 			status = purple_savedstatus_new(NULL, newprim);
-			purple_savedstatus_set_message(status, newmessage);
+			purple_savedstatus_set_message(status, escnewmessage);
 		}
 
 		purple_savedstatus_activate(status);
@@ -2245,6 +2247,7 @@
 
 	gnt_box_give_focus_to_child(GNT_BOX(ggblist->window), ggblist->tree);
 end:
+	g_free(escnewmessage);
 	if (ggblist->typing)
 		g_source_remove(ggblist->typing);
 	ggblist->typing = 0;