changeset 27592:4cddfd2d06be

Use purple_util_format_song_info in MSN/XMPP for the buddy list status text.
author Paul Aurich <paul@darkrain42.org>
date Sun, 12 Jul 2009 21:09:05 +0000
parents f92d37b363c6
children 6b1eb8dbf86e
files libpurple/protocols/jabber/jabber.c libpurple/protocols/msn/msn.c
diffstat 2 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Sun Jul 12 18:48:59 2009 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Sun Jul 12 21:09:05 2009 +0000
@@ -1975,13 +1975,16 @@
 		ret = g_strdup(jb->error_msg);
 	} else {
 		PurplePresence *presence = purple_buddy_get_presence(b);
-		PurpleStatus *status =purple_presence_get_active_status(presence);
+		PurpleStatus *status = purple_presence_get_active_status(presence);
 		char *stripped;
 
 		if(!(stripped = purple_markup_strip_html(purple_status_get_attr_string(status, "message")))) {
 			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));
+				const char *title = purple_status_get_attr_string(status, PURPLE_TUNE_TITLE);
+				const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST);
+				const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM);
+				stripped = purple_util_format_song_info(title, artist, album, NULL);
 			}
 		}
 
--- a/libpurple/protocols/msn/msn.c	Sun Jul 12 18:48:59 2009 +0000
+++ b/libpurple/protocols/msn/msn.c	Sun Jul 12 21:09:05 2009 +0000
@@ -672,12 +672,7 @@
 		if (title && *title) {
 			const char *artist = purple_status_get_attr_string(status, PURPLE_TUNE_ARTIST);
 			const char *album = purple_status_get_attr_string(status, PURPLE_TUNE_ALBUM);
-			media = g_strdup_printf("%s%s%s%s%s%s", title,
-			                        (artist && *artist) ? " - " : "",
-			                        (artist && *artist) ? artist : "",
-			                        (album && *album) ? " (" : "",
-			                        (album && *album) ? album : "",
-			                        (album && *album) ? ")" : "");
+			media = purple_util_format_song_info(title, artist, album, NULL);
 		}
 		else if (game && *game)
 			media = g_strdup_printf("Playing %s", game);