cpw.ivan: 563c6a79: Unescape X-Status message before showing...

ivan.komarov at soc.pidgin.im ivan.komarov at soc.pidgin.im
Sun Sep 26 11:51:23 EDT 2010


----------------------------------------------------------------------
Revision: 563c6a79e1266b750fe4bd608890195cfbcd8a2c
Parent:   b4b01e015e5c9e5ce422640df7149d766e7e16fb
Author:   ivan.komarov at soc.pidgin.im
Date:     09/26/10 11:36:05
Branch:   im.pidgin.cpw.ivan
URL: http://d.pidgin.im/viewmtn/revision/info/563c6a79e1266b750fe4bd608890195cfbcd8a2c

Changelog: 

Unescape X-Status message before showing it to the user.

Changes against parent b4b01e015e5c9e5ce422640df7149d766e7e16fb

  patched  libpurple/protocols/oscar/family_icbm.c
  patched  libpurple/protocols/oscar/userinfo.c

-------------- next part --------------
============================================================
--- libpurple/protocols/oscar/family_icbm.c	8c85ff771e981aa2863ec01d659c7b137617c672
+++ libpurple/protocols/oscar/family_icbm.c	0c1f3c4b0796bb76d814ecee20cd9b93fcfb4d23
@@ -1691,7 +1691,7 @@ static int clientautoresp(OscarData *od,
 				purple_debug_misc("oscar", "X-Status: Received XML reply\n");
 				if (xml) {
 					GString *xstatus;
-					char *tmp1, *tmp2;
+					char *tmp1, *tmp2, *unescaped_xstatus;
 
 					/* purple_debug_misc("oscar", "X-Status: XML reply: %s\n", xml); */
 
@@ -1709,13 +1709,15 @@ static int clientautoresp(OscarData *od,
 						tmp1 += 12;
 						tmp2 = strstr(tmp1, "</desc>");
 						if (tmp2 != NULL) {
-							if (xstatus->len > 0)
+							if (xstatus->len > 0 && tmp2 > tmp1)
 								g_string_append(xstatus, " - ");
 							g_string_append_len(xstatus, tmp1, tmp2 - tmp1);
 						}
 					}
-					if (xstatus->len > 0) {
-						purple_debug_misc("oscar", "X-Status reply: %s\n", xstatus->str);
+					unescaped_xstatus = purple_unescape_text(xstatus->str);
+					g_string_free(xstatus, TRUE);
+					if (*unescaped_xstatus) {
+						purple_debug_misc("oscar", "X-Status reply: %s\n", unescaped_xstatus);
 						account = purple_connection_get_account(od->gc);
 						buddy = purple_find_buddy(account, bn);
 						presence = purple_buddy_get_presence(buddy);
@@ -1724,17 +1726,15 @@ static int clientautoresp(OscarData *od,
 							purple_prpl_got_user_status(account, bn,
 									"mood",
 									PURPLE_MOOD_NAME, purple_status_get_attr_string(status, PURPLE_MOOD_NAME),
-									PURPLE_MOOD_COMMENT, xstatus->str, NULL);
+									PURPLE_MOOD_COMMENT, unescaped_xstatus, NULL);
 						}
 					}
-					g_string_free(xstatus, TRUE);
+					g_free(unescaped_xstatus);
 				} else {
 					purple_debug_misc("oscar", "X-Status: Can't get XML reply string\n");
 				}
 			} else {
 				purple_debug_misc("oscar", "X-Status: 0x0004, 0x000b not an xstatus reply\n");
-				/* if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))
-					ret = userfunc(od, conn, frame, channel, sn, reason); */
 			}
 
 		}
============================================================
--- libpurple/protocols/oscar/userinfo.c	ea93e169098591e773909e0b8f066b13523628ac
+++ libpurple/protocols/oscar/userinfo.c	39fdfe7ec62dd0447aa30fa1f1f671c1cc667c2f
@@ -296,7 +296,6 @@ oscar_user_info_append_status(PurpleConn
 				description = g_strdup(_(mood));
 			}
 			purple_notify_user_info_add_pair(user_info, _("Mood"), description);
-			g_free(comment);
 			g_free(description);
 		}
 	}


More information about the Commits mailing list