changeset 22059:fdebef95b300

merge of '2654fa4bf505fd6b8e400e329323a4b8fb67126f' and 'f46a2c20964123688f14b0584cfb4155bd45892b'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Thu, 10 Jan 2008 02:28:48 +0000
parents 895120b1b926 (diff) 3abf33e2572f (current diff)
children 83613550512b 5295c7f113da
files
diffstat 13 files changed, 114 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntft.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/finch/gntft.c	Thu Jan 10 02:28:48 2008 +0000
@@ -65,6 +65,7 @@
 	gboolean in_list;
 
 	char *name;
+	gboolean notified;   /* Has the completion of the transfer been notified? */
 
 } PurpleGntXferUiData;
 
@@ -142,15 +143,23 @@
 	xfer_dialog->auto_clear = !xfer_dialog->auto_clear;
 	purple_prefs_set_bool("/finch/filetransfer/clear_finished",
 						xfer_dialog->auto_clear);
+	if (xfer_dialog->auto_clear) {
+		GList *iter = purple_xfers_get_all();
+		while (iter) {
+			PurpleXfer *xfer = iter->data;
+			iter = iter->next;
+			if (purple_xfer_is_completed(xfer) || purple_xfer_is_canceled(xfer))
+			finch_xfer_dialog_remove_xfer(xfer);
+		}
+	}
 }
 
 static void
 remove_button_cb(GntButton *button)
 {
 	PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree));
-	if (selected_xfer && (selected_xfer->status == PURPLE_XFER_STATUS_CANCEL_LOCAL ||
-			selected_xfer->status == PURPLE_XFER_STATUS_CANCEL_REMOTE ||
-			selected_xfer->status == PURPLE_XFER_STATUS_DONE)) {
+	if (selected_xfer && (purple_xfer_is_completed(selected_xfer) ||
+				purple_xfer_is_canceled(selected_xfer))) {
 		finch_xfer_dialog_remove_xfer(selected_xfer);
 	}
 }
@@ -404,7 +413,7 @@
 	if ((data = FINCHXFER(xfer)) == NULL)
 		return;
 
-	if (data->in_list == FALSE)
+	if (data->in_list == FALSE || data->notified)
 		return;
 
 	current_time = time(NULL);
@@ -433,6 +442,7 @@
 		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, _("Finished"));
 		purple_xfer_conversation_write(xfer, msg, FALSE);
 		g_free(msg);
+		data->notified = TRUE;
 	} else {
 		gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Transferring"));
 	}
--- a/finch/gntroomlist.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/finch/gntroomlist.c	Thu Jan 10 02:28:48 2008 +0000
@@ -65,8 +65,12 @@
 unset_roomlist(gpointer null)
 {
 	froomlist.window = NULL;
-	if (froomlist.roomlist)
+	if (froomlist.roomlist) {
 		purple_roomlist_unref(froomlist.roomlist);
+		froomlist.roomlist = NULL;
+	}
+	froomlist.account = NULL;
+	froomlist.tree = NULL;
 }
 
 static void
@@ -97,6 +101,7 @@
 	if (!gc)
 		return;
 
+	update_roomlist(NULL);
 	froomlist.roomlist = purple_roomlist_get_list(gc);
 	gnt_box_give_focus_to_child(GNT_BOX(froomlist.window), froomlist.tree);
 }
--- a/libpurple/account.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/account.c	Thu Jan 10 02:28:48 2008 +0000
@@ -1219,7 +1219,11 @@
 	if (ops != NULL && ops->close_account_request != NULL)
 		ops->close_account_request(info->ui_handle);
 
+	/* TODO: This will leak info->user_data, but there is no callback to just clean that up */
+
+	g_free(info->user);
 	g_free(info);
+
 }
 
 void
