# HG changeset patch # User Sean Egan # Date 1185917544 0 # Node ID 0a2059a1b0cc288064ef9ee14bf04ae9d9601d33 # Parent d54fecfe6bf79fb1d12c7c92ef77b001d13ff192 Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356 diff -r d54fecfe6bf7 -r 0a2059a1b0cc libpurple/protocols/yahoo/yahoo.c --- a/libpurple/protocols/yahoo/yahoo.c Tue Jul 31 16:30:58 2007 +0000 +++ b/libpurple/protocols/yahoo/yahoo.c Tue Jul 31 21:32:24 2007 +0000 @@ -196,6 +196,8 @@ GSList *l = pkt->hash; YahooFriend *f = NULL; char *name = NULL; + gboolean unicode = FALSE; + char *message = NULL; if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { gc->wants_to_die = TRUE; @@ -269,7 +271,7 @@ break; case 19: /* custom message */ if (f) - yahoo_friend_set_status_message(f, yahoo_string_decode(gc, pair->value, FALSE)); + message = pair->value; break; case 11: /* this is the buddy's session id */ break; @@ -380,6 +382,10 @@ g_free(tmp); } break; + case 97: /* Unicode status message */ + unicode = !strcmp(pair->value, "1"); + break; + default: purple_debug(PURPLE_DEBUG_ERROR, "yahoo", "Unknown status key %d\n", pair->key); @@ -389,6 +395,9 @@ l = l->next; } + if (message && f) + yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); + if (name && f) /* update the last buddy */ yahoo_update_status(gc, name, f); } @@ -3451,6 +3460,7 @@ const char *msg = NULL; char *tmp = NULL; char *conv_msg = NULL; + gboolean utf8 = TRUE; if (!purple_status_is_active(status)) return; @@ -3467,13 +3477,13 @@ msg = purple_status_get_attr_string(status, "message"); if (purple_status_is_available(status)) { - tmp = yahoo_string_encode(gc, msg, NULL); + tmp = yahoo_string_encode(gc, msg, &utf8); conv_msg = purple_markup_strip_html(tmp); g_free(tmp); } else { if ((msg == NULL) || (*msg == '\0')) msg = _("Away"); - tmp = yahoo_string_encode(gc, msg, NULL); + tmp = yahoo_string_encode(gc, msg, &utf8); conv_msg = purple_markup_strip_html(tmp); g_free(tmp); } @@ -3491,6 +3501,7 @@ yahoo_packet_hash_int(pkt, 10, yd->current_status); if (yd->current_status == YAHOO_STATUS_CUSTOM) { + yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); yahoo_packet_hash_str(pkt, 19, conv_msg); } else { yahoo_packet_hash_str(pkt, 19, "");