changeset 27767:76ff0ad87964

propagate from branch 'im.pidgin.pidgin' (head 9de3934cd71a8b08f0f6da39df8f0102d36fbd2b) to branch 'im.pidgin.pidgin.yaz' (head d439d42fe8d0ee4a40486b4de12acb4116bc2e58)
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 25 Feb 2008 05:45:57 +0000
parents 9d02eb04f406 (diff) 056fb36a5770 (current diff)
children 969a2aeae461
files libpurple/conversation.c libpurple/protocols/yahoo/yahoo.c libpurple/protocols/yahoo/yahoo_profile.c
diffstat 12 files changed, 88 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Wed Feb 20 06:56:39 2008 +0000
+++ b/COPYRIGHT	Mon Feb 25 05:45:57 2008 +0000
@@ -154,6 +154,7 @@
 Konrad Gräfe
 Miah Gregory
 David Grohmann
+Gideon N. Guillen
 Christian Hammond
 Erick Hamness
 Fred Hampton
--- a/ChangeLog	Wed Feb 20 06:56:39 2008 +0000
+++ b/ChangeLog	Mon Feb 25 05:45:57 2008 +0000
@@ -10,12 +10,15 @@
 	* Partial support for viewing ICQ status notes (Collin from
 	  ComBOTS GmbH).
 	* Support for /notice on IRC.
-	* Support for Yahoo Messenger 7.0+ file transfer method (Thanumalayan S.)
+	* Support for Yahoo! Messenger 7.0+ file transfer method (Thanumalayan S.)
 	* Support for retrieving full names and addresses from the address book
 	  on Yahoo! Japan (Yusuke Odate)
 	* The AIM/ICQ server-side preference for "allow others to see me
 	  as idle" is no longer unconditionally set to "yes" even when
 	  your libpurple preference is "no."
+	* Fixed retrieval of buddy icons and setting of server-side aliases on
+	  Yahoo! and Yahoo! Japan when using an HTTP proxy server (Gideon N.
+	  Guillen)
 
 	Pidgin:
 	* Added the ability to theme conversation name colors (red and blue)
--- a/libpurple/blist.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/blist.c	Mon Feb 25 05:45:57 2008 +0000
@@ -1588,7 +1588,7 @@
 					hb->group = gnode;
 					g_hash_table_replace(purplebuddylist->buddies, hb, b);
 
