diff options
-rw-r--r-- | NEWS | 19 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | libmcclient/Makefile.am | 5 | ||||
-rw-r--r-- | mission-control-plugins/Makefile.am | 3 | ||||
-rw-r--r-- | mission-control-plugins/account-storage.c | 28 | ||||
-rw-r--r-- | mission-control-plugins/account.c | 3 | ||||
-rw-r--r-- | mission-control-plugins/dbus-acl.c | 22 | ||||
-rw-r--r-- | mission-control-plugins/debug-internal.h | 24 | ||||
-rw-r--r-- | mission-control-plugins/debug.c | 65 | ||||
-rw-r--r-- | mission-control-plugins/debug.h | 51 | ||||
-rw-r--r-- | mission-control-plugins/loader.c | 26 | ||||
-rw-r--r-- | mission-control-plugins/mission-control-plugins.h | 1 | ||||
-rw-r--r-- | plugins/mcp-dbus-aegis-acl.c | 45 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/mcd-account-manager-default.c | 5 | ||||
-rw-r--r-- | src/mcd-account-manager-default.h | 2 | ||||
-rw-r--r-- | src/mcd-account-manager-sso.h | 2 | ||||
-rw-r--r-- | src/mcd-account-manager.h | 2 | ||||
-rw-r--r-- | src/mcd-account.h | 3 | ||||
-rw-r--r-- | src/mcd-connection.c | 5 | ||||
-rw-r--r-- | src/mcd-debug.c | 1 | ||||
-rw-r--r-- | src/mcd-dispatch-operation.c | 12 | ||||
-rw-r--r-- | tools/header-checks.am | 9 |
23 files changed, 256 insertions, 83 deletions
@@ -1,6 +1,8 @@ -telepathy-mission-control 5.8.0 (UNRELEASED) +telepathy-mission-control 5.8.0 (2011-07-22) ============================================ +The "It's a big ball of... branchy-wanchy stuff" release + Fixes: • Fix the regression tests to pass under newer telepathy-glib versions @@ -23,6 +25,21 @@ Fixes: not correctly handle all internal requests which should have been dispatched to an existing channel (fledermaus) +• The McdTransport framework should have considered "no plugins" to be + equivalent to "proceed", not "abort" (fledermaus) + +• Some files were missing G_END_DECLS, which broke C++ includes (fledermaus) + +• The Aegis ACL plugin needs to activate inactive handlers if they are + not runnng, as you cannot check the aegis credentials of a DBus name + alone, a PID or DBus connection is required (fledermaus) + +Enhancements: + +• Centralised debug control for MCP plugins via MCP_DEBUG environment + variable (and macro + flags so out-of-tree plugins can take advantage + of same) (fledermaus) + telepathy-mission-control 5.7.11 (2011-05-11) ============================================ diff --git a/configure.ac b/configure.ac index 88a42cfa..606aa0e6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl Set the version number to e.g. 5.0.beta42 immediately before a release. dnl Set the version number to e.g. 5.0.beta42+ immediately after (this will dnl enable -Werror). -AC_INIT([telepathy-mission-control], [5.7.11+]) +AC_INIT([telepathy-mission-control], [5.8.0]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(Makefile.am) diff --git a/libmcclient/Makefile.am b/libmcclient/Makefile.am index 4a64e3df..7a085963 100644 --- a/libmcclient/Makefile.am +++ b/libmcclient/Makefile.am @@ -204,3 +204,8 @@ _gen/svc-%.c _gen/svc-%.h: _gen/%.xml \ --not-implemented-func='tp_dbus_g_method_return_not_implemented' \ --allow-unstable \ $< Mc_Svc_ + +include ../tools/header-checks.am + +check-local: header-decl-macro-check + diff --git a/mission-control-plugins/Makefile.am b/mission-control-plugins/Makefile.am index 513aab64..d44583a3 100644 --- a/mission-control-plugins/Makefile.am +++ b/mission-control-plugins/Makefile.am @@ -22,6 +22,7 @@ plugins_include_HEADERS = \ account.h \ account-storage.h \ dbus-acl.h \ + debug.h \ dispatch-operation.h \ dispatch-operation-policy.h \ loader.h \ @@ -44,6 +45,8 @@ nodist_libmission_control_plugins_la_SOURCES = \ libmission_control_plugins_la_SOURCES = \ debug-internal.h \ + debug.h \ + debug.c \ account.c \ account-storage.c \ dbus-acl.c \ diff --git a/mission-control-plugins/account-storage.c b/mission-control-plugins/account-storage.c index b4eaaeef..354f121e 100644 --- a/mission-control-plugins/account-storage.c +++ b/mission-control-plugins/account-storage.c @@ -78,18 +78,20 @@ #include <mission-control-plugins/mission-control-plugins.h> #include <mission-control-plugins/mcp-signals-marshal.h> #include <mission-control-plugins/implementation.h> +#include <mission-control-plugins/debug-internal.h> #include <glib.h> +#define MCP_DEBUG_TYPE MCP_DEBUG_ACCOUNT_STORAGE + #ifdef ENABLE_DEBUG -#define DEBUG(_p, _format, ...) \ - if (g_getenv ("MC_STORAGE_DEBUG") != NULL) \ - g_debug ("%s: %s: " _format, G_STRFUNC, \ +#define SDEBUG(_p, _format, ...) \ + DEBUG("%s: " _format, \ (_p != NULL) ? mcp_account_storage_name (_p) : "NULL", ##__VA_ARGS__) #else /* ENABLE_DEBUG */ -#define DEBUG(_p, _format, ...) do {} while (0); +#define SDEBUG(_p, _format, ...) do {} while (0); #endif /* ENABLE_DEBUG */ @@ -397,7 +399,7 @@ mcp_account_storage_get (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, ""); + SDEBUG (storage, ""); g_return_val_if_fail (iface != NULL, FALSE); return iface->get (storage, am, account, key); @@ -429,7 +431,7 @@ mcp_account_storage_set (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, ""); + SDEBUG (storage, ""); g_return_val_if_fail (iface != NULL, FALSE); return iface->set (storage, am, account, key, val); @@ -466,7 +468,7 @@ mcp_account_storage_delete (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, ""); + SDEBUG (storage, ""); g_return_val_if_fail (iface != NULL, FALSE); return iface->delete (storage, am, account, key); @@ -498,7 +500,7 @@ mcp_account_storage_commit (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, "committing all accounts"); + SDEBUG (storage, "committing all accounts"); g_return_val_if_fail (iface != NULL, FALSE); if (iface->commit != NULL) @@ -511,7 +513,7 @@ mcp_account_storage_commit (const McpAccountStorage *storage, } else { - DEBUG (storage, + SDEBUG (storage, "neither commit nor commit_one is implemented; cannot save accounts"); return FALSE; } @@ -538,7 +540,7 @@ mcp_account_storage_commit_one (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, "called for %s", account ? account : "<all accounts>"); + SDEBUG (storage, "called for %s", account ? account : "<all accounts>"); g_return_val_if_fail (iface != NULL, FALSE); if (iface->commit_one != NULL) @@ -566,7 +568,7 @@ mcp_account_storage_list (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, ""); + SDEBUG (storage, ""); g_return_val_if_fail (iface != NULL, NULL); return iface->list (storage, am); @@ -612,7 +614,7 @@ mcp_account_storage_get_identifier (const McpAccountStorage *storage, { McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); - DEBUG (storage, ""); + SDEBUG (storage, ""); g_return_if_fail (iface != NULL); g_return_if_fail (identifier != NULL); g_return_if_fail (!G_IS_VALUE (identifier)); @@ -646,7 +648,7 @@ mcp_account_storage_get_additional_info (const McpAccountStorage *storage, McpAccountStorageIface *iface = MCP_ACCOUNT_STORAGE_GET_IFACE (storage); GHashTable *ret = NULL; - DEBUG (storage, ""); + SDEBUG (storage, ""); g_return_val_if_fail (iface != NULL, FALSE); if (iface->get_additional_info != NULL) diff --git a/mission-control-plugins/account.c b/mission-control-plugins/account.c index fda29e4a..849c3204 100644 --- a/mission-control-plugins/account.c +++ b/mission-control-plugins/account.c @@ -20,6 +20,9 @@ #include <mission-control-plugins/mission-control-plugins.h> #include <mission-control-plugins/implementation.h> +#include <mission-control-plugins/debug-internal.h> + +#define MCP_DEBUG_TYPE MCP_DEBUG_ACCOUNT /** * SECTION:account diff --git a/mission-control-plugins/dbus-acl.c b/mission-control-plugins/dbus-acl.c index 4c1a2663..82ef0a27 100644 --- a/mission-control-plugins/dbus-acl.c +++ b/mission-control-plugins/dbus-acl.c @@ -58,22 +58,16 @@ #include "config.h" #include <mission-control-plugins/mission-control-plugins.h> +#include <mission-control-plugins/debug-internal.h> #include <mission-control-plugins/mcp-signals-marshal.h> #include <glib.h> #include <telepathy-glib/telepathy-glib.h> -#ifdef ENABLE_DEBUG - -#define DEBUG(_p, _format, ...) \ - g_debug ("dbus-acl: %s: %s: " _format, G_STRFUNC, \ +#define MCP_DEBUG_TYPE MCP_DEBUG_DBUS_ACL +#define ACL_DEBUG(_p, _format, ...) \ + DEBUG("%s: " _format, \ (_p != NULL) ? mcp_dbus_acl_name (_p) : "-", ##__VA_ARGS__) -#else /* ENABLE_DEBUG */ - -#define DEBUG(_p, _format, ...) do {} while (0); - -#endif /* ENABLE_DEBUG */ - /** * McpDBusAclIface: * @parent: the parent type @@ -266,7 +260,7 @@ mcp_dbus_acl_authorised (const TpDBusDaemon *dbus, McpDBusAcl *plugin = MCP_DBUS_ACL (p->data); McpDBusAclIface *iface = MCP_DBUS_ACL_GET_IFACE (p->data); - DEBUG (plugin, "checking ACL for %s", name); + ACL_DEBUG (plugin, "checking ACL for %s", name); if (iface->authorised != NULL) permitted = iface->authorised (plugin, dbus, context, type, name, params); @@ -312,7 +306,7 @@ mcp_dbus_acl_authorised_async_step (DBusAclAuthData *ad, McpDBusAclIface *iface = MCP_DBUS_ACL_GET_IFACE (plugin); if (ad->acl != NULL) - DEBUG (ad->acl, "passed ACL for %s", ad->name); + ACL_DEBUG (ad->acl, "passed ACL for %s", ad->name); /* take the next plugin off the next_acl list */ ad->next_acl = g_list_next (ad->next_acl); @@ -330,7 +324,7 @@ mcp_dbus_acl_authorised_async_step (DBusAclAuthData *ad, } if (ad->acl != NULL) - DEBUG (ad->acl, "passed final ACL for %s", ad->name); + ACL_DEBUG (ad->acl, "passed final ACL for %s", ad->name); ad->handler (ad->context, ad->data); } @@ -403,7 +397,7 @@ mcp_dbus_acl_authorised_async (TpDBusDaemon *dbus, ad->handler = handler; ad->next_acl = acls; - DEBUG (NULL, "DBus access ACL verification: %u rules for %s", + ACL_DEBUG (NULL, "DBus access ACL verification: %u rules for %s", g_list_length (acls), name); mcp_dbus_acl_authorised_async_step (ad, TRUE); diff --git a/mission-control-plugins/debug-internal.h b/mission-control-plugins/debug-internal.h index ff6440c4..c02e86b7 100644 --- a/mission-control-plugins/debug-internal.h +++ b/mission-control-plugins/debug-internal.h @@ -24,31 +24,21 @@ #include "config.h" #include <glib.h> +#include <mission-control-plugins/debug.h> -G_BEGIN_DECLS - -gboolean _mcp_is_debugging (void); -void _mcp_debug (const gchar *format, ...) G_GNUC_PRINTF (1, 2); - -G_END_DECLS +#ifdef DEBUG +#undef DEBUG +#endif #ifdef ENABLE_DEBUG -#undef DEBUG #define DEBUG(format, ...) \ - _mcp_debug ("%s: " format, G_STRFUNC, ##__VA_ARGS__) + MCP_DEBUG (MCP_DEBUG_TYPE, format, ##__VA_ARGS__) -#undef DEBUGGING -#define DEBUGGING _mcp_is_debugging () +#else -#else /* !defined (ENABLE_DEBUG) */ - -#undef DEBUG #define DEBUG(format, ...) do {} while (0) -#undef DEBUGGING -#define DEBUGGING 0 - -#endif /* !defined (ENABLE_DEBUG) */ +#endif #endif diff --git a/mission-control-plugins/debug.c b/mission-control-plugins/debug.c new file mode 100644 index 00000000..af0f1df1 --- /dev/null +++ b/mission-control-plugins/debug.c @@ -0,0 +1,65 @@ +/* Mission Control plugin API - plugin debug infrastructure + * + * Copyright © 2011 Nokia Corporation + * Copyright © 2011 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <config.h> +#include <mission-control-plugins/mission-control-plugins.h> + +static McpDebugFlags debug_flags; + +static GDebugKey const keys[] = { + { "account", MCP_DEBUG_ACCOUNT }, + { "account-storage", MCP_DEBUG_ACCOUNT_STORAGE }, + { "dbus-acl", MCP_DEBUG_DBUS_ACL }, + { "dispatch-operation", MCP_DEBUG_DISPATCH_OPERATION }, + { "dispatch-operation-policy", MCP_DEBUG_DISPATCH_OPERATION_POLICY }, + { "loader", MCP_DEBUG_LOADER }, + { "request", MCP_DEBUG_REQUEST }, + { "request-policy", MCP_DEBUG_REQUEST_POLICY }, + { NULL, 0 } +}; + +void +mcp_debug_init (void) +{ + const gchar *p_debug = g_getenv ("MCP_DEBUG"); + const gchar *d_debug = g_getenv ("MC_DEBUG"); + const gchar *debug = NULL; + + debug_flags = MCP_DEBUG_NONE; + + if (p_debug != NULL) + debug = p_debug; + else if (g_strcmp0 ("all", d_debug) == 0) + debug = d_debug; + else + return; + + debug_flags = g_parse_debug_string (debug, keys, G_N_ELEMENTS (keys) - 1); +} + +gboolean +mcp_is_debugging (McpDebugFlags flags) +{ +#ifdef ENABLE_DEBUG + return (flags & debug_flags) != 0; +#else + return FALSE; +#endif +} diff --git a/mission-control-plugins/debug.h b/mission-control-plugins/debug.h new file mode 100644 index 00000000..909631c1 --- /dev/null +++ b/mission-control-plugins/debug.h @@ -0,0 +1,51 @@ +/* Mission Control plugin API - for plugin debug messages + * + * Copyright © 2011 Nokia Corporation + * Copyright © 2011 Collabora Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef MCP_DEBUG_H +#define MCP_DEBUG_H + +#ifndef _MCP_IN_MISSION_CONTROL_PLUGINS_H +#error Use <mission-control-plugins/mission-control-plugins.h> instead +#endif + +#define MCP_DEBUG(_type, _fmt, ...) \ + G_STMT_START { if (mcp_is_debugging (_type)) \ + g_debug ("%s: " _fmt, G_STRLOC, ##__VA_ARGS__); } G_STMT_END + +G_BEGIN_DECLS + +typedef enum { + MCP_DEBUG_NONE = 0, + MCP_DEBUG_ACCOUNT = 1 << 0, + MCP_DEBUG_ACCOUNT_STORAGE = 1 << 1, + MCP_DEBUG_DBUS_ACL = 1 << 2, + MCP_DEBUG_DISPATCH_OPERATION = 1 << 3, + MCP_DEBUG_DISPATCH_OPERATION_POLICY = 1 << 4, + MCP_DEBUG_LOADER = 1 << 5, + MCP_DEBUG_REQUEST = 1 << 6, + MCP_DEBUG_REQUEST_POLICY = 1 << 7, +} McpDebugFlags; + +gboolean mcp_is_debugging (McpDebugFlags type); +void mcp_debug_init (void); + +G_END_DECLS + +#endif diff --git a/mission-control-plugins/loader.c b/mission-control-plugins/loader.c index 78765f46..4336c082 100644 --- a/mission-control-plugins/loader.c +++ b/mission-control-plugins/loader.c @@ -43,10 +43,15 @@ #include <gmodule.h> #include <mission-control-plugins/mission-control-plugins.h> -#include <mission-control-plugins/debug-internal.h> +#include <mission-control-plugins/debug.h> static gboolean debugging = FALSE; +#undef DEBUG +#define DEBUG(format, ...) \ + G_STMT_START { if (debugging || mcp_is_debugging (MCP_DEBUG_LOADER)) \ + g_debug ("%s" format, G_STRLOC, ##__VA_ARGS__); } G_STMT_END + /** * mcp_set_debug: * @debug: whether to log debug output @@ -60,25 +65,6 @@ mcp_set_debug (gboolean debug) debugging = debug; } -gboolean -_mcp_is_debugging (void) -{ - return debugging; -} - -void -_mcp_debug (const gchar *format, ...) -{ - if (debugging) - { - va_list args; - - va_start (args, format); - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format, args); - va_end (args); - } -} - static GList *plugins = NULL; /** diff --git a/mission-control-plugins/mission-control-plugins.h b/mission-control-plugins/mission-control-plugins.h index 40d8ff09..8b6d9c8e 100644 --- a/mission-control-plugins/mission-control-plugins.h +++ b/mission-control-plugins/mission-control-plugins.h @@ -33,6 +33,7 @@ #include <mission-control-plugins/loader.h> #include <mission-control-plugins/request.h> #include <mission-control-plugins/request-policy.h> +#include <mission-control-plugins/debug.h> #undef _MCP_IN_MISSION_CONTROL_PLUGINS_H #endif diff --git a/plugins/mcp-dbus-aegis-acl.c b/plugins/mcp-dbus-aegis-acl.c index 1f5b1b4e..b67a8681 100644 --- a/plugins/mcp-dbus-aegis-acl.c +++ b/plugins/mcp-dbus-aegis-acl.c @@ -26,11 +26,7 @@ #endif #define G_LOG_DOMAIN "mission-control-DBus-Access-ACL" -#ifdef ENABLE_DEBUG -#define DEBUG(_f, ...) g_debug ("%s: " _f, G_STRLOC, ##__VA_ARGS__) -#else -#define DEBUG(_f, ...) do {} while (0) -#endif +#define DEBUG(_f, ...) MCP_DEBUG (MCP_DEBUG_DBUS_ACL, _f, ##__VA_ARGS__) #include <dbus/dbus-glib.h> #include <telepathy-glib/interfaces.h> @@ -200,7 +196,8 @@ caller_creds_are_enough (const gchar *name, static gboolean check_peer_creds_sync (DBusGConnection *dgc, - const gchar *bus_name) + const gchar *bus_name, + gboolean activate) { DBusGProxy *proxy = dbus_g_proxy_new_for_name (dgc, DBUS_SERVICE_DBUS, @@ -208,7 +205,7 @@ check_peer_creds_sync (DBusGConnection *dgc, AEGIS_INTERFACE); GArray *au = NULL; GError *error = NULL; - gboolean ok; + gboolean ok = FALSE; if (dbus_g_proxy_call (proxy, "GetConnectionCredentials", &error, G_TYPE_STRING, bus_name, @@ -219,6 +216,34 @@ check_peer_creds_sync (DBusGConnection *dgc, ok = caller_creds_are_enough (bus_name, au); g_array_unref (au); } + else if (activate && error->code == DBUS_GERROR_NAME_HAS_NO_OWNER) + { + guint status; + GError *start_error = NULL; + DBusGProxy *dbus = dbus_g_proxy_new_for_name (dgc, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + + DEBUG ("Trying to activate %s for aegis credentials check", bus_name); + if (dbus_g_proxy_call (dbus, "StartServiceByName", &start_error, + G_TYPE_STRING, bus_name, + G_TYPE_UINT, 0, + G_TYPE_INVALID, + G_TYPE_UINT, &status, + G_TYPE_INVALID)) + { + ok = check_peer_creds_sync (dgc, bus_name, FALSE); + } + else + { + DEBUG ("GetConnectionCredentials failed: %s", start_error->message); + g_clear_error (&start_error); + } + + g_object_unref (dbus); + g_clear_error (&error); + } else { DEBUG ("GetConnectionCredentials failed: %s", error->message); @@ -245,7 +270,7 @@ caller_authorised (const McpDBusAcl *self, { gchar *caller = dbus_g_method_get_sender ((DBusGMethodInvocation *) call); - ok = check_peer_creds_sync (dgc, caller); + ok = check_peer_creds_sync (dgc, caller, FALSE); g_free (caller); } @@ -376,14 +401,14 @@ handler_is_suitable_async (McpDispatchOperationPolicy *self, if (!tp_str_empty (unique_name)) { ok = check_peer_creds_sync (tp_proxy_get_dbus_connection (dbus), - unique_name); + unique_name, TRUE); } else { g_assert (recipient != NULL); ok = check_peer_creds_sync (tp_proxy_get_dbus_connection (dbus), - tp_proxy_get_bus_name (recipient)); + tp_proxy_get_bus_name (recipient), TRUE); } if (!ok) diff --git a/src/Makefile.am b/src/Makefile.am index dbc10d3d..9637fbd8 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -358,3 +358,7 @@ _gen/svc-%.c _gen/svc-%.h: _gen/%.xml \ --not-implemented-func='tp_dbus_g_method_return_not_implemented' \ --allow-unstable \ $< Mc_Svc_ + +include ../tools/header-checks.am + +check-local: header-decl-macro-check diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c index 7cfdd2aa..9e811045 100644 --- a/src/mcd-account-manager-default.c +++ b/src/mcd-account-manager-default.c @@ -418,7 +418,10 @@ _set (const McpAccountStorage *self, g_key_file_remove_key (amd->removed, account, key, NULL); #else - g_key_file_set_value (amd->keyfile, account, key, val); + if (val != NULL) + g_key_file_set_value (amd->keyfile, account, key, val); + else + g_key_file_remove_key (amd->keyfile, account, key, NULL); #endif diff --git a/src/mcd-account-manager-default.h b/src/mcd-account-manager-default.h index 06541d5a..99635bf9 100644 --- a/src/mcd-account-manager-default.h +++ b/src/mcd-account-manager-default.h @@ -71,4 +71,6 @@ GType mcd_account_manager_default_get_type (void) G_GNUC_CONST; McdAccountManagerDefault *mcd_account_manager_default_new (void); +G_END_DECLS + #endif diff --git a/src/mcd-account-manager-sso.h b/src/mcd-account-manager-sso.h index c4c6e8ad..108d0704 100644 --- a/src/mcd-account-manager-sso.h +++ b/src/mcd-account-manager-sso.h @@ -97,4 +97,6 @@ gboolean _mcd_account_manager_sso_get ( const gchar *account_suffix, const gchar *key); +G_END_DECLS + #endif diff --git a/src/mcd-account-manager.h b/src/mcd-account-manager.h index f9edf844..1d2bd19e 100644 --- a/src/mcd-account-manager.h +++ b/src/mcd-account-manager.h @@ -99,4 +99,6 @@ McdAccount *mcd_account_manager_lookup_account_by_path (McdAccountManager *accou McdStorage *mcd_account_manager_get_storage (McdAccountManager *manager); +G_END_DECLS + #endif diff --git a/src/mcd-account.h b/src/mcd-account.h index f81812f8..61689b4a 100644 --- a/src/mcd-account.h +++ b/src/mcd-account.h @@ -140,4 +140,7 @@ gboolean mcd_account_parameter_is_secret (McdAccount *self, const gchar *name); void mcd_account_property_changed (McdAccount *account, const gchar *name); + +G_END_DECLS + #endif diff --git a/src/mcd-connection.c b/src/mcd-connection.c index 9c50dce9..3aaf37cc 100644 --- a/src/mcd-connection.c +++ b/src/mcd-connection.c @@ -2854,7 +2854,10 @@ _mcd_connection_presence_info_is_ready (McdConnection *self) static void clear_emergency_handles (McdConnectionPrivate *priv) { - guint n_handles = tp_intset_size (priv->emergency.handles); + guint n_handles = 0; + + if (priv->emergency.handles != NULL) + n_handles = tp_intset_size (priv->emergency.handles); /* trawl through the handles and unref them */ if (n_handles > 0) diff --git a/src/mcd-debug.c b/src/mcd-debug.c index 2ad57790..350299bc 100644 --- a/src/mcd-debug.c +++ b/src/mcd-debug.c @@ -161,6 +161,7 @@ void mcd_debug_init () } mcp_set_debug ((mcd_debug_level >= 1)); + mcp_debug_init (); tp_debug_divert_messages (g_getenv ("MC_LOGFILE")); diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c index cb1e83a3..a2b60666 100644 --- a/src/mcd-dispatch-operation.c +++ b/src/mcd-dispatch-operation.c @@ -2009,8 +2009,10 @@ collect_satisfied_requests (const GList *channels, } satisfied_requests = g_ptr_array_sized_new (g_hash_table_size (set)); + g_ptr_array_set_free_func (satisfied_requests, g_free); + request_properties = g_hash_table_new_full (g_str_hash, g_str_equal, - NULL, (GDestroyNotify) g_hash_table_unref); + g_free, (GDestroyNotify) g_hash_table_unref); g_hash_table_iter_init (&it, set); @@ -2018,12 +2020,14 @@ collect_satisfied_requests (const GList *channels, { GHashTable *props; - g_ptr_array_add (satisfied_requests, path); + g_ptr_array_add (satisfied_requests, g_strdup (path)); props = _mcd_request_dup_immutable_properties (value); g_assert (props != NULL); - g_hash_table_insert (request_properties, path, props); + g_hash_table_insert (request_properties, g_strdup (path), props); } + g_hash_table_unref (set); + if (paths_out != NULL) *paths_out = satisfied_requests; else @@ -2110,8 +2114,6 @@ _mcd_dispatch_operation_run_observers (McdDispatchOperation *self) observe_channels_cb, g_object_ref (self), g_object_unref, NULL); - /* don't free the individual object paths, which are borrowed from the - * McdChannel objects */ g_ptr_array_unref (satisfied_requests); _mcd_tp_channel_details_free (channels_array); diff --git a/tools/header-checks.am b/tools/header-checks.am new file mode 100644 index 00000000..af94dda3 --- /dev/null +++ b/tools/header-checks.am @@ -0,0 +1,9 @@ +header-decl-macro-check: $(filter %.h,$(DIST_SOURCES)) + @(for H in $^; \ + do \ + if [ x"$$(grep -l G_BEGIN_DECLS $$H)" != x"$$(grep -l G_END_DECLS $$H)" ]; \ + then \ + echo Unbalanced G_\*_DECL macros in $$H; \ + exit 1; \ + fi;\ + done) |