summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-05-30 13:08:35 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2012-05-30 13:08:35 +0100
commit382886e7dacd79b86dc72a38e9ef32d321d8ab95 (patch)
tree71239faee2556a3c755c457e04e9bb89c6a1440f
parentf8bec1f34af87c4bc044b022abc69f1176ba1f33 (diff)
parentf333fe80d27ded0882b9301ecab957bbe8d79e5e (diff)
Merge branch 'catch-up'
Conflicts: configure.ac src/idle-muc-channel.c
-rw-r--r--configure.ac87
-rw-r--r--m4/tp-compiler-flag.m443
-rw-r--r--m4/tp-compiler-warnings.m449
-rw-r--r--m4/tp-linker-flag.m444
-rw-r--r--src/Makefile.am4
-rw-r--r--src/idle-connection.c37
-rw-r--r--src/idle-ctcp.c22
-rw-r--r--src/idle-debug.c10
-rw-r--r--src/idle-debug.h2
-rw-r--r--src/idle-handles.c14
-rw-r--r--src/idle-im-channel.c55
-rw-r--r--src/idle-im-manager.h2
-rw-r--r--src/idle-muc-channel.c3
-rw-r--r--src/idle-muc-manager.c55
-rw-r--r--src/idle-muc-manager.h2
-rw-r--r--src/idle-parser.c2
-rw-r--r--src/idle-text.c6
-rw-r--r--src/idle.c2
-rw-r--r--src/protocol.c2
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/test-ctcp-kill-blingbling.c4
-rw-r--r--tests/test-ctcp-tokenize.c4
-rw-r--r--tests/test-text-encode-and-split.c2
23 files changed, 309 insertions, 146 deletions
diff --git a/configure.ac b/configure.ac
index 7242ed7..aeac785 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,61 +42,62 @@ AC_PROG_CC
AC_PROG_CC_STDC
AM_PROG_AS
-dnl decide error flags
-AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")
-AS_COMPILER_FLAG(-Werror, werror=yes, werror=no)
-AS_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
-AS_COMPILER_FLAG(-Wno-missing-field-initializers,
- wno_missing_field_initializers=yes,
- wno_missing_field_initializers=no)
-AS_COMPILER_FLAG(-Wno-unused-parameter,
- wno_unused_parameter=yes,
- wno_unused_parameter=no)
-
-ifelse(idle_nano_version, 0, [],
- [
- if test x$werror = xyes; then
- ERROR_CFLAGS="$ERROR_CFLAGS -Werror"
- fi
- if test x$wextra = xyes -a \
- x$wno_missing_field_initializers = xyes -a \
- x$wno_unused_parameter = xyes; then
- ERROR_CFLAGS="$ERROR_CFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter"
- fi
- ])
-
-AC_SUBST(ERROR_CFLAGS)
+AS_IF([test idle_nano_version = 0],
+[ # version x.y.z - "official release",
+ # disable extra checks by default
+ AC_ARG_ENABLE([fatal-warnings],
+ [AC_HELP_STRING([--enable-fatal-warnings],
+ [make various warnings fatal])],
+ [],
+ [enable_fatal_warnings=no])
+],
+[ # version x.y.z.1 - development snapshot,
+ # enable extra checks by default
+ AC_ARG_ENABLE([fatal-warnings],
+ [AC_HELP_STRING([--disable-fatal-warnings],
+ [make various warnings non-fatal])],
+ [],
+ [enable_fatal_warnings=yes])
+])
+
+TP_COMPILER_WARNINGS([ERROR_CFLAGS], [test "x$enable_fatal_warnings" = xyes],
+ [all \
+ extra \
+ declaration-after-statement \
+ shadow \
+ missing-prototypes \
+ nested-externs \
+ pointer-arith \
+ sign-compare \
+ strict-prototypes \
+ format-security \
+ init-self],
+ [missing-field-initializers \
+ unused-parameter])
+AC_SUBST([ERROR_CFLAGS])
+
+# these aren't really error flags but they serve a similar purpose for us -
+# making the toolchain stricter
+if test "x$enable_fatal_warnings" = xyes; then
+ TP_ADD_LINKER_FLAG([ERROR_LDFLAGS], [-Wl,--no-copy-dt-needed-entries])
+fi
AC_HEADER_STDC([])
AC_C_INLINE
-dnl Check for Glib
AC_DEFINE(GLIB_VERSION_MIN_REQUIRED, GLIB_VERSION_2_28, [Ignore post 2.28 deprecations])
AC_DEFINE(GLIB_VERSION_MAX_ALLOWED, GLIB_VERSION_2_30, [Prevent post 2.30 APIs])
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.30.0, gobject-2.0 >= 2.30.0, gio-2.0 >= 2.30.0 ])
-
-AC_SUBST(GLIB_CFLAGS)
-AC_SUBST(GLIB_LIBS)
-
-dnl Check for D-Bus
-PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.51, dbus-glib-1 >= 0.51])
+PKG_CHECK_MODULES([GLIB],
+ [glib-2.0 >= 2.30.0, gobject-2.0 >= 2.30.0, gio-2.0 >= 2.30.0 ])
-AC_SUBST(DBUS_CFLAGS)
-AC_SUBST(DBUS_LIBS)
+PKG_CHECK_MODULES([DBUS], [dbus-1 >= 0.51, dbus-glib-1 >= 0.51])
AC_DEFINE(TP_VERSION_MIN_REQUIRED, TP_VERSION_0_18, [Ignore post 0.18 deprecations])
AC_DEFINE(TP_VERSION_MAX_ALLOWED, TP_VERSION_0_20, [Prevent post 0.20 APIs])
-PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib >= 0.15.9])
-
-AC_SUBST(TELEPATHY_CFLAGS)
-AC_SUBST(TELEPATHY_LIBS)
-
-dnl Check for OpenSSL
-PKG_CHECK_MODULES(OPENSSL, [openssl >= 0.9.7])
+PKG_CHECK_MODULES([TELEPATHY], [telepathy-glib >= 0.15.9])
-AC_SUBST(OPENSSL_CFLAGS)
-AC_SUBST(OPENSSL_LIBS)
+PKG_CHECK_MODULES([OPENSSL], [openssl >= 0.9.7])
dnl Check for code generation tools
XSLTPROC=
diff --git a/m4/tp-compiler-flag.m4 b/m4/tp-compiler-flag.m4
new file mode 100644
index 0000000..06deaba
--- /dev/null
+++ b/m4/tp-compiler-flag.m4
@@ -0,0 +1,43 @@
+dnl A version of AS_COMPILER_FLAG that supports both C and C++.
+dnl Based on:
+
+dnl as-compiler-flag.m4 0.1.0
+dnl autostars m4 macro for detection of compiler flags
+dnl David Schleef <ds@schleef.org>
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
+
+dnl TP_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
+dnl Tries to compile with the given CFLAGS and CXXFLAGS.
+dnl
+dnl Runs ACTION-IF-ACCEPTED if the compiler for the currently selected
+dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise.
+
+AC_DEFUN([TP_COMPILER_FLAG],
+[
+ AC_MSG_CHECKING([to see if compiler understands $1])
+
+ save_CFLAGS="$CFLAGS"
+ save_CXXFLAGS="$CXXFLAGS"
+ CFLAGS="$CFLAGS $1"
+ CXXFLAGS="$CXXFLAGS $1"
+
+ AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
+ CFLAGS="$save_CFLAGS"
+ CXXFLAGS="$save_CXXFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ $2
+ true
+ else
+ $3
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
+
+dnl TP_ADD_COMPILER_FLAG(VARIABLE, CFLAGS)
+dnl Append CFLAGS to VARIABLE if the compiler supports them.
+AC_DEFUN([TP_ADD_COMPILER_FLAG],
+[
+ TP_COMPILER_FLAG([$2], [$1="[$]$1 $2"])
+])
diff --git a/m4/tp-compiler-warnings.m4 b/m4/tp-compiler-warnings.m4
new file mode 100644
index 0000000..ee4af31
--- /dev/null
+++ b/m4/tp-compiler-warnings.m4
@@ -0,0 +1,49 @@
+dnl TP_COMPILER_WARNINGS(VARIABLE, WERROR_BY_DEFAULT, DESIRABLE, UNDESIRABLE)
+dnl $1 (VARIABLE): the variable to put flags into
+dnl $2 (WERROR_BY_DEFAULT): a command returning true if -Werror should be the
+dnl default
+dnl $3 (DESIRABLE): warning flags we want (e.g. all extra shadow)
+dnl $4 (UNDESIRABLE): warning flags we don't want (e.g.
+dnl missing-field-initializers unused-parameter)
+AC_DEFUN([TP_COMPILER_WARNINGS],
+[
+ AC_REQUIRE([AC_ARG_ENABLE])dnl
+ AC_REQUIRE([AC_HELP_STRING])dnl
+ AC_REQUIRE([TP_COMPILER_FLAG])dnl
+
+ tp_warnings=""
+ for tp_flag in $3; do
+ TP_COMPILER_FLAG([-W$tp_flag], [tp_warnings="$tp_warnings -W$tp_flag"])
+ done
+
+ tp_error_flags="-Werror"
+ TP_COMPILER_FLAG([-Werror], [tp_werror=yes], [tp_werror=no])
+
+ for tp_flag in $4; do
+ TP_COMPILER_FLAG([-Wno-$tp_flag],
+ [tp_warnings="$tp_warnings -Wno-$tp_flag"])
+dnl Yes, we do need to use both -Wno-foo and -Wno-error=foo. Simon says:
+dnl some warnings we explicitly don't want, like unused-parameter, but
+dnl they're in -Wall. when a distro using cdbs compiles us, we have:
+dnl -Werror -Wno-unused-parameter -Wall
+dnl ^ from us ^ from cdbs
+dnl which turns -Wunused-parameter back on, in effect
+ TP_COMPILER_FLAG([-Wno-error=$tp_flag],
+ [tp_error_flags="$tp_error_flags -Wno-error=$tp_flag"], [tp_werror=no])
+ done
+
+ AC_ARG_ENABLE([Werror],
+ AC_HELP_STRING([--disable-Werror],
+ [compile without -Werror (normally enabled in development builds)]),
+ tp_werror=$enableval, :)
+
+ if test "x$tp_werror" = xyes && $2; then
+dnl We put -Wno-error=foo before -Wno-foo because clang interprets -Wall
+dnl -Werror -Wno-foo -Wno-error=foo as “make foo a non-fatal warning”, but does
+dnl what we want if you reverse them.
+ $1="$tp_error_flags $tp_warnings"
+ else
+ $1="$tp_warnings"
+ fi
+
+])
diff --git a/m4/tp-linker-flag.m4 b/m4/tp-linker-flag.m4
new file mode 100644
index 0000000..8fd3506
--- /dev/null
+++ b/m4/tp-linker-flag.m4
@@ -0,0 +1,44 @@
+dnl A version of AS_COMPILER_FLAG that supports linker flags
+dnl Based on:
+
+dnl as-compiler-flag.m4 0.1.0
+dnl autostars m4 macro for detection of compiler flags
+dnl David Schleef <ds@schleef.org>
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
+
+dnl TP_LINKER_FLAG(LDFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
+dnl Tries to compile with the given LDFLAGS.
+dnl
+dnl Runs ACTION-IF-ACCEPTED if the compiler/linker for the currently selected
+dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise.
+dnl
+dnl Note that LDFLAGS are passed to the linker via the compiler, so you
+dnl should check for -Wl,--no-add-needed rather than --no-add-needed.
+
+AC_DEFUN([TP_LINKER_FLAG],
+[
+ AC_MSG_CHECKING([to see if compiler/linker understand $1])
+
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+
+ AC_COMPILE_IFELSE(AC_LANG_SOURCE([]), [flag_ok=yes], [flag_ok=no])
+
+ LDFLAGS="$save_LDFLAGS"
+
+ if test "X$flag_ok" = Xyes ; then
+ $2
+ true
+ else
+ $3
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
+
+dnl TP_ADD_LINKER_FLAG(VARIABLE, LDFLAGS)
+dnl Append LDFLAGS to VARIABLE if the linker supports them.
+AC_DEFUN([TP_ADD_LINKER_FLAG],
+[
+ TP_LINKER_FLAG([$2], [$1="[$]$1 $2"])
+])
diff --git a/src/Makefile.am b/src/Makefile.am
index 9a2eb99..4fd55cc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,6 +61,10 @@ AM_CFLAGS = \
@TELEPATHY_CFLAGS@ \
-std=c99
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
+
ALL_LIBS = \
@DBUS_LIBS@ \
@GLIB_LIBS@ \
diff --git a/src/idle-connection.c b/src/idle-connection.c
index f18c2b3..289a993 100644
--- a/src/idle-connection.c
+++ b/src/idle-connection.c
@@ -1059,13 +1059,16 @@ static IdleParserHandlerResult _ping_handler(IdleParser *parser, IdleParserMessa
static IdleParserHandlerResult _version_privmsg_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray *args, gpointer user_data) {
IdleConnection *conn = IDLE_CONNECTION(user_data);
const gchar *msg = g_value_get_string(g_value_array_get_nth(args, 2));
+ TpHandle handle;
+ const gchar *nick;
+ gchar *reply;
if (g_ascii_strcasecmp(msg, "\001VERSION\001"))
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
- TpHandle handle = g_value_get_uint(g_value_array_get_nth(args, 0));
- const gchar *nick = tp_handle_inspect(tp_base_connection_get_handles(TP_BASE_CONNECTION(conn), TP_HANDLE_TYPE_CONTACT), handle);
- gchar *reply = g_strdup_printf("VERSION telepathy-idle %s Telepathy IM/VoIP Framework http://telepathy.freedesktop.org", VERSION);
+ handle = g_value_get_uint(g_value_array_get_nth(args, 0));
+ nick = tp_handle_inspect(tp_base_connection_get_handles(TP_BASE_CONNECTION(conn), TP_HANDLE_TYPE_CONTACT), handle);
+ reply = g_strdup_printf("VERSION telepathy-idle %s Telepathy IM/VoIP Framework http://telepathy.freedesktop.org", VERSION);
idle_ctcp_notice(nick, reply, conn);
@@ -1095,11 +1098,15 @@ _whois_user_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray
TpHandle handle = g_value_get_uint(g_value_array_get_nth(args, 0));
TpHandle self = tp_base_connection_get_self_handle(TP_BASE_CONNECTION(conn));
if (handle == self) {
+ const char *user;
+ const char *host;
+
if (priv->relay_prefix != NULL) {
g_free(priv->relay_prefix);
}
- const char* user = g_value_get_string(g_value_array_get_nth(args, 1));
- const char* host = g_value_get_string(g_value_array_get_nth(args, 2));
+
+ user = g_value_get_string(g_value_array_get_nth(args, 1));
+ host = g_value_get_string(g_value_array_get_nth(args, 2));
priv->relay_prefix = g_strdup_printf("%s!%s@%s", priv->nickname, user, host);
IDLE_DEBUG("user host prefix = %s", priv->relay_prefix);
}
@@ -1161,7 +1168,8 @@ static void connection_disconnect_cb(IdleConnection *conn, TpConnectionStatusRea
idle_connection_clear_queue_timeout (conn);
}
-void _queue_alias_changed(IdleConnection *conn, TpHandle handle, const gchar *alias) {
+static void
+_queue_alias_changed(IdleConnection *conn, TpHandle handle, const gchar *alias) {
IdleConnectionPrivate *priv = IDLE_CONNECTION_GET_PRIVATE(conn);
if (!priv->queued_aliases_owners) {
@@ -1181,7 +1189,8 @@ void _queue_alias_changed(IdleConnection *conn, TpHandle handle, const gchar *al
G_TYPE_INVALID));
}
-static GQuark _canon_nick_quark() {
+static GQuark
+_canon_nick_quark (void) {
static GQuark quark = 0;
if (!quark)
@@ -1271,6 +1280,7 @@ idle_connection_get_aliases (
TpHandleRepoIface *repo = tp_base_connection_get_handles (
TP_BASE_CONNECTION (iface), TP_HANDLE_TYPE_CONTACT);
GError *error = NULL;
+ GHashTable *aliases;
if (!tp_handles_are_valid (repo, handles, FALSE, &error))
{
@@ -1279,7 +1289,7 @@ idle_connection_get_aliases (
return;
}
- GHashTable *aliases = g_hash_table_new (NULL, NULL);
+ aliases = g_hash_table_new (NULL, NULL);
for (guint i = 0; i < handles->len; i++)
{
@@ -1297,6 +1307,7 @@ idle_connection_get_aliases (
static void idle_connection_request_aliases(TpSvcConnectionInterfaceAliasing *iface, const GArray *handles, DBusGMethodInvocation *context) {
TpHandleRepoIface *repo = tp_base_connection_get_handles(TP_BASE_CONNECTION(iface), TP_HANDLE_TYPE_CONTACT);
GError *error = NULL;
+ const gchar **aliases;
if (!tp_handles_are_valid(repo, handles, FALSE, &error)) {
dbus_g_method_return_error(context, error);
@@ -1304,7 +1315,7 @@ static void idle_connection_request_aliases(TpSvcConnectionInterfaceAliasing *if
return;
}
- const gchar **aliases = g_new0(const gchar *, handles->len + 1);
+ aliases = g_new0(const gchar *, handles->len + 1);
for (guint i = 0; i < handles->len; i++) {
TpHandle handle = g_array_index(handles, TpHandle, i);
@@ -1318,19 +1329,17 @@ static void idle_connection_request_aliases(TpSvcConnectionInterfaceAliasing *if
static gboolean _send_rename_request(IdleConnection *obj, const gchar *nick, DBusGMethodInvocation *context) {
TpHandleRepoIface *handles = tp_base_connection_get_handles(TP_BASE_CONNECTION(obj), TP_HANDLE_TYPE_CONTACT);
TpHandle handle = tp_handle_ensure(handles, nick, NULL, NULL);
+ gchar msg[IRC_MSG_MAXLEN + 1];
if (handle == 0) {
- IDLE_DEBUG("failed to get handle for \"%s\"", nick);
-
GError error = {TP_ERROR, TP_ERROR_NOT_AVAILABLE, "Invalid nickname requested"};
+
+ IDLE_DEBUG("failed to get handle for \"%s\"", nick);
dbus_g_method_return_error(context, &error);
return FALSE;
}
- tp_handle_unref(handles, handle);
-
- gchar msg[IRC_MSG_MAXLEN + 1];
g_snprintf(msg, IRC_MSG_MAXLEN + 1, "NICK %s", nick);
idle_connection_send(obj, msg);
diff --git a/src/idle-ctcp.c b/src/idle-ctcp.c
index 12752db..6285e69 100644
--- a/src/idle-ctcp.c
+++ b/src/idle-ctcp.c
@@ -84,11 +84,13 @@ const gchar *idle_ctcp_notice(const gchar *target, const gchar *ctcp, IdleConnec
}
gchar *idle_ctcp_kill_blingbling(const gchar *msg) {
+ gchar *killed, *killed_iter;
+
if (msg == NULL)
return NULL;
- gchar *killed = g_malloc0(strlen(msg) + 1);
- gchar *killed_iter = killed;
+ killed = g_malloc0(strlen(msg) + 1);
+ killed_iter = killed;
for (const gchar *iter = msg; *iter != '\0';) {
switch (*iter) {
@@ -125,15 +127,19 @@ gchar *idle_ctcp_kill_blingbling(const gchar *msg) {
}
gchar **idle_ctcp_decode(const gchar *msg) {
+ GPtrArray *tokens;
+ gchar cur_token[IRC_MSG_MAXLEN] = {'\0'};
+ gchar *cur_iter = cur_token;
+ gchar **ret;
+ const gchar *iter;
+ gboolean string = FALSE;
+
if (!msg || (msg[0] != '\001') || !msg[1] || (msg[1] == '\001'))
return NULL;
- GPtrArray *tokens = g_ptr_array_new();
- gchar cur_token[IRC_MSG_MAXLEN] = {'\0'};
- gchar *cur_iter = cur_token;
+ tokens = g_ptr_array_new();
- const gchar *iter = msg + 1;
- gboolean string = FALSE;
+ iter = msg + 1;
while (*iter != '\0') {
switch (*iter) {
case '\\':
@@ -194,7 +200,7 @@ gchar **idle_ctcp_decode(const gchar *msg) {
g_ptr_array_add(tokens, NULL);
- gchar **ret = (gchar **) tokens->pdata;
+ ret = (gchar **) tokens->pdata;
g_ptr_array_free(tokens, FALSE);
return ret;
diff --git a/src/idle-debug.c b/src/idle-debug.c
index 8ae65bf..156dc3b 100644
--- a/src/idle-debug.c
+++ b/src/idle-debug.c
@@ -36,11 +36,15 @@ static GDebugKey _keys[] = {
{NULL, 0}
};
-void idle_debug_init() {
+void
+idle_debug_init (void) {
+ const gchar *flags_string = g_getenv("IDLE_DEBUG");
guint nkeys;
- for (nkeys = 0; _keys[nkeys].value; nkeys++);
- const gchar *flags_string = g_getenv("IDLE_DEBUG");
+ for (nkeys = 0; _keys[nkeys].value; nkeys++) {
+ /* do nothing, just count nkeys */
+ }
+
if (flags_string) {
tp_debug_set_flags(flags_string);
_flags |= g_parse_debug_string(flags_string, _keys, nkeys);
diff --git a/src/idle-debug.h b/src/idle-debug.h
index a025940..6677d2f 100644
--- a/src/idle-debug.h
+++ b/src/idle-debug.h
@@ -32,7 +32,7 @@ typedef enum {
IDLE_DEBUG_TEXT = (1 << 6),
} IdleDebugFlags;
-void idle_debug_init();
+void idle_debug_init (void);
void idle_debug(IdleDebugFlags flag, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
void idle_debug_free (void);
diff --git a/src/idle-handles.c b/src/idle-handles.c
index 5e3843e..3aa07d9 100644
--- a/src/idle-handles.c
+++ b/src/idle-handles.c
@@ -92,11 +92,13 @@ gboolean idle_nickname_is_valid(const gchar *nickname, gboolean strict_mode) {
static gboolean _channelname_is_valid(const gchar *channel) {
static const gchar not_allowed_chars[] = {' ', '\007', ',', '\r', '\n', ':', '\0'};
+ gsize len;
+ const gchar *tmp;
if (!idle_muc_channel_is_typechar(channel[0]))
return FALSE;
- gsize len = strlen(channel);
+ len = strlen(channel);
if ((len < 2) || (len > 50))
return FALSE;
@@ -107,7 +109,7 @@ static gboolean _channelname_is_valid(const gchar *channel) {
}
}
- const gchar *tmp = strchr(channel + 1, ':');
+ tmp = strchr(channel + 1, ':');
if (tmp != NULL) {
for (const gchar *tmp2 = channel + 1; tmp2 != tmp; tmp2++) {
if (strchr(not_allowed_chars, *tmp2))
@@ -129,12 +131,14 @@ static gboolean _channelname_is_valid(const gchar *channel) {
}
gchar *idle_normalize_nickname (const gchar *id, GError **error) {
+ gchar *normalized;
+
if (!idle_nickname_is_valid(id, FALSE)) {
g_set_error(error, TP_ERROR, TP_ERROR_INVALID_HANDLE, "invalid nickname");
return NULL;
}
- gchar *normalized = g_utf8_strdown(id, -1);
+ normalized = g_utf8_strdown(id, -1);
return normalized;
}
@@ -144,12 +148,14 @@ static gchar *_nick_normalize_func(TpHandleRepoIface *repo, const gchar *id, gpo
}
static gchar *_channel_normalize_func(TpHandleRepoIface *repo, const gchar *id, gpointer ctx, GError **error) {
+ gchar *normalized;
+
if (!_channelname_is_valid(id)) {
g_set_error(error, TP_ERROR, TP_ERROR_INVALID_HANDLE, "invalid channel ID");
return NULL;
}
- gchar *normalized = g_utf8_strdown(id, -1);
+ normalized = g_utf8_strdown(id, -1);
return normalized;
}
diff --git a/src/idle-im-channel.c b/src/idle-im-channel.c
index 6f312db..1be101b 100644
--- a/src/idle-im-channel.c
+++ b/src/idle-im-channel.c
@@ -103,7 +103,6 @@ static GObject *idle_im_channel_constructor(GType type, guint n_props, GObjectCo
GObject *obj;
IdleIMChannelPrivate *priv;
TpDBusDaemon *bus;
- TpHandleRepoIface *handles;
TpBaseConnection *conn;
TpChannelTextMessageType types[] = {
TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
@@ -120,9 +119,6 @@ static GObject *idle_im_channel_constructor(GType type, guint n_props, GObjectCo
conn = TP_BASE_CONNECTION(priv->connection);
- handles = tp_base_connection_get_handles(conn, TP_HANDLE_TYPE_CONTACT);
- tp_handle_ref(handles, priv->handle);
- tp_handle_ref(handles, priv->initiator);
g_assert(tp_handle_is_valid(tp_base_connection_get_handles(TP_BASE_CONNECTION(priv->connection), TP_HANDLE_TYPE_CONTACT), priv->handle, NULL));
bus = tp_base_connection_get_dbus_daemon (conn);
@@ -269,6 +265,25 @@ static void idle_im_channel_set_property(GObject *object, guint property_id, con
}
static void idle_im_channel_class_init (IdleIMChannelClass *idle_im_channel_class) {
+ static TpDBusPropertiesMixinPropImpl channel_props[] = {
+ { "Interfaces", "interfaces", NULL },
+ { "ChannelType", "channel-type", NULL },
+ { "TargetHandleType", "handle-type", NULL },
+ { "TargetHandle", "handle", NULL },
+ { "TargetID", "target-id", NULL },
+ { "InitiatorHandle", "initiator-handle", NULL },
+ { "InitiatorID", "initiator-id", NULL },
+ { "Requested", "requested", NULL },
+ { NULL }
+ };
+ static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
+ { TP_IFACE_CHANNEL,
+ tp_dbus_properties_mixin_getter_gobject_properties,
+ NULL,
+ channel_props,
+ },
+ { NULL }
+ };
GObjectClass *object_class = G_OBJECT_CLASS(idle_im_channel_class);
GParamSpec *param_spec;
@@ -326,26 +341,6 @@ static void idle_im_channel_class_init (IdleIMChannelClass *idle_im_channel_clas
NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
g_object_class_install_property (object_class, PROP_INITIATOR_ID, param_spec);
- static TpDBusPropertiesMixinPropImpl channel_props[] = {
- { "Interfaces", "interfaces", NULL },
- { "ChannelType", "channel-type", NULL },
- { "TargetHandleType", "handle-type", NULL },
- { "TargetHandle", "handle", NULL },
- { "TargetID", "target-id", NULL },
- { "InitiatorHandle", "initiator-handle", NULL },
- { "InitiatorID", "initiator-id", NULL },
- { "Requested", "requested", NULL },
- { NULL }
- };
- static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = {
- { TP_IFACE_CHANNEL,
- tp_dbus_properties_mixin_getter_gobject_properties,
- NULL,
- channel_props,
- },
- { NULL }
- };
-
idle_im_channel_class->dbus_props_class.interfaces = prop_interfaces;
tp_dbus_properties_mixin_class_init(object_class, G_STRUCT_OFFSET(IdleIMChannelClass, dbus_props_class));
tp_message_mixin_init_dbus_properties (object_class);
@@ -372,11 +367,6 @@ void idle_im_channel_dispose (GObject *object) {
void idle_im_channel_finalize (GObject *object) {
IdleIMChannel *self = IDLE_IM_CHANNEL(object);
IdleIMChannelPrivate *priv = IDLE_IM_CHANNEL_GET_PRIVATE(self);
- TpHandleRepoIface *handles;
-
- handles = tp_base_connection_get_handles(TP_BASE_CONNECTION(priv->connection), TP_HANDLE_TYPE_CONTACT);
- tp_handle_unref(handles, priv->handle);
- tp_handle_unref(handles, priv->initiator);
if (priv->object_path)
g_free(priv->object_path);
@@ -423,17 +413,10 @@ static void idle_im_channel_close (TpSvcChannel *iface, DBusGMethodInvocation *c
IDLE_DEBUG("Not really closing, I still have pending messages");
if (priv->initiator != priv->handle) {
- TpHandleRepoIface *contact_repo =
- tp_base_connection_get_handles(
- (TpBaseConnection *) priv->connection,
- TP_HANDLE_TYPE_CONTACT);
-
g_assert(priv->initiator != 0);
g_assert(priv->handle != 0);
- tp_handle_unref(contact_repo, priv->initiator);
priv->initiator = priv->handle;
- tp_handle_ref(contact_repo, priv->initiator);
}
tp_message_mixin_set_rescued ((GObject *) obj);
diff --git a/src/idle-im-manager.h b/src/idle-im-manager.h
index 1967a29..3765de4 100644
--- a/src/idle-im-manager.h
+++ b/src/idle-im-manager.h
@@ -36,7 +36,7 @@ struct _IdleIMManager {
GObject parent;
};
-GType idle_im_manager_get_type();
+GType idle_im_manager_get_type (void);
#define IDLE_TYPE_IM_MANAGER (idle_im_manager_get_type())
#define IDLE_IM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IDLE_TYPE_IM_MANAGER, IdleIMManager))
diff --git a/src/idle-muc-channel.c b/src/idle-muc-channel.c
index 1ee5748..5dc6373 100644
--- a/src/idle-muc-channel.c
+++ b/src/idle-muc-channel.c
@@ -902,9 +902,6 @@ void idle_muc_channel_mode(IdleMUCChannel *chan, GValueArray *args) {
IDLE_DEBUG("got MODE '%c' concerning us", *modes);
mode_accum |= _modechar_to_modeflag(*modes);
}
-
- if (handle)
- tp_handle_unref(handles, handle);
}
break;
diff --git a/src/idle-muc-manager.c b/src/idle-muc-manager.c
index e2400cc..5cba4d7 100644
--- a/src/idle-muc-manager.c
+++ b/src/idle-muc-manager.c
@@ -186,13 +186,14 @@ static void idle_muc_manager_class_init(IdleMUCManagerClass *klass) {
static IdleParserHandlerResult _numeric_error_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray *args, gpointer user_data) {
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(user_data);
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (!chan)
return IDLE_PARSER_HANDLER_RESULT_HANDLED;
@@ -226,13 +227,14 @@ static IdleParserHandlerResult _numeric_topic_handler(IdleParser *parser, IdlePa
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(user_data);
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
const gchar *topic = g_value_get_string(g_value_array_get_nth(args, 1));
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan)
idle_muc_channel_topic(chan, topic);
@@ -245,13 +247,14 @@ static IdleParserHandlerResult _numeric_topic_stamp_handler(IdleParser *parser,
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
TpHandle toucher_handle = g_value_get_uint(g_value_array_get_nth(args, 1));
time_t touched = g_value_get_uint(g_value_array_get_nth(args, 2));
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
idle_connection_emit_queued_aliases_changed(priv->conn);
@@ -267,6 +270,7 @@ static IdleParserHandlerResult _invite_handler(IdleParser *parser, IdleParserMes
TpHandle inviter_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
TpHandle invited_handle = g_value_get_uint(g_value_array_get_nth(args, 1));
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 2));
+ IdleMUCChannel *chan;
if (invited_handle != priv->conn->parent.self_handle)
return IDLE_PARSER_HANDLER_RESULT_HANDLED;
@@ -276,7 +280,7 @@ static IdleParserHandlerResult _invite_handler(IdleParser *parser, IdleParserMes
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
idle_connection_emit_queued_aliases_changed(priv->conn);
@@ -294,6 +298,7 @@ static IdleParserHandlerResult _join_handler(IdleParser *parser, IdleParserMessa
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(manager);
TpHandle joiner_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 1));
+ IdleMUCChannel *chan;
idle_connection_emit_queued_aliases_changed(priv->conn);
@@ -302,7 +307,7 @@ static IdleParserHandlerResult _join_handler(IdleParser *parser, IdleParserMessa
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (!chan) {
/* TODO: If we're in "bouncer mode", maybe these should be Requested:
@@ -321,13 +326,14 @@ static IdleParserHandlerResult _kick_handler(IdleParser *parser, IdleParserMessa
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 1));
TpHandle kicked_handle = g_value_get_uint(g_value_array_get_nth(args, 2));
const gchar *message = (args->n_values == 4) ? g_value_get_string(g_value_array_get_nth(args, 3)) : NULL;
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan)
idle_muc_channel_kick(chan, kicked_handle, kicker_handle, message);
@@ -338,13 +344,14 @@ static IdleParserHandlerResult _kick_handler(IdleParser *parser, IdleParserMessa
static IdleParserHandlerResult _numeric_namereply_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray *args, gpointer user_data) {
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(user_data);
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan)
idle_muc_channel_namereply(chan, args);
@@ -355,13 +362,14 @@ static IdleParserHandlerResult _numeric_namereply_handler(IdleParser *parser, Id
static IdleParserHandlerResult _numeric_namereply_end_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray *args, gpointer user_data) {
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(user_data);
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan)
idle_muc_channel_namereply_end(chan);
@@ -372,13 +380,14 @@ static IdleParserHandlerResult _numeric_namereply_end_handler(IdleParser *parser
static IdleParserHandlerResult _mode_handler(IdleParser *parser, IdleParserMessageCode code, GValueArray *args, gpointer user_data) {
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(user_data);
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan)
idle_muc_channel_mode(chan, args);
@@ -417,22 +426,22 @@ static IdleParserHandlerResult _notice_privmsg_handler(IdleParser *parser, IdleP
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(manager);
TpHandle sender_handle = (TpHandle) g_value_get_uint(g_value_array_get_nth(args, 0));
TpHandle room_handle = (TpHandle) g_value_get_uint(g_value_array_get_nth(args, 1));
+ IdleMUCChannel *chan;
+ TpChannelTextMessageType type;
+ gchar *body;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
/* XXX: just check for chan == NULL here and bail with NOT_HANDLED if room
* was not found ? Currently we go through all of the decoding of the
* message, but don't actually deliver the message to a channel if chan is
* NULL, and then we return 'HANDLED', which seems wrong
*/
- TpChannelTextMessageType type;
- gchar *body;
-
if (code == IDLE_PARSER_PREFIXCMD_NOTICE_CHANNEL) {
type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NOTICE;
body = idle_ctcp_kill_blingbling(g_value_get_string(g_value_array_get_nth(args, 2)));
@@ -456,13 +465,14 @@ static IdleParserHandlerResult _part_handler(IdleParser *parser, IdleParserMessa
TpHandle leaver_handle = g_value_get_uint(g_value_array_get_nth(args, 0));
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 1));
const gchar *message = (args->n_values == 3) ? g_value_get_string(g_value_array_get_nth(args, 2)) : NULL;
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan)
idle_muc_channel_part(chan, leaver_handle, message);
@@ -500,13 +510,14 @@ static IdleParserHandlerResult _topic_handler(IdleParser *parser, IdleParserMess
TpHandle room_handle = g_value_get_uint(g_value_array_get_nth(args, 1));
const gchar *topic = (args->n_values == 3) ? g_value_get_string(g_value_array_get_nth(args, 2)) : NULL;
time_t stamp = time(NULL);
+ IdleMUCChannel *chan;
if (!priv->channels) {
IDLE_DEBUG("Channels hash table missing, ignoring...");
return IDLE_PARSER_HANDLER_RESULT_NOT_HANDLED;
}
- IdleMUCChannel *chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
+ chan = g_hash_table_lookup(priv->channels, GUINT_TO_POINTER(room_handle));
if (chan) {
if (topic)
@@ -532,9 +543,7 @@ static void _muc_manager_close_all(IdleMUCManager *manager)
return;
}
- GHashTable *tmp = priv->channels;
- priv->channels = NULL;
- g_hash_table_destroy(tmp);
+ tp_clear_pointer (&priv->channels, g_hash_table_destroy);
}
static void
@@ -691,16 +700,16 @@ static void _channel_join_ready_cb(IdleMUCChannel *chan, guint err, gpointer use
TpChannelManager *manager = TP_CHANNEL_MANAGER(user_data);
IdleMUCManagerPrivate *priv = IDLE_MUC_MANAGER_GET_PRIVATE(user_data);
GSList *reqs = take_request_tokens(user_data, chan);
+ gint err_code = 0;
+ const gchar* err_msg = NULL;
+ TpHandle handle;
+ GSList *l;
if (err == MUC_CHANNEL_JOIN_ERROR_NONE) {
tp_channel_manager_emit_new_channel(manager, (TpExportableChannel *) chan, reqs);
goto out;
}
- gint err_code = 0;
- const gchar* err_msg = NULL;
- TpHandle handle;
-
g_object_get(chan, "handle", &handle, NULL);
switch (err) {
@@ -724,7 +733,7 @@ static void _channel_join_ready_cb(IdleMUCChannel *chan, guint err, gpointer use
break;
}
- for (GSList *l = reqs; reqs != NULL; reqs = reqs->next) {
+ for (l = reqs; reqs != NULL; reqs = reqs->next) {
tp_channel_manager_emit_request_failed(manager, l->data, TP_ERROR, err_code, err_msg);
}
diff --git a/src/idle-muc-manager.h b/src/idle-muc-manager.h
index ee2a3f9..8fc509a 100644
--- a/src/idle-muc-manager.h
+++ b/src/idle-muc-manager.h
@@ -36,7 +36,7 @@ struct _IdleMUCManager {
GObject parent;
};
-GType idle_muc_manager_get_type();
+GType idle_muc_manager_get_type (void);
#define IDLE_TYPE_MUC_MANAGER (idle_muc_manager_get_type())
#define IDLE_MUC_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IDLE_TYPE_MUC_MANAGER, IdleMUCManager))
diff --git a/src/idle-parser.c b/src/idle-parser.c
index 2d675cc..eb77086 100644
--- a/src/idle-parser.c
+++ b/src/idle-parser.c
@@ -514,12 +514,10 @@ static gboolean _parse_atom(IdleParser *parser, GValueArray *arr, char atom, con
if (atom == 'r') {
if ((handle = tp_handle_ensure(room_repo, id, NULL, NULL))) {
tp_handle_set_add(room_reffed, handle);
- tp_handle_unref(room_repo, handle);
}
} else {
if ((handle = tp_handle_ensure(contact_repo, id, NULL, NULL))) {
tp_handle_set_add(contact_reffed, handle);
- tp_handle_unref(contact_repo, handle);
idle_connection_canon_nick_receive(priv->conn, handle, id);
}
diff --git a/src/idle-text.c b/src/idle-text.c
index 4b439a4..a168787 100644
--- a/src/idle-text.c
+++ b/src/idle-text.c
@@ -159,6 +159,8 @@ void idle_text_send(GObject *obj, TpMessage *message, TpMessageSendingFlags flag
guint n_parts;
GStrv messages;
GStrv bodies;
+ gsize msg_len;
+ guint i;
#define INVALID_ARGUMENT(msg, ...) \
G_STMT_START { \
@@ -198,12 +200,12 @@ void idle_text_send(GObject *obj, TpMessage *message, TpMessageSendingFlags flag
/* Okay, it's valid. Let's send it. */
- gsize msg_len = idle_connection_get_max_message_length(conn);
+ msg_len = idle_connection_get_max_message_length(conn);
messages = idle_text_encode_and_split(type, recipient, text, msg_len, &bodies, &error);
if (messages == NULL)
goto failed;
- for(guint i = 0; messages[i] != NULL; i++) {
+ for(i = 0; messages[i] != NULL; i++) {
g_assert(bodies[i] != NULL);
idle_connection_send(conn, messages[i]);
}
diff --git a/src/idle.c b/src/idle.c
index 44585bd..8d3706b 100644
--- a/src/idle.c
+++ b/src/idle.c
@@ -27,7 +27,7 @@
#include "idle-connection-manager.h"
#include "idle-debug.h"
-static TpBaseConnectionManager *_construct_cm() {
+static TpBaseConnectionManager *_construct_cm (void) {
TpBaseConnectionManager *base_cm = TP_BASE_CONNECTION_MANAGER(g_object_new(IDLE_TYPE_CONNECTION_MANAGER, NULL));
return base_cm;
diff --git a/src/protocol.c b/src/protocol.c
index 4a67fe1..8feda4e 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -40,7 +40,7 @@
G_DEFINE_TYPE (IdleProtocol, idle_protocol, TP_TYPE_BASE_PROTOCOL)
-gboolean
+static gboolean
filter_nick (const TpCMParamSpec *paramspec,
GValue *value,
GError **error)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5c1133d..295512a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,6 +24,10 @@ AM_CFLAGS = \
@TELEPATHY_CFLAGS@ \
@OPENSSL_CFLAGS@
+AM_LDFLAGS = \
+ $(ERROR_LDFLAGS) \
+ $(NULL)
+
ALL_LIBS = \
@DBUS_LIBS@ \
@GLIB_LIBS@ \
diff --git a/tests/test-ctcp-kill-blingbling.c b/tests/test-ctcp-kill-blingbling.c
index 192fbb7..559282b 100644
--- a/tests/test-ctcp-kill-blingbling.c
+++ b/tests/test-ctcp-kill-blingbling.c
@@ -3,7 +3,9 @@
#include <stdio.h>
#include <string.h>
-int main() {
+int
+main (void)
+{
gboolean fail = FALSE;
const gchar *test_strings[] = {
diff --git a/tests/test-ctcp-tokenize.c b/tests/test-ctcp-tokenize.c
index 6421724..58794d8 100644
--- a/tests/test-ctcp-tokenize.c
+++ b/tests/test-ctcp-tokenize.c
@@ -6,7 +6,9 @@
#include <telepathy-glib/util.h>
-int main() {
+int
+main (void)
+{
gboolean fail = FALSE;
const gchar *test_str = "\001 foo \" fo bar\" bar\\001\\002\\003baz\"for every foo there is \\001 bar\\\\\001";
diff --git a/tests/test-text-encode-and-split.c b/tests/test-text-encode-and-split.c
index 86cf6ac..c0a6083 100644
--- a/tests/test-text-encode-and-split.c
+++ b/tests/test-text-encode-and-split.c
@@ -19,7 +19,7 @@
G_STMT_END
-gboolean
+static gboolean
test (TpChannelTextMessageType type,
gchar *msg)
{