changeset 19996:c9f994a88f5f

merge of '5d4b00a88466bb9e851eaca42ab3fd3f2c4093ef' and 'e2bf4d2bd2deeff5ae939ecc159eb07697dc61c0'
author William Ehlhardt <williamehlhardt@gmail.com>
date Thu, 13 Sep 2007 04:32:19 +0000
parents e73e510d56ec (diff) 401d1182d1dc (current diff)
children 6e93a79b2ae5
files
diffstat 11 files changed, 114 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Thu Sep 13 04:30:54 2007 +0000
+++ b/COPYRIGHT	Thu Sep 13 04:32:19 2007 +0000
@@ -270,6 +270,7 @@
 Nathan Owens (pianocomp81)
 John Oyler
 Matt Pandina
+Laszlo Pandy
 Ricardo Fernandez Pascual
 Riley Patterson
 Havoc Pennington
--- a/ChangeLog	Thu Sep 13 04:30:54 2007 +0000
+++ b/ChangeLog	Thu Sep 13 04:32:19 2007 +0000
@@ -10,7 +10,8 @@
 	* Option to show protocol icons in the buddy list, from the
 	  Buddies > Show menu (Justin Heiner)
 	* Ability to build with native, non-X11 GTK+ on OSX (Anders
-   	  Hasselqvist)
+	  Hasselqvist)
+	* Remember the 'Enable Sounds' setting for a conversation
 
 	Finch:
 	* Per-conversation mute and logging options (accessible from the menu)
--- a/finch/gntconv.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/finch/gntconv.c	Thu Sep 13 04:32:19 2007 +0000
@@ -63,6 +63,25 @@
 		const char *message, PurpleMessageFlags flags, time_t mtime);
 static void generate_send_to_menu(FinchConv *ggc);
 
+static PurpleBlistNode *
+get_conversation_blist_node(PurpleConversation *conv)
+{
+	PurpleBlistNode *node = NULL;
+
+	switch (purple_conversation_get_type(conv)) {
+		case PURPLE_CONV_TYPE_IM:
+			node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
+			node = node ? node->parent : NULL;
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
+			break;
+		default:
+			break;
+	}
+	return node;
+}
+
 static void
 send_typing_notification(GntWidget *w, FinchConv *ggconv)
 {
@@ -391,7 +410,10 @@
 toggle_sound_cb(GntMenuItem *item, gpointer ggconv)
 {
 	FinchConv *fc = ggconv;
+	PurpleBlistNode *node = get_conversation_blist_node(fc->active_conv);
 	fc->flags ^= FINCH_CONV_NO_SOUND;
+	if (node)
+		purple_blist_node_set_bool(node, "gnt-mute-sound", !!(fc->flags & FINCH_CONV_NO_SOUND));
 }
 
 static void
@@ -547,6 +569,7 @@
 	PurpleConversationType type;
 	PurpleConversation *cc;
 	PurpleAccount *account;
+	PurpleBlistNode *convnode = NULL;
 
 	if (ggc)
 		return;
@@ -653,7 +676,9 @@
 		g_signal_connect(G_OBJECT(ggc->entry), "text_changed", G_CALLBACK(send_typing_notification), ggc);
 	}
 
-	if (!finch_sound_is_enabled())
+	convnode = get_conversation_blist_node(conv);
+	if ((convnode && purple_blist_node_get_bool(convnode, "gnt-mute-sound")) ||
+			!finch_sound_is_enabled())
 		ggc->flags |= FINCH_CONV_NO_SOUND;
 
 	gg_create_menu(ggc);
--- a/libpurple/ntlm.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/libpurple/ntlm.c	Thu Sep 13 04:32:19 2007 +0000
@@ -131,7 +131,7 @@
 	tmsg->protocol[6] = 'P';
 	tmsg->protocol[7] = '\0';
 	tmsg->type      = 0x00000001;
-	tmsg->flags     = 0x0000b202;
+	tmsg->flags     = 0x0000b203;
 	tmsg->dom_len1  = tmsg->dom_len2 = domainlen;
 	tmsg->dom_off   = sizeof(struct type1_message) + hostnamelen;
 	tmsg->host_len1 = tmsg->host_len2 = hostnamelen;
@@ -286,7 +286,7 @@
 		tmsg->sess_len1 = tmsg->sess_len2 = 0x0010;
 	}
 
