changeset 22713:74f586c40f6e

merge of '006a7eef54129319c82b282c765b3fbba968006f' and '1512dadb99f3b96f7793c8e2dcff6e0ccf1b6eb3'
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 25 Apr 2008 17:51:03 +0000
parents 4c731c4dcc0b (current diff) 36e5b74b2f74 (diff)
children 645423a7a7b6
files
diffstat 6 files changed, 42 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/irc/msgs.c	Fri Apr 25 16:23:35 2008 +0000
+++ b/libpurple/protocols/irc/msgs.c	Fri Apr 25 17:51:03 2008 +0000
@@ -715,7 +715,7 @@
 		return;
 	}
 
-	g_hash_table_insert(components, strdup("channel"), strdup(args[1]));
+	g_hash_table_insert(components, g_strdup("channel"), g_strdup(args[1]));
 
 	serv_got_chat_invite(gc, args[1], nick, NULL, components);
 	g_free(nick);
@@ -980,7 +980,7 @@
 	if (!args || !args[1])
 		return;
 
-	newnick = strdup(args[1]);
+	newnick = g_strdup(args[1]);
 	end = newnick + strlen(newnick) - 1;
 	/* try fallbacks */
 	if((*end < '9') && (*end >= '1')) {
--- a/libpurple/savedstatuses.c	Fri Apr 25 16:23:35 2008 +0000
+++ b/libpurple/savedstatuses.c	Fri Apr 25 17:51:03 2008 +0000
@@ -1128,10 +1128,12 @@
 
 	g_list_free(accounts);
 
-	purple_savedstatus_set_idleaway(FALSE);
-
-	purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed",
-					 saved_status, old);
+	if (purple_savedstatus_is_idleaway()) {
+		purple_savedstatus_set_idleaway(FALSE);
+	} else {
+		purple_signal_emit(purple_savedstatuses_get_handle(), "savedstatus-changed",
+					 	   saved_status, old);
+	}
 }
 
 void
@@ -1250,6 +1252,7 @@
 	}
 
 	g_hash_table_destroy(creation_times);
+	creation_times = NULL;
 
 	purple_signals_unregister_by_instance(purple_savedstatuses_get_handle());
 }
--- a/libpurple/win32/giowin32.c	Fri Apr 25 16:23:35 2008 +0000
+++ b/libpurple/win32/giowin32.c	Fri Apr 25 17:51:03 2008 +0000
@@ -37,8 +37,8 @@
 #include <glib.h>
 
 #include <stdlib.h>
+#include <winsock2.h>
 #include <windows.h>
-#include <winsock.h>          /* Not everybody has winsock2 */
 #include <fcntl.h>
 #include <io.h>
 #include <process.h>
@@ -541,7 +541,7 @@
   g_io_channel_unref (watch->channel);
 }
 
-GSourceFuncs g_io_watch_funcs = {
+static GSourceFuncs wp_g_io_watch_funcs = {
   g_io_win32_prepare,
   g_io_win32_check,
   g_io_win32_dispatch,
@@ -559,7 +559,7 @@
   GSource *source;
   char send_buffer[] = "c";
 
-  source = g_source_new (&g_io_watch_funcs, sizeof (GIOWin32Watch));
+  source = g_source_new (&wp_g_io_watch_funcs, sizeof (GIOWin32Watch));
   watch = (GIOWin32Watch *)source;
   
   watch->channel = channel;
--- a/libpurple/win32/libc_interface.c	Fri Apr 25 16:23:35 2008 +0000
+++ b/libpurple/win32/libc_interface.c	Fri Apr 25 17:51:03 2008 +0000
@@ -319,23 +319,23 @@
 	if (errornum > WSABASEERR) {
 		switch(errornum) {
 			case WSAECONNABORTED: /* 10053 */
-				snprintf(errbuf, sizeof(errbuf), _("Connection interrupted by other software on your computer."));
+				g_snprintf(errbuf, sizeof(errbuf), _("Connection interrupted by other software on your computer."));
 				break;
 			case WSAECONNRESET: /* 10054 */
-				snprintf(errbuf, sizeof(errbuf), _("Remote host closed connection."));
+				g_snprintf(errbuf, sizeof(errbuf), _("Remote host closed connection."));
 				break;
 			case WSAETIMEDOUT: /* 10060 */
-				snprintf(errbuf, sizeof(errbuf), _("Connection timed out."));
+				g_snprintf(errbuf, sizeof(errbuf), _("Connection timed out."));
 				break;
 			case WSAECONNREFUSED: /*10061 */
-				snprintf(errbuf, sizeof(errbuf), _("Connection refused."));
+				g_snprintf(errbuf, sizeof(errbuf), _("Connection refused."));
 				break;
 			default:
-				snprintf(errbuf, sizeof(errbuf), "Windows socket error #%d", errornum);
+				g_snprintf(errbuf, sizeof(errbuf), "Windows socket error #%d", errornum);
 		}
 	} else {
 		const char *tmp = g_strerror(errornum);
-		snprintf(errbuf, sizeof(errbuf), tmp);
+		g_snprintf(errbuf, sizeof(errbuf), tmp);
 	}
 	return errbuf;
 }
@@ -368,7 +368,7 @@
 		}
 	} else {
 		/* fd is not a socket handle.. pass it off to read */
-		return read(fd, buf, size);
+		return _read(fd, buf, size);
 	}
 }
 
