changeset 15256:7a94d65a8f6a

[gaim-migrate @ 18046] When there is no away message specified in the info block and the contact is no longer away, clear the cached away message if there is one. Previously, when a contact did the following: 1. Away with Message 1 2. Available 3. Away with Message 2 the 3rd event would lead to setting away first with Message 1 (cached in the old user_info object) and then with Message 2 (using a newly created user_info object). I also changed 2 "#if 0" directives which together controlled logging unknown TLVs into "#ifdef LOG_UNKNOWN_TLV" and added a commented-out #define at the top of the file. committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Fri, 22 Dec 2006 08:33:12 +0000
parents 2e3ffe29f9ae
children b380e326d602
files libgaim/protocols/oscar/family_locate.c
diffstat 1 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/oscar/family_locate.c	Fri Dec 22 08:29:28 2006 +0000
+++ b/libgaim/protocols/oscar/family_locate.c	Fri Dec 22 08:33:12 2006 +0000
@@ -31,6 +31,9 @@
 #include "win32dep.h"
 #endif
 
+/* Define to log unknown TLVs */
+/* #define LOG_UNKNOWN_TLV */
+
 /*
  * Capability blocks.
  *
@@ -301,6 +304,21 @@
 			cur->away = NULL;
 		cur->away_encoding = strdup(userinfo->away_encoding);
 		cur->away_len = userinfo->away_len;
+
+	} else if (!(userinfo->flags & AIM_FLAG_AWAY)) {
+		/*
+		 * We don't have an away message specified in this user_info block.
+		 * If the user is not away, clear any cached away message now.
+		 */
+		if (cur->away) {
+			free(cur->away);
+			cur->away = NULL;
+		}
+		if (cur->away_encoding) {
+			free(cur->away_encoding);
+			cur->away_encoding = NULL;
+		}
+		cur->away_len = 0;
 	}
 
 	/*
@@ -525,7 +543,7 @@
 	return 0;
 }
 
-#if 0
+#ifdef LOG_UNKNOWN_TLV
 static void
 dumptlv(OscarData *od, guint16 type, ByteStream *bs, guint8 len)
 {
@@ -851,7 +869,7 @@
 			 * recovery.
 			 *
 			 */
-#if 0
+#ifdef LOG_UNKNOWN_TLV
 			gaim_debug_misc("oscar", "userinfo: **warning: unexpected TLV:\n");
 			gaim_debug_misc("oscar", "userinfo:   sn    =%s\n", outinfo->sn);
 			dumptlv(od, type, bs, length);