Mercurial > pidgin.yaz
changeset 28117:c8af11ba1ee8
merge of '80c06f6950b5ea3ca311d8e4752ad5b19ea84059'
and 'e51813f1e6fd21732acaaaa95d22ab3ac75a0c72'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 01 Aug 2009 02:59:31 +0000 |
parents | 07de864fc024 (current diff) 3ad2700e7c68 (diff) |
children | 784013acc2f3 ed11d1cabbe4 14e5eadff540 |
files | |
diffstat | 5 files changed, 53 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Fri Jul 31 21:44:52 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Aug 01 02:59:31 2009 +0000 @@ -463,6 +463,11 @@ if(!js->vcard_fetched) return; + if (js->vcard_timer) { + purple_timeout_remove(js->vcard_timer); + js->vcard_timer = 0; + } + g_free(js->avatar_hash); js->avatar_hash = NULL; @@ -854,12 +859,26 @@ } } +static gboolean +set_own_vcard_cb(gpointer data) +{ + JabberStream *js = data; + PurpleAccount *account = purple_connection_get_account(js->gc); + + js->vcard_timer = 0; + + jabber_set_info(js->gc, purple_account_get_user_info(account)); + + return FALSE; +} + static void jabber_vcard_save_mine(JabberStream *js, const char *from, JabberIqType type, const char *id, xmlnode *packet, gpointer data) { xmlnode *vcard, *photo, *binval; char *txt, *vcard_hash = NULL; + PurpleAccount *account; if (type == JABBER_IQ_ERROR) { xmlnode *error; @@ -870,12 +889,13 @@ return; } + account = purple_connection_get_account(js->gc); + if((vcard = xmlnode_get_child(packet, "vCard")) || (vcard = xmlnode_get_child_with_namespace(packet, "query", "vcard-temp"))) { txt = xmlnode_to_str(vcard, NULL); - purple_account_set_user_info(purple_connection_get_account(js->gc), txt); - + purple_account_set_user_info(account, txt); g_free(txt); } else { /* if we have no vCard, then lets not overwrite what we might have locally */ @@ -898,8 +918,17 @@ /* Republish our vcard if the photo is different than the server's */ if (!purple_strequal(vcard_hash, js->initial_avatar_hash)) { - PurpleAccount *account = purple_connection_get_account(js->gc); - jabber_set_info(js->gc, purple_account_get_user_info(account)); + /* + * Google Talk has developed the behavior that it will not accept + * a vcard set in the first 10 seconds (or so) of the connection; + * it returns an error (namespaces trimmed): + * <error code="500" type="wait"><internal-server-error/></error>. + */ + if (js->googletalk) + js->vcard_timer = purple_timeout_add_seconds(10, set_own_vcard_cb, + js); + else + jabber_set_info(js->gc, purple_account_get_user_info(account)); } else if (js->initial_avatar_hash) { /* Our photo is in the vcard, so advertise vcard-temp updates */ js->avatar_hash = g_strdup(js->initial_avatar_hash);
--- a/libpurple/protocols/jabber/disco.c Fri Jul 31 21:44:52 2009 +0000 +++ b/libpurple/protocols/jabber/disco.c Sat Aug 01 02:59:31 2009 +0000 @@ -98,10 +98,6 @@ JabberIqType type, const char *id, xmlnode *in_query) { - - if(!from) - return; - if(type == JABBER_IQ_GET) { xmlnode *query, *identity, *feature; JabberIq *iq; @@ -116,7 +112,8 @@ jabber_iq_set_id(iq, id); - xmlnode_set_attrib(iq->node, "to", from); + if (from) + xmlnode_set_attrib(iq->node, "to", from); query = xmlnode_get_child(iq->node, "query"); if(node) @@ -208,7 +205,8 @@ xmlnode_set_namespace(bad_request, "urn:ietf:params:xml:ns:xmpp-stanzas"); jabber_iq_set_id(iq, id); - xmlnode_set_attrib(iq->node, "to", from); + if (from) + xmlnode_set_attrib(iq->node, "to", from); jabber_iq_send(iq); }
--- a/libpurple/protocols/jabber/jabber.c Fri Jul 31 21:44:52 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Aug 01 02:59:31 2009 +0000 @@ -1542,6 +1542,9 @@ g_free(js->old_track); g_free(js->expected_rspauth); + if (js->vcard_timer != 0) + purple_timeout_remove(js->vcard_timer); + if (js->keepalive_timeout != 0) purple_timeout_remove(js->keepalive_timeout); @@ -3467,6 +3470,8 @@ #ifdef USE_VV jabber_add_feature("http://www.google.com/xmpp/protocol/session", jabber_audio_enabled); jabber_add_feature("http://www.google.com/xmpp/protocol/voice/v1", jabber_audio_enabled); + jabber_add_feature("http://www.google.com/xmpp/protocol/video/v1", jabber_video_enabled); + jabber_add_feature("http://www.google.com/xmpp/protocol/camera/v1", jabber_video_enabled); jabber_add_feature(JINGLE_APP_RTP_SUPPORT_AUDIO, jabber_audio_enabled); jabber_add_feature(JINGLE_APP_RTP_SUPPORT_VIDEO, jabber_video_enabled); jabber_add_feature(JINGLE_TRANSPORT_ICEUDP, 0);
--- a/libpurple/protocols/jabber/jabber.h Fri Jul 31 21:44:52 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sat Aug 01 02:59:31 2009 +0000 @@ -214,6 +214,8 @@ void *unregistration_user_data; gboolean vcard_fetched; + /* Timer at login to push updated avatar */ + guint vcard_timer; /* Entity Capabilities hash */ char *caps_hash;
--- a/libpurple/protocols/jabber/useravatar.c Fri Jul 31 21:44:52 2009 +0000 +++ b/libpurple/protocols/jabber/useravatar.c Sat Aug 01 02:59:31 2009 +0000 @@ -219,16 +219,18 @@ const char *server_hash = NULL; if (items && (item = xmlnode_get_child(items, "item")) && - (metadata = xmlnode_get_child(item, "metadata")) && - (info = xmlnode_get_child(metadata, "info"))) { + (metadata = xmlnode_get_child(item, "metadata")) && + (info = xmlnode_get_child(metadata, "info"))) { server_hash = xmlnode_get_attrib(info, "id"); } - if (items && !metadata) - return; - - /* Publish ours if it's different than the server's */ - if (!purple_strequal(server_hash, js->initial_avatar_hash)) { + /* + * If we have an avatar and the server returned an error/malformed data, + * push our avatar. If the server avatar doesn't match the local one, push + * our avatar. + */ + if (((!items || !metadata) && js->initial_avatar_hash) || + !purple_strequal(server_hash, js->initial_avatar_hash)) { PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); jabber_avatar_set(js, img); purple_imgstore_unref(img);