-	tmsg->flags = 0x00008200;
+	tmsg->flags = 0x00008201;
 
 	tmp = (char *)tmsg + sizeof(struct type3_message);
 
--- a/libpurple/protocols/msn/httpconn.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/libpurple/protocols/msn/httpconn.c	Thu Sep 13 04:32:19 2007 +0000
@@ -725,7 +725,7 @@
 		msn_httpconn_disconnect(httpconn);
 
 	httpconn->connect_data = purple_proxy_connect(NULL, httpconn->session->account,
-		"gateway.messenger.hotmail.com", 80, connect_cb, httpconn);
+		host, 80, connect_cb, httpconn);
 
 	if (httpconn->connect_data != NULL)
 	{
--- a/libpurple/protocols/msn/msn.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/libpurple/protocols/msn/msn.c	Thu Sep 13 04:32:19 2007 +0000
@@ -351,7 +351,7 @@
 						_("Do you want to allow or disallow people on "
 						  "your buddy list to send you MSN Mobile pages "
 						  "to your cell phone or other mobile device?"),
-						-1, 
+						-1,
 						purple_connection_get_account(gc), NULL, NULL,
 						gc, 3,
 						_("Allow"), G_CALLBACK(enable_msn_pages_cb),
@@ -537,13 +537,13 @@
 
 	user = buddy->proto_data;
 
-	
+
 	if (purple_presence_is_online(presence))
 	{
 		purple_notify_user_info_add_pair(user_info, _("Status"),
 									   (purple_presence_is_idle(presence) ? _("Idle") : purple_status_get_name(status)));
 	}
-	
+
 	if (full && user)
 	{
 		purple_notify_user_info_add_pair(user_info, _("Has you"),
@@ -598,11 +598,11 @@
 	status = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
 			NULL, NULL, FALSE, TRUE, FALSE);
 	types = g_list_append(types, status);
-	
+
 	status = purple_status_type_new_full(PURPLE_STATUS_MOBILE,
 			"mobile", NULL, FALSE, FALSE, TRUE);
 	types = g_list_append(types, status);
-	
+
 	return types;
 }
 
@@ -730,7 +730,10 @@
 
 	http_method = purple_account_get_bool(account, "http_method", FALSE);
 
-	host = purple_account_get_string(account, "server", MSN_SERVER);
+	if (http_method)
+		host = purple_account_get_string(account, "http_method_server", MSN_SERVER);
+	else
+		host = purple_account_get_string(account, "server", MSN_SERVER);
 	port = purple_account_get_int(account, "port", MSN_PORT);
 
 	session = msn_session_new(account);
@@ -1570,16 +1573,16 @@
 	/* No we're not. */
 	s = g_string_sized_new(strlen(url_buffer));
 	s2 = g_string_sized_new(strlen(url_buffer));
-	
+
 	/* General section header */
 	if (has_tooltip_text)
 		purple_notify_user_info_add_section_break(user_info);
-	
+
 	purple_notify_user_info_add_section_header(user_info, _("General"));
-	
+
 	/* Extract their Name and put it in */
 	MSN_GOT_INFO_GET_FIELD("Name", _("Name"));
-	
+
 	/* General */
 	MSN_GOT_INFO_GET_FIELD("Nickname", _("Nickname"));
 	MSN_GOT_INFO_GET_FIELD_NO_SEARCH("Age", _("Age"));
@@ -1597,24 +1600,24 @@
 		sect_info = TRUE;
 
 	MSN_GOT_INFO_GET_FIELD("More about me", _("A Little About Me"));
-	
+
 	if (sect_info)
 	{
 		has_info = TRUE;
 		sect_info = FALSE;
 	}
-    else 
+    else
     {
 		/* Remove the section header */
 		purple_notify_user_info_remove_last_item(user_info);
 		if (has_tooltip_text)
 			purple_notify_user_info_remove_last_item(user_info);
 	}
-											   
+
 	/* Social */
 	purple_notify_user_info_add_section_break(user_info);
 	purple_notify_user_info_add_section_header(user_info, _("Social"));
-										   
+
 	MSN_GOT_INFO_GET_FIELD("Marital status", _("Marital Status"));
 	MSN_GOT_INFO_GET_FIELD("Interested in", _("Interests"));
 	MSN_GOT_INFO_GET_FIELD("Pets", _("Pets"));
@@ -1630,7 +1633,7 @@
 		has_info = TRUE;
 		sect_info = FALSE;
 	}
