Mercurial > pidgin.yaz
changeset 18164:1100b05e9fb7
merge of '32961dad56e96e8d450230e7266cffe8b7deb058'
and '7997723d5d06867d57a08dedf7d62b52c4be20e0'
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 17 Jun 2007 15:29:02 +0000 |
parents | c4518bbca240 (current diff) 703872bf33c6 (diff) |
children | 580eeb340cf4 |
files | |
diffstat | 7 files changed, 98 insertions(+), 59 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.ac Sun Jun 17 14:49:10 2007 +0000 +++ b/configure.ac Sun Jun 17 15:29:02 2007 +0000 @@ -47,7 +47,7 @@ m4_define([purple_major_version], [2]) m4_define([purple_minor_version], [1]) m4_define([purple_micro_version], [0]) -m4_define([purple_version_suffix], []) +m4_define([purple_version_suffix], [devel]) m4_define([purple_version], [purple_major_version.purple_minor_version.purple_micro_version]) m4_define([purple_display_version], purple_version[]m4_ifdef([purple_version_suffix],[purple_version_suffix])) @@ -56,7 +56,7 @@ m4_define([gnt_major_version], [2]) m4_define([gnt_minor_version], [0]) m4_define([gnt_micro_version], [0]) -m4_define([gnt_version_suffix], []) +m4_define([gnt_version_suffix], [devel]) m4_define([gnt_version], [gnt_major_version.gnt_minor_version.gnt_micro_version]) m4_define([gnt_display_version], gnt_version[]m4_ifdef([gnt_version_suffix],[gnt_version_suffix]))
--- a/libpurple/protocols/jabber/buddy.c Sun Jun 17 14:49:10 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sun Jun 17 15:29:02 2007 +0000 @@ -385,6 +385,11 @@ xmlnode *vc_node; struct tag_attr *tag_attr; + /* if we have't grabbed the remote vcard yet, we can't + * assume that what we have here is correct */ + if(!js->vcard_fetched) + return; + g_free(js->avatar_hash); js->avatar_hash = NULL; @@ -734,6 +739,40 @@ } } +static void jabber_vcard_save_mine(JabberStream *js, xmlnode *packet, gpointer data) +{ + xmlnode *vcard; + char *txt; + PurpleStoredImage *img; + + 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); + + g_free(txt); + } else { + /* if we have no vCard, then lets not overwrite what we might have locally */ + } + + js->vcard_fetched = TRUE; + + if(NULL != (img = purple_buddy_icons_find_account_icon(js->gc->account))) { + jabber_set_buddy_icon(js->gc, img); + purple_imgstore_unref(img); + } +} + +void jabber_vcard_fetch_mine(JabberStream *js) +{ + JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, "vcard-temp"); + + jabber_iq_set_callback(iq, jabber_vcard_save_mine, NULL); + + jabber_iq_send(iq); +} + static void jabber_vcard_parse(JabberStream *js, xmlnode *packet, gpointer data) { const char *id, *from;
--- a/libpurple/protocols/jabber/buddy.h Sun Jun 17 14:49:10 2007 +0000 +++ b/libpurple/protocols/jabber/buddy.h Sun Jun 17 15:29:02 2007 +0000 @@ -103,4 +103,6 @@ void jabber_buddy_remove_all_pending_buddy_info_requests(JabberStream *js); +void jabber_vcard_fetch_mine(JabberStream *js); + #endif /* _PURPLE_JABBER_BUDDY_H_ */
--- a/libpurple/protocols/jabber/disco.c Sun Jun 17 14:49:10 2007 +0000 +++ b/libpurple/protocols/jabber/disco.c Sun Jun 17 15:29:02 2007 +0000 @@ -218,6 +218,9 @@ static void jabber_disco_finish_server_info_result_cb(JabberStream *js) { + + jabber_vcard_fetch_mine(js); + if (!(js->server_caps & JABBER_CAP_GOOGLE_ROSTER)) { /* If the server supports JABBER_CAP_GOOGLE_ROSTER; we will have already requested it */ jabber_roster_request(js);
--- a/libpurple/protocols/jabber/google.c Sun Jun 17 14:49:10 2007 +0000 +++ b/libpurple/protocols/jabber/google.c Sun Jun 17 15:29:02 2007 +0000 @@ -1,4 +1,3 @@ - /** * Purple is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this @@ -30,7 +29,7 @@ #include "presence.h" #include "iq.h" -static void +static void jabber_gmail_parse(JabberStream *js, xmlnode *packet, gpointer nul) { const char *type = xmlnode_get_attrib(packet, "type"); @@ -40,57 +39,57 @@ const char *in_str; char *to_name; int i, count = 1, returned_count; - + const char **tos, **froms, **subjects, **urls; - + if (strcmp(type, "result")) return; - + child = xmlnode_get_child(packet, "mailbox"); if (!child) return; in_str = xmlnode_get_attrib(child, "total-matched"); - if (in_str && *in_str) + if (in_str && *in_str) count = atoi(in_str); - - if (count == 0) + + if (count == 0) return; message = xmlnode_get_child(child, "mail-thread-info"); - + /* Loop once to see how many messages were returned so we can allocate arrays * accordingly */ - if (!message) + if (!message) return; for (returned_count = 0; message; returned_count++, message=xmlnode_get_next_twin(message)); - + froms = g_new0(const char* , returned_count); tos = g_new0(const char* , returned_count); subjects = g_new0(const char* , returned_count); urls = g_new0(const char* , returned_count); - + to = xmlnode_get_attrib(packet, "to"); to_name = jabber_get_bare_jid(to); url = xmlnode_get_attrib(child, "url"); if (!url || !*url) url = "http://www.gmail.com"; - + message= xmlnode_get_child(child, "mail-thread-info"); for (i=0; message; message = xmlnode_get_next_twin(message), i++) { subject_node = xmlnode_get_child(message, "subject"); sender_node = xmlnode_get_child(message, "senders"); sender_node = xmlnode_get_child(sender_node, "sender"); - while (sender_node && (!xmlnode_get_attrib(sender_node, "unread") || + while (sender_node && (!xmlnode_get_attrib(sender_node, "unread") || !strcmp(xmlnode_get_attrib(sender_node, "unread"),"0"))) sender_node = xmlnode_get_next_twin(sender_node); - + if (!sender_node) { i--; continue; } - + from = xmlnode_get_attrib(sender_node, "name"); if (!from || !*from) from = xmlnode_get_attrib(sender_node, "address"); @@ -102,18 +101,18 @@ froms[i] = (from != NULL ? from : ""); subjects[i] = (subject != NULL ? subject : ""); urls[i] = (url != NULL ? url : ""); - + tid = xmlnode_get_attrib(message, "tid"); - if (tid && + if (tid && (js->gmail_last_tid == NULL || strcmp(tid, js->gmail_last_tid) > 0)) { g_free(js->gmail_last_tid); js->gmail_last_tid = g_strdup(tid); } } - if (i>0) - purple_notify_emails(js->gc, count, count == returned_count, subjects, froms, tos, - urls, NULL, NULL); + if (i>0) + purple_notify_emails(js->gc, count, count == returned_count, subjects, froms, tos, + urls, NULL, NULL); g_free(to_name); g_free(tos); @@ -128,19 +127,19 @@ } } -void -jabber_gmail_poke(JabberStream *js, xmlnode *packet) +void +jabber_gmail_poke(JabberStream *js, xmlnode *packet) { const char *type; xmlnode *query; JabberIq *iq; - + /* bail if the user isn't interested */ if (!purple_account_get_check_mail(js->gc->account)) return; type = xmlnode_get_attrib(packet, "type"); - + /* Is this an initial incoming mail notification? If so, send a request for more info */ if (strcmp(type, "set") || !xmlnode_get_child(packet, "new-mail")) @@ -165,7 +164,7 @@ void jabber_gmail_init(JabberStream *js) { JabberIq *iq; - if (!purple_account_get_check_mail(js->gc->account)) + if (!purple_account_get_check_mail(js->gc->account)) return; iq = jabber_iq_new_query(js, JABBER_IQ_GET, "google:mail:notify"); @@ -180,7 +179,7 @@ iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:roster"); query = xmlnode_get_child(iq->node, "query"); - + xmlnode_set_attrib(query, "xmlns:gr", "google:roster"); xmlnode_set_attrib(query, "gr:ext", "2"); @@ -218,14 +217,14 @@ const char *grt = xmlnode_get_attrib_with_namespace(item, "t", "google:roster"); const char *subscription = xmlnode_get_attrib(item, "subscription"); - + if (!subscription || !strcmp(subscription, "none")) { /* The Google Talk servers will automatically add people from your Gmail address book * with subscription=none. If we see someone with subscription=none, ignore them. */ return FALSE; } - + while (list) { if (!strcmp(jid_norm, (char*)list->data)) { on_block_list = TRUE; @@ -233,13 +232,13 @@ } list = list->next; } - + if (grt && (*grt == 'H' || *grt == 'h')) { PurpleBuddy *buddy = purple_find_buddy(account, jid_norm); purple_blist_remove_buddy(buddy); return FALSE; } - + if (!on_block_list && (grt && (*grt == 'B' || *grt == 'b'))) { purple_debug_info("jabber", "Blocking %s\n", jid_norm); purple_privacy_deny_add(account, jid_norm, TRUE); @@ -250,7 +249,7 @@ return TRUE; } -void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who) +void jabber_google_roster_add_deny(PurpleConnection *gc, const char *who) { JabberStream *js; GSList *buddies; @@ -262,7 +261,7 @@ JabberBuddy *jb; js = (JabberStream*)(gc->proto_data); - + if (!js || !js->server_caps & JABBER_CAP_GOOGLE_ROSTER) return; @@ -271,11 +270,11 @@ buddies = purple_find_buddies(js->gc->account, who); if(!buddies) return; - + b = buddies->data; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - + query = xmlnode_get_child(iq->node, "query"); item = xmlnode_new_child(query, "item"); @@ -287,7 +286,7 @@ group = xmlnode_new_child(item, "group"); xmlnode_insert_data(group, g->name, -1); - + buddies = buddies->next; } @@ -333,20 +332,20 @@ g_return_if_fail(gc != NULL); g_return_if_fail(who != NULL); - + js = (JabberStream*)(gc->proto_data); - + if (!js || !js->server_caps & JABBER_CAP_GOOGLE_ROSTER) return; - + buddies = purple_find_buddies(js->gc->account, who); if(!buddies) return; - + b = buddies->data; iq = jabber_iq_new_query(js, JABBER_IQ_SET, "jabber:iq:roster"); - + query = xmlnode_get_child(iq->node, "query"); item = xmlnode_new_child(query, "item"); @@ -358,7 +357,7 @@ group = xmlnode_new_child(item, "group"); xmlnode_insert_data(group, g->name, -1); - + buddies = buddies->next; } @@ -440,15 +439,15 @@ for (p = text; *p != '\0'; p = g_utf8_next_char(p)) { gunichar c = g_utf8_get_char(p); - + if (bold_count < 2 && italic_count < 2 && !in_bold && !in_italic) { g_string_append(str, p); return g_string_free(str, FALSE); } - + if (c == '*' && !in_tag) { - if (in_bold && + if (in_bold && (g_unichar_isspace(*(p+1))||*(p+1)=='<')) { /* This is safe in UTF-8 */ str = g_string_append(str, "</b>"); in_bold = FALSE; @@ -490,6 +489,6 @@ } else { str = g_string_append_unichar(str, c); } - } + } return g_string_free(str, FALSE); }
--- a/libpurple/protocols/jabber/jabber.c Sun Jun 17 14:49:10 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Jun 17 15:29:02 2007 +0000 @@ -1038,8 +1038,6 @@ void jabber_stream_set_state(JabberStream *js, JabberStreamState state) { - PurpleStoredImage *img; - js->state = state; switch(state) { case JABBER_STREAM_OFFLINE: @@ -1071,14 +1069,6 @@ break; case JABBER_STREAM_CONNECTED: - /* lets make sure our buddy icon is up to date - * before we go letting people know we're here */ - img = purple_buddy_icons_find_account_icon(js->gc->account); - if(NULL != img) { - jabber_set_buddy_icon(js->gc, img); - purple_imgstore_unref(img); - } - /* now we can alert the core that we're ready to send status */ purple_connection_set_state(js->gc, PURPLE_CONNECTED); jabber_disco_items_server(js);
--- a/libpurple/protocols/jabber/jabber.h Sun Jun 17 14:49:10 2007 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sun Jun 17 15:29:02 2007 +0000 @@ -142,11 +142,17 @@ #ifdef HAVE_CYRUS_SASL sasl_conn_t *sasl; sasl_callback_t *sasl_cb; +#else /* keep the struct the same size */ + void *sasl; + void *sasl_cb; +#endif + int sasl_state; int sasl_maxbuf; GString *sasl_mechs; char *serverFQDN; -#endif + + gboolean vcard_fetched; } JabberStream;