Mercurial > pidgin.yaz
changeset 29215:07ec4a569da1
ft: Add some useful debug logging.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 30 Dec 2009 23:00:54 +0000 |
parents | 24b341ae63f7 |
children | 0c5995395579 |
files | libpurple/ft.c |
diffstat | 1 files changed, 45 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/ft.c Mon Dec 28 21:19:51 2009 +0000 +++ b/libpurple/ft.c Wed Dec 30 23:00:54 2009 +0000 @@ -69,6 +69,30 @@ g_free(priv); } +static const gchar * +purple_xfer_status_type_to_string(PurpleXferStatusType type) +{ + static const struct { + PurpleXferStatusType type; + const char *name; + } type_names[] = { + { PURPLE_XFER_STATUS_UNKNOWN, "unknown" }, + { PURPLE_XFER_STATUS_NOT_STARTED, "not started" }, + { PURPLE_XFER_STATUS_ACCEPTED, "accepted" }, + { PURPLE_XFER_STATUS_STARTED, "started" }, + { PURPLE_XFER_STATUS_DONE, "done" }, + { PURPLE_XFER_STATUS_CANCEL_LOCAL, "cancelled locally" }, + { PURPLE_XFER_STATUS_CANCEL_REMOTE, "cancelled remotely" } + }; + int i; + + for (i = 0; i < G_N_ELEMENTS(type_names); ++i) + if (type_names[i].type == type) + return type_names[i].name; + + return "invalid state"; +} + GList * purple_xfers_get_all() { @@ -180,6 +204,11 @@ { g_return_if_fail(xfer != NULL); + if (purple_debug_is_verbose()) + purple_debug_info("xfer", "Changing status of xfer %p from %s to %s\n", + xfer, purple_xfer_status_type_to_string(xfer->status), + purple_xfer_status_type_to_string(status)); + if (xfer->status == status) return; @@ -539,6 +568,8 @@ type = purple_xfer_get_type(xfer); account = purple_xfer_get_account(xfer); + purple_debug_misc("xfer", "request accepted for %p\n", xfer); + if (!filename && type == PURPLE_XFER_RECEIVE) { xfer->status = PURPLE_XFER_STATUS_ACCEPTED; xfer->ops.init(xfer); @@ -616,6 +647,8 @@ { g_return_if_fail(xfer != NULL); + purple_debug_misc("xfer", "xfer %p denied\n", xfer); + if (xfer->ops.request_denied != NULL) xfer->ops.request_denied(xfer); @@ -1144,6 +1177,8 @@ purple_input_remove(xfer->watcher); xfer->watcher = 0; + + purple_debug_misc("xfer", "prpl is ready on ft %p, waiting for UI\n", xfer); return; } } @@ -1206,8 +1241,12 @@ priv = g_hash_table_lookup(xfers_data, xfer); priv->ready |= PURPLE_XFER_READY_UI; - if (0 == (priv->ready & PURPLE_XFER_READY_PRPL)) + if (0 == (priv->ready & PURPLE_XFER_READY_PRPL)) { + purple_debug_misc("xfer", "UI is ready on ft %p, waiting for prpl\n", xfer); return; + } + + purple_debug_misc("xfer", "UI (and prpl) ready on ft %p, so proceeding\n", xfer); type = purple_xfer_get_type(xfer); if (type == PURPLE_XFER_SEND) @@ -1234,8 +1273,12 @@ priv->ready |= PURPLE_XFER_READY_PRPL; /* I don't think fwrite/fread are ever *not* ready */ - if (xfer->dest_fp == NULL && 0 == (priv->ready & PURPLE_XFER_READY_UI)) + if (xfer->dest_fp == NULL && 0 == (priv->ready & PURPLE_XFER_READY_UI)) { + purple_debug_misc("xfer", "prpl is ready on ft %p, waiting for UI\n", xfer); return; + } + + purple_debug_misc("xfer", "Prpl (and UI) ready on ft %p, so proceeding\n", xfer); priv->ready = PURPLE_XFER_READY_NONE;