diff libpurple/protocols/jabber/presence.c @ 20571:c97e3ab9ef11

Music support for Google Talk
author Sean Egan <seanegan@gmail.com>
date Thu, 20 Sep 2007 23:22:35 +0000
parents 5913725cbcd6
children 485a0bffe4f5
line wrap: on
line diff
--- a/libpurple/protocols/jabber/presence.c	Thu Sep 20 16:30:17 2007 +0000
+++ b/libpurple/protocols/jabber/presence.c	Thu Sep 20 23:22:35 2007 +0000
@@ -33,6 +33,7 @@
 
 #include "buddy.h"
 #include "chat.h"
+#include "google.h"
 #include "presence.h"
 #include "iq.h"
 #include "jutil.h"
@@ -107,6 +108,7 @@
 	const char *artist = NULL, *title = NULL, *source = NULL, *uri = NULL, *track = NULL;
 	int length = -1;
 	gboolean allowBuzz;
+	PurplePresence *p = purple_account_get_presence(account);
 	PurpleStatus *tune;
 
 	if(NULL == status) {
@@ -145,6 +147,12 @@
 	if (allowBuzz != js->allowBuzz || js->old_state != state || CHANGED(js->old_msg, stripped) ||
 		js->old_priority != priority || CHANGED(js->old_avatarhash, js->avatar_hash)) {
 		js->allowBuzz = allowBuzz;
+
+		if (js->googletalk && stripped == NULL && purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) {
+			tune = purple_presence_get_status(presence, "tune");
+			stripped = jabber_google_presence_outgoing(tune);
+		}
+
 		presence = jabber_presence_create_js(js, state, stripped, priority);
 
 		if(js->avatar_hash) {
@@ -735,7 +743,9 @@
 		}
 
 		if((found_jbr = jabber_buddy_find_resource(jb, NULL))) {
-			purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, found_jbr->status ? "message" : NULL, found_jbr->status, NULL);
+			const char *message;
+			jabber_google_presence_incoming(js, buddy_name, found_jbr);
+			purple_prpl_got_user_status(js->gc->account, buddy_name, jabber_buddy_state_get_status_id(found_jbr->state), "priority", found_jbr->priority, "message", found_jbr->status, NULL);
 		} else {
 			purple_prpl_got_user_status(js->gc->account, buddy_name, "offline", status ? "message" : NULL, status, NULL);
 		}