changeset 15825:aabeea8c6c40

merge of '04fd9089e93e64f81bc6caafb8bd7805037cd3ad' and '50462290007872fbc71682021623547dfa477158'
author Nathan Walp <nwalp@pidgin.im>
date Mon, 19 Mar 2007 00:20:29 +0000
parents bf7d258a26e6 (current diff) ccc28043f423 (diff)
children f59cfcce68a8
files
diffstat 8 files changed, 53 insertions(+), 60 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.c	Mon Mar 19 00:19:58 2007 +0000
+++ b/libpurple/connection.c	Mon Mar 19 00:20:29 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	Mon Mar 19 00:19:58 2007 +0000
+++ b/libpurple/dnsquery.c	Mon Mar 19 00:20:29 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	Mon Mar 19 00:19:58 2007 +0000
+++ b/libpurple/dnssrv.c	Mon Mar 19 00:20:29 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
 }
--- a/pidgin/gtkdebug.c	Mon Mar 19 00:19:58 2007 +0000
+++ b/pidgin/gtkdebug.c	Mon Mar 19 00:20:29 2007 +0000
@@ -904,7 +904,7 @@
 }
 
 static void
-gaim_glib_log_handler(const gchar *domain, GLogLevelFlags flags,
+pidgin_glib_log_handler(const gchar *domain, GLogLevelFlags flags,
 					  const gchar *msg, gpointer user_data)
 {
 	GaimDebugLevel level;
@@ -950,7 +950,7 @@
 
 #ifdef _WIN32
 static void
-gaim_glib_dummy_print_handler(const gchar *string)
+pidgin_glib_dummy_print_handler(const gchar *string)
 {
 }
 #endif
@@ -991,7 +991,7 @@
 #define REGISTER_G_LOG_HANDLER(name) \
 	g_log_set_handler((name), G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL \
 					  | G_LOG_FLAG_RECURSION, \
-					  gaim_glib_log_handler, NULL)
+					  pidgin_glib_log_handler, NULL)
 
 	/* Register the glib/gtk log handlers. */
 	REGISTER_G_LOG_HANDLER(NULL);
@@ -1005,7 +1005,7 @@
 
 #ifdef _WIN32
 	if (!gaim_debug_is_enabled())
-		g_set_print_handler(gaim_glib_dummy_print_handler);
+		g_set_print_handler(pidgin_glib_dummy_print_handler);
 #endif
 }
 
--- a/pidgin/gtknotify.c	Mon Mar 19 00:19:58 2007 +0000
+++ b/pidgin/gtknotify.c	Mon Mar 19 00:20:29 2007 +0000
@@ -67,15 +67,15 @@
 
 enum
 {
-	GAIM_MAIL_ICON,
-	GAIM_MAIL_TEXT,
-	GAIM_MAIL_DATA,
-	COLUMNS_GAIM_MAIL
+	PIDGIN_MAIL_ICON,
+	PIDGIN_MAIL_TEXT,
+	PIDGIN_MAIL_DATA,
+	COLUMNS_PIDGIN_MAIL
 };
 
-typedef struct _GaimMailDialog GaimMailDialog;
+typedef struct _PidginMailDialog PidginMailDialog;
 
-struct _GaimMailDialog
+struct _PidginMailDialog
 {
 	GtkWidget *dialog;
 	GtkWidget *treeview;
@@ -86,7 +86,7 @@
 	gboolean in_use;
 };
 
-static GaimMailDialog *mail_dialog = NULL;
+static PidginMailDialog *mail_dialog = NULL;
 
 static void *pidgin_notify_emails(GaimConnection *gc, size_t count, gboolean detailed,
 									const char **subjects,
@@ -100,7 +100,7 @@
 }
 
 static void
-email_response_cb(GtkDialog *dlg, gint id, GaimMailDialog *dialog)
+email_response_cb(GtkDialog *dlg, gint id, PidginMailDialog *dialog)
 {
 	GaimNotifyMailData *data = NULL;
 	GtkTreeIter iter;
@@ -114,7 +114,7 @@
 		if (gtk_tree_selection_get_selected(selection, NULL, &iter))
 		{
 			gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter,
-								GAIM_MAIL_DATA, &data, -1);
+								PIDGIN_MAIL_DATA, &data, -1);
 			gaim_notify_uri(NULL, data->url);
 
 			gtk_tree_store_remove(dialog->treemodel, &iter);