@@ -1264,9 +1268,14 @@
 request_auth_cb(void *data)
 {
 	PurpleAccountRequestInfo *info = data;
+
+	handles = g_list_remove(handles, info);
+
 	info->auth_cb(info->userdata);
+
 	purple_signal_emit(purple_accounts_get_handle(),
 			"account-authorization-granted", info->account, info->user);
+
 	g_free(info->user);
 	g_free(info);
 }
@@ -1275,9 +1284,14 @@
 request_deny_cb(void *data)
 {
 	PurpleAccountRequestInfo *info = data;
+
+	handles = g_list_remove(handles, info);
+
 	info->deny_cb(info->userdata);
+
 	purple_signal_emit(purple_accounts_get_handle(),
 			"account-authorization-denied", info->account, info->user);
+
 	g_free(info->user);
 	g_free(info);
 }
--- a/libpurple/buddyicon.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/buddyicon.c	Thu Jan 10 02:28:48 2008 +0000
@@ -1161,7 +1161,8 @@
 	                                        g_free, NULL);
 	pointer_icon_cache = g_hash_table_new(g_direct_hash, g_direct_equal);
 
-	cache_dir = g_build_filename(purple_user_dir(), "icons", NULL);
+    if (!cache_dir)
+    	cache_dir = g_build_filename(purple_user_dir(), "icons", NULL);
 
 	purple_signal_connect(purple_imgstore_get_handle(), "image-deleting",
 	                      purple_buddy_icons_get_handle(),
--- a/libpurple/conversation.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/conversation.c	Thu Jan 10 02:28:48 2008 +0000
@@ -295,10 +295,14 @@
 	/* Check if this conversation already exists. */
 	if ((conv = purple_find_conversation_with_account(type, name, account)) != NULL)
 	{
-		if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
+		if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT ||
 				purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
-			purple_conversation_chat_cleanup_for_rejoin(conv);
-		return conv;
+		{
+			if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT)
+				purple_conversation_chat_cleanup_for_rejoin(conv);
+
+			return conv;
+		}
 	}
 
 	gc = purple_account_get_connection(account);
--- a/libpurple/protocols/bonjour/mdns_avahi.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/protocols/bonjour/mdns_avahi.c	Thu Jan 10 02:28:48 2008 +0000
@@ -445,14 +445,14 @@
 				idata->group, AVAHI_IF_UNSPEC,
 				AVAHI_PROTO_INET, 0,
 				purple_account_get_username(data->account),
-				ICHAT_SERVICE, NULL, NULL, data->port_p2pj, lst);
+				LINK_LOCAL_RECORD_NAME, NULL, NULL, data->port_p2pj, lst);
 			break;
 		case PUBLISH_UPDATE:
 			publish_result = avahi_entry_group_update_service_txt_strlst(
 				idata->group, AVAHI_IF_UNSPEC,
 				AVAHI_PROTO_INET, 0,
 				purple_account_get_username(data->account),
-				ICHAT_SERVICE, NULL, lst);
+				LINK_LOCAL_RECORD_NAME, NULL, lst);
 			break;
 	}
 
@@ -461,7 +461,7 @@
 
 	if (publish_result < 0) {
 		purple_debug_error("bonjour",
-			"Failed to add the " ICHAT_SERVICE " service. Error: %s\n",
+			"Failed to add the " LINK_LOCAL_RECORD_NAME " service. Error: %s\n",
 			avahi_strerror(publish_result));
 		return FALSE;
 	}
@@ -469,7 +469,7 @@
 	if (type == PUBLISH_START
 			&& (publish_result = avahi_entry_group_commit(idata->group)) < 0) {
 		purple_debug_error("bonjour",
-			"Failed to commit " ICHAT_SERVICE " service. Error: %s\n",
+			"Failed to commit " LINK_LOCAL_RECORD_NAME " service. Error: %s\n",
 			avahi_strerror(publish_result));
 		return FALSE;
 	}
@@ -482,7 +482,7 @@
 
 	g_return_val_if_fail(idata != NULL, FALSE);
 