@@ -391,7 +391,7 @@
 	if(wpurple_is_socket(fd))
 		return wpurple_send(fd, buf, size, 0);
 	else
-		return write(fd, buf, size);
+		return _write(fd, buf, size);
 }
 
 int wpurple_recv(int fd, void *buf, size_t len, int flags) {
@@ -419,7 +419,7 @@
 			return 0;
 	}
 	else
-		return close(fd);
+		return _close(fd);
 }
 
 int wpurple_gethostname(char *name, size_t size) {
@@ -454,6 +454,14 @@
 /* stdio.h */
 
 int wpurple_rename (const char *oldname, const char *newname) {
+
+#if GLIB_CHECK_VERSION(2,8,5)
+
+	return g_rename(oldname, newname);
+
+#else
+
+	/* This is a ugly, but we still compile with 2.6.10 but use newer runtimes */
 	struct stat oldstat, newstat;
 
 	/* As of Glib 2.8.5, g_rename() uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING to behave more sanely */
@@ -503,6 +511,8 @@
 		return -1;
 	}
 
+#endif
+
 }
 
 /* time.h */
@@ -1080,7 +1090,6 @@
 	return "";
 }
 
-#if !GLIB_CHECK_VERSION(2,8,0)
 /**
  * g_access:
  * @filename: a pathname in the GLib file name encoding (UTF-8 on Windows)
@@ -1105,6 +1114,12 @@
 wpurple_g_access (const gchar *filename,
 	  int          mode)
 {
+#if GLIB_CHECK_VERSION(2,8,0)
+
+	return g_access(filename, mode);
+
+#else
+
   if (G_WIN32_HAVE_WIDECHAR_API ())
     {
       wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
@@ -1145,7 +1160,8 @@
       errno = save_errno;
       return retval;
     }
+
+#endif
 }
-#endif
 
 
--- a/libpurple/win32/win32dep.c	Fri Apr 25 16:23:35 2008 +0000
+++ b/libpurple/win32/win32dep.c	Fri Apr 25 17:51:03 2008 +0000
@@ -23,23 +23,12 @@
  *
  */
 #define _WIN32_IE 0x500
-#include <windows.h>
-#include <io.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include "internal.h"
 #include <winuser.h>
 
-#include <glib.h>
-#include <glib/gstdio.h>
-
-#include "internal.h"
 #include "debug.h"
 #include "notify.h"
 
-#include <libintl.h>
-
-#include "win32dep.h"
-
 /*
  *  DEFINES & MACROS
  */
--- a/libpurple/win32/win32dep.h	Fri Apr 25 16:23:35 2008 +0000
+++ b/libpurple/win32/win32dep.h	Fri Apr 25 17:51:03 2008 +0000
@@ -22,8 +22,9 @@
  */
 #ifndef _WIN32DEP_H_
 #define _WIN32DEP_H_
+#include <winsock2.h>
+#include <windows.h>
 #include <shlobj.h>
-#include <winsock2.h>
 #include <process.h>
 #include "wpurpleerror.h"
 #include "libc_interface.h"