-					if (b->account->gc)
+					if (purple_account_get_connection(b->account))
 						serv_move_buddy(b, (PurpleGroup *)cnode->parent, g);
 				} else {
 					gboolean empty_contact = FALSE;
@@ -1597,7 +1597,7 @@
 					 * gonna delete it instead */
 					g_free(hb->name);
 					g_free(hb);
-					if (b->account->gc)
+					if (purple_account_get_connection(b->account))
 						purple_account_remove_buddy(b->account, b, (PurpleGroup *)cnode->parent);
 
 					if (!cnode->child->next)
@@ -2087,7 +2087,7 @@
 	prpl = purple_find_prpl(purple_account_get_protocol_id(chat->account));
 	prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
 
-	parts = prpl_info->chat_info(chat->account->gc);
+	parts = prpl_info->chat_info(purple_account_get_connection(chat->account));
 	pce = parts->data;
 	ret = g_hash_table_lookup(chat->components, pce->identifier);
 	g_list_foreach(parts, (GFunc)g_free, NULL);
--- a/libpurple/conversation.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/conversation.c	Mon Feb 25 05:45:57 2008 +0000
@@ -209,11 +209,14 @@
 		const char *message, PurpleMessageFlags flags, time_t when)
 {
 	PurpleConvMessage *msg;
+	PurpleConnection *gc;
+
+	gc = purple_account_get_connection(conv->account);
 
 	if (flags & PURPLE_MESSAGE_SEND) {
 		const char *me = NULL;
-		if (conv->account->gc)
-			me = conv->account->gc->display_name;
+		if (gc)
+			me = purple_connection_get_display_name(gc);
 		if (!me)
 			me = conv->account->username;
 		who = me;
--- a/libpurple/protocols/myspace/message.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/protocols/myspace/message.c	Mon Feb 25 05:45:57 2008 +0000
@@ -429,6 +429,7 @@
  * @param user_data Not used; required to match g_list_foreach() callback prototype.
  *
  * Frees both the element data and the element itself.
+ * Also frees the name if dynamic_name is TRUE.
  */
 static void 
 msim_msg_free_element(gpointer data, gpointer user_data)
@@ -439,6 +440,12 @@
 
 	msim_msg_free_element_data(elem);
 
+	if (elem->dynamic_name)
+		/* Need to cast to remove const-ness, because
+		 * elem->name is almost always a constant, static
+		 * string, but not in this case. */
+		g_free((gchar *)elem->name);
+
 	g_free(elem);
 }
 
@@ -512,15 +519,18 @@
 /** Create a new MsimMessageElement * - must be g_free()'d. 
  *
  * For internal use; users probably want msim_msg_append() or msim_msg_insert_before(). 
+ *
+ * @param dynamic_name Whether 'name' should be freed when the message is destroyed.
  */
 static MsimMessageElement *
-msim_msg_element_new(const gchar *name, MsimMessageType type, gpointer data)
+msim_msg_element_new(const gchar *name, MsimMessageType type, gpointer data, gboolean dynamic_name)
 {
 	MsimMessageElement *elem;
 
 	elem = g_new0(MsimMessageElement, 1);
 
 	elem->name = name;
+	elem->dynamic_name = dynamic_name;
 	elem->type = type;
 	elem->data = data;
 
@@ -559,7 +569,18 @@
 msim_msg_append(MsimMessage *msg, const gchar *name, 
 		MsimMessageType type, gpointer data)
 {
-	return g_list_append(msg, msim_msg_element_new(name, type, data));
+	return g_list_append(msg, msim_msg_element_new(name, type, data, FALSE));
+}
+
+/** Append a new element, but with a dynamically-allocated name.
+ * Exactly the same as msim_msg_append(), except 'name' will be freed when
+ * the message is destroyed. Normally, it isn't, because a static string is given.
+ */
+static MsimMessage *
+msim_msg_append_dynamic_name(MsimMessage *msg, gchar *name,
+		MsimMessageType type, gpointer data)
+{
+	return g_list_append(msg, msim_msg_element_new(name, type, data, TRUE));
 }
 
 /** Insert a new element into a message, before the given element name.
@@ -576,7 +597,7 @@
 	MsimMessageElement *new_elem;
 	GList *node_before;
 
-	new_elem = msim_msg_element_new(name, type, data);
+	new_elem = msim_msg_element_new(name, type, data, FALSE);
 
 	node_before = msim_msg_get_node(msg, name_before);
 
@@ -1196,8 +1217,9 @@
 		purple_debug_info("msim_msg_parse_dictionary","-- %s: %s\n", key ? key : "(NULL)", 
 				value ? value : "(NULL)");
 #endif
-		/* TODO: free key; right now it is treated as static */
-		dict = msim_msg_append(dict, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value));
+		/* Append with _dynamic_name since g_strdup(key) is dynamic, and
+		 * needs to be freed when the message is destroyed. It isn't static as usual. */
+		dict = msim_msg_append_dynamic_name(dict, g_strdup(key), MSIM_TYPE_RAW, g_strdup(value));
 
 		g_strfreev(elements);
 	}
--- a/libpurple/protocols/myspace/message.h	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/protocols/myspace/message.h	Mon Feb 25 05:45:57 2008 +0000
@@ -29,6 +29,7 @@
 typedef struct _MsimMessageElement
 {
 	const gchar *name;              /**< Textual name of element. */
+	gboolean dynamic_name;          /**< TRUE if 'name' is a dynamic string to be freed, not static. */
 	guint type;                     /**< MSIM_TYPE_* code. */
 	gpointer data;                  /**< Pointer to data, or GUINT_TO_POINTER for int/bool. */
 } MsimMessageElement;
--- a/libpurple/protocols/yahoo/yahoo.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Mon Feb 25 05:45:57 2008 +0000
@@ -3515,8 +3515,13 @@
 		"Host: login.yahoo.com\r\n"
 		"Content-Length: 0\r\n\r\n",
 		yd->cookie_t, yd->cookie_y);
