diff src/protocols/yahoo/yahoo.c @ 4777:e23a7e166680

[gaim-migrate @ 5097] - a couple compile cleanups - status messages and tooltips won't crash gaim when people put up certain away messages - yahoo status messages will show the current "custom" message instead of the previous one committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 14 Mar 2003 22:49:32 +0000
parents 92ae181271e9
children 677d3cb193a1
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Fri Mar 14 17:41:41 2003 +0000
+++ b/src/protocols/yahoo/yahoo.c	Fri Mar 14 22:49:32 2003 +0000
@@ -413,10 +413,6 @@
 			}
 			if (g_hash_table_lookup(yd->games, name))
 				gamestate = YAHOO_STATUS_GAME;
-			if (state == YAHOO_STATUS_AVAILABLE)
-				serv_got_update(gc, name, 1, 0, 0, 0, gamestate);
-			else 
-				serv_got_update(gc, name, 1, 0, 0, 0, (state << 2) | UC_UNAVAILABLE | gamestate);
 			if (state == YAHOO_STATUS_CUSTOM) {
 				gpointer val = g_hash_table_lookup(yd->hash, name);
 				if (val) {
@@ -427,6 +423,10 @@
 					g_hash_table_insert(yd->hash, g_strdup(name),
 							msg ? g_strdup(msg) : g_malloc0(1));
 			}
+			if (state == YAHOO_STATUS_AVAILABLE)
+				serv_got_update(gc, name, 1, 0, 0, 0, gamestate);
+			else
+				serv_got_update(gc, name, 1, 0, 0, 0, (state << 2) | UC_UNAVAILABLE | gamestate);
 			break;
 		case 60: /* no clue */
 			 break;
@@ -1078,8 +1078,14 @@
 	if (b->uc & UC_UNAVAILABLE) {
 		if ((b->uc >> 2) != YAHOO_STATUS_CUSTOM)
 			return g_strdup(yahoo_get_status_string(b->uc >> 2));
-		else
-			return strip_html(g_hash_table_lookup(yd->hash, b->name));
+		else {
+			char *stripped = strip_html(g_hash_table_lookup(yd->hash, b->name));
+			if(stripped) {
+				char *ret = g_markup_escape_text(stripped, strlen(stripped));
+				g_free(stripped);
+				return ret;
+			}
+		}
 	}
 	return NULL;
 }
@@ -1095,8 +1101,10 @@
 		else
 			status = strip_html(g_hash_table_lookup(yd->hash, b->name));
 		if(status) {
-			ret = g_strdup_printf(_("<b>Status:</b> %s"), status);
+			char *escaped = g_markup_escape_text(status, strlen(status));
+			ret = g_strdup_printf(_("<b>Status:</b> %s"), escaped);
 			g_free(status);
+			g_free(escaped);
 			return ret;
 		}
 	}