changeset 23544:3ca9800a9be3

merge of '1a465eae5dc1b7bfc09b0724788403c096f461ce' and '532937221446ba2643f5101c22ae58abc83fa1be'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Mon, 14 Jul 2008 03:04:03 +0000
parents d8e83a6a4127 (diff) af402fc34cb3 (current diff)
children faaa1b36a9b2
files COPYRIGHT
diffstat 12 files changed, 68 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Sun Jul 13 22:51:47 2008 +0000
+++ b/COPYRIGHT	Mon Jul 14 03:04:03 2008 +0000
@@ -48,6 +48,7 @@
 Chris Boyle
 Derrick J Brashear
 Mauro Sérgio Ferreira Brasil
+Luke Bratch
 Matt Brenneke
 Jeremy Brooks
 Jonathan Brossard
@@ -160,6 +161,7 @@
 Christian Hammond
 Erick Hamness
 Fred Hampton
+Phil Hannent
 Casey Harkins
 Andy Harrison
 Andrew Hart (arhart)
--- a/ChangeLog.API	Sun Jul 13 22:51:47 2008 +0000
+++ b/ChangeLog.API	Mon Jul 14 03:04:03 2008 +0000
@@ -20,6 +20,7 @@
 		* "website" and "dev_website" items to the ui_info hash table
 		* purple_cmds_get_handle, purple_cmds_init, purple_cmds_uninit
 		* cmd-added and cmd-removed signals
+		* purple_get_host_name
 
 		Deprecated:
 		* purple_blist_update_buddy_icon
--- a/finch/gntconv.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/finch/gntconv.c	Mon Jul 14 03:04:03 2008 +0000
@@ -1059,9 +1059,12 @@
 	if (!new_arrivals)
 	{
 		/* Print the list of users in the room */
-		GString *string = g_string_new(_("List of users:\n"));
+		GString *string = g_string_new(NULL);
 		GList *iter;
+		int count = g_list_length(users);
 
+		g_string_printf(string,
+				ngettext("List of %d user:\n", "List of %d users:\n", count), count);
 		for (iter = users; iter; iter = iter->next)
 		{
 			PurpleConvChatBuddy *cbuddy = iter->data;
--- a/libpurple/core.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/core.c	Mon Jul 14 03:04:03 2008 +0000
@@ -131,6 +131,7 @@
 #endif
 
 	purple_ciphers_init();
+	purple_cmds_init();
 
 	/* Since plugins get probed so early we should probably initialize their
 	 * subsystem right away too.
@@ -170,7 +171,6 @@
 	purple_xfers_init();
 	purple_idle_init();
 	purple_smileys_init();
-	purple_cmds_init();
 
 	/*
 	 * Call this early on to try to auto-detect our IP address and
@@ -199,7 +199,6 @@
 	purple_connections_disconnect_all();
 
 	/* Save .xml files, remove signals, etc. */
-	purple_cmds_uninit();
 	purple_smileys_uninit();
 	purple_idle_uninit();
 	purple_ssl_uninit();
@@ -233,6 +232,7 @@
 	purple_dbus_uninit();
 #endif
 
+	purple_cmds_uninit();
 	purple_util_uninit();
 
 	purple_signals_uninit();
--- a/libpurple/plugins/autoaccept.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/plugins/autoaccept.c	Mon Jul 14 03:04:03 2008 +0000
@@ -51,6 +51,7 @@
 #define PREF_PATH		PREF_PREFIX "/path"
 #define PREF_STRANGER	PREF_PREFIX "/reject_stranger"
 #define PREF_NOTIFY		PREF_PREFIX "/notify"
+#define PREF_NEWDIR     PREF_PREFIX "/newdir"
 
 typedef enum
 {
@@ -116,7 +117,11 @@
 			{
 				int count = 1;
 				const char *escape;
-				dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL);
+
+				if (purple_prefs_get_bool(PREF_NEWDIR))
+					dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL);
+				else
+					dirname = g_build_filename(pref, NULL);
 
 				if (!ensure_path_exists(dirname))
 				{
@@ -236,6 +241,10 @@
 					  "(only when there's no conversation with the sender)"));
 	purple_plugin_pref_frame_add(frame, pref);
 
+	pref = purple_plugin_pref_new_with_name_and_label(PREF_NEWDIR,
+			_("Create a new directory for each user"));
+	purple_plugin_pref_frame_add(frame, pref);
+
 	return frame;
 }
 
@@ -294,6 +303,7 @@
 	purple_prefs_add_string(PREF_PATH, dirname);
 	purple_prefs_add_bool(PREF_STRANGER, TRUE);
 	purple_prefs_add_bool(PREF_NOTIFY, TRUE);
+	purple_prefs_add_bool(PREF_NEWDIR, TRUE);
 	g_free(dirname);
 }
 
--- a/libpurple/protocols/bonjour/bonjour.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/protocols/bonjour/bonjour.c	Mon Jul 14 03:04:03 2008 +0000
@@ -641,7 +641,6 @@
 	struct passwd *info;
 #endif
 	const char *fullname = NULL, *splitpoint, *tmp;
-	char hostname[255];
 	gchar *conv = NULL;
 
 #ifndef _WIN32