-
-	url_data = purple_util_fetch_url_request(base_url, FALSE,
+	gboolean use_whole_url = FALSE;
+
+	/* use whole URL if using HTTP Proxy */
+	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+	    use_whole_url = TRUE;
+
+	url_data = purple_util_fetch_url_request(base_url, use_whole_url,
 			"Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE,
 			yahoo_get_inbox_token_cb, gc);
 
--- a/libpurple/protocols/yahoo/yahoo_aliases.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_aliases.c	Mon Feb 25 05:45:57 2008 +0000
@@ -148,6 +148,12 @@
 	char *request, *webpage, *webaddress;
 	PurpleUtilFetchUrlData *url_data;
 
+	gboolean use_whole_url = FALSE;
+
+	/* use whole URL if using HTTP Proxy */
+	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+	    use_whole_url = TRUE;
+
 	/* Using callback_data so I have access to gc in the callback function */
 	cb = g_new0(struct callback_data, 1);
 	cb->gc = gc;
@@ -155,15 +161,15 @@
 	/*  Build all the info to make the web request */
 	url = yd->jp ? YAHOOJP_ALIAS_FETCH_URL : YAHOO_ALIAS_FETCH_URL;
 	purple_url_parse(url, &webaddress, NULL, &webpage, NULL, NULL);
-	request = g_strdup_printf("GET /%s HTTP/1.1\r\n"
+	request = g_strdup_printf("GET %s%s/%s HTTP/1.1\r\n"
 				 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
 				 "Cookie: T=%s; Y=%s\r\n"
 				 "Host: %s\r\n"
 				 "Cache-Control: no-cache\r\n\r\n",
-				 webpage, yd->cookie_t,yd->cookie_y, webaddress);
+				  use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, yd->cookie_t,yd->cookie_y, webaddress);
 
 	/* We have a URL and some header information, let's connect and get some aliases  */
-	url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb);
+	url_data = purple_util_fetch_url_request(url, use_whole_url, NULL, TRUE, request, FALSE, yahoo_fetch_aliases_cb, cb);
 	if (url_data != NULL) {
 		yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
 	}
@@ -232,6 +238,11 @@
 	struct callback_data *cb;
 	PurpleBuddy *buddy;
 	PurpleUtilFetchUrlData *url_data;
+	gboolean use_whole_url = FALSE;
+
+	/* use whole URL if using HTTP Proxy */
+	if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+	    use_whole_url = TRUE;
 
 	g_return_if_fail(alias != NULL);
 	g_return_if_fail(who != NULL);
@@ -274,18 +285,18 @@
 		g_free(escaped_alias);
 	}
 
