Mercurial > pidgin.yaz
changeset 20573:e2347dda167c
merge of '1c5efeb28eebea9bc8d25b6a543a3e71a31a4884'
and 'dcf42d4b0a0219f1eeabf9686321735ae9b13e7f'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 21 Sep 2007 00:20:20 +0000 |
parents | 1933f2084eb3 (current diff) c97e3ab9ef11 (diff) |
children | 485a0bffe4f5 |
files | |
diffstat | 4 files changed, 47 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/google.c Thu Sep 20 20:18:57 2007 +0000 +++ b/libpurple/protocols/jabber/google.c Fri Sep 21 00:20:20 2007 +0000 @@ -517,3 +517,22 @@ } return g_string_free(str, FALSE); } + +void jabber_google_presence_incoming(JabberStream *js, const char *user, JabberBuddyResource *jbr) +{ + if (!js->googletalk) + return; + if (jbr->status && !strncmp(jbr->status, "♫ ", strlen("♫ "))) { + purple_prpl_got_user_status(js->gc->account, user, "tune", + PURPLE_TUNE_TITLE, jbr->status + strlen("♫ "), NULL); + jbr->status = NULL; + } else { + purple_prpl_got_user_status_deactive(js->gc->account, user, "tune"); + } +} + +char *jabber_google_presence_outgoing(PurpleStatus *tune) +{ + char *ret = g_strdup_printf("♫ %s", purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE)); + return ret; +}
--- a/libpurple/protocols/jabber/google.h Thu Sep 20 20:18:57 2007 +0000 +++ b/libpurple/protocols/jabber/google.h Fri Sep 21 00:20:20 2007 +0000 @@ -36,6 +36,10 @@ * if this roster item should continue to be processed */ gboolean jabber_google_roster_incoming(JabberStream *js, xmlnode *item); + +void jabber_google_presence_incoming(JabberStream *js, const char *who, JabberBuddyResource *jbr); +char *jabber_google_presence_outgoing(PurpleStatus *tune); + void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who); void jabber_google_roster_rem_deny(PurpleConnection *gc, const char *who);
--- a/libpurple/protocols/jabber/jabber.c Thu Sep 20 20:18:57 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Sep 21 00:20:20 2007 +0000 @@ -1400,10 +1400,11 @@ char *stripped; if(!(stripped = purple_markup_strip_html(jabber_buddy_get_status_msg(jb)))) { - PurpleStatus *status = purple_presence_get_active_status(purple_buddy_get_presence(b)); - - if(!purple_status_is_available(status)) - stripped = g_strdup(purple_status_get_name(status)); + 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)); + } } if(stripped) { @@ -1429,6 +1430,7 @@ if(jb) { JabberBuddyResource *jbr = NULL; + PurplePresence *presence = purple_buddy_get_presence(b); const char *sub; GList *l; const char *mood; @@ -1455,7 +1457,7 @@ purple_notify_user_info_add_pair(user_info, _("Subscription"), sub); - status = purple_presence_get_active_status(purple_buddy_get_presence(b)); + status = purple_presence_get_active_status(presence); value = purple_status_get_attr_value(status, "mood"); if (value && purple_value_get_type(value) == PURPLE_TYPE_STRING && (mood = purple_value_get_string(value))) { @@ -1467,7 +1469,12 @@ g_free(moodplustext); } else purple_notify_user_info_add_pair(user_info, _("Mood"), mood); - } + } + if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_TUNE)) { + PurpleStatus *tune = purple_presence_get_status(presence, "tune"); + const char *title = purple_status_get_attr_string(tune, PURPLE_TUNE_TITLE); + purple_notify_user_info_add_pair(user_info, _("Current media"), title); + } } for(l=jb->resources; l; l = l->next) {
--- a/libpurple/protocols/jabber/presence.c Thu Sep 20 20:18:57 2007 +0000 +++ b/libpurple/protocols/jabber/presence.c Fri Sep 21 00:20:20 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); }