summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac19
-rw-r--r--data/Makefile.am8
-rw-r--r--lib/gibber/Makefile.am5
-rw-r--r--lib/gibber/gibber-listener.c2
-rw-r--r--lib/gibber/gibber-sockets-win32.h4
-rw-r--r--src/Makefile.am5
-rw-r--r--src/addressing-util.c2
-rw-r--r--src/bytestream-muc.c4
-rw-r--r--src/bytestream-socks5.c4
-rw-r--r--src/ft-channel.c4
-rw-r--r--src/google-relay.c4
-rw-r--r--src/media-stream.c10
-rw-r--r--src/muc-channel.c2
-rw-r--r--tests/twisted/test-resolver.c5
14 files changed, 62 insertions, 16 deletions
diff --git a/configure.ac b/configure.ac
index a43f0f223..3e8d53812 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,25 @@ TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$official_release" = xno],
unused-parameter])
AC_SUBST([ERROR_CFLAGS])
+
+#------------------------------------------------------------
+# Detect Operating system based on $host
+#------------------------------------------------------------
+AC_MSG_CHECKING([operating system])
+
+case "$host" in
+ *-*-*mingw*|*-*-*cygwin*)
+ platform=win32
+ AC_MSG_RESULT($platform)
+ ;;
+ *)
+ platform=unix
+ AC_MSG_RESULT($platform)
+ ;;
+esac
+
+AM_CONDITIONAL([WINDOWS], [test "$platform" = "win32"])
+
# -----------------------------------------------------------
# Make CA certificates path configurable
# Stolen from GIO's TLS
diff --git a/data/Makefile.am b/data/Makefile.am
index 8d7e299c3..66fa514dd 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -15,6 +15,10 @@ org.freedesktop.Telepathy.ConnectionManager.gabble.service: gabble.service.in \
CLEANFILES = $(service_DATA) $(manager_DATA)
+if WINDOWS
+ ext = ".exe"
+endif
+
$(manager_DATA): ../src/write-mgr-file.c ../src/protocol.c ../src/protocol.h
- @$(MAKE) -C ../src write-mgr-file
- $(AM_V_GEN)../src/write-mgr-file > $@
+ @$(MAKE) -C ../src write-mgr-file$(ext)
+ $(AM_V_GEN)../src/write-mgr-file$(ext) > $@
diff --git a/lib/gibber/Makefile.am b/lib/gibber/Makefile.am
index f50bfd02e..0685be90a 100644
--- a/lib/gibber/Makefile.am
+++ b/lib/gibber/Makefile.am
@@ -63,6 +63,11 @@ gibber-signals-marshal.list: $(OUR_SOURCES) Makefile.am
AM_CFLAGS = $(ERROR_CFLAGS) $(GCOV_CFLAGS) @GLIB_CFLAGS@ @GMODULE_CFLAGS@ -fno-strict-aliasing
+# following flag is requied to make getnameinfo work
+if WINDOWS
+ AM_CFLAGS += -D_WIN32_WINNT=0x0501
+endif
+
AM_LDFLAGS = $(GCOV_LIBS) @GLIB_LIBS@
Android.mk: Makefile.am $(BUILT_SOURCES)
diff --git a/lib/gibber/gibber-listener.c b/lib/gibber/gibber-listener.c
index 40d4610d7..a885294cb 100644
--- a/lib/gibber/gibber-listener.c
+++ b/lib/gibber/gibber-listener.c
@@ -259,7 +259,7 @@ add_listener (GibberListener *self, int family, int type, int protocol,
goto error;
}
- ret = setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof (int));
+ ret = setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (char *) &yes, sizeof (int));
if (ret == -1)
{
gibber_socket_set_error (error, "setsockopt failed",
diff --git a/lib/gibber/gibber-sockets-win32.h b/lib/gibber/gibber-sockets-win32.h
index d35e3cbdf..e61e28451 100644
--- a/lib/gibber/gibber-sockets-win32.h
+++ b/lib/gibber/gibber-sockets-win32.h
@@ -22,8 +22,8 @@
#include <winsock2.h>
#include <ws2tcpip.h>
-#include <Windows.h>
-#include <Winbase.h>
+#include <windows.h>
+#include <winbase.h>
/* Winsock makes some inappropriately-namespaced definitions */
#undef ERROR
#undef interface
diff --git a/src/Makefile.am b/src/Makefile.am
index 126436393..b3d140e5e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -248,6 +248,11 @@ AM_CFLAGS = $(ERROR_CFLAGS) -I$(top_srcdir) -I$(top_builddir) \
-DG_LOG_DOMAIN=\"gabble\" \
-DPLUGIN_DIR=\"$(libdir)/telepathy/gabble-0\"
+# following flag is requied to make getnameinfo work
+if WINDOWS
+ AM_CFLAGS += -D_WIN32_WINNT=0x0501
+endif
+
ALL_LIBS = @DBUS_LIBS@ @GLIB_LIBS@ @WOCKY_LIBS@ @TP_GLIB_LIBS@ \
@SOUP_LIBS@ @NICE_LIBS@ @GMODULE_LIBS@
diff --git a/src/addressing-util.c b/src/addressing-util.c
index 3478bc156..1ea089854 100644
--- a/src/addressing-util.c
+++ b/src/addressing-util.c
@@ -299,7 +299,7 @@ gabble_jid_to_vcard_address (const gchar *vcard_field,
if (address[0] == '-' &&
g_str_has_suffix (address, "@chat.facebook.com"))
{
- const gchar *at = index (address, '@');
+ const gchar *at = strchr (address, '@');
const gchar *start_of_number = address + 1;
const gchar *s;
diff --git a/src/bytestream-muc.c b/src/bytestream-muc.c
index c83ea6922..7511a669a 100644
--- a/src/bytestream-muc.c
+++ b/src/bytestream-muc.c
@@ -516,7 +516,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self,
}
else
{
- DEBUG ("Append data to buffer of %s (%zu bytes)", from, str->len);
+ DEBUG ("Append data to buffer of %s (%" G_GSIZE_FORMAT " bytes)", from, str->len);
g_string_append_len (buffer, str->str, str->len);
}
@@ -542,7 +542,7 @@ gabble_bytestream_muc_receive (GabbleBytestreamMuc *self,
if (fully_received)
{
- DEBUG ("fully received %zu bytes of data", str->len);
+ DEBUG ("fully received %" G_GSIZE_FORMAT " bytes of data", str->len);
g_signal_emit_by_name (G_OBJECT (self), "data-received", sender, str);
g_string_free (str, TRUE);
}
diff --git a/src/bytestream-socks5.c b/src/bytestream-socks5.c
index 2d0a1711a..759b2573a 100644
--- a/src/bytestream-socks5.c
+++ b/src/bytestream-socks5.c
@@ -1649,7 +1649,7 @@ get_local_interfaces_ips (void)
GSList *ips = NULL;
/* FIXME: add IPv6 addresses */
- if ((sockfd = socket (AF_INET, SOCK_DGRAM, IPPROTO_IP)) == INVALID_SOCKET)
+ if ((sockfd = socket (AF_INET, SOCK_DGRAM, IPPROTO_IP)) == (int) INVALID_SOCKET)
{
DEBUG ("Cannot open socket to retrieve interface list");
return NULL;
@@ -1669,7 +1669,7 @@ get_local_interfaces_ips (void)
}
ret = WSAIoctl (sockfd, SIO_GET_INTERFACE_LIST, NULL, 0, iflist,
- size, &bytes, NULL, NULL);
+ size, (LPDWORD) &bytes, NULL, NULL);
error = WSAGetLastError ();
if (ret == SOCKET_ERROR && error != WSAEFAULT)
diff --git a/src/ft-channel.c b/src/ft-channel.c
index bad2da652..ecf6ff14d 100644
--- a/src/ft-channel.c
+++ b/src/ft-channel.c
@@ -1493,7 +1493,11 @@ offer_bytestream (GabbleFileTransferChannel *self, const gchar *jid,
t = (time_t) self->priv->date;
tm = gmtime (&t);
+#ifdef G_OS_WIN32
+ strftime (date_str, sizeof (date_str), "%Y-%m-%dT%H:%M:%SZ", tm);
+#else
strftime (date_str, sizeof (date_str), "%FT%H:%M:%SZ", tm);
+#endif
lm_message_node_set_attribute (file_node, "date", date_str);
}
diff --git a/src/google-relay.c b/src/google-relay.c
index 3a6728d69..d78f37e00 100644
--- a/src/google-relay.c
+++ b/src/google-relay.c
@@ -31,6 +31,10 @@
#define DEBUG_FLAG GABBLE_DEBUG_MEDIA
+#ifdef G_OS_WIN32
+#undef ERROR
+#endif
+
#include "debug.h"
#define RELAY_HTTP_TIMEOUT 5
diff --git a/src/media-stream.c b/src/media-stream.c
index 36a7ee0ee..09570ebba 100644
--- a/src/media-stream.c
+++ b/src/media-stream.c
@@ -743,15 +743,15 @@ gabble_media_stream_codec_choice (TpSvcMediaStreamHandler *iface,
gboolean
gabble_media_stream_error (GabbleMediaStream *self,
- guint errno,
+ guint errnum,
const gchar *message,
GError **error)
{
g_assert (GABBLE_IS_MEDIA_STREAM (self));
DEBUG ( "Media.StreamHandler::Error called, error %u (%s) -- emitting signal",
- errno, message);
- g_signal_emit (self, signals[ERROR], 0, errno, message);
+ errnum, message);
+ g_signal_emit (self, signals[ERROR], 0, errnum, message);
return TRUE;
}
@@ -765,14 +765,14 @@ gabble_media_stream_error (GabbleMediaStream *self,
*/
static void
gabble_media_stream_error_async (TpSvcMediaStreamHandler *iface,
- guint errno,
+ guint errnum,
const gchar *message,
DBusGMethodInvocation *context)
{
GabbleMediaStream *self = GABBLE_MEDIA_STREAM (iface);
GError *error = NULL;
- if (gabble_media_stream_error (self, errno, message, &error))
+ if (gabble_media_stream_error (self, errnum, message, &error))
{
tp_svc_media_stream_handler_return_from_error (context);
}
diff --git a/src/muc-channel.c b/src/muc-channel.c
index f7022a1c1..354dbde7d 100644
--- a/src/muc-channel.c
+++ b/src/muc-channel.c
@@ -1557,7 +1557,7 @@ handle_nick_conflict (GabbleMucChannel *chan,
*/
g_assert (from != NULL);
- if (index (from, '/') != NULL && tp_strdiff (from, priv->self_jid->str))
+ if (strchr (from, '/') != NULL && tp_strdiff (from, priv->self_jid->str))
{
DEBUG ("ignoring spurious conflict message for %s", from);
return TRUE;
diff --git a/tests/twisted/test-resolver.c b/tests/twisted/test-resolver.c
index ef45970b9..4e2274119 100644
--- a/tests/twisted/test-resolver.c
+++ b/tests/twisted/test-resolver.c
@@ -32,9 +32,14 @@
#include <stdio.h>
#include <glib.h>
+
+#ifdef G_OS_WIN32
+#include <windows.h>
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#endif
#include "test-resolver.h"