changeset 15825:ccc28043f423

merge of '5d82380976ddbe6635550905c1fac7198a445809' and 'c406626cbfaf8f3f5e035c3cb8c90c21bc8365f5'
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 18 Mar 2007 22:56:57 +0000
parents c02a897a67c7 (current diff) 76bdff454d6f (diff)
children aabeea8c6c40
files console/Makefile.am console/getopt.c console/getopt.h console/getopt1.c console/gntaccount.c console/gntaccount.h console/gntblist.c console/gntblist.h console/gntconn.c console/gntconn.h console/gntconv.c console/gntconv.h console/gntdebug.c console/gntdebug.h console/gntft.c console/gntft.h console/gntgaim.c console/gntgaim.h console/gntidle.c console/gntidle.h console/gntnotify.c console/gntnotify.h console/gntplugin.c console/gntplugin.h console/gntpounce.c console/gntpounce.h console/gntprefs.c console/gntprefs.h console/gntrequest.c console/gntrequest.h console/gntstatus.c console/gntstatus.h console/gntui.c console/gntui.h console/libgnt/AUTHORS console/libgnt/COPYING console/libgnt/ChangeLog console/libgnt/INSTALL console/libgnt/Makefile.am console/libgnt/NEWS console/libgnt/README console/libgnt/autogen.sh console/libgnt/configure.ac console/libgnt/genmarshal console/libgnt/gnt-skel.c console/libgnt/gnt-skel.h console/libgnt/gnt.h console/libgnt/gnt.pc.in console/libgnt/gntbindable.c console/libgnt/gntbindable.h console/libgnt/gntbox.c console/libgnt/gntbox.h console/libgnt/gntbutton.c console/libgnt/gntbutton.h console/libgnt/gntcheckbox.c console/libgnt/gntcheckbox.h console/libgnt/gntclipboard.c console/libgnt/gntclipboard.h console/libgnt/gntcolors.c console/libgnt/gntcolors.h console/libgnt/gntcombobox.c console/libgnt/gntcombobox.h console/libgnt/gntentry.c console/libgnt/gntentry.h console/libgnt/gntkeys.c console/libgnt/gntkeys.h console/libgnt/gntlabel.c console/libgnt/gntlabel.h console/libgnt/gntline.c console/libgnt/gntline.h console/libgnt/gntmain.c console/libgnt/gntmenu.c console/libgnt/gntmenu.h console/libgnt/gntmenuitem.c console/libgnt/gntmenuitem.h console/libgnt/gntmenuitemcheck.c console/libgnt/gntmenuitemcheck.h console/libgnt/gntrc.sample console/libgnt/gntstyle.c console/libgnt/gntstyle.h console/libgnt/gnttextview.c console/libgnt/gnttextview.h console/libgnt/gnttree.c console/libgnt/gnttree.h console/libgnt/gntutils.c console/libgnt/gntutils.h console/libgnt/gntwidget.c console/libgnt/gntwidget.h console/libgnt/gntwindow.c console/libgnt/gntwindow.h console/libgnt/gntwm.c console/libgnt/gntwm.h console/libgnt/test.c console/libgnt/test/Makefile console/libgnt/test/combo.c console/libgnt/test/focus.c console/libgnt/test/key.c console/libgnt/test/keys.c console/libgnt/test/menu.c console/libgnt/test/multiwin.c console/libgnt/test/tv.c console/libgnt/test/wm.c console/libgnt/wms/Makefile.am console/libgnt/wms/s.c console/plugins/Makefile.am console/plugins/gntclipboard.c console/plugins/gntgf.c console/plugins/gnthistory.c console/plugins/lastlog.c libpurple/connection.c libpurple/tests/check_libgaim.c
diffstat 3 files changed, 19 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.c	Sun Mar 18 21:12:40 2007 +0000
+++ b/libpurple/connection.c	Sun Mar 18 22:56:57 2007 +0000
@@ -435,7 +435,7 @@
 
 	g_return_if_fail(gc   != NULL);
 
-	if (text != NULL) {
+	if (text == NULL) {
 		g_critical("gaim_connection_error: check `text != NULL' failed");
 		text = _("Unknown error");
 	}
--- a/libpurple/dnsquery.c	Sun Mar 18 21:12:40 2007 +0000
+++ b/libpurple/dnsquery.c	Sun Mar 18 22:56:57 2007 +0000
@@ -758,7 +758,7 @@
 		{
 			char message[1024];
 			g_snprintf(message, sizeof(message), _("Thread creation failure: %s"),
-					err ? err->message : _("Unknown reason"));
+					(err && err->message) ? err->message : _("Unknown reason"));
 			g_error_free(err);
 			gaim_dnsquery_failed(query_data, message);
 		}
--- a/libpurple/dnssrv.c	Sun Mar 18 21:12:40 2007 +0000
+++ b/libpurple/dnssrv.c	Sun Mar 18 22:56:57 2007 +0000
@@ -110,7 +110,7 @@
 #ifdef HAVE_SIGNAL_H
 	gaim_restore_default_signal_handlers();
 #endif
-	
+
 	if (read(in, query, 256) <= 0)
 		_exit(0);
 
@@ -222,9 +222,9 @@
 		GaimSrvResponse *srvres_tmp = NULL;
 		GSList *lst = query_data->results;
 
-		size = g_slist_length(query_data->results);
+		size = g_slist_length(lst);
 
-		if(query_data->cb)
+		if(query_data->cb && size > 0)
 			srvres_tmp = srvres = g_new0(GaimSrvResponse, size);
 		while (lst) {
 			if(query_data->cb)
@@ -234,10 +234,10 @@
 		}
 
 		query_data->results = NULL;
+
+		gaim_debug_info("dnssrv", "found %d SRV entries\n", size);
 	}
 
-	gaim_debug_info("dnssrv", "found %d SRV entries\n", size);
-
 	if(query_data->cb)
 		query_data->cb(srvres, size, query_data->extradata);
 
@@ -367,29 +367,22 @@
 	query_data->query = query;
 	query_data->extradata = extradata;
 
-	if (!MyDnsQuery_UTF8 || !MyDnsRecordListFree) {
-		query_data->error_message = g_strdup_printf("System missing DNS API (Requires W2K+)\n");
-
-		/* Asynchronously call the callback since stuff may not expect
-		 * the callback to be called before this returns */
-		query_data->handle = g_idle_add(res_main_thread_cb, query_data);
-
-		return query_data;
+	if (!MyDnsQuery_UTF8 || !MyDnsRecordListFree)
+		query_data->error_message = g_strdup("System missing DNS API (Requires W2K+)\n");
+	else {
+		query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err);
+		if (query_data->resolver == NULL) {
+			query_data->error_message = g_strdup_printf("SRV thread create failure: %s\n", (err && err->message) ? err->message : "");
+			g_error_free(err);
+		}
 	}
 
-	query_data->resolver = g_thread_create(res_thread, query_data, FALSE, &err);
-	if (query_data->resolver == NULL)
-	{
-		query_data->error_message = g_strdup_printf("SRV thread create failure: %s\n", err ? err->message : "");
-		g_error_free(err);
-
-		/* Asynchronously call the callback since stuff may not expect
-		 * the callback to be called before this returns */
+	/* The query isn't going to happen, so finish the SRV lookup now.
+	 * Asynchronously call the callback since stuff may not expect
+	 * the callback to be called before this returns */
+	if (query_data->error_message != NULL)
 		query_data->handle = g_idle_add(res_main_thread_cb, query_data);
 
-		return query_data;
-	}
-
 	return query_data;
 #endif
 }