@@ -131,7 +131,7 @@
 		while (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter))
 		{
 			gtk_tree_model_get(GTK_TREE_MODEL(dialog->treemodel), &iter,
-								GAIM_MAIL_DATA, &data, -1);
+								PIDGIN_MAIL_DATA, &data, -1);
 
 			if (id == GTK_RESPONSE_ACCEPT)
 				gaim_notify_uri(NULL, data->url);
@@ -277,7 +277,7 @@
 }
 
 static void
-selection_changed_cb(GtkTreeSelection *sel, GaimMailDialog *dialog)
+selection_changed_cb(GtkTreeSelection *sel, PidginMailDialog *dialog)
 {
 	GtkTreeIter iter;
 	GtkTreeModel *model;
@@ -288,7 +288,7 @@
 		active = FALSE;
 	else
 	{
-		gtk_tree_model_get(model, &iter, GAIM_MAIL_DATA, &data, -1);
+		gtk_tree_model_get(model, &iter, PIDGIN_MAIL_DATA, &data, -1);
 		if (data->url == NULL)
 			active = FALSE;
 	}
@@ -355,14 +355,14 @@
 		gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
 		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 
-		mail_dialog = g_new0(GaimMailDialog, 1);
+		mail_dialog = g_new0(PidginMailDialog, 1);
 		mail_dialog->dialog = dialog;
 		mail_dialog->open_button = button;
 
-		mail_dialog->treemodel = gtk_tree_store_new(COLUMNS_GAIM_MAIL,
+		mail_dialog->treemodel = gtk_tree_store_new(COLUMNS_PIDGIN_MAIL,
 						GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
 		mail_dialog->treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(mail_dialog->treemodel));
-		gtk_tree_view_set_search_column(GTK_TREE_VIEW(mail_dialog->treeview), GAIM_MAIL_TEXT);
+		gtk_tree_view_set_search_column(GTK_TREE_VIEW(mail_dialog->treeview), PIDGIN_MAIL_TEXT);
 		gtk_tree_view_set_search_equal_func(GTK_TREE_VIEW(mail_dialog->treeview),
 			             pidgin_tree_view_search_equal_func, NULL, NULL);
 
@@ -379,10 +379,10 @@
 		gtk_tree_view_column_set_resizable(column, TRUE);
 		rend = gtk_cell_renderer_pixbuf_new();
 		gtk_tree_view_column_pack_start(column, rend, FALSE);
-		gtk_tree_view_column_set_attributes(column, rend, "pixbuf", GAIM_MAIL_ICON, NULL);
+		gtk_tree_view_column_set_attributes(column, rend, "pixbuf", PIDGIN_MAIL_ICON, NULL);
 		rend = gtk_cell_renderer_text_new();
 		gtk_tree_view_column_pack_start(column, rend, TRUE);
-		gtk_tree_view_column_set_attributes(column, rend, "markup", GAIM_MAIL_TEXT, NULL);
+		gtk_tree_view_column_set_attributes(column, rend, "markup", PIDGIN_MAIL_TEXT, NULL);
 		gtk_tree_view_append_column(GTK_TREE_VIEW(mail_dialog->treeview), column);
 
 		label = gtk_label_new(NULL);
@@ -414,7 +414,7 @@
 		if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(treemodel), &iter)) {
 			do {
 				gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter,
-						GAIM_MAIL_DATA, &data, -1);
+						PIDGIN_MAIL_DATA, &data, -1);
 				if (data->account == account && data->count > 0) {
 					new_n = FALSE;
 					g_free(data->url);
@@ -435,15 +435,15 @@
 		data->url = g_strdup(url);
 
 	gtk_tree_store_set(treemodel, &iter,
-								GAIM_MAIL_ICON, icon,
-								GAIM_MAIL_TEXT, notification,
-								GAIM_MAIL_DATA, data,
+								PIDGIN_MAIL_ICON, icon,
+								PIDGIN_MAIL_TEXT, notification,
+								PIDGIN_MAIL_DATA, data,
 								-1);
 	data->iter = iter;              /* XXX: Do we use this for something? */
 	data->account = account;
 	data->count = count;
 	gtk_tree_model_get(GTK_TREE_MODEL(treemodel), &iter,
-						GAIM_MAIL_DATA, &data, -1);
+						PIDGIN_MAIL_DATA, &data, -1);
 	if (icon)
 		g_object_unref(icon);
 	return data;