-    else 
+    else
     {
 		/* Remove the section header */
 		purple_notify_user_info_remove_last_item(user_info);
@@ -1662,7 +1665,7 @@
 		sect_info = FALSE;
 		has_contact_info = TRUE;
 	}
-    else 
+    else
     {
 		/* Remove the section header */
 		purple_notify_user_info_remove_last_item(user_info);
@@ -1692,7 +1695,7 @@
 		sect_info = FALSE;
 		has_contact_info = TRUE;
 	}
-    else 
+    else
     {
 		/* Remove the section header */
 		purple_notify_user_info_remove_last_item(user_info);
@@ -1867,7 +1870,7 @@
 	tmp = g_strdup_printf("<a href=\"%s%s\">%s%s</a>",
 					PROFILE_URL, info_data->name, PROFILE_URL, info_data->name);
 	purple_notify_user_info_add_pair(user_info, _("Profile URL"), tmp);
-	g_free(tmp);									   
+	g_free(tmp);
 
 #if PHOTO_SUPPORT
 	/* Find the URL to the photo; must be before the marshalling [Bug 994207] */
@@ -2193,6 +2196,12 @@
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
 											   option);
 
+	/* TODO: Mark translatable as soon as 2.2.0 is released and we're not string frozen */
+	option = purple_account_option_string_new("HTTP Method Server",
+										  "http_method_server", MSN_HTTPCONN_SERVER);
+	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
+											   option);
+
 	option = purple_account_option_bool_new(_("Show custom smileys"),
 										  "custom_smileys", TRUE);
 	prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
--- a/libpurple/protocols/msn/msn.h	Thu Sep 13 04:30:54 2007 +0000
+++ b/libpurple/protocols/msn/msn.h	Thu Sep 13 04:32:19 2007 +0000
@@ -59,6 +59,7 @@
 
 #define USEROPT_MSNSERVER 3
 #define MSN_SERVER "messenger.hotmail.com"
+#define MSN_HTTPCONN_SERVER "gateway.messenger.hotmail.com"
 #define USEROPT_MSNPORT 4
 #define MSN_PORT 1863
 
--- a/libpurple/protocols/msn/servconn.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/libpurple/protocols/msn/servconn.c	Thu Sep 13 04:32:19 2007 +0000
@@ -223,7 +223,7 @@
 
 		if (!servconn->httpconn->connected)
 			if (!msn_httpconn_connect(servconn->httpconn, host, port))
-				return FALSE;;
+				return FALSE;
 
 		servconn->connected = TRUE;
 		servconn->httpconn->virgin = TRUE;
--- a/libpurple/proxy.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/libpurple/proxy.c	Thu Sep 13 04:32:19 2007 +0000
@@ -668,6 +668,16 @@
 		if (status == 407 /* Proxy Auth */)
 		{
 			gchar *ntlm;
+			char hostname[256];
+			int ret;
+
+			ret = gethostname(hostname, sizeof(hostname));
+			hostname[sizeof(hostname) - 1] = '\0';
+			if (ret < 0 || hostname[0] == '\0') {
+				purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?");
+				strcpy(hostname, "localhost");
+			}
+
 			ntlm = g_strrstr((const gchar *)connect_data->read_buffer,
 					"Proxy-Authenticate: NTLM ");
 			if (ntlm != NULL)
@@ -679,6 +689,7 @@
 				gchar *username;
 				gchar *request;
 				gchar *response;
+
 				username = strchr(domain, '\\');
 				if (username == NULL)
 				{
@@ -694,7 +705,7 @@
 				nonce = purple_ntlm_parse_type2(ntlm, NULL);
 				response = purple_ntlm_gen_type3(username,
 					(gchar*) purple_proxy_info_get_password(connect_data->gpi),
-					(gchar*) purple_proxy_info_get_host(connect_data->gpi),
+					hostname,
 					domain, nonce, NULL);
 				username--;
 				*username = '\\';
@@ -745,9 +756,7 @@
 					sizeof(request) - request_len,
 					"Proxy-Authorization: NTLM %s\r\n"
 					"Proxy-Connection: Keep-Alive\r\n\r\n",
-					purple_ntlm_gen_type1(
-						(gchar*) purple_proxy_info_get_host(connect_data->gpi),
-						domain));
+					purple_ntlm_gen_type1(hostname, domain));
 				*username = '\\';
 
 				purple_input_remove(connect_data->inpa);