-	idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, ICHAT_SERVICE, NULL, 0, _browser_callback, data->account);
+	idata->sb = avahi_service_browser_new(idata->client, AVAHI_IF_UNSPEC, AVAHI_PROTO_INET, LINK_LOCAL_RECORD_NAME, NULL, 0, _browser_callback, data->account);
 	if (!idata->sb) {
 
 		purple_debug_error("bonjour",
@@ -524,7 +524,7 @@
 			return FALSE;
 		}
 
-		svc_name = g_strdup_printf("%s." ICHAT_SERVICE "local",
+		svc_name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local",
 				purple_account_get_username(data->account));
 
 		ret = avahi_entry_group_add_record(idata->buddy_icon_group, AVAHI_IF_UNSPEC,
@@ -615,7 +615,7 @@
 
 	purple_debug_info("bonjour", "Retrieving buddy icon for '%s'.\n", buddy->name);
 
-	name = g_strdup_printf("%s." ICHAT_SERVICE "local", buddy->name);
+	name = g_strdup_printf("%s." LINK_LOCAL_RECORD_NAME "local", buddy->name);
 	idata->buddy_icon_rec_browser = avahi_record_browser_new(session_idata->client, AVAHI_IF_UNSPEC,
 		AVAHI_PROTO_INET, name, AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_NULL, 0,
 		_buddy_icon_record_cb, buddy);
--- a/libpurple/protocols/bonjour/mdns_types.h	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/protocols/bonjour/mdns_types.h	Thu Jan 10 02:28:48 2008 +0000
@@ -20,7 +20,7 @@
 #include <glib.h>
 #include "account.h"
 
-#define ICHAT_SERVICE "_presence._tcp."
+#define LINK_LOCAL_RECORD_NAME "_presence._tcp."
 
 /**
  * Data to be used by the dns-sd connection.
--- a/libpurple/protocols/bonjour/mdns_win32.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/protocols/bonjour/mdns_win32.c	Thu Jan 10 02:28:48 2008 +0000
@@ -476,7 +476,7 @@
 		switch (type) {
 			case PUBLISH_START:
 				purple_debug_info("bonjour", "Registering presence on port %d\n", data->port_p2pj);
-				errorCode = DNSServiceRegister(&presence_sr, 0, 0, purple_account_get_username(data->account), ICHAT_SERVICE,
+				errorCode = DNSServiceRegister(&presence_sr, 0, 0, purple_account_get_username(data->account), LINK_LOCAL_RECORD_NAME,
 					NULL, NULL, htons(data->port_p2pj), TXTRecordGetLength(&dns_data), TXTRecordGetBytesPtr(&dns_data),
 					_mdns_service_register_callback, NULL);
 				break;
@@ -515,7 +515,7 @@
 
 	g_return_val_if_fail(idata != NULL, FALSE);
 
-	errorCode = DNSServiceBrowse(&browser_sr, 0, 0, ICHAT_SERVICE, NULL,
+	errorCode = DNSServiceBrowse(&browser_sr, 0, 0, LINK_LOCAL_RECORD_NAME, NULL,
 		_mdns_service_browse_callback, data->account);
 	if (errorCode == kDNSServiceErr_NoError) {
 		idata->browser_query = g_new(DnsSDServiceRefHandlerData, 1);
@@ -622,7 +622,7 @@
 		idata->null_query = NULL;
 	}
 
-	if (DNSServiceConstructFullName(svc_name, buddy->name, ICHAT_SERVICE, "local") != 0)
+	if (DNSServiceConstructFullName(svc_name, buddy->name, LINK_LOCAL_RECORD_NAME, "local") != 0)
 		purple_debug_error("bonjour", "Unable to construct full name to retrieve buddy icon for %s.\n", buddy->name);
 	else {
 		DNSServiceRef null_query_sr;
--- a/libpurple/protocols/irc/cmds.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/protocols/irc/cmds.c	Thu Jan 10 02:28:48 2008 +0000
@@ -368,10 +368,10 @@
 			end = cur + strlen(cur);
 		msg = g_strndup(cur, end - cur);
 
-		if(!strcmp(cmd, "msg"))
+		if(!strcmp(cmd, "notice"))
+			buf = irc_format(irc, "vt:", "NOTICE", args[0], msg);
+		else
 			buf = irc_format(irc, "vt:", "PRIVMSG", args[0], msg);
-		else /* seding a notice if we get here */
-			buf = irc_format(irc, "vt:", "NOTICE", args[0], msg);
 
 		irc_send(irc, buf);
 		g_free(msg);
--- a/libpurple/protocols/yahoo/yahoo.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Thu Jan 10 02:28:48 2008 +0000
@@ -970,13 +970,19 @@
 yahoo_buddy_add_authorize_cb(gpointer data) {
 	struct yahoo_add_request *add_req = data;
 
-	struct yahoo_packet *pkt;
-	struct yahoo_data *yd = add_req->gc->proto_data;
-
-	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0);
-	yahoo_packet_hash(pkt, "ssiii", 1, add_req->id, 5, add_req->who, 241, add_req->protocol,
-	                  13, 1, 334, 0);
-	yahoo_packet_send_and_free(pkt, yd);
+	if (PURPLE_CONNECTION_IS_VALID(add_req->gc)) {
+		struct yahoo_packet *pkt;
+		struct yahoo_data *yd = add_req->gc->proto_data;
+
+		pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0);
+		yahoo_packet_hash(pkt, "ssiii",
+						  1, add_req->id,
+						  5, add_req->who,
+						  241, add_req->protocol,
+						  13, 1,
+						  334, 0);
+		yahoo_packet_send_and_free(pkt, yd);
+	}
 
 	g_free(add_req->id);
 	g_free(add_req->who);
@@ -985,28 +991,31 @@
 
 static void
 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) {
-	struct yahoo_packet *pkt;
-	char *encoded_msg = NULL;
-	struct yahoo_data *yd = add_req->gc->proto_data;
-	PurpleAccount *account = purple_connection_get_account(add_req->gc);
-
-	if (msg && *msg)
-		encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
-
-	pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
-			YAHOO_STATUS_AVAILABLE, 0);
-
-	yahoo_packet_hash(pkt, "ssiiis",
-			1, purple_normalize(account, purple_account_get_username(account)),
-			5, add_req->who,
-			13, 2,
-			334, 0,
-			97, 1,
-			14, encoded_msg ? encoded_msg : "");
-
-	yahoo_packet_send_and_free(pkt, yd);
-
-	g_free(encoded_msg);
+
+	if (PURPLE_CONNECTION_IS_VALID(add_req->gc)) {
+		struct yahoo_data *yd = add_req->gc->proto_data;
+		struct yahoo_packet *pkt;
+		char *encoded_msg = NULL;
+		PurpleAccount *account = purple_connection_get_account(add_req->gc);
+
+		if (msg && *msg)
+			encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
+
+		pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
+				YAHOO_STATUS_AVAILABLE, 0);
+
+		yahoo_packet_hash(pkt, "ssiiis",
+				1, purple_normalize(account, purple_account_get_username(account)),
+				5, add_req->who,
+				13, 2,
+				334, 0,
+				97, 1,
+				14, encoded_msg ? encoded_msg : "");
+
+		yahoo_packet_send_and_free(pkt, yd);
+
+		g_free(encoded_msg);
+	}
 
 	g_free(add_req->id);
 	g_free(add_req->who);