--- a/pidgin/gtkplugin.c	Mon Mar 19 00:19:58 2007 +0000
+++ b/pidgin/gtkplugin.c	Mon Mar 19 00:20:29 2007 +0000
@@ -33,7 +33,7 @@
 
 #include <string.h>
 
-#define GAIM_RESPONSE_CONFIGURE 98121
+#define PIDGIN_RESPONSE_CONFIGURE 98121
 
 static void plugin_toggled_stage_two(GaimPlugin *plug, GtkTreeModel *model,
                                   GtkTreeIter *iter, gboolean unload);
@@ -455,7 +455,7 @@
 		}
 		plugin_dialog = NULL;
 		break;
-	case GAIM_RESPONSE_CONFIGURE:
+	case PIDGIN_RESPONSE_CONFIGURE:
 		if (! gtk_tree_selection_get_selected (sel, &model, &iter))
 			return;
 		val.g_type = 0;
@@ -508,7 +508,7 @@
 		return;
 
 	/* Now show the pref-dialog for the plugin */
-	plugin_dialog_response_cb(dialog, GAIM_RESPONSE_CONFIGURE, sel);
+	plugin_dialog_response_cb(dialog, PIDGIN_RESPONSE_CONFIGURE, sel);
 }
 
 void pidgin_plugin_dialog_show()
@@ -530,7 +530,7 @@
 						    GTK_DIALOG_NO_SEPARATOR,
 						    NULL);
 	pref_button = gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
-						_("Configure Pl_ugin"), GAIM_RESPONSE_CONFIGURE);
+						_("Configure Pl_ugin"), PIDGIN_RESPONSE_CONFIGURE);
 	gtk_dialog_add_button(GTK_DIALOG(plugin_dialog),
 						GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
 	gtk_widget_set_sensitive(pref_button, FALSE);
--- a/pidgin/gtkprefs.c	Mon Mar 19 00:19:58 2007 +0000
+++ b/pidgin/gtkprefs.c	Mon Mar 19 00:20:29 2007 +0000
@@ -585,7 +585,7 @@
 }
 
 /* Does same as normal sort, except "none" is sorted first */
-static gint gaim_sort_smileys (GtkTreeModel	*model,
+static gint pidgin_sort_smileys (GtkTreeModel	*model,
 						GtkTreeIter		*a,
 						GtkTreeIter		*b,
 						gpointer		userdata)
@@ -665,7 +665,7 @@
 
 	/* Custom sort so "none" theme is at top of list */
 	gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(smiley_theme_store),
-									3, gaim_sort_smileys, NULL, NULL);
+									3, pidgin_sort_smileys, NULL, NULL);
 
 	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(smiley_theme_store),
 										 3, GTK_SORT_ASCENDING);
--- a/pidgin/gtksound.c	Mon Mar 19 00:19:58 2007 +0000
+++ b/pidgin/gtksound.c	Mon Mar 19 00:20:29 2007 +0000
@@ -44,7 +44,7 @@
 #include "gtkconv.h"
 #include "gtksound.h"
 
-struct gaim_sound_event {
+struct pidgin_sound_event {
 	char *label;
 	char *pref;
 	char *def;
@@ -59,7 +59,7 @@
 static gboolean gst_init_failed;
 #endif /* USE_GSTREAMER */
 
-static struct gaim_sound_event sounds[GAIM_NUM_SOUNDS] = {
+static struct pidgin_sound_event sounds[GAIM_NUM_SOUNDS] = {
 	{N_("Buddy logs in"), "login", "login.wav"},
 	{N_("Buddy logs out"), "logout", "logout.wav"},
 	{N_("Message received"), "im_recv", "receive.wav"},