@@ -691,13 +690,7 @@
 
 	/* Try to figure out a good host name to use */
 	/* TODO: Avoid 'localhost,' if possible */
-	if (gethostname(hostname, sizeof(hostname)) != 0) {
-		purple_debug_warning("bonjour", "Error when getting host name: %s.  Using \"localhost.\"\n",
-				g_strerror(errno));
-		strcpy(hostname, "localhost");
-	}
-	hostname[sizeof(hostname) - 1] = '\0';
-	default_hostname = g_strdup(hostname);
+	default_hostname = g_strdup(purple_get_host_name());
 }
 
 static void
--- a/libpurple/protocols/irc/irc.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/protocols/irc/irc.c	Mon Jul 14 03:04:03 2008 +0000
@@ -360,11 +360,10 @@
 
 static gboolean do_login(PurpleConnection *gc) {
 	char *buf, *tmp = NULL;
-	char hostname[256];
+	const char *hostname;
 	const char *username, *realname;
 	struct irc_conn *irc = gc->proto_data;
 	const char *pass = purple_connection_get_password(gc);
-	int ret;
 
 	if (pass && *pass) {
 		buf = irc_format(irc, "vv", "PASS", pass);
@@ -375,13 +374,7 @@
 		g_free(buf);
 	}
 
-
-	ret = gethostname(hostname, sizeof(hostname));
-	hostname[sizeof(hostname) - 1] = '\0';
-	if (ret < 0 || hostname[0] == '\0') {
-		purple_debug_warning("irc", "gethostname() failed -- is your hostname set?");
-		strcpy(hostname, "localhost");
-	}
+	hostname = purple_get_host_name();
 	realname = purple_account_get_string(irc->account, "realname", "");
 	username = purple_account_get_string(irc->account, "username", "");
 
--- a/libpurple/protocols/msn/Makefile.mingw	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/protocols/msn/Makefile.mingw	Mon Jul 14 03:04:03 2008 +0000
@@ -61,7 +61,6 @@
 			slpmsg.c \
 			slpsession.c \
 			soap.c\
-            soap2.c\
 			state.c \
 			switchboard.c \
 			sync.c \
--- a/libpurple/protocols/msn/nexus.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/protocols/msn/nexus.c	Mon Jul 14 03:04:03 2008 +0000
@@ -239,6 +239,15 @@
 	gpointer data;
 };
 
+#if !GLIB_CHECK_VERSION(2, 12, 0)
+static gboolean
+nexus_remove_all_cb(gpointer key, gpointer val, gpointer data)
+{
+	return TRUE;
+}
+#endif
+
+
 static gboolean
 nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node)
 {
@@ -267,7 +276,12 @@
 	if (token_str == NULL)
 		return FALSE;
 
+#if GLIB_CHECK_VERSION(2, 12, 0)
 	g_hash_table_remove_all(nexus->tokens[id].token);
+#else
+	g_hash_table_foreach_remove(nexus->tokens[id].token,
+		nexus_remove_all_cb, NULL);
+#endif
 
 	elems = g_strsplit(token_str, "&", 0);
 
--- a/libpurple/util.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/util.c	Mon Jul 14 03:04:03 2008 +0000
@@ -4723,3 +4723,21 @@
 	return g_string_free(string, FALSE);
 }
 
+const gchar *
+purple_get_host_name(void)
+{
+#if GLIB_CHECK_VERSION(2,8,0)
+	return g_get_host_name();
+#else
+	static char hostname[256];
+	int ret = gethostname(hostname, sizeof(hostname));
+	hostname[sizeof(hostname) - 1] = '\0';
+
+	if (ret == -1 || hostname[0] == '\0') {
+		purple_debug_info("purple_get_host_name: ", "could not find host name");
+		return "localhost";
+	} else {
+		return hostname;
+	}
+#endif
+}
--- a/libpurple/util.h	Sun Jul 13 22:51:47 2008 +0000
+++ b/libpurple/util.h	Mon Jul 14 03:04:03 2008 +0000
@@ -1271,6 +1271,14 @@
  */
 void purple_restore_default_signal_handlers(void);
 
+/**
+ * Gets the host name of the machine. If it not possible to determine the
+ * host name, "localhost" is returned
+ *
+ * @constreturn The hostname
+ */
+const gchar *purple_get_host_name(void);
+
 #ifdef __cplusplus
 }
 #endif
--- a/pidgin/gtkdocklet.c	Sun Jul 13 22:51:47 2008 +0000
+++ b/pidgin/gtkdocklet.c	Mon Jul 14 03:04:03 2008 +0000
@@ -708,6 +708,11 @@
 	if (status == PURPLE_STATUS_OFFLINE)
 		gtk_widget_set_sensitive(menuitem, FALSE);
 
+	menuitem = pidgin_new_item_from_stock(menu, _("Join Chat..."), PIDGIN_STOCK_CHAT,
+			G_CALLBACK(pidgin_blist_joinchat_show), NULL, 0, 0, NULL);
+	if (status == PURPLE_STATUS_OFFLINE)
+		gtk_widget_set_sensitive(menuitem, FALSE);
+
 	menuitem = docklet_status_submenu();
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);