--- a/pidgin/gtkaccount.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/pidgin/gtkaccount.c	Thu Jan 10 02:28:48 2008 +0000
@@ -241,7 +241,7 @@
 
 	gtk_widget_grab_focus(dialog->protocol_menu);
 
-	if (!dialog->prpl_info || !dialog->prpl_info->register_user || 
+	if (!dialog->prpl_info || !dialog->prpl_info->register_user ||
 	    g_object_get_data(G_OBJECT(item), "fake")) {
 		gtk_widget_hide(dialog->register_button);
 	} else {
@@ -2478,6 +2478,7 @@
 						  _("Authorize"), authorize_and_add_cb,
 						  _("Deny"), deny_no_add_cb,
 						  NULL);
+		g_object_set_data(G_OBJECT(alert), "auth_and_add", aa);
 	} else {
 		alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
 						  _("Authorize buddy?"), buffer, user_data,
@@ -2489,13 +2490,20 @@
 
 	g_free(buffer);
 
-	return NULL;
+	return alert;
 }
 
 static void
 pidgin_accounts_request_close(void *ui_handle)
 {
-
+	/* This is super ugly, but without API changes, this is how it works */
+	struct auth_and_add *aa = g_object_get_data(G_OBJECT(ui_handle), "auth_and_add");
+	if (aa != NULL) {
+		g_free(aa->username);
+		g_free(aa->alias);
+		g_free(aa);
+	}
+	gtk_widget_destroy(GTK_WIDGET(ui_handle));
 }
 
 static PurpleAccountUiOps ui_ops =