@@ -832,6 +841,14 @@
 	if (purple_proxy_info_get_username(connect_data->gpi) != NULL)
 	{
 		char *t1, *t2;
+		char hostname[256];
+
+		ret = gethostname(hostname, sizeof(hostname));
+		hostname[sizeof(hostname) - 1] = '\0';
+		if (ret < 0 || hostname[0] == '\0') {
+			purple_debug_warning("proxy", "gethostname() failed -- is your hostname set?");
+			strcpy(hostname, "localhost");
+		}
 
 		t1 = g_strdup_printf("%s:%s",
 			purple_proxy_info_get_username(connect_data->gpi),
@@ -844,8 +861,7 @@
 			"Proxy-Authorization: Basic %s\r\n"
 			"Proxy-Authorization: NTLM %s\r\n"
 			"Proxy-Connection: Keep-Alive\r\n",
-			t2, purple_ntlm_gen_type1(
-					purple_proxy_info_get_host(connect_data->gpi), ""));
+			t2, purple_ntlm_gen_type1(hostname, ""));
 		g_free(t2);
 	}
 
--- a/pidgin/gtkconv.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/pidgin/gtkconv.c	Thu Sep 13 04:32:19 2007 +0000
@@ -183,6 +183,25 @@
 	return &col;
 }
 
+static PurpleBlistNode *
+get_conversation_blist_node(PurpleConversation *conv)
+{
+	PurpleBlistNode *node = NULL;
+
+	switch (purple_conversation_get_type(conv)) {
+		case PURPLE_CONV_TYPE_IM:
+			node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
+			node = node ? node->parent : NULL;
+			break;
+		case PURPLE_CONV_TYPE_CHAT:
+			node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
+			break;
+		default:
+			break;
+	}
+	return node;
+}
+
 /**************************************************************************
  * Callbacks
  **************************************************************************/
@@ -1379,6 +1398,7 @@
 	PidginWindow *win = data;
 	PurpleConversation *conv;
 	PidginConversation *gtkconv;
+	PurpleBlistNode *node;
 
 	conv = pidgin_conv_window_get_active_conversation(win);
 
@@ -1389,6 +1409,9 @@
 
 	gtkconv->make_sound =
 		gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget));
+	node = get_conversation_blist_node(conv);
+	if (node)
+		purple_blist_node_set_bool(node, "gtk-mute-sound", !gtkconv->make_sound);
 }
 
 static void
@@ -2948,7 +2971,7 @@
 
 		if (gtkconv != NULL)
 			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds),
-			                               TRUE);
+			                               gtkconv->make_sound);
 		gtk_widget_set_sensitive(win->menu.sounds, TRUE);
 
 	}
@@ -4927,6 +4950,7 @@
 	PurpleConversationType conv_type = purple_conversation_get_type(conv);
 	GtkWidget *pane = NULL;
 	GtkWidget *tab_cont;
+	PurpleBlistNode *convnode;
 
 	if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) {
 		conv->ui_data = gtkconv;
@@ -5004,7 +5028,9 @@
 	gtk_container_add(GTK_CONTAINER(tab_cont), pane);
 	gtk_widget_show(pane);
 
-	gtkconv->make_sound = TRUE;
+	convnode = get_conversation_blist_node(conv);
+	if (convnode == NULL || !purple_blist_node_get_bool(convnode, "gtk-mute-sound"))
+		gtkconv->make_sound = TRUE;
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/show_formatting_toolbar"))
 		gtk_widget_show(gtkconv->toolbar);
--- a/pidgin/plugins/musicmessaging/musicmessaging.c	Thu Sep 13 04:30:54 2007 +0000
+++ b/pidgin/plugins/musicmessaging/musicmessaging.c	Thu Sep 13 04:32:19 2007 +0000
@@ -311,7 +311,9 @@
 static gboolean
 intercept_sent(PurpleAccount *account, const char *who, char **message, void* pData)
 {
-	
+	if (message == NULL || *message == NULL || **message == '\0')
+		return FALSE;
+
 	if (0 == strncmp(*message, MUSICMESSAGING_PREFIX, strlen(MUSICMESSAGING_PREFIX)))
 	{
 		purple_debug_misc("purple-musicmessaging", "Sent MM Message: %s\n", *message);