-	request = g_strdup_printf("POST /%s HTTP/1.1\r\n"
+	request = g_strdup_printf("POST %s%s/%s HTTP/1.1\r\n"
 				  "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n"
 				  "Cookie: T=%s; Y=%s\r\n"
 				  "Host: %s\r\n"
 				  "Content-Length: %" G_GSIZE_FORMAT "\r\n"
 				  "Cache-Control: no-cache\r\n\r\n"
 				  "%s",
-				  webpage, yd->cookie_t,yd->cookie_y, webaddress,
+				  use_whole_url ? "http://" : "", use_whole_url ? webaddress : "", webpage, yd->cookie_t,yd->cookie_y, webaddress,
 			 	  strlen(content), content);
 
 	/* We have a URL and some header information, let's connect and update the alias  */
-	url_data = purple_util_fetch_url_request(url, FALSE, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb);
+	url_data = purple_util_fetch_url_request(url, use_whole_url, NULL, TRUE, request, FALSE, yahoo_update_alias_cb, cb);
 	if (url_data != NULL) {
 		yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
 	}
--- a/libpurple/protocols/yahoo/yahoo_picture.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_picture.c	Mon Feb 25 05:45:57 2008 +0000
@@ -116,6 +116,11 @@
 		struct yahoo_fetch_picture_data *data;
 		PurpleBuddy *b = purple_find_buddy(gc->account, who);
 		const char *locksum = NULL;
+		gboolean use_whole_url = FALSE;
+
+		/* use whole URL if using HTTP Proxy */
+		if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+		    use_whole_url = TRUE;
 
 		/* FIXME: Cleanup this strtol() stuff if possible. */
 		if (b && (locksum = purple_buddy_icons_get_checksum_for_user(b)) != NULL && 
@@ -126,7 +131,7 @@
 		data->gc = gc;
 		data->who = g_strdup(who);
 		data->checksum = checksum;
-		url_data = purple_util_fetch_url(url, FALSE,
+		url_data = purple_util_fetch_url(url, use_whole_url,
 				"Mozilla/4.0 (compatible; MSIE 5.0)", FALSE,
 				yahoo_fetch_picture_cb, data);
 		if (url_data != NULL) {
--- a/libpurple/protocols/yahoo/yahoo_profile.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo_profile.c	Mon Feb 25 05:45:57 2008 +0000
@@ -934,11 +934,17 @@
 	/* Try to put the photo in there too, if there's one */
 	if (photo_url_text) {
 		PurpleUtilFetchUrlData *url_data;
+		gboolean use_whole_url = FALSE;
+
+		/* use whole URL if using HTTP Proxy */
+		if ((info_data->gc->account->proxy_info) && (info_data->gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
+		    use_whole_url = TRUE;
+
 		/* User-uploaded photos use a different server that requires the Host
 		 * header, but Yahoo Japan will use the "chunked" content encoding if
 		 * we specify HTTP 1.1. So we have to specify 1.0 & fix purple_util_fetch_url
 		 */
-		url_data = purple_util_fetch_url(photo_url_text, FALSE, NULL,
+		url_data = purple_util_fetch_url(photo_url_text, use_whole_url, NULL,
 				FALSE, yahoo_got_photo, info2_data);
 		if (url_data != NULL)
 			yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
--- a/pidgin/minidialog.c	Wed Feb 20 06:56:39 2008 +0000
+++ b/pidgin/minidialog.c	Mon Feb 25 05:45:57 2008 +0000
@@ -164,7 +164,8 @@
 	priv->idle_destroy_cb_id =
 		g_idle_add((GSourceFunc) idle_destroy_cb, data->mini_dialog);
 
-	data->callback(data->mini_dialog, button, data->user_data);
+	if (data->callback != NULL)
+		data->callback(data->mini_dialog, button, data->user_data);
 
 }
 
--- a/po/de.po	Wed Feb 20 06:56:39 2008 +0000
+++ b/po/de.po	Mon Feb 25 05:45:57 2008 +0000
@@ -11,8 +11,8 @@
 msgstr ""
 "Project-Id-Version: de\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-02-19 20:29+0100\n"
-"PO-Revision-Date: 2008-02-19 20:28+0100\n"
+"POT-Creation-Date: 2008-02-24 19:28+0100\n"
+"PO-Revision-Date: 2008-02-24 19:28+0100\n"
 "Last-Translator: Jochen Kemnade <jochenkemnade@web.de>\n"
 "Language-Team: Deutsch <de@li.org>\n"
 "MIME-Version: 1.0\n"
@@ -199,9 +199,8 @@
 msgid "Alias (optional)"
 msgstr "Alias (optional)"
 
-#, fuzzy
 msgid "Add in group"
-msgstr "Gruppe hinzufügen"
+msgstr "Zu Gruppe hinzufügen"
 
 msgid "Account"
 msgstr "Konto"
@@ -765,13 +764,13 @@
 msgid "Transferring"
 msgstr "Übertragung"
 
-#, fuzzy, c-format
+#, c-format
 msgid "Conversation in %s on %s"
-msgstr "Unterhaltung in %s"
-
-#, fuzzy, c-format
+msgstr "Unterhaltung in %s am %s"
+
+#, c-format
 msgid "Conversation with %s on %s"
-msgstr "Unterhaltung mit %s"
+msgstr "Unterhaltung mit %s am %s"
 
 msgid "%B %Y"
 msgstr "%B %Y"