--- a/pidgin/plugins/convcolors.c	Tue Jan 08 13:17:59 2008 +0000
+++ b/pidgin/plugins/convcolors.c	Thu Jan 10 02:28:48 2008 +0000
@@ -77,7 +77,7 @@
 	FONT_UNDERLINE	= 1 << 2
 };
 
-struct
+static struct
 {
 	PurpleMessageFlags flag;
 	char *prefix;
@@ -129,6 +129,11 @@
 
 	if (purple_prefs_get_bool(PREF_IGNORE))
 	{
+		/* This seems to be necessary, especially for received messages. */
+		t = *displaying;
+		*displaying = purple_strreplace(t, "\n", "<br>");
+		g_free(t);
+
 		t = *displaying;
 		*displaying = purple_markup_strip_html(t);
 		g_free(t);
--- a/pidgin/win32/nsis/pidgin-installer.nsi	Tue Jan 08 13:17:59 2008 +0000
+++ b/pidgin/win32/nsis/pidgin-installer.nsi	Thu Jan 10 02:28:48 2008 +0000
@@ -700,7 +700,6 @@
     Delete "$INSTDIR\ca-certs\GTE_CyberTrust_Global_Root.pem"
     Delete "$INSTDIR\ca-certs\Microsoft_Secure_Server_Authority.pem"
     Delete "$INSTDIR\ca-certs\StartCom_Free_SSL_CA.pem"
-    Delete "$INSTDIR\ca-certs\Verisign_Class3_Extended_Validation_CA.pem"
     Delete "$INSTDIR\ca-certs\Verisign_Class3_Primary_CA.pem"
     Delete "$INSTDIR\ca-certs\Verisign_RSA_Secure_Server_CA.pem"
     RMDir "$INSTDIR\ca-certs"
@@ -1168,7 +1167,6 @@
     MessageBox MB_RETRYCANCEL|MB_ICONEXCLAMATION $(PIDGIN_IS_RUNNING) /SD IDCANCEL IDRETRY retry_runcheck
     Abort
 
-  done:
   Pop $R1
   Pop $R0
 FunctionEnd
@@ -1264,7 +1262,7 @@
 
   ClearErrors
   ${GetOptions} "$R0" "/DS=" $R1
-  IfErrors +7
+  IfErrors +8
   SectionGetFlags ${SecDesktopShortcut} $R2
   StrCmp "1" $R1 0 +2
   IntOp $R2 $R2 | ${SF_SELECTED}
@@ -1275,7 +1273,7 @@
 
   ClearErrors
   ${GetOptions} "$R0" "/SMS=" $R1
-  IfErrors +7
+  IfErrors +8
   SectionGetFlags ${SecStartMenuShortcut} $R2
   StrCmp "1" $R1 0 +2
   IntOp $R2 $R2 | ${SF_SELECTED}