Mercurial > pidgin.yaz
changeset 27894:f3477b0d32f4
improved "now listening" status support.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Fri, 03 Oct 2008 12:17:03 +0000 |
parents | 43b19e3dbda7 |
children | e626fb0f2aab |
files | libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jabber.c |
diffstat | 2 files changed, 18 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/google.c Sat Sep 27 14:21:37 2008 +0000 +++ b/libpurple/protocols/jabber/google.c Fri Oct 03 12:17:03 2008 +0000 @@ -1,3 +1,4 @@ +/* -*- coding: utf-8 -*- */ /** * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this @@ -512,8 +513,11 @@ if (!js->googletalk) return; if (jbr->status && !strncmp(jbr->status, "♫ ", strlen("♫ "))) { + gchar *unescaped; + unescaped = purple_unescape_html(jbr->status + strlen("♫ ")); purple_prpl_got_user_status(js->gc->account, user, "tune", - PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL); + PURPLE_TUNE_TITLE, unescaped, NULL); + g_free(unescaped); jbr->status = NULL; } else { purple_prpl_got_user_status_deactive(js->gc->account, user, "tune");
--- a/libpurple/protocols/jabber/jabber.c Sat Sep 27 14:21:37 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Oct 03 12:17:03 2008 +0000 @@ -1498,7 +1498,7 @@ { char *ret = NULL; JabberBuddy *jb = NULL; - + if (b->account->gc && b->account->gc->proto_data) jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE); @@ -1507,13 +1507,21 @@ } else if(jb && !PURPLE_BUDDY_IS_ONLINE(b) && jb->error_msg) { ret = g_strdup(jb->error_msg); } else { - char *stripped; + char *stripped = NULL; if(!(stripped = purple_markup_strip_html(jabber_buddy_get_status_msg(jb)))) { PurplePresence *presence = purple_buddy_get_presence(b); if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { - PurpleStatus *status = purple_presence_get_status(presence, "tune"); - stripped = g_strdup(purple_status_get_attr_string(status, PURPLE_TUNE_TITLE)); + PurpleStatus *status; + const char *title, *artist; + + status = purple_presence_get_status(presence, "tune"); + title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE); + artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST); + + stripped = g_strdup_printf("%s%s%s", title, artist ? " - " : "", + artist ? artist : ""); + } } @@ -1584,6 +1592,7 @@ const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); const char *artist = purple_status_get_attr_string(tune, PURPLE_TUNE_ARTIST); const char *album = purple_status_get_attr_string(tune, PURPLE_TUNE_ALBUM); + char *playing = purple_util_format_song_info(title, artist, album, NULL); if (playing) { purple_notify_user_info_add_pair(user_info, _("Now Listening"), playing);