diff src/protocols/oscar/oscar.c @ 10563:3e2cd3fe8897

[gaim-migrate @ 11944] Fix a problem Justin Wood noticed and supplied sf patch 920581 to fix My fix is slightly difference. The problem was that, if an iChat user had an available message up, then they changed their buddy icon, Gaim would stop showing the available message for the person. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 01 Feb 2005 05:19:27 +0000
parents 33746d45bd0d
children 3b66a8f25bad
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Tue Feb 01 05:02:40 2005 +0000
+++ b/src/protocols/oscar/oscar.c	Tue Feb 01 05:19:27 2005 +0000
@@ -3023,12 +3023,21 @@
 	bi->ico_informed = FALSE;
 	bi->ipaddr = info->icqinfo.ipaddr;
 
-	/* Available message stuff */
-	free(bi->availmsg);
+	/*
+	 * Handle the available message.  If info->avail is NULL then the user
+	 * may or may not have an available message, so don't do anything.  If
+	 * info->avail is set to the empty string, then the user's client DOES
+	 * support available messages and the user DOES NOT have one set.
+	 * Otherwise info->avail contains the available message.
+	 */
 	if (info->avail != NULL)
-		bi->availmsg = oscar_encoding_to_utf8(info->avail_encoding, info->avail, info->avail_len);
-	else
-		bi->availmsg = NULL;
+	{
+		free(bi->availmsg);
+		if (info->avail[0] != '\0')
+			bi->availmsg = oscar_encoding_to_utf8(info->avail_encoding, info->avail, info->avail_len);
+		else
+			bi->availmsg = NULL;
+	}
 
 	/* Server stored icon stuff */
 	if (info->iconcsumlen) {