# HG changeset patch # User Sadrul Habib Chowdhury # Date 1209155804 0 # Node ID c4d1689afe20bbf8a1426e0a17d8867d9c13e6a8 # Parent 5433b59bdfc34a5d4cae79fdf4b0a775c55546ac# Parent 8d3c68a8eed44d0b9a50028f9599871b8f11db9c merge of '503c61f4fb406b82adcdbb0f209ba58a4e7f5954' and '8591cff66d2b598fd98ef844ad0c89c5bb1d307f' diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/plugin.c --- a/libpurple/plugin.c Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/plugin.c Fri Apr 25 20:36:44 2008 +0000 @@ -1212,7 +1212,7 @@ if (g_list_find_custom(search_paths, path, (GCompareFunc)strcmp)) return; - search_paths = g_list_append(search_paths, strdup(path)); + search_paths = g_list_append(search_paths, g_strdup(path)); } void diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/protocols/irc/msgs.c --- a/libpurple/protocols/irc/msgs.c Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/protocols/irc/msgs.c Fri Apr 25 20:36:44 2008 +0000 @@ -706,16 +706,16 @@ void irc_msg_invite(struct irc_conn *irc, const char *name, const char *from, char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); - GHashTable *components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - char *nick = irc_mask_nick(from); + GHashTable *components; + gchar *nick; - if (!args || !args[1] || !gc) { - g_free(nick); - g_hash_table_destroy(components); + if (!args || !args[1] || !gc) return; - } - g_hash_table_insert(components, strdup("channel"), strdup(args[1])); + components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); + nick = irc_mask_nick(from); + + 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')) { diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/savedstatuses.c --- a/libpurple/savedstatuses.c Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/savedstatuses.c Fri Apr 25 20:36:44 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()); } diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/win32/giowin32.c --- a/libpurple/win32/giowin32.c Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/win32/giowin32.c Fri Apr 25 20:36:44 2008 +0000 @@ -37,8 +37,8 @@ #include #include +#include #include -#include /* Not everybody has winsock2 */ #include #include #include @@ -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; diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/win32/libc_interface.c --- a/libpurple/win32/libc_interface.c Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/win32/libc_interface.c Fri Apr 25 20:36:44 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 diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/win32/win32dep.c --- a/libpurple/win32/win32dep.c Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/win32/win32dep.c Fri Apr 25 20:36:44 2008 +0000 @@ -23,23 +23,12 @@ * */ #define _WIN32_IE 0x500 -#include -#include -#include -#include +#include "internal.h" #include -#include -#include - -#include "internal.h" #include "debug.h" #include "notify.h" -#include - -#include "win32dep.h" - /* * DEFINES & MACROS */ diff -r 5433b59bdfc3 -r c4d1689afe20 libpurple/win32/win32dep.h --- a/libpurple/win32/win32dep.h Fri Apr 25 20:35:32 2008 +0000 +++ b/libpurple/win32/win32dep.h Fri Apr 25 20:36:44 2008 +0000 @@ -22,8 +22,9 @@ */ #ifndef _WIN32DEP_H_ #define _WIN32DEP_H_ +#include +#include #include -#include #include #include "wpurpleerror.h" #include "libc_interface.h"