changeset 17860:84638e3af1bc

Minor compilation fixes and corrected some typos on user tune. Added convenience function for setting the user tune.
author Andreas Monitzer <pidgin@monitzer.com>
date Mon, 18 Jun 2007 01:55:54 +0000
parents beaeb7fb4dbd
children 91cbd18fee06
files libpurple/account.c libpurple/account.h libpurple/protocols/jabber/usertune.c libpurple/prpl.h
diffstat 4 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Mon Jun 18 00:56:00 2007 +0000
+++ b/libpurple/account.c	Mon Jun 18 01:55:54 2007 +0000
@@ -2153,6 +2153,18 @@
 }
 
 void
+purple_account_set_tune(PurpleAccount *account, const PurpleTuneInfo *info) {
+	PurplePluginProtocolInfo *prpl_info = NULL;
+	PurpleConnection *gc = purple_account_get_connection(account);
+	
+	if (gc != NULL && gc->prpl != NULL)
+		prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+	
+	if (prpl_info && prpl_info->publish_tune)
+		prpl_info->publish_tune(gc, info);
+}
+
+void
 purple_accounts_add(PurpleAccount *account)
 {
 	g_return_if_fail(account != NULL);
--- a/libpurple/account.h	Mon Jun 18 00:56:00 2007 +0000
+++ b/libpurple/account.h	Mon Jun 18 01:55:54 2007 +0000
@@ -841,6 +841,14 @@
  */
 gboolean purple_account_supports_offline_message(PurpleAccount *account, PurpleBuddy *buddy);
 
+/**
+ * Sets the current tune playing on the machine (if the prpl support setting this information)
+ *
+ * @param account	The account
+ * @param info		The tune information
+ */
+void purple_account_set_tune(PurpleAccount *account, const PurpleTuneInfo *info);
+
 /*@}*/
 
 /**************************************************************************/
--- a/libpurple/protocols/jabber/usertune.c	Mon Jun 18 00:56:00 2007 +0000
+++ b/libpurple/protocols/jabber/usertune.c	Mon Jun 18 01:55:54 2007 +0000
@@ -107,14 +107,11 @@
 			xmlnode_insert_data(xmlnode_new_child(tunenode, "uri"),tuneinfo->url,-1);
 		if(tuneinfo->time >= 0) {
 			char *length = g_strdup_printf("%d", tuneinfo->time);
-			xmlnode_insert_data(xmlnode_new_child(tunenode, "length"),tuneinfo->artist,-1);
+			xmlnode_insert_data(xmlnode_new_child(tunenode, "length"),length,-1);
 			g_free(length);
 		}
-		if(tuneinfo->track >= 0) {
-			char *track = g_strdup_printf("%d", tuneinfo->year);
+		if(tuneinfo->track)
 			xmlnode_insert_data(xmlnode_new_child(tunenode, "track"),tuneinfo->track,-1);
-			g_free(track);
-		}
 	}
 	
 	jabber_pep_publish(js, publish);
--- a/libpurple/prpl.h	Mon Jun 18 00:56:00 2007 +0000
+++ b/libpurple/prpl.h	Mon Jun 18 01:55:54 2007 +0000
@@ -47,6 +47,7 @@
  * Dimensions less than 1 should be ignored and the image not scaled.
  */
 typedef struct _PurpleBuddyIconSpec PurpleBuddyIconSpec;
+typedef struct _PurpleTuneInfo PurpleTuneInfo;
 
 /**
  * This \#define exists just to make it easier to fill out the buddy icon
@@ -91,8 +92,6 @@
 	gboolean secret;
 };
 
-typedef struct _PurpleTuneInfo PurpleTuneInfo;
-
 struct _PurpleTuneInfo {
 	char *artist;
 	char *title;