changeset 4852:d1c17e81055e

[gaim-migrate @ 5179] Gather around children, and I shall tell you a tale of goblins and witches and bunnies. Yes, you heard me. Witches. You see, there once was a rooster named Fredrick some away messages AND HE WAS A MIGHTY ROOSTER with powers of they had & in them which were and one day he said, "I shall find me an adventure!" And so he set off and they were being truncated and so he grabbed a pitchfork and headed to the Dungeon of Evil where pango got upset and CRASH! committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sat, 22 Mar 2003 06:11:12 +0000
parents 4b6bf5ed9c5e
children fbfdacf7c611
files src/buddy.c
diffstat 1 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/buddy.c	Sat Mar 22 01:26:07 2003 +0000
+++ b/src/buddy.c	Sat Mar 22 06:11:12 2003 +0000
@@ -894,11 +894,38 @@
 		}
 
 		if(tmp) {
+			char *temp;
+
 			g_strdelimit(tmp, "\n", ' ');
-			if(strlen(tmp) > 20)
+
+			if(strlen(tmp) > 20) {
+				char *c1, *c2;
+
 				statustext = g_strdup_printf("%.20s... ", tmp);
+
+				if ((c1 = strrchr(statustext, '&')) != NULL) {
+					if ((c2 = strrchr(statustext, ';')) == NULL ||
+						c2 < c1) {
+
+						char *new_statustext;
+
+						/* We must escape this broken entity. */
+						new_statustext = g_new0(char, strlen(statustext) + 5);
+
+						strncpy(new_statustext, statustext, c1 - statustext);
+						sprintf(new_statustext + (c1 - statustext),
+								"&amp;%s", c1 + 1);
+
+						g_free(statustext);
+
+						statustext = new_statustext;
+					}
+				}
+					
+			}
 			else
 				statustext = g_strdup_printf("%s ", tmp);
+
 			g_free(tmp);
 		}
 	}