Mercurial > pidgin.yaz
changeset 29505:2cc15ca3c26d
propagate from branch 'im.pidgin.pidgin' (head d88831199cb010e3856ff07fccd05fc6be6b1e72)
to branch 'im.pidgin.pidgin.next.minor' (head 7b9059d9db3453ec4ab669b459b8403fe11363df)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sat, 03 Oct 2009 16:29:05 +0000 |
parents | 057372f5c319 (current diff) 3397fb5f89cf (diff) |
children | e4627566223d |
files | ChangeLog libpurple/dnsquery.c libpurple/dnssrv.c libpurple/protocols/yahoo/libymsg.c pidgin/gtkcelllayout.c pidgin/gtkcelllayout.h pidgin/gtkcellrendererprogress.c pidgin/gtkcellrendererprogress.h pidgin/gtkcellview.c pidgin/gtkcellview.h pidgin/gtkcellviewmenuitem.c pidgin/gtkcellviewmenuitem.h pidgin/gtkexpander.c pidgin/gtkexpander.h pidgin/pidgincombobox.c pidgin/pidgincombobox.h |
diffstat | 15 files changed, 191 insertions(+), 104 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Sep 27 22:22:36 2009 +0000 +++ b/ChangeLog Sat Oct 03 16:29:05 2009 +0000 @@ -15,6 +15,11 @@ * Fix a crash when performing DNS queries on Unixes that use the blocking DNS lookups. (Brian Lu) + Finch: + * The TinyURL plugin now creates shorter URLs for long non-conversation + URLs, e.g. URLs to open Inbox in Yahoo/MSN protocols, or the Yahoo + Captcha when joining chat rooms. + version 2.6.2 (09/05/2009): libpurple: * Fix --disable-avahi to actually disable it in configure, as opposed
--- a/finch/libgnt/gntcolors.c Sun Sep 27 22:22:36 2009 +0000 +++ b/finch/libgnt/gntcolors.c Sat Oct 03 16:29:05 2009 +0000 @@ -208,8 +208,10 @@ key = g_ascii_strdown(key, -1); color = gnt_colors_get_color(key); g_free(key); - if (color == -EINVAL) + if (color == -EINVAL) { + g_strfreev(list); continue; + } init_color(color, r, g, b); } @@ -251,8 +253,10 @@ int bg = gnt_colors_get_color(bgc); g_free(fgc); g_free(bgc); - if (fg == -EINVAL || bg == -EINVAL) + if (fg == -EINVAL || bg == -EINVAL) { + g_strfreev(list); continue; + } key = g_ascii_strdown(key, -1); @@ -275,6 +279,7 @@ else if (strcmp(key, "urgent") == 0) type = GNT_COLOR_URGENT; else { + g_strfreev(list); g_free(key); continue; }
--- a/finch/plugins/gnttinyurl.c Sun Sep 27 22:22:36 2009 +0000 +++ b/finch/plugins/gnttinyurl.c Sat Oct 03 16:29:05 2009 +0000 @@ -41,7 +41,10 @@ #include <gntconv.h> #include <gntplugin.h> + +#include <gntlabel.h> #include <gnttextview.h> +#include <gntwindow.h> static int tag_num = 0; @@ -52,6 +55,8 @@ int num; } CbInfo; +static void process_urls(PurpleConversation *conv, GList *urls); + /* 3 functions from util.c */ static gboolean badchar(char c) @@ -83,7 +88,8 @@ return FALSE; } -static GList *extract_urls(char *text) { +static GList *extract_urls(const char *text) +{ const char *t, *c, *q = NULL; char *url_buf; GList *ret = NULL; @@ -207,10 +213,12 @@ gnt_text_view_tag_change(tv, data->tag, str, FALSE); g_free(str); g_free(data->tag); + g_free(data); return; } } g_free(data->tag); + g_free(data); purple_debug_info("TinyURL", "Conversation no longer exists... :(\n"); } @@ -219,13 +227,14 @@ g_free(data); } -static gboolean receiving_msg(PurpleAccount *account, char **sender, char **message, - PurpleConversation *conv, PurpleMessageFlags *flags) { +static gboolean writing_msg(PurpleAccount *account, char *sender, char **message, + PurpleConversation *conv, PurpleMessageFlags flags) +{ GString *t; GList *iter, *urls; int c = 0; - if (!(*flags & PURPLE_MESSAGE_RECV) || *flags & PURPLE_MESSAGE_INVISIBLE) + if ((flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_INVISIBLE))) return FALSE; urls = purple_conversation_get_data(conv, "TinyURLs"); @@ -270,22 +279,33 @@ *message = t->str; g_string_free(t, FALSE); if (conv == NULL) - conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, *sender); + conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); purple_conversation_set_data(conv, "TinyURLs", urls); return FALSE; } -static void received_msg(PurpleAccount *account, char *sender, char *message, - PurpleConversation *conv, PurpleMessageFlags flags) { +static void wrote_msg(PurpleAccount *account, char *sender, char *message, + PurpleConversation *conv, PurpleMessageFlags flags) +{ + GList *urls; + + urls = purple_conversation_get_data(conv, "TinyURLs"); + if ((flags & PURPLE_MESSAGE_SEND) || urls == NULL) + return; + + process_urls(conv, urls); + purple_conversation_set_data(conv, "TinyURLs", NULL); +} + +/* Frees 'urls' */ +static void +process_urls(PurpleConversation *conv, GList *urls) +{ + GList *iter; int c; - GList *urls, *iter; FinchConv *fconv = FINCH_CONV(conv); GntTextView *tv = GNT_TEXT_VIEW(fconv->tv); - urls = purple_conversation_get_data(conv, "TinyURLs"); - if (!(flags & PURPLE_MESSAGE_RECV) || urls == NULL) - return; - for (iter = urls, c = 0; iter; iter = iter->next) { int i; CbInfo *cbdata; @@ -312,7 +332,6 @@ g_free(url); } g_list_free(urls); - purple_conversation_set_data(conv, "TinyURLs", NULL); } static void @@ -324,20 +343,75 @@ g_list_free(urls); } +static void tinyurl_notify_fetch_cb(PurpleUtilFetchUrlData *urldata, gpointer cbdata, + const gchar *urltext, gsize len, const gchar *error) +{ + GntWidget *win = cbdata; + GntWidget *label = g_object_get_data(G_OBJECT(win), "info-widget"); + char *message; + + message = g_strdup_printf(_("TinyURL for above: %s"), urltext); + gnt_label_set_text(GNT_LABEL(label), message); + g_free(message); + + g_signal_handlers_disconnect_matched(G_OBJECT(win), G_SIGNAL_MATCH_FUNC, + 0, 0, NULL, + G_CALLBACK(purple_util_fetch_url_cancel), NULL); +} + +static void * +tinyurl_notify_uri(const char *uri) +{ + char *fullurl = NULL; + GntWidget *win; + PurpleUtilFetchUrlData *urlcb; + + /* XXX: The following expects that finch_notify_message gets called. This + * may not always happen, e.g. when another plugin sets its own + * notify_message. So tread carefully. */ + win = purple_notify_message(NULL, PURPLE_NOTIFY_URI, _("URI"), uri, + _("Please wait while TinyURL fetches a shorter URL ..."), NULL, NULL); + if (!GNT_IS_WINDOW(win) || !g_object_get_data(G_OBJECT(win), "info-widget")) + return win; + + if (g_ascii_strncasecmp(uri, "http://", 7) && g_ascii_strncasecmp(uri, "https://", 8)) { + fullurl = g_strdup_printf("%shttp%%3A%%2F%%2F%s", + purple_prefs_get_string(PREF_URL), purple_url_encode(uri)); + } else { + fullurl = g_strdup_printf("%s%s", purple_prefs_get_string(PREF_URL), + purple_url_encode(uri)); + } + + /* Store the return value of _fetch_url and destroy that when win is + destroyed, so that the callback for _fetch_url does not try to molest a + non-existent window */ + urlcb = purple_util_fetch_url(fullurl, TRUE, "finch", FALSE, tinyurl_notify_fetch_cb, win); + g_free(fullurl); + g_signal_connect_swapped(G_OBJECT(win), "destroy", + G_CALLBACK(purple_util_fetch_url_cancel), urlcb); + + return win; +} + static gboolean -plugin_load(PurplePlugin *plugin) { +plugin_load(PurplePlugin *plugin) +{ + PurpleNotifyUiOps *ops = purple_notify_get_ui_ops(); + plugin->extra = ops->notify_uri; + ops->notify_uri = tinyurl_notify_uri; + purple_signal_connect(purple_conversations_get_handle(), "wrote-im-msg", - plugin, PURPLE_CALLBACK(received_msg), NULL); + plugin, PURPLE_CALLBACK(wrote_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg", - plugin, PURPLE_CALLBACK(received_msg), NULL); + plugin, PURPLE_CALLBACK(wrote_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), - "receiving-im-msg", - plugin, PURPLE_CALLBACK(receiving_msg), NULL); + "writing-im-msg", + plugin, PURPLE_CALLBACK(writing_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), - "receiving-chat-msg", - plugin, PURPLE_CALLBACK(receiving_msg), NULL); + "writing-chat-msg", + plugin, PURPLE_CALLBACK(writing_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(free_conv_urls), NULL); @@ -345,6 +419,15 @@ return TRUE; } +static gboolean +plugin_unload(PurplePlugin *plugin) +{ + PurpleNotifyUiOps *ops = purple_notify_get_ui_ops(); + if (ops->notify_uri == tinyurl_notify_uri) + ops->notify_uri = plugin->extra; + return TRUE; +} + static PurplePluginPrefFrame * get_plugin_pref_frame(PurplePlugin *plugin) { @@ -394,7 +477,7 @@ "Richard Nelson <wabz@whatsbeef.net>", PURPLE_WEBSITE, plugin_load, - NULL, + plugin_unload, NULL, NULL, NULL,
--- a/libpurple/blist.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/blist.c Sat Oct 03 16:29:05 2009 +0000 @@ -2009,18 +2009,14 @@ ops = purple_blist_get_ui_ops(); - if (!purplebuddylist->root) { - purplebuddylist->root = gnode; - - key = g_utf8_collate_key(group->name, -1); - g_hash_table_insert(groups_cache, key, group); - return; + /* if we're moving to overtop of ourselves, do nothing */ + if (gnode == node) { + if (!purplebuddylist->root) + node = NULL; + else + return; } - /* if we're moving to overtop of ourselves, do nothing */ - if (gnode == node) - return; - if (purple_find_group(group->name)) { /* This is just being moved */
--- a/libpurple/dnsquery.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/dnsquery.c Sat Oct 03 16:29:05 2009 +0000 @@ -330,6 +330,8 @@ printf("dns[%d] Error: getaddrinfo returned %d\n", getpid(), rc); dns_params.hostname[0] = '\0'; + g_free(hostname); + hostname = NULL; continue; } tmp = res; @@ -776,11 +778,8 @@ if (!dns_str_is_ascii(query_data->hostname)) { rc = purple_network_convert_idn_to_ascii(query_data->hostname, &hostname); if (rc != 0) { - /* FIXME: Dirty 2.6.0 string freeze hack */ - char tmp[8]; - g_snprintf(tmp, sizeof(tmp), "%d", rc); - query_data->error_message = g_strdup_printf(_("Error resolving %s:\n%s"), - query_data->hostname, tmp); + query_data->error_message = g_strdup_printf(_("Error converting %s " + "to punycode: %d"), query_data->hostname, rc); /* back to main thread */ purple_timeout_add(0, dns_main_thread_cb, query_data); return 0; @@ -953,6 +952,7 @@ g_snprintf(message, sizeof(message), _("Error resolving %s: %d"), query_data->hostname, h_errno); purple_dnsquery_failed(query_data, message); + g_free(hostname); return FALSE; } memset(&sin, 0, sizeof(struct sockaddr_in));
--- a/libpurple/dnssrv.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/dnssrv.c Sat Oct 03 16:29:05 2009 +0000 @@ -676,6 +676,7 @@ internal_query.type = T_SRV; strncpy(internal_query.query, query, 255); + internal_query.query[255] = '\0'; if (write(in[1], &internal_query, sizeof(internal_query)) < 0) purple_debug_error("dnssrv", "Could not write to SRV resolver\n");
--- a/libpurple/protocols/jabber/bosh.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/jabber/bosh.c Sat Oct 03 16:29:05 2009 +0000 @@ -401,7 +401,8 @@ void jabber_bosh_connection_close(PurpleBOSHConnection *conn) { - jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL); + if (conn->state == BOSH_CONN_ONLINE) + jabber_bosh_connection_send(conn, PACKET_TERMINATE, NULL); } static gboolean jabber_bosh_connection_error_check(PurpleBOSHConnection *conn, xmlnode *node) {
--- a/libpurple/protocols/jabber/buddy.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Oct 03 16:29:05 2009 +0000 @@ -1149,9 +1149,8 @@ char *bintext = NULL; xmlnode *binval; - if( ((binval = xmlnode_get_child(child, "BINVAL")) && - (bintext = xmlnode_get_data(binval))) || - (bintext = xmlnode_get_data(child))) { + if ((binval = xmlnode_get_child(child, "BINVAL")) && + (bintext = xmlnode_get_data(binval))) { gsize size; guchar *data; gboolean photo = (strcmp(child->name, "PHOTO") == 0);
--- a/libpurple/protocols/jabber/google.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/jabber/google.c Sat Oct 03 16:29:05 2009 +0000 @@ -104,7 +104,8 @@ for (;candidates;candidates = candidates->next) { JabberIq *iq; - gchar *ip, *port, *pref, *username, *password; + gchar *ip, *port, *username, *password; + gchar pref[16]; PurpleMediaCandidateType type; xmlnode *sess; xmlnode *candidate; @@ -123,9 +124,8 @@ ip = purple_media_candidate_get_ip(transport); port = g_strdup_printf("%d", purple_media_candidate_get_port(transport)); - pref = g_strdup_printf("%f", - purple_media_candidate_get_priority(transport) - /1000.0); + g_ascii_dtostr(pref, 16, + purple_media_candidate_get_priority(transport) / 1000.0); username = purple_media_candidate_get_username(transport); password = purple_media_candidate_get_password(transport); type = purple_media_candidate_get_candidate_type(transport); @@ -163,7 +163,6 @@ g_free(ip); g_free(port); - g_free(pref); g_free(username); g_free(password);
--- a/libpurple/protocols/jabber/jabber.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sat Oct 03 16:29:05 2009 +0000 @@ -1077,53 +1077,53 @@ return; } } else { - const char *value = purple_request_field_string_get_value(field); - - if(!strcmp(id, "username")) { - y = xmlnode_new_child(query, "username"); - } else if(!strcmp(id, "password")) { - y = xmlnode_new_child(query, "password"); - } else if(!strcmp(id, "name")) { - y = xmlnode_new_child(query, "name"); - } else if(!strcmp(id, "email")) { - y = xmlnode_new_child(query, "email"); - } else if(!strcmp(id, "nick")) { - y = xmlnode_new_child(query, "nick"); - } else if(!strcmp(id, "first")) { - y = xmlnode_new_child(query, "first"); - } else if(!strcmp(id, "last")) { - y = xmlnode_new_child(query, "last"); - } else if(!strcmp(id, "address")) { - y = xmlnode_new_child(query, "address"); - } else if(!strcmp(id, "city")) { - y = xmlnode_new_child(query, "city"); - } else if(!strcmp(id, "state")) { - y = xmlnode_new_child(query, "state"); - } else if(!strcmp(id, "zip")) { - y = xmlnode_new_child(query, "zip"); - } else if(!strcmp(id, "phone")) { - y = xmlnode_new_child(query, "phone"); - } else if(!strcmp(id, "url")) { - y = xmlnode_new_child(query, "url"); - } else if(!strcmp(id, "date")) { - y = xmlnode_new_child(query, "date"); - } else { - continue; - } - xmlnode_insert_data(y, value, -1); + const char *value = purple_request_field_string_get_value(field); + + if(!strcmp(id, "username")) { + y = xmlnode_new_child(query, "username"); + } else if(!strcmp(id, "password")) { + y = xmlnode_new_child(query, "password"); + } else if(!strcmp(id, "name")) { + y = xmlnode_new_child(query, "name"); + } else if(!strcmp(id, "email")) { + y = xmlnode_new_child(query, "email"); + } else if(!strcmp(id, "nick")) { + y = xmlnode_new_child(query, "nick"); + } else if(!strcmp(id, "first")) { + y = xmlnode_new_child(query, "first"); + } else if(!strcmp(id, "last")) { + y = xmlnode_new_child(query, "last"); + } else if(!strcmp(id, "address")) { + y = xmlnode_new_child(query, "address"); + } else if(!strcmp(id, "city")) { + y = xmlnode_new_child(query, "city"); + } else if(!strcmp(id, "state")) { + y = xmlnode_new_child(query, "state"); + } else if(!strcmp(id, "zip")) { + y = xmlnode_new_child(query, "zip"); + } else if(!strcmp(id, "phone")) { + y = xmlnode_new_child(query, "phone"); + } else if(!strcmp(id, "url")) { + y = xmlnode_new_child(query, "url"); + } else if(!strcmp(id, "date")) { + y = xmlnode_new_child(query, "date"); + } else { + continue; + } + xmlnode_insert_data(y, value, -1); if(cbdata->js->registration && !strcmp(id, "username")) { g_free(cbdata->js->user->node); cbdata->js->user->node = g_strdup(value); - } + } if(cbdata->js->registration && !strcmp(id, "password")) purple_account_set_password(cbdata->js->gc->account, value); + } } } - } if(cbdata->js->registration) { - username = g_strdup_printf("%s@%s/%s", cbdata->js->user->node, cbdata->js->user->domain, - cbdata->js->user->resource); + username = g_strdup_printf("%s@%s%s%s", cbdata->js->user->node, cbdata->js->user->domain, + cbdata->js->user->resource ? "/" : "", cbdata->js->user->resource); purple_account_set_username(cbdata->js->gc->account, username); g_free(username); }
--- a/libpurple/protocols/jabber/jingle/content.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/jabber/jingle/content.c Sat Oct 03 16:29:05 2009 +0000 @@ -330,8 +330,8 @@ void jingle_content_set_session(JingleContent *content, JingleSession *session) { - JINGLE_IS_CONTENT(content); - JINGLE_IS_SESSION(session); + g_return_if_fail(JINGLE_IS_CONTENT(content)); + g_return_if_fail(JINGLE_IS_SESSION(session)); g_object_set(content, "session", session, NULL); }
--- a/libpurple/protocols/jabber/presence.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/jabber/presence.c Sat Oct 03 16:29:05 2009 +0000 @@ -403,19 +403,20 @@ g_free(nickname); } - if((photo = xmlnode_get_child(vcard, "PHOTO")) && - (( (binval = xmlnode_get_child(photo, "BINVAL")) && - (text = xmlnode_get_data(binval))) || - (text = xmlnode_get_data(photo)))) { + if ((photo = xmlnode_get_child(vcard, "PHOTO")) && + (binval = xmlnode_get_child(photo, "BINVAL")) && + (text = xmlnode_get_data(binval))) { guchar *data; - gchar *hash; gsize size; data = purple_base64_decode(text, &size); - hash = jabber_calculate_data_sha1sum(data, size); + if (data) { + gchar *hash = jabber_calculate_data_sha1sum(data, size); + purple_buddy_icons_set_for_user(js->gc->account, from, data, + size, hash); + g_free(hash); + } - purple_buddy_icons_set_for_user(js->gc->account, from, data, size, hash); - g_free(hash); g_free(text); } }
--- a/libpurple/protocols/yahoo/libymsg.c Sun Sep 27 22:22:36 2009 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Sat Oct 03 16:29:05 2009 +0000 @@ -983,7 +983,10 @@ if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im ? im->from : "(im was null)"); /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ - g_hash_table_remove(yd->peers, im->from); + if (im) { + g_hash_table_remove(yd->peers, im->from); + g_free(im); + } return; } @@ -1025,7 +1028,6 @@ char *m, *m2; char *msn_from = NULL; const char *from; - PurpleConversation *c; im = l->data; if (!im->from || !im->msg) { @@ -1077,14 +1079,9 @@ from = im->from; } - c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); - if (!strcmp(m, "<ding>")) { char *username; - if (c == NULL) { - c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, from); - } username = g_markup_escape_text(from, -1); purple_prpl_got_attention(gc, username, YAHOO_BUZZ); g_free(username);
--- a/pidgin/pixmaps/emotes/default/24/default.theme.in Sun Sep 27 22:22:36 2009 +0000 +++ b/pidgin/pixmaps/emotes/default/24/default.theme.in Sat Oct 03 16:29:05 2009 +0000 @@ -491,7 +491,7 @@ smile-big.png :D :-D =D wink.png ;) ;-) ;^) shock.png :-o -tongue.png :P :-P :-p +tongue.png :P :-P :-p :p glasses-cool.png B-) angry.png X-( sad.png :( :-( =(
--- a/pidgin/pixmaps/emotes/small/16/small.theme.in Sun Sep 27 22:22:36 2009 +0000 +++ b/pidgin/pixmaps/emotes/small/16/small.theme.in Sat Oct 03 16:29:05 2009 +0000 @@ -188,7 +188,7 @@ smile-big.png :D :-D =D wink.png ;) ;-) ;^) shock.png :-o -tongue.png :P :-P :-p +tongue.png :P :-P :-p :p glasses-cool.png B-) angry.png X-( sad.png :( :-( =(