diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2011-06-23 15:46:28 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2011-06-24 15:30:48 +0100 |
commit | 01d600f1f9f52ac7f021fed2a75e6aa8e7168274 (patch) | |
tree | 8bbff13c83d8b0ff2c026edb94decbe7fee6bd7c | |
parent | b2616cbb5e25fcd28dbeaad68055b18a399db8b5 (diff) |
Presence: debug GabblePresenceId names where possible
(I may have missed a few places, but these are the two I came across.)
-rw-r--r-- | src/presence-cache.c | 27 | ||||
-rw-r--r-- | src/presence.c | 11 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/presence-cache.c b/src/presence-cache.c index 6132ed68d..a377047ec 100644 --- a/src/presence-cache.c +++ b/src/presence-cache.c @@ -38,6 +38,7 @@ #include <telepathy-glib/channel-manager.h> #include <telepathy-glib/intset.h> #include <wocky/wocky-caps-cache.h> +#include <wocky/wocky-utils.h> #define DEBUG_FLAG GABBLE_DEBUG_PRESENCE @@ -1956,20 +1957,28 @@ gabble_presence_cache_do_update ( gboolean *update_client_types) { GabblePresenceCachePrivate *priv = cache->priv; - TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( - (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); - const gchar *jid; GabblePresence *presence; GabbleCapabilitySet *old_cap_set; const GabbleCapabilitySet *new_cap_set; gboolean ret = FALSE; - jid = tp_handle_inspect (contact_repo, handle); - DEBUG ("%s (%d) resource %s prio %d presence %d message \"%s\"", - jid, handle, - resource == NULL ? "<null>" : resource, - priority, presence_id, - status_message == NULL ? "<null>" : status_message); + if (DEBUGGING) + { + TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( + (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_CONTACT); + const gchar *jid = tp_handle_inspect (contact_repo, handle); + const gchar *presence_name = wocky_enum_to_nick ( + GABBLE_TYPE_PRESENCE_ID, presence_id); + + if (presence_name == NULL) + presence_name = "plugin-specific, not an element of GabblePresenceId"; + + DEBUG ("%s (%d) resource %s prio %d presence %d (%s) message \"%s\"", + jid, handle, + resource == NULL ? "<null>" : resource, + priority, presence_id, presence_name, + status_message == NULL ? "<null>" : status_message); + } presence = gabble_presence_cache_get (cache, handle); diff --git a/src/presence.c b/src/presence.c index 9447031f9..db279fae2 100644 --- a/src/presence.c +++ b/src/presence.c @@ -23,6 +23,7 @@ #include <string.h> #include <telepathy-glib/channel-manager.h> +#include <wocky/wocky-utils.h> #include "capabilities.h" #include "conn-presence.h" @@ -636,13 +637,19 @@ gabble_presence_dump (GabblePresence *presence) GString *ret = g_string_new (""); gchar *tmp; GabblePresencePrivate *priv = presence->priv; + const gchar *presence_name = wocky_enum_to_nick (GABBLE_TYPE_PRESENCE_ID, + presence->status); + + if (presence_name == NULL) + presence_name = "plugin-specific, not an element of GabblePresenceId"; g_string_append_printf (ret, "nickname: %s\n" - "accumulated status: %d\n" + "accumulated status: %d (%s)\n" "accumulated status msg: %s\n" "kept while unavailable: %d\n", - presence->nickname, presence->status, + presence->nickname, + presence->status, presence_name, presence->status_message, presence->keep_unavailable); |