[evolution-mapi] Better debugging of named properties; also do not use g_debug() anymore
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-mapi] Better debugging of named properties; also do not use g_debug() anymore
- Date: Thu, 11 Aug 2011 14:59:08 +0000 (UTC)
commit 10ac3df1cba9780a90408555024ac972d1f5e53c
Author: Milan Crha <mcrha redhat com>
Date: Thu Aug 11 16:55:10 2011 +0200
Better debugging of named properties; also do not use g_debug() anymore
.../exchange-mapi-account-listener.c | 2 +-
.../exchange-mapi-account-setup.c | 2 +-
src/addressbook/e-book-backend-mapi.c | 2 +-
src/camel/camel-mapi-folder.c | 2 +-
src/libexchangemapi/Makefile.am | 3 +
src/libexchangemapi/exchange-mapi-cal-utils.c | 6 +-
src/libexchangemapi/exchange-mapi-connection.c | 221 +++---
src/libexchangemapi/exchange-mapi-connection.h | 1 +
src/libexchangemapi/exchange-mapi-debug.c | 851 ++++++++++++++++++++
src/libexchangemapi/exchange-mapi-debug.h | 35 +
src/libexchangemapi/exchange-mapi-mail-utils.c | 2 +-
src/libexchangemapi/exchange-mapi-utils.c | 200 -----
src/libexchangemapi/exchange-mapi-utils.h | 3 +-
13 files changed, 1018 insertions(+), 312 deletions(-)
---
diff --git a/src/account-setup-eplugin/exchange-mapi-account-listener.c b/src/account-setup-eplugin/exchange-mapi-account-listener.c
index d5a9174..c7949f5 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-listener.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-listener.c
@@ -1344,7 +1344,7 @@ exchange_mapi_account_listener_construct (ExchangeMAPIAccountListener *config_li
}
}
- d(g_debug ("MAPI listener is constructed with %d listed MAPI accounts ", g_list_length (mapi_accounts)));
+ d(exchange_mapi_debug_print ("MAPI listener is constructed with %d listed MAPI accounts ", g_list_length (mapi_accounts)));
g_signal_connect (config_listener->priv->account_list, "account_added", G_CALLBACK (mapi_account_added), NULL);
g_signal_connect (config_listener->priv->account_list, "account_changed", G_CALLBACK (mapi_account_changed), NULL);
diff --git a/src/account-setup-eplugin/exchange-mapi-account-setup.c b/src/account-setup-eplugin/exchange-mapi-account-setup.c
index 04f540d..914850f 100644
--- a/src/account-setup-eplugin/exchange-mapi-account-setup.c
+++ b/src/account-setup-eplugin/exchange-mapi-account-setup.c
@@ -76,7 +76,7 @@ free_mapi_listener ( void )
gint
e_plugin_lib_enable (EPlugin *ep, gint enable)
{
- d(g_debug ("Loading Exchange MAPI Plugin"));
+ d(exchange_mapi_debug_print ("Loading Exchange MAPI Plugin"));
if (!config_listener) {
config_listener = exchange_mapi_account_listener_new ();
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 9b0c1a5..5bd9fd9 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -171,7 +171,7 @@ ebbm_set_cache_time (EBookBackendMAPI *ebma, glong cache_seconds)
g_free (iso_time);
if (error) {
- g_debug ("%s: Failed to set value: %s", G_STRFUNC, error->message);
+ exchange_mapi_debug_print ("%s: Failed to set value: %s", G_STRFUNC, error->message);
g_error_free (error);
}
}
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 4945d75..4b4b806 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -159,7 +159,7 @@ fetch_items_summary_cb (FetchItemsCallbackData *item_data, gpointer data)
MailItem *item = g_new0(MailItem , 1);
if (camel_debug_start("mapi:folder")) {
- exchange_mapi_debug_property_dump (item_data->properties);
+ exchange_mapi_debug_dump_properties (item_data->conn, item_data->fid, item_data->properties);
camel_debug_end();
}
diff --git a/src/libexchangemapi/Makefile.am b/src/libexchangemapi/Makefile.am
index 1e0e75d..4bfcf6b 100644
--- a/src/libexchangemapi/Makefile.am
+++ b/src/libexchangemapi/Makefile.am
@@ -22,6 +22,8 @@ libexchangemapi_1_0_la_SOURCES = \
exchange-mapi-folder.h \
exchange-mapi-connection.c \
exchange-mapi-connection.h \
+ exchange-mapi-debug.c \
+ exchange-mapi-debug.h \
exchange-mapi-utils.c \
exchange-mapi-utils.h \
exchange-mapi-cal-utils.c \
@@ -51,6 +53,7 @@ libexchangemapiinclude_HEADERS = \
exchange-mapi-defs.h \
exchange-mapi-folder.h \
exchange-mapi-connection.h \
+ exchange-mapi-debug.h \
exchange-mapi-utils.h \
exchange-mapi-cal-utils.h \
exchange-mapi-cal-tz-utils.h \
diff --git a/src/libexchangemapi/exchange-mapi-cal-utils.c b/src/libexchangemapi/exchange-mapi-cal-utils.c
index c86b441..97fbad0 100644
--- a/src/libexchangemapi/exchange-mapi-cal-utils.c
+++ b/src/libexchangemapi/exchange-mapi-cal-utils.c
@@ -271,7 +271,7 @@ exchange_mapi_cal_util_fetch_attachments (ECalComponent *comp, GSList **attach_l
g_mapped_file_free (mapped_file);
#endif
} else if (error) {
- g_debug ("Could not map %s: %s \n", sfname_uri, error->message);
+ exchange_mapi_debug_print ("Could not map %s: %s \n", sfname_uri, error->message);
g_error_free (error);
}
@@ -477,10 +477,10 @@ set_attachments_to_cal_component (ECalComponent *comp, GSList *attach_list, cons
fd = g_open (filename, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0600);
if (fd == -1) {
/* skip gracefully */
- g_debug ("Could not open %s for writing \n", filename);
+ exchange_mapi_debug_print ("Could not open %s for writing \n", filename);
} else if (len && write (fd, attach, len) == -1) {
/* skip gracefully */
- g_debug ("Attachment write failed \n");
+ exchange_mapi_debug_print ("Attachment write failed \n");
}
if (fd != -1) {
close (fd);
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index 54515d0..9ddc906 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -53,8 +53,8 @@ static void ema_global_unlock (void);
G_DEFINE_TYPE (ExchangeMapiConnection, exchange_mapi_connection, G_TYPE_OBJECT)
/* These two macros require 'priv' variable of type ExchangeMapiConnectionPrivate */
-#define LOCK() g_debug ("%s: %s: lock(session/global_lock)", G_STRLOC, G_STRFUNC); g_static_rec_mutex_lock (&priv->session_lock); ema_global_lock();
-#define UNLOCK() g_debug ("%s: %s: unlock(session/global_lock)", G_STRLOC, G_STRFUNC); g_static_rec_mutex_unlock (&priv->session_lock); ema_global_unlock();
+#define LOCK() exchange_mapi_debug_print ("%s: %s: lock(session/global_lock)", G_STRLOC, G_STRFUNC); g_static_rec_mutex_lock (&priv->session_lock); ema_global_lock();
+#define UNLOCK() exchange_mapi_debug_print ("%s: %s: unlock(session/global_lock)", G_STRLOC, G_STRFUNC); g_static_rec_mutex_unlock (&priv->session_lock); ema_global_unlock();
#define e_return_val_mapi_error_if_fail(expr, _code, _val) \
G_STMT_START { \
@@ -368,7 +368,7 @@ exchange_mapi_connection_new (const gchar *profile, const gchar *password, GErro
session = mapi_profile_load (profile, password, perror);
if (!session) {
- g_debug ("%s: %s: Login failed ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: %s: Login failed ", G_STRLOC, G_STRFUNC);
return NULL;
}
@@ -397,7 +397,7 @@ exchange_mapi_connection_new (const gchar *profile, const gchar *password, GErro
priv->has_public_store = FALSE;
UNLOCK ();
- g_debug ("%s: %s: Connected ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: %s: Connected ", G_STRLOC, G_STRFUNC);
return conn;
}
@@ -436,7 +436,7 @@ exchange_mapi_connection_reconnect (ExchangeMapiConnection *conn, const gchar *p
priv->session = mapi_profile_load (priv->profile, password, perror);
if (!priv->session) {
- g_debug ("%s: %s: Login failed ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: %s: Login failed ", G_STRLOC, G_STRFUNC);
UNLOCK ();
return FALSE;
}
@@ -459,7 +459,7 @@ exchange_mapi_connection_reconnect (ExchangeMapiConnection *conn, const gchar *p
UNLOCK ();
- g_debug ("%s: %s: Connected ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: %s: Connected ", G_STRLOC, G_STRFUNC);
return priv->session != NULL;
}
@@ -578,8 +578,8 @@ exchange_mapi_util_read_generic_stream (mapi_object_t *obj_message, const uint32
if (add_stream_from_properties (stream_list, properties, proptag, cpid))
return TRUE;
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
- g_debug("Attempt to read stream for proptag 0x%08X ", proptag);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("Attempt to read stream for proptag 0x%08X ", proptag);
mem_ctx = talloc_init ("ExchangeMAPI_ReadGenericStream");
mapi_object_init(&obj_stream);
@@ -648,7 +648,7 @@ exchange_mapi_util_read_generic_stream (mapi_object_t *obj_message, const uint32
stream->proptag = proptag;
set_stream_value (stream, cpid, buf_data, off_data, FALSE);
- g_debug("Attempt succeeded for proptag 0x%08X (after name conversion) ", stream->proptag);
+ exchange_mapi_debug_print("Attempt succeeded for proptag 0x%08X (after name conversion) ", stream->proptag);
*stream_list = g_slist_append (*stream_list, stream);
}
@@ -657,7 +657,7 @@ cleanup:
mapi_object_release(&obj_stream);
talloc_free (mem_ctx);
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return (ms == MAPI_E_SUCCESS);
}
@@ -699,7 +699,7 @@ exchange_mapi_util_write_generic_streams (mapi_object_t *obj_message, GSList *st
enum MAPISTATUS ms;
gboolean status = TRUE;
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
for (l = stream_list; l; l = l->next) {
ExchangeMAPIStream *stream = (ExchangeMAPIStream *) (l->data);
@@ -760,7 +760,7 @@ exchange_mapi_util_write_generic_streams (mapi_object_t *obj_message, GSList *st
mapi_object_release(&obj_stream);
}
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return status;
}
@@ -812,7 +812,7 @@ exchange_mapi_util_modify_recipients (ExchangeMapiConnection *conn, TALLOC_CTX *
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
SPropTagArray = set_SPropTagArray(mem_ctx, 0xA,
PR_ENTRYID,
@@ -855,7 +855,7 @@ exchange_mapi_util_modify_recipients (ExchangeMapiConnection *conn, TALLOC_CTX *
if (FlagList->aulPropTag[i] == MAPI_AMBIGUOUS) {
/* We should never get an ambiguous resolution as we use the email-id for resolving.
* However, if we do still get an ambiguous entry, we can't handle it :-( */
- g_debug ("%s: %s() - '%s' is ambiguous ", G_STRLOC, G_STRFUNC, recipient->email_id);
+ exchange_mapi_debug_print ("%s: %s() - '%s' is ambiguous ", G_STRLOC, G_STRFUNC, recipient->email_id);
} else if (FlagList->aulPropTag[i] == MAPI_UNRESOLVED) {
/* If the recipient is unresolved, consider it is a SMTP one */
SRowSet->aRow = talloc_realloc(mem_ctx, SRowSet->aRow, struct SRow, SRowSet->cRows + 1);
@@ -888,7 +888,7 @@ exchange_mapi_util_modify_recipients (ExchangeMapiConnection *conn, TALLOC_CTX *
cleanup:
g_free (users);
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return TRUE;
}
@@ -905,7 +905,7 @@ exchange_mapi_util_delete_attachments (mapi_object_t *obj_message, GError **perr
uint32_t i_row_attach;
gboolean status = TRUE;
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
mem_ctx = talloc_init ("ExchangeMAPI_DeleteAttachments");
@@ -964,7 +964,7 @@ cleanup:
mapi_object_release(&obj_tb_attach);
talloc_free (mem_ctx);
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return status;
}
@@ -977,7 +977,7 @@ exchange_mapi_util_set_attachments (ExchangeMapiConnection *conn, mapi_id_t fid,
enum MAPISTATUS ms;
gboolean status = FALSE;
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
if (remove_existing)
exchange_mapi_util_delete_attachments (obj_message, NULL);
@@ -1097,7 +1097,7 @@ exchange_mapi_util_set_attachments (ExchangeMapiConnection *conn, mapi_id_t fid,
mapi_object_release(&obj_attach);
}
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return status;
}
@@ -1187,7 +1187,7 @@ exchange_mapi_util_get_attachments (ExchangeMapiConnection *conn, mapi_id_t fid,
uint32_t i_row_attach;
gboolean status = TRUE;
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
mem_ctx = talloc_init ("ExchangeMAPI_GetAttachments");
@@ -1329,7 +1329,7 @@ cleanup:
mapi_object_release(&obj_tb_attach);
talloc_free (mem_ctx);
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return status;
}
@@ -1438,7 +1438,7 @@ exchange_mapi_util_get_recipients (ExchangeMapiConnection *conn, mapi_object_t *
uint32_t i_row_recip;
gboolean status = TRUE;
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
/* fetch recipient table */
ms = GetRecipientTable (obj_message, &rows_recip, &proptags);
@@ -1500,7 +1500,7 @@ cleanup:
if (ms != MAPI_E_SUCCESS)
status = FALSE;
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return status;
}
@@ -1552,7 +1552,7 @@ exchange_mapi_connection_check_restriction (ExchangeMapiConnection *conn, mapi_i
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, NULL);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, NULL);
- g_debug("%s: Entering %s: folder-id %016" G_GINT64_MODIFIER "X ", G_STRLOC, G_STRFUNC, fid);
+ exchange_mapi_debug_print("%s: Entering %s: folder-id %016" G_GINT64_MODIFIER "X ", G_STRLOC, G_STRFUNC, fid);
LOCK ();
mem_ctx = talloc_init("ExchangeMAPI_CheckRestriction");
@@ -1635,7 +1635,7 @@ cleanup:
talloc_free (mem_ctx);
UNLOCK();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return mids;
}
@@ -1659,7 +1659,7 @@ exchange_mapi_connection_fetch_items (ExchangeMapiConnection *conn, mapi_id_t
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s: folder-id %016" G_GINT64_MODIFIER "X ", G_STRLOC, G_STRFUNC, fid);
+ exchange_mapi_debug_print("%s: Entering %s: folder-id %016" G_GINT64_MODIFIER "X ", G_STRLOC, G_STRFUNC, fid);
LOCK ();
mem_ctx = talloc_init("ExchangeMAPI_FetchItems");
@@ -1887,7 +1887,7 @@ exchange_mapi_connection_fetch_items (ExchangeMapiConnection *conn, mapi_id_t
talloc_free (mem_ctx);
UNLOCK ();
- g_debug("%s: Leaving %s: folder-id %016" G_GINT64_MODIFIER "X ", G_STRLOC, G_STRFUNC, fid);
+ exchange_mapi_debug_print("%s: Leaving %s: folder-id %016" G_GINT64_MODIFIER "X ", G_STRLOC, G_STRFUNC, fid);
return result;
}
@@ -1911,7 +1911,7 @@ exchange_mapi_connection_fetch_object_props (ExchangeMapiConnection *conn, mapi_
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s: folder %p message %p", G_STRLOC, G_STRFUNC, obj_folder, obj_message);
+ exchange_mapi_debug_print("%s: Entering %s: folder %p message %p", G_STRLOC, G_STRFUNC, obj_folder, obj_message);
LOCK ();
mem_ctx = talloc_init("ExchangeMAPI_FetchObjectProps");
@@ -2022,7 +2022,7 @@ cleanup:
talloc_free (mem_ctx);
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2042,7 +2042,7 @@ exchange_mapi_connection_fetch_item (ExchangeMapiConnection *conn, mapi_id_t fid
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s: folder-id %016" G_GINT64_MODIFIER "X message-id %016" G_GINT64_MODIFIER "X",
+ exchange_mapi_debug_print("%s: Entering %s: folder-id %016" G_GINT64_MODIFIER "X message-id %016" G_GINT64_MODIFIER "X",
G_STRLOC, G_STRFUNC, fid, mid);
LOCK ();
@@ -2072,7 +2072,7 @@ cleanup:
talloc_free (mem_ctx);
UNLOCK ();
- g_debug ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2090,7 +2090,7 @@ exchange_mapi_connection_create_folder (ExchangeMapiConnection *conn, uint32_t o
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, 0);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, 0);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
mapi_object_init(&obj_top);
@@ -2139,7 +2139,7 @@ exchange_mapi_connection_create_folder (ExchangeMapiConnection *conn, uint32_t o
}
fid = mapi_object_get_id (&obj_folder);
- g_debug("Folder %s created with id %016" G_GINT64_MODIFIER "X ", name, fid);
+ exchange_mapi_debug_print("Folder %s created with id %016" G_GINT64_MODIFIER "X ", name, fid);
g_static_rec_mutex_lock (&priv->folders_lock);
@@ -2159,7 +2159,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
/* Shouldn't we return (ExchangeMAPIFolder *) instead of a plain fid ? */
return fid;
@@ -2175,7 +2175,7 @@ exchange_mapi_connection_empty_folder (ExchangeMapiConnection *conn, mapi_id_t f
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
mapi_object_init (&obj_folder);
@@ -2193,7 +2193,7 @@ exchange_mapi_connection_empty_folder (ExchangeMapiConnection *conn, mapi_id_t f
goto cleanup;
}
- g_debug("Folder with id %016" G_GINT64_MODIFIER "X was emptied ", fid);
+ exchange_mapi_debug_print("Folder with id %016" G_GINT64_MODIFIER "X was emptied ", fid);
result = TRUE;
@@ -2201,7 +2201,7 @@ cleanup:
mapi_object_release(&obj_folder);
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2221,7 +2221,7 @@ exchange_mapi_connection_remove_folder (ExchangeMapiConnection *conn, mapi_id_t
g_return_val_if_fail (fid != 0, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
folder = NULL;
for (l = exchange_mapi_connection_peek_folders_list (conn); l; l = l->next) {
@@ -2255,7 +2255,7 @@ exchange_mapi_connection_remove_folder (ExchangeMapiConnection *conn, mapi_id_t
goto cleanup;
}
- g_debug("Folder with id %016" G_GINT64_MODIFIER "X was emptied ", fid);
+ exchange_mapi_debug_print("Folder with id %016" G_GINT64_MODIFIER "X was emptied ", fid);
/* Attempt to open the top/parent folder */
ms = open_folder (conn, 0, &folder->parent_folder_id, fid_options, &obj_top, perror);
@@ -2270,7 +2270,7 @@ exchange_mapi_connection_remove_folder (ExchangeMapiConnection *conn, mapi_id_t
goto cleanup;
}
- g_debug("Folder with id %016" G_GINT64_MODIFIER "X was deleted ", fid);
+ exchange_mapi_debug_print("Folder with id %016" G_GINT64_MODIFIER "X was deleted ", fid);
result = TRUE;
@@ -2286,7 +2286,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2303,7 +2303,7 @@ exchange_mapi_connection_rename_folder (ExchangeMapiConnection *conn, mapi_id_t
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
mem_ctx = talloc_init("ExchangeMAPI_RenameFolder");
@@ -2331,7 +2331,7 @@ cleanup:
talloc_free(mem_ctx);
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2411,7 +2411,7 @@ exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi
e_return_val_mapi_error_if_fail (named_ids_n_elems > 0, MAPI_E_INVALID_PARAMETER, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug ("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
if (priv->named_ids) {
@@ -2423,7 +2423,7 @@ exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi
ResolveNamedIDsData *data = &named_ids_list[i];
uint32_t propid;
- propid = GPOINTER_TO_INT (g_hash_table_lookup (ids, GINT_TO_POINTER (data->pidlid_propid)));
+ propid = GPOINTER_TO_UINT (g_hash_table_lookup (ids, GUINT_TO_POINTER (data->pidlid_propid)));
if (propid) {
data->propid = propid;
} else {
@@ -2435,7 +2435,7 @@ exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi
if (!todo) {
UNLOCK ();
- g_debug ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return TRUE;
}
}
@@ -2506,7 +2506,7 @@ exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi
for (i = 0; i < todo->len; i++) {
ResolveNamedIDsData *data = todo->pdata[i];
- g_hash_table_insert (ids, GINT_TO_POINTER (data->pidlid_propid), GINT_TO_POINTER (data->propid));
+ g_hash_table_insert (ids, GUINT_TO_POINTER (data->pidlid_propid), GUINT_TO_POINTER (data->propid));
}
}
@@ -2520,7 +2520,7 @@ exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi
UNLOCK ();
- g_debug ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return res;
}
@@ -2539,7 +2539,7 @@ exchange_mapi_connection_resolve_named_prop (ExchangeMapiConnection *conn, mapi_
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, res);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, res);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
@@ -2548,10 +2548,10 @@ exchange_mapi_connection_resolve_named_prop (ExchangeMapiConnection *conn, mapi_
GHashTable *ids = g_hash_table_lookup (priv->named_ids, &i64);
if (ids) {
- res = GPOINTER_TO_INT (g_hash_table_lookup (ids, GINT_TO_POINTER (pidlid_propid)));
+ res = GPOINTER_TO_UINT (g_hash_table_lookup (ids, GUINT_TO_POINTER (pidlid_propid)));
if (res != 0) {
UNLOCK ();
- g_debug ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return res;
}
@@ -2597,7 +2597,7 @@ exchange_mapi_connection_resolve_named_prop (ExchangeMapiConnection *conn, mapi_
g_hash_table_insert (priv->named_ids, i64ptr, ids);
}
- g_hash_table_insert (ids, GINT_TO_POINTER (pidlid_propid), GINT_TO_POINTER (res));
+ g_hash_table_insert (ids, GUINT_TO_POINTER (pidlid_propid), GUINT_TO_POINTER (res));
}
cleanup:
@@ -2606,7 +2606,42 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+
+ return res;
+}
+
+/* returns named id, aka PidLid/PidName for a given proptag, which might be previously
+ obtained as a result of exchange_mapi_connection_resolve_named_prop/s.
+ Returns MAPI_E_RESERVED when not found.
+*/
+uint32_t
+exchange_mapi_connection_unresolve_proptag_to_nameid (ExchangeMapiConnection *conn, mapi_id_t fid, uint32_t proptag)
+{
+ uint32_t res = MAPI_E_RESERVED;
+ /* to have this used in the below macros */
+ GError **perror = NULL;
+
+ CHECK_CORRECT_CONN_AND_GET_PRIV (conn, res);
+
+ if (priv->named_ids) {
+ gint64 i64 = fid;
+ GHashTable *ids = g_hash_table_lookup (priv->named_ids, &i64);
+
+ if (ids) {
+ GHashTableIter iter;
+ gpointer stored_pidlid, stored_proptag, lookup_proptag = GUINT_TO_POINTER (proptag);
+ gboolean is_error = PT_ERROR == (proptag & 0xFFFF);
+
+ g_hash_table_iter_init (&iter, ids);
+ while (g_hash_table_iter_next (&iter, &stored_pidlid, &stored_proptag)) {
+ if (stored_proptag == lookup_proptag || (is_error && (GPOINTER_TO_UINT (stored_proptag) & ~0xFFFF) == (proptag & ~0xFFFF))) {
+ res = GPOINTER_TO_UINT (stored_pidlid);
+ break;
+ }
+ }
+ }
+ }
return res;
}
@@ -2620,7 +2655,7 @@ exchange_mapi_connection_get_default_folder_id (ExchangeMapiConnection *conn, ui
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, 0);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, 0);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
@@ -2633,7 +2668,7 @@ exchange_mapi_connection_get_default_folder_id (ExchangeMapiConnection *conn, ui
cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return (ms == MAPI_E_SUCCESS ? fid : 0);
}
@@ -2655,7 +2690,7 @@ exchange_mapi_connection_create_item (ExchangeMapiConnection *conn, uint32_t olF
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, 0);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, 0);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
@@ -2680,7 +2715,7 @@ exchange_mapi_connection_create_item (ExchangeMapiConnection *conn, uint32_t olF
/* Add regular props using callback */
if (build_props && !build_props (conn, fid, mem_ctx, &props, &propslen, bwp_data)) {
- g_debug ("%s: (%s): build_props failed! propslen = %d ", G_STRLOC, G_STRFUNC, propslen);
+ exchange_mapi_debug_print ("%s: (%s): build_props failed! propslen = %d ", G_STRLOC, G_STRFUNC, propslen);
make_mapi_error (perror, "build_props", MAPI_E_CALL_FAILED);
goto cleanup;
}
@@ -2758,7 +2793,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return mid;
}
@@ -2780,7 +2815,7 @@ exchange_mapi_connection_modify_item (ExchangeMapiConnection *conn, uint32_t olF
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
@@ -2805,7 +2840,7 @@ exchange_mapi_connection_modify_item (ExchangeMapiConnection *conn, uint32_t olF
/* Add regular props using callback */
if (build_props && !build_props (conn, fid, mem_ctx, &props, &propslen, bwp_data)) {
- g_debug ("%s: (%s): Could not build props ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: (%s): Could not build props ", G_STRLOC, G_STRFUNC);
make_mapi_error (perror, "build_props", MAPI_E_CALL_FAILED);
goto cleanup;
}
@@ -2861,7 +2896,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2880,7 +2915,7 @@ exchange_mapi_connection_set_flags (ExchangeMapiConnection *conn, uint32_t olFol
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
mem_ctx = talloc_init("ExchangeMAPI_SetFlags");
@@ -2910,7 +2945,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -2973,13 +3008,13 @@ exchange_mapi_connection_copy_items (ExchangeMapiConnection *conn, mapi_id_t src
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, MAPI_E_INVALID_PARAMETER);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, MAPI_E_INVALID_PARAMETER);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
ms = mapi_move_items (conn, src_fid, src_fid_options, dest_fid, dest_fid_options, mids, TRUE, perror);
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return ms == MAPI_E_SUCCESS;
}
@@ -2992,13 +3027,13 @@ exchange_mapi_connection_move_items (ExchangeMapiConnection *conn, mapi_id_t src
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, MAPI_E_INVALID_PARAMETER);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, MAPI_E_INVALID_PARAMETER);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
ms = mapi_move_items (conn, src_fid, src_fid_options, dest_fid, dest_fid_options, mids, FALSE, perror);
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return ms == MAPI_E_SUCCESS;
}
@@ -3017,7 +3052,7 @@ exchange_mapi_connection_remove_items (ExchangeMapiConnection *conn, uint32_t ol
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
@@ -3051,7 +3086,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -3144,7 +3179,7 @@ get_child_folders (TALLOC_CTX *mem_ctx, ExchangeMAPIFolderCategory folder_hier,
if (!class)
class = IPF_NOTE;
- g_debug("|---+ %-15s : (Container class: %s %016" G_GINT64_MODIFIER "X) UnRead : %d Total : %d size : %d",
+ exchange_mapi_debug_print("|---+ %-15s : (Container class: %s %016" G_GINT64_MODIFIER "X) UnRead : %d Total : %d size : %d",
name, class, *fid, unread ? *unread : 0, total ? *total : 0, folder_size ? *folder_size : 0);
folder = exchange_mapi_folder_new (name, class, folder_hier, *fid, pid ? *pid : folder_id,
@@ -3338,7 +3373,7 @@ exchange_mapi_connection_get_folders_list (ExchangeMapiConnection *conn, GSList
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
@@ -3404,7 +3439,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -3421,7 +3456,7 @@ exchange_mapi_connection_get_pf_folders_list (ExchangeMapiConnection *conn, GSLi
CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
e_return_val_mapi_error_if_fail (priv->session != NULL, MAPI_E_INVALID_PARAMETER, FALSE);
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
LOCK ();
mem_ctx = talloc_init("ExchangeMAPI_PF_GetFoldersList");
@@ -3447,7 +3482,7 @@ cleanup:
UNLOCK ();
- g_debug("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return result;
}
@@ -3693,18 +3728,6 @@ try_create_profile (const gchar *profname, const gchar *password)
return data.has_profile;
}
-static void
-mapi_debug_logger (const gchar * domain, GLogLevelFlags level, const gchar * message, gpointer data)
-{
- g_print ("[DEBUG] %s\n", message);
-}
-
-static void
-mapi_debug_logger_muted (const gchar * domain, GLogLevelFlags level, const gchar * message, gpointer data)
-{
- /*Nothing here. Just a dummy function*/
-}
-
static gboolean
ensure_mapi_init_called (GError **perror)
{
@@ -3783,13 +3806,7 @@ mapi_profile_load (const gchar *profname, const gchar *password, GError **perror
g_static_rec_mutex_lock (&profile_mutex);
- /* Initialize libexchangemapi logger*/
- if (g_getenv ("EXCHANGEMAPI_DEBUG")) {
- g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, mapi_debug_logger, NULL);
- } else
- g_log_set_handler (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, mapi_debug_logger_muted, NULL);
-
- g_debug("%s: Entering %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
if (!ensure_mapi_init_called (perror))
goto cleanup;
@@ -3801,7 +3818,7 @@ mapi_profile_load (const gchar *profname, const gchar *password, GError **perror
SetMAPIDebugLevel (mapi_ctx, debug_log_level);
}
- g_debug("Loading profile %s ", profname);
+ exchange_mapi_debug_print("Loading profile %s ", profname);
ms = MapiLogonEx (mapi_ctx, &session, profname, password);
if (ms == MAPI_E_NOT_FOUND && try_create_profile (profname, password))
@@ -3814,7 +3831,7 @@ mapi_profile_load (const gchar *profname, const gchar *password, GError **perror
cleanup:
g_static_rec_mutex_unlock (&profile_mutex);
- g_debug ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
+ exchange_mapi_debug_print ("%s: Leaving %s ", G_STRLOC, G_STRFUNC);
return session;
}
@@ -3863,7 +3880,7 @@ mapi_profile_create (const ExchangeMapiProfileData *empd,
if (use_locking)
g_static_rec_mutex_lock (&profile_mutex);
- g_debug ("Create profile with %s %s %s\n", empd->username,
+ exchange_mapi_debug_print ("Create profile with %s %s %s\n", empd->username,
empd->domain, empd->server);
if (!ensure_mapi_init_called (perror)) {
@@ -3912,25 +3929,25 @@ mapi_profile_create (const ExchangeMapiProfileData *empd,
#undef add_string_attr
/* Login now */
- g_debug("Logging into the server... ");
+ exchange_mapi_debug_print("Logging into the server... ");
ms = MapiLogonProvider (mapi_ctx, &session, profname, empd->password,
PROVIDER_ID_NSPI);
if (ms != MAPI_E_SUCCESS) {
make_mapi_error (perror, "MapiLogonProvider", ms);
- g_debug ("Deleting profile %s ", profname);
+ exchange_mapi_debug_print ("Deleting profile %s ", profname);
DeleteProfile (mapi_ctx, profname);
goto cleanup;
}
- g_debug("MapiLogonProvider : succeeded \n");
+ exchange_mapi_debug_print("MapiLogonProvider : succeeded \n");
ms = ProcessNetworkProfile (session, empd->username, callback, data);
if (ms != MAPI_E_SUCCESS) {
make_mapi_error (perror, "ProcessNetworkProfile", ms);
- g_debug ("Deleting profile %s ", profname);
+ exchange_mapi_debug_print ("Deleting profile %s ", profname);
DeleteProfile (mapi_ctx, profname);
goto cleanup;
}
- g_debug("ProcessNetworkProfile : succeeded \n");
+ exchange_mapi_debug_print("ProcessNetworkProfile : succeeded \n");
result = TRUE;
@@ -3978,7 +3995,7 @@ exchange_mapi_delete_profile (const gchar *profile, GError **perror)
if (ensure_mapi_init_called (perror)) {
enum MAPISTATUS ms;
- g_debug ("Deleting profile %s ", profile);
+ exchange_mapi_debug_print ("Deleting profile %s ", profile);
ms = DeleteProfile (mapi_ctx, profile);
if (ms == MAPI_E_SUCCESS) {
diff --git a/src/libexchangemapi/exchange-mapi-connection.h b/src/libexchangemapi/exchange-mapi-connection.h
index 9ee9d8a..e2d0427 100644
--- a/src/libexchangemapi/exchange-mapi-connection.h
+++ b/src/libexchangemapi/exchange-mapi-connection.h
@@ -215,6 +215,7 @@ GSList * exchange_mapi_connection_peek_folders_list (ExchangeMapiConnection *co
gboolean exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi_id_t fid, ResolveNamedIDsData *named_ids_list, guint named_ids_n_elems, GError **perror);
uint32_t exchange_mapi_connection_resolve_named_prop (ExchangeMapiConnection *conn, mapi_id_t fid, uint32_t pidlid_propid, GError **perror);
+uint32_t exchange_mapi_connection_unresolve_proptag_to_nameid (ExchangeMapiConnection *conn, mapi_id_t fid, uint32_t proptag);
gchar * exchange_mapi_connection_ex_to_smtp (ExchangeMapiConnection *conn, const gchar *ex_address, gchar **display_name, GError **perror);
diff --git a/src/libexchangemapi/exchange-mapi-debug.c b/src/libexchangemapi/exchange-mapi-debug.c
new file mode 100644
index 0000000..c068d0a
--- /dev/null
+++ b/src/libexchangemapi/exchange-mapi-debug.c
@@ -0,0 +1,851 @@
+/*
+ * This program 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 of the License, or (at your option) version 3.
+ *
+ * This program 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+#include <stdarg.h>
+
+#include "exchange-mapi-debug.h"
+
+gboolean
+exchange_mapi_debug_is_enabled (void)
+{
+ static gchar enabled = -1;
+
+ if (enabled == -1)
+ enabled = g_getenv ("EXCHANGEMAPI_DEBUG") != NULL ? 1 : 0;
+
+ return enabled == 1;
+}
+
+void
+exchange_mapi_debug_print (const gchar *format, ...)
+{
+ va_list args;
+
+ g_return_if_fail (format != NULL);
+
+ if (!exchange_mapi_debug_is_enabled ())
+ return;
+
+ va_start (args, format);
+ vfprintf (stdout, format, args);
+ va_end (args);
+
+ fprintf (stdout, "\n");
+ fflush (stdout);
+}
+
+static void
+dump_bin (const uint8_t *bin, uint32_t bin_sz, const gchar *line_prefix)
+{
+ gint k, l, last;
+
+ if (!bin) {
+ g_print ("NULL");
+ return;
+ }
+
+ g_print ("%s", line_prefix);
+
+ last = 0;
+ for (k = 0; k < bin_sz; k++) {
+ if ((k > 0 && (k % 16) == 0)) {
+ g_print (" ");
+ for (l = last; l < k; l++) {
+ uint8_t u8 = bin[l];
+
+ if ((l % 8) == 0)
+ g_print (" ");
+ if (u8 <= 32 || u8 >= 128)
+ g_print (".");
+ else
+ g_print ("%c", u8);
+ }
+
+ last = l;
+ g_print ("\n%s", line_prefix);
+ } else if (k > 0 && (k % 8) == 0) {
+ g_print (" ");
+ }
+ g_print (" %02X", bin[k]);
+ }
+
+ if (last < k) {
+ l = k;
+
+ while ((l % 16) != 0) {
+ g_print (" ");
+ if (l > 0 && (l % 8) == 0)
+ g_print (" ");
+ l++;
+ }
+
+ g_print (" ");
+ for (l = last; l < k; l++) {
+ uint8_t u8 = bin[l];
+
+ if ((l % 8) == 0)
+ g_print (" ");
+ if (u8 <= 32 || u8 >= 128)
+ g_print (".");
+ else
+ g_print ("%c", u8);
+ }
+ }
+}
+
+static const gchar *
+get_namedid_name (ExchangeMapiConnection *conn, mapi_id_t fid, uint32_t proptag)
+{
+ if (conn)
+ proptag = exchange_mapi_connection_unresolve_proptag_to_nameid (conn, fid, proptag);
+
+ if (proptag == MAPI_E_RESERVED)
+ return NULL;
+
+ switch (proptag) {
+ #define cs(x) case x: return #x;
+ cs (PidLidAddressBookProviderArrayType)
+ cs (PidLidAddressBookProviderEmailList)
+ cs (PidLidAddressCountryCode)
+ cs (PidLidAnniversaryEventEntryId)
+ cs (PidLidAutoLog)
+ cs (PidLidBirthdayEventEntryId)
+ cs (PidLidBirthdayLocal)
+ cs (PidLidBusinessCardCardPicture)
+ cs (PidLidBusinessCardDisplayDefinition)
+ cs (PidLidContactCharacterSet)
+ cs (PidLidContactItemData)
+ cs (PidLidContactUserField1)
+ cs (PidLidContactUserField2)
+ cs (PidLidContactUserField3)
+ cs (PidLidContactUserField4)
+ cs (PidLidDepartment)
+ cs (PidLidDistributionListChecksum)
+ cs (PidLidDistributionListMembers)
+ cs (PidLidDistributionListName)
+ cs (PidLidDistributionListOneOffMembers)
+ cs (PidLidDistributionListStream)
+ cs (PidLidEmail1AddressType)
+ cs (PidLidEmail1DisplayName)
+ cs (PidLidEmail1EmailAddress)
+ cs (PidLidEmail1OriginalDisplayName)
+ cs (PidLidEmail1OriginalEntryId)
+ cs (PidLidEmail1RichTextFormat)
+ cs (PidLidEmail2AddressType)
+ cs (PidLidEmail2DisplayName)
+ cs (PidLidEmail2EmailAddress)
+ cs (PidLidEmail2OriginalDisplayName)
+ cs (PidLidEmail2OriginalEntryId)
+ cs (PidLidEmail2RichTextFormat)
+ cs (PidLidEmail3AddressType)
+ cs (PidLidEmail3DisplayName)
+ cs (PidLidEmail3EmailAddress)
+ cs (PidLidEmail3OriginalDisplayName)
+ cs (PidLidEmail3OriginalEntryId)
+ cs (PidLidEmail3RichTextFormat)
+ cs (PidLidEmailList)
+ cs (PidLidFax1AddressType)
+ cs (PidLidFax1EmailAddress)
+ cs (PidLidFax1OriginalDisplayName)
+ cs (PidLidFax1OriginalEntryId)
+ cs (PidLidFax2AddressType)
+ cs (PidLidFax2EmailAddress)
+ cs (PidLidFax2OriginalDisplayName)
+ cs (PidLidFax2OriginalEntryId)
+ cs (PidLidFax3AddressType)
+ cs (PidLidFax3EmailAddress)
+ cs (PidLidFax3OriginalDisplayName)
+ cs (PidLidFax3OriginalEntryId)
+ cs (PidLidFileUnder)
+ cs (PidLidFileUnderId)
+ cs (PidLidFileUnderList)
+ cs (PidLidFreeBusyLocation)
+ cs (PidLidHasPicture)
+ cs (PidLidHomeAddress)
+ cs (PidLidHomeAddressCountryCode)
+ cs (PidLidHtml)
+ cs (PidLidInstantMessagingAddress)
+ cs (PidLidOtherAddress)
+ cs (PidLidOtherAddressCountryCode)
+ cs (PidLidPostalAddressId)
+ cs (PidLidReferredBy)
+ cs (PidLidWeddingAnniversaryLocal)
+ cs (PidLidWorkAddress)
+ cs (PidLidWorkAddressCity)
+ cs (PidLidWorkAddressCountry)
+ cs (PidLidWorkAddressCountryCode)
+ cs (PidLidWorkAddressPostalCode)
+ cs (PidLidWorkAddressPostOfficeBox)
+ cs (PidLidWorkAddressState)
+ cs (PidLidYomiCompanyName)
+ cs (PidLidYomiFirstName)
+ cs (PidLidYomiLastName)
+ cs (PidLidAllAttendeesString)
+ cs (PidLidAllowExternalCheck)
+ cs (PidLidAppointmentAuxiliaryFlags)
+ cs (PidLidAppointmentColor)
+ cs (PidLidAppointmentCounterProposal)
+ cs (PidLidAppointmentDuration)
+ cs (PidLidAppointmentEndDate)
+ cs (PidLidAppointmentEndTime)
+ cs (PidLidAppointmentEndWhole)
+ cs (PidLidAppointmentLastSequence)
+ cs (PidLidAppointmentNotAllowPropose)
+ cs (PidLidAppointmentProposalNumber)
+ cs (PidLidAppointmentProposedDuration)
+ cs (PidLidAppointmentProposedEndWhole)
+ cs (PidLidAppointmentProposedStartWhole)
+ cs (PidLidAppointmentRecur)
+ cs (PidLidAppointmentReplyName)
+ cs (PidLidAppointmentReplyTime)
+ cs (PidLidAppointmentSequence)
+ cs (PidLidAppointmentSequenceTime)
+ cs (PidLidAppointmentStartDate)
+ cs (PidLidAppointmentStartTime)
+ cs (PidLidAppointmentStartWhole)
+ cs (PidLidAppointmentStateFlags)
+ cs (PidLidAppointmentSubType)
+ cs (PidLidAppointmentTimeZoneDefinitionEndDisplay)
+ cs (PidLidAppointmentTimeZoneDefinitionRecur)
+ cs (PidLidAppointmentTimeZoneDefinitionStartDisplay)
+ cs (PidLidAppointmentUnsendableRecipients)
+ cs (PidLidAppointmentUpdateTime)
+ cs (PidLidAutoFillLocation)
+ cs (PidLidAutoStartCheck)
+ cs (PidLidBusyStatus)
+ cs (PidLidCcAttendeesString)
+ cs (PidLidChangeHighlight)
+ cs (PidLidClipEnd)
+ cs (PidLidClipStart)
+ cs (PidLidCollaborateDoc)
+ cs (PidLidConferencingCheck)
+ cs (PidLidConferencingType)
+ cs (PidLidDirectory)
+ cs (PidLidExceptionReplaceTime)
+ cs (PidLidFExceptionalAttendees)
+ cs (PidLidFExceptionalBody)
+ cs (PidLidFInvited)
+ cs (PidLidForwardInstance)
+ cs (PidLidForwardNotificationRecipients)
+ cs (PidLidFOthersAppointment)
+ cs (PidLidInboundICalStream)
+ cs (PidLidIntendedBusyStatus)
+ cs (PidLidLinkedTaskItems)
+ cs (PidLidLocation)
+ cs (PidLidMeetingWorkspaceUrl)
+ cs (PidLidNetShowUrl)
+ cs (PidLidOnlinePassword)
+ cs (PidLidOrganizerAlias)
+ cs (PidLidOriginalStoreEntryId)
+ cs (PidLidOwnerName)
+ cs (PidLidRecurrencePattern)
+ cs (PidLidRecurrenceType)
+ cs (PidLidRecurring)
+ cs (PidLidResponseStatus)
+ cs (PidLidSingleBodyICal)
+ cs (PidLidTimeZoneDescription)
+ cs (PidLidTimeZoneStruct)
+ cs (PidLidToAttendeesString)
+ cs (PidLidClientIntent)
+ cs (PidLidServerProcessed)
+ cs (PidLidServerProcessingActions)
+ cs (PidLidAgingDontAgeMe)
+ cs (PidLidAutoProcessState)
+ cs (PidLidBilling)
+ cs (PidLidClassification)
+ cs (PidLidClassificationDescription)
+ cs (PidLidClassificationGuid)
+ cs (PidLidClassificationKeep)
+ cs (PidLidClassified)
+ cs (PidLidCommonEnd)
+ cs (PidLidCommonStart)
+ cs (PidLidCompanies)
+ cs (PidLidContactLinkEntry)
+ cs (PidLidContactLinkName)
+ cs (PidLidContactLinkSearchKey)
+ cs (PidLidContacts)
+ cs (PidLidConversationActionLastAppliedTime)
+ cs (PidLidConversationActionMaxDeliveryTime)
+ cs (PidLidConversationActionMoveFolderEid)
+ cs (PidLidConversationActionMoveStoreEid)
+ cs (PidLidConversationActionVersion)
+ cs (PidLidConversationProcessed)
+ cs (PidLidCurrentVersion)
+ cs (PidLidCurrentVersionName)
+ cs (PidLidDayOfMonth)
+ cs (PidLidFlagRequest)
+ cs (PidLidFlagString)
+ cs (PidLidICalendarDayOfWeekMask)
+ cs (PidLidInfoPathFormName)
+ cs (PidLidInternetAccountName)
+ cs (PidLidInternetAccountStamp)
+ cs (PidLidMonthOfYear)
+ cs (PidLidNoEndDateFlag)
+ cs (PidLidNonSendableBcc)
+ cs (PidLidNonSendableCc)
+ cs (PidLidNonSendableTo)
+ cs (PidLidNonSendBccTrackStatus)
+ cs (PidLidNonSendCcTrackStatus)
+ cs (PidLidNonSendToTrackStatus)
+ cs (PidLidOccurrences)
+ cs (PidLidPrivate)
+ cs (PidLidPromptSendUpdate)
+ cs (PidLidRecurrenceDuration)
+ cs (PidLidReferenceEntryId)
+ cs (PidLidReminderDelta)
+ cs (PidLidReminderFileParameter)
+ cs (PidLidReminderOverride)
+ cs (PidLidReminderPlaySound)
+ cs (PidLidReminderSet)
+ cs (PidLidReminderSignalTime)
+ cs (PidLidReminderTime)
+ cs (PidLidReminderTimeDate)
+ cs (PidLidReminderTimeTime)
+ cs (PidLidReminderType)
+ cs (PidLidRemoteStatus)
+ cs (PidLidSideEffects)
+ cs (PidLidSmartNoAttach)
+ cs (PidLidSpamOriginalFolder)
+ cs (PidLidTaskGlobalId)
+ cs (PidLidTaskMode)
+ cs (PidLidToDoOrdinalDate)
+ cs (PidLidToDoSubOrdinal)
+ cs (PidLidToDoTitle)
+ cs (PidLidUseTnef)
+ cs (PidLidValidFlagStringProof)
+ cs (PidLidVerbResponse)
+ cs (PidLidVerbStream)
+ cs (PidLidLogDocumentPosted)
+ cs (PidLidLogDocumentPrinted)
+ cs (PidLidLogDocumentRouted)
+ cs (PidLidLogDocumentSaved)
+ cs (PidLidLogDuration)
+ cs (PidLidLogEnd)
+ cs (PidLidLogFlags)
+ cs (PidLidLogStart)
+ cs (PidLidLogType)
+ cs (PidLidLogTypeDesc)
+ cs (PidLidAppointmentMessageClass)
+ cs (PidLidAttendeeCriticalChange)
+ cs (PidLidCalendarType)
+ cs (PidLidCleanGlobalObjectId)
+ cs (PidLidDayInterval)
+ cs (PidLidDelegateMail)
+ cs (PidLidEndRecurrenceDate)
+ cs (PidLidEndRecurrenceTime)
+ cs (PidLidGlobalObjectId)
+ cs (PidLidIsException)
+ cs (PidLidIsRecurring)
+ cs (PidLidIsSilent)
+ cs (PidLidMeetingType)
+ cs (PidLidMonthInterval)
+ cs (PidLidMonthOfYearMask)
+ cs (PidLidOldLocation)
+ cs (PidLidOldRecurrenceType)
+ cs (PidLidOldWhenEndWhole)
+ cs (PidLidOldWhenStartWhole)
+ cs (PidLidOptionalAttendees)
+ cs (PidLidOwnerCriticalChange)
+ cs (PidLidRequiredAttendees)
+ cs (PidLidResourceAttendees)
+ cs (PidLidStartRecurrenceDate)
+ cs (PidLidStartRecurrenceTime)
+ cs (PidLidTimeZone)
+ cs (PidLidWeekInterval)
+ cs (PidLidWhere)
+ cs (PidLidYearInterval)
+ cs (PidLidNoteColor)
+ cs (PidLidNoteHeight)
+ cs (PidLidNoteWidth)
+ cs (PidLidNoteX)
+ cs (PidLidNoteY)
+ cs (PidLidPostRssChannel)
+ cs (PidLidPostRssChannelLink)
+ cs (PidLidPostRssItemGuid)
+ cs (PidLidPostRssItemHash)
+ cs (PidLidPostRssItemLink)
+ cs (PidLidPostRssItemXml)
+ cs (PidLidPostRssSubscription)
+ cs (PidLidSharingAnonymity)
+ cs (PidLidSharingBindingEntryId)
+ cs (PidLidSharingBrowseUrl)
+ cs (PidLidSharingCapabilities)
+ cs (PidLidSharingConfigurationUrl)
+ cs (PidLidSharingDataRangeEnd)
+ cs (PidLidSharingDataRangeStart)
+ cs (PidLidSharingDetail)
+ cs (PidLidSharingExtensionXml)
+ cs (PidLidSharingFilter)
+ cs (PidLidSharingFlags)
+ cs (PidLidSharingFlavor)
+ cs (PidLidSharingFolderEntryId)
+ cs (PidLidSharingIndexEntryId)
+ cs (PidLidSharingInitiatorEntryId)
+ cs (PidLidSharingInitiatorName)
+ cs (PidLidSharingInitiatorSmtp)
+ cs (PidLidSharingInstanceGuid)
+ cs (PidLidSharingLastAutoSyncTime)
+ cs (PidLidSharingLastSyncTime)
+ cs (PidLidSharingLocalComment)
+ cs (PidLidSharingLocalLastModificationTime)
+ cs (PidLidSharingLocalName)
+ cs (PidLidSharingLocalPath)
+ cs (PidLidSharingLocalStoreUid)
+ cs (PidLidSharingLocalType)
+ cs (PidLidSharingLocalUid)
+ cs (PidLidSharingOriginalMessageEntryId)
+ cs (PidLidSharingParentBindingEntryId)
+ cs (PidLidSharingParticipants)
+ cs (PidLidSharingPermissions)
+ cs (PidLidSharingProviderExtension)
+ cs (PidLidSharingProviderGuid)
+ cs (PidLidSharingProviderName)
+ cs (PidLidSharingProviderUrl)
+ cs (PidLidSharingRangeEnd)
+ cs (PidLidSharingRangeStart)
+ cs (PidLidSharingReciprocation)
+ cs (PidLidSharingRemoteByteSize)
+ cs (PidLidSharingRemoteComment)
+ cs (PidLidSharingRemoteCrc)
+ cs (PidLidSharingRemoteLastModificationTime)
+ cs (PidLidSharingRemoteMessageCount)
+ cs (PidLidSharingRemoteName)
+ cs (PidLidSharingRemotePass)
+ cs (PidLidSharingRemotePath)
+ cs (PidLidSharingRemoteStoreUid)
+ cs (PidLidSharingRemoteType)
+ cs (PidLidSharingRemoteUid)
+ cs (PidLidSharingRemoteUser)
+ cs (PidLidSharingRemoteVersion)
+ cs (PidLidSharingResponseTime)
+ cs (PidLidSharingResponseType)
+ cs (PidLidSharingRoamLog)
+ cs (PidLidSharingStart)
+ cs (PidLidSharingStatus)
+ cs (PidLidSharingStop)
+ cs (PidLidSharingSyncFlags)
+ cs (PidLidSharingSyncInterval)
+ cs (PidLidSharingTimeToLive)
+ cs (PidLidSharingTimeToLiveAuto)
+ cs (PidLidSharingWorkingHoursDays)
+ cs (PidLidSharingWorkingHoursEnd)
+ cs (PidLidSharingWorkingHoursStart)
+ cs (PidLidSharingWorkingHoursTimeZone)
+ cs (PidLidPercentComplete)
+ cs (PidLidTaskAcceptanceState)
+ cs (PidLidTaskAccepted)
+ cs (PidLidTaskActualEffort)
+ cs (PidLidTaskAssigner)
+ cs (PidLidTaskAssigners)
+ cs (PidLidTaskComplete)
+ cs (PidLidTaskCustomFlags)
+ cs (PidLidTaskDateCompleted)
+ cs (PidLidTaskDeadOccurrence)
+ cs (PidLidTaskDueDate)
+ cs (PidLidTaskEstimatedEffort)
+ cs (PidLidTaskFCreator)
+ cs (PidLidTaskFFixOffline)
+ cs (PidLidTaskFRecurring)
+ cs (PidLidTaskHistory)
+ cs (PidLidTaskLastDelegate)
+ cs (PidLidTaskLastUpdate)
+ cs (PidLidTaskLastUser)
+ cs (PidLidTaskMultipleRecipients)
+ cs (PidLidTaskNoCompute)
+ cs (PidLidTaskOrdinal)
+ cs (PidLidTaskOwner)
+ cs (PidLidTaskOwnership)
+ cs (PidLidTaskRecurrence)
+ cs (PidLidTaskResetReminder)
+ cs (PidLidTaskRole)
+ cs (PidLidTaskStartDate)
+ cs (PidLidTaskState)
+ cs (PidLidTaskStatus)
+ cs (PidLidTaskStatusOnComplete)
+ cs (PidLidTaskUpdates)
+ cs (PidLidTaskVersion)
+ cs (PidLidTeamTask)
+ cs (PidLidTrustRecipientHighlights)
+ cs (PidLidCategories)
+ cs (PidNameInstantMessagingAddress2)
+ cs (PidNameInstantMessagingAddress3)
+ cs (PidNameAttachmentMacContentType)
+ cs (PidNameAttachmentMacInfo)
+ cs (PidNameOriginalSpamConfidenceLevel)
+ cs (PidNameAudioNotes)
+ cs (PidNameAutomaticSpeechRecognitionData)
+ cs (PidNameOutlookProtectionRuleTimestamp)
+ cs (PidNameXUnifiedMessagingPartnerAssignedId)
+ cs (PidNameXUnifiedMessagingPartnerContent)
+ cs (PidNameXUnifiedMessagingPartnerContext)
+ cs (PidNameXUnifiedMessagingPartnerStatus)
+ cs (PidNameAcceptLanguage)
+ cs (PidNameApprovalAllowedDecisionMakers)
+ cs (PidNameApprovalRequestor)
+ cs (PidNameApproved)
+ cs (PidNameAuthenticatedAs)
+ cs (PidNameAuthenticatedDomain)
+ cs (PidNameAuthenticatedMechanism)
+ cs (PidNameAuthenticatedSource)
+ cs (PidNameBcc)
+ cs (PidNameCc)
+ cs (PidNameContentBase)
+ cs (PidNameContentClass)
+ cs (PidNameContentDisposition)
+ cs (PidNameContentID)
+ cs (PidNameContentLanguage)
+ cs (PidNameContentLocation)
+ cs (PidNameContentTransferEncoding)
+ cs (PidNameContentType)
+ cs (PidNameControl)
+ cs (PidNameCrossReference)
+ cs (PidNameDisposition)
+ cs (PidNameDispositionNotificationTo)
+ cs (PidNameDistribution)
+ cs (PidNameExpires)
+ cs (PidNameExpiryDate)
+ cs (PidNameFollowupTo)
+ cs (PidNameFrom)
+ cs (PidNameImportance)
+ cs (PidNameInReplyTo)
+ cs (PidNameInternetComment)
+ cs (PidNameInternetKeywords)
+ cs (PidNameInternetSubject)
+ cs (PidNameLines)
+ cs (PidNameMessageId)
+ cs (PidNameMimeVersion)
+ cs (PidNameNewsgroups)
+ cs (PidNameNntpPostingHost)
+ cs (PidNameOrganization)
+ cs (PidNameOriginalRecipient)
+ cs (PidNameOutlookProtectionRuleOverridden)
+ cs (PidNameOutlookProtectionRuleVersion)
+ cs (PidNamePath)
+ cs (PidNamePostingVersion)
+ cs (PidNamePriority)
+ cs (PidNameReceived)
+ cs (PidNameReferences)
+ cs (PidNameRelayVersion)
+ cs (PidNameReplyBy)
+ cs (PidNameReplyTo)
+ cs (PidNameReturnPath)
+ cs (PidNameReturnReceiptTo)
+ cs (PidNameRightsProtectMessage)
+ cs (PidNameSender)
+ cs (PidNameSensitivity)
+ cs (PidNameSummary)
+ cs (PidNameThreadIndex)
+ cs (PidNameThreadTopic)
+ cs (PidNameTo)
+ cs (PidNameXCallId)
+ cs (PidNameXFaxNumberOfPages)
+ cs (PidNameXMailer)
+ cs (PidNameXMessageCompleted)
+ cs (PidNameXMessageFlag)
+ cs (PidNameXRequireProtectedPlayOnPhone)
+ cs (PidNameXSenderTelephoneNumber)
+ cs (PidNameXSharingBrowseUrl)
+ cs (PidNameXSharingCapabilities)
+ cs (PidNameXSharingConfigUrl)
+ cs (PidNameXSharingExendedCaps)
+ cs (PidNameXSharingFlavor)
+ cs (PidNameXSharingInstanceGuid)
+ cs (PidNameXSharingLocalType)
+ cs (PidNameXSharingProviderGuid)
+ cs (PidNameXSharingProviderName)
+ cs (PidNameXSharingProviderUrl)
+ cs (PidNameXSharingRemoteName)
+ cs (PidNameXSharingRemotePath)
+ cs (PidNameXSharingRemoteStoreUid)
+ cs (PidNameXSharingRemoteType)
+ cs (PidNameXSharingRemoteUid)
+ cs (PidNameXUnsent)
+ cs (PidNameXVoiceMessageAttachmentOrder)
+ cs (PidNameXVoiceMessageDuration)
+ cs (PidNameXVoiceMessageSenderName)
+ cs (PidNameApplicationName)
+ cs (PidNameAuthor)
+ cs (PidNameByteCount)
+ cs (PidNameCalendarAttendeeRole)
+ cs (PidNameCalendarBusystatus)
+ cs (PidNameCalendarContact)
+ cs (PidNameCalendarContactUrl)
+ cs (PidNameCalendarCreated)
+ cs (PidNameCalendarDescriptionUrl)
+ cs (PidNameCalendarDuration)
+ cs (PidNameCalendarExceptionDate)
+ cs (PidNameCalendarExceptionRule)
+ cs (PidNameCalendarGeoLatitude)
+ cs (PidNameCalendarGeoLongitude)
+ cs (PidNameCalendarInstanceType)
+ cs (PidNameCalendarIsOrganizer)
+ cs (PidNameCalendarLastModified)
+ cs (PidNameCalendarLocationUrl)
+ cs (PidNameCalendarMeetingStatus)
+ cs (PidNameCalendarMethod)
+ cs (PidNameCalendarProductId)
+ cs (PidNameCalendarRecurrenceIdRange)
+ cs (PidNameCalendarReminderOffset)
+ cs (PidNameCalendarResources)
+ cs (PidNameCalendarRsvp)
+ cs (PidNameCalendarSequence)
+ cs (PidNameCalendarTimeZone)
+ cs (PidNameCalendarTimeZoneId)
+ cs (PidNameCalendarTransparent)
+ cs (PidNameCalendarUid)
+ cs (PidNameCalendarVersion)
+ cs (PidNameCategory)
+ cs (PidNameCharacterCount)
+ cs (PidNameComments)
+ cs (PidNameCompany)
+ cs (PidNameContactsAlternateRecipient)
+ cs (PidNameContactsCountry)
+ cs (PidNameContactsEmail1)
+ cs (PidNameContactsEmail2)
+ cs (PidNameContactsEmail3)
+ cs (PidNameContactsFileAs)
+ cs (PidNameContactsFileasId)
+ cs (PidNameContactsHomeLatitude)
+ cs (PidNameContactsHomeLongitude)
+ cs (PidNameContactsHomeTimeZone)
+ cs (PidNameContactsMapUrl)
+ cs (PidNameContactsOtherCountryCode)
+ cs (PidNameContactsOtherPager)
+ cs (PidNameContactsOtherTimeZone)
+ cs (PidNameContactsProxyAddresses)
+ cs (PidNameContactsSecretaryUrl)
+ cs (PidNameContactsSourceUrl)
+ cs (PidNameCreateDateTimeReadOnly)
+ cs (PidNameDavGetContentType)
+ cs (PidNameDavId)
+ cs (PidNameDavIsCollection)
+ cs (PidNameDavIsStructuredDocument)
+ cs (PidNameDavParentName)
+ cs (PidNameDavResourceType)
+ cs (PidNameDavSearchRequest)
+ cs (PidNameDavSearchType)
+ cs (PidNameDavUid)
+ cs (PidNameDocumentParts)
+ cs (PidNameEditTime)
+ cs (PidNameExchangeIntendedBusyStatus)
+ cs (PidNameExchangeJunkEmailMoveStamp)
+ cs (PidNameExchangeModifyExceptionStructure)
+ cs (PidNameExchangeNoModifyExceptions)
+ cs (PidNameExchangePatternEnd)
+ cs (PidNameExchangePatternStart)
+ cs (PidNameExchangePublicFolderEmailAddress)
+ cs (PidNameExchangeReminderInterval)
+ cs (PidNameExchDatabaseSchema)
+ cs (PidNameExchDataExpectedContentClass)
+ cs (PidNameExchDataSchemaCollectionReference)
+ cs (PidNameHeadingPairs)
+ cs (PidNameHiddenCount)
+ cs (PidNameHttpmailCalendar)
+ cs (PidNameHttpmailCc)
+ cs (PidNameHttpmailContacts)
+ cs (PidNameHttpmailContentMediaType)
+ cs (PidNameHttpmailFrom)
+ cs (PidNameHttpmailFromEmail)
+ cs (PidNameHttpmailHtmlDescription)
+ cs (PidNameHttpmailOutbox)
+ cs (PidNameHttpmailSendMessage)
+ cs (PidNameHttpmailSubmitted)
+ cs (PidNameHttpmailTo)
+ cs (PidNameICalendarRecurrenceDate)
+ cs (PidNameICalendarRecurrenceRule)
+ cs (PidNameKeywords)
+ cs (PidNameLastAuthor)
+ cs (PidNameLastPrinted)
+ cs (PidNameLastSaveDateTime)
+ cs (PidNameLineCount)
+ cs (PidNameLinksDirty)
+ cs (PidNameMailSubmissionUri)
+ cs (PidNameManager)
+ cs (PidNameMultimediaClipCount)
+ cs (PidNameNoteCount)
+ cs (PidNameOMSAccountGuid)
+ cs (PidNameOMSMobileModel)
+ cs (PidNameOMSScheduleTime)
+ cs (PidNameOMSServiceType)
+ cs (PidNameOMSSourceType)
+ cs (PidNamePageCount)
+ cs (PidNameParagraphCount)
+ cs (PidNamePhishingStamp)
+ cs (PidNamePresentationFormat)
+ cs (PidNameQuarantineOriginalSender)
+ cs (PidNameRevisionNumber)
+ cs (PidNameRightsManagementLicense)
+ cs (PidNameScale)
+ cs (PidNameSecurity)
+ cs (PidNameSlideCount)
+ cs (PidNameSubject)
+ cs (PidNameTemplate)
+ cs (PidNameThumbnail)
+ cs (PidNameTitle)
+ cs (PidNameWordCount)
+ #undef cs
+ }
+
+ return NULL;
+}
+
+void
+exchange_mapi_debug_dump_properties (ExchangeMapiConnection *conn, mapi_id_t fid, struct mapi_SPropValue_array *properties)
+{
+ gint i = 0;
+
+ g_return_if_fail (properties != NULL);
+
+ for (i = 0; i < properties->cValues; i++) {
+ for (i = 0; i < properties->cValues; i++) {
+ struct mapi_SPropValue *lpProp = &properties->lpProps[i];
+ const gchar *tmp = get_proptag_name (lpProp->ulPropTag);
+ gchar t_str[26];
+ gint j = 0;
+
+ if (!tmp || !*tmp)
+ tmp = get_namedid_name (conn, fid, lpProp->ulPropTag);
+
+ if (tmp && *tmp)
+ g_print ("\n%s \t",tmp);
+ else
+ g_print ("\n0x%08X \t", lpProp->ulPropTag);
+ switch (lpProp->ulPropTag & 0xFFFF) {
+ case PT_UNSPECIFIED:
+ g_print (" PT_UNSPECIFIED");
+ break;
+ case PT_NULL:
+ g_print (" PT_NULL");
+ break;
+ case PT_BOOLEAN:
+ g_print (" (bool) - %d", (bool) lpProp->value.b);
+ break;
+ case PT_I2:
+ g_print (" (uint16_t) - %d", lpProp->value.i);
+ break;
+ case PT_LONG:
+ g_print (" (long) - %u", lpProp->value.l);
+ break;
+ case PT_FLOAT:
+ g_print (" PT_FLOAT");
+ break;
+ case PT_DOUBLE:
+ g_print (" (double) - %lf", (double)lpProp->value.dbl);
+ break;
+ case PT_CURRENCY:
+ g_print (" PT_CURRENCY");
+ break;
+ case PT_APPTIME:
+ g_print (" PT_APPTIME");
+ case PT_I8:
+ g_print (" (gint) - 0x%016" G_GINT64_MODIFIER "X", lpProp->value.d);
+ break;
+ case PT_SYSTIME: {
+ struct timeval t;
+ struct tm tm;
+ if (get_mapi_SPropValue_array_date_timeval (&t, properties, lpProp->ulPropTag) == MAPI_E_SUCCESS) {
+ gmtime_r (&(t.tv_sec), &tm);
+ strftime (t_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
+ g_print (" (struct FILETIME *) - %p\t (struct timeval) %s\t", &lpProp->value.ft, t_str);
+ }
+ }
+ break;
+ case PT_ERROR:
+ g_print (" (error) - "/* , lpProp->value.err */);
+ break;
+ case PT_STRING8:
+ g_print (" (string) - %s", lpProp->value.lpszA ? lpProp->value.lpszA : "null" );
+ break;
+ case PT_UNICODE:
+ if (lpProp)
+ g_print (" (unicodestring) - %s", lpProp->value.lpszW ? lpProp->value.lpszW : lpProp->value.lpszA ? lpProp->value.lpszA : "null");
+ break;
+ case PT_OBJECT:
+ g_print (" PT_OBJECT");
+ break;
+ case PT_CLSID:
+ g_print (" PT_CLSID");
+ break;
+ case PT_SVREID:
+ g_print (" PT_SVREID");
+ break;
+ case PT_SRESTRICT:
+ g_print (" PT_SRESTRICT");
+ break;
+ case PT_ACTIONS:
+ g_print (" PT_ACTIONS");
+ break;
+ case PT_BINARY:
+ g_print (" (struct SBinary_short *) - %p Binary data follows (size %d): \n", &lpProp->value.bin, lpProp->value.bin.cb);
+ dump_bin (lpProp->value.bin.lpb, lpProp->value.bin.cb, " ");
+ break;
+ case PT_MV_STRING8:
+ g_print (" (struct mapi_SLPSTRArray *) (%d items)", lpProp->value.MVszA.cValues);
+ for (j = 0; j < lpProp->value.MVszA.cValues; j++) {
+ g_print ("\n item[%d] = '%s'", j, lpProp->value.MVszA.strings[j].lppszA ? lpProp->value.MVszA.strings[j].lppszA : "[NULL]");
+ }
+ break;
+ case PT_MV_SHORT:
+ g_print (" PT_MV_SHORT");
+ break;
+ case PT_MV_LONG:
+ g_print (" PT_MV_LONG");
+ break;
+ case PT_MV_FLOAT:
+ g_print (" PT_MV_FLOAT");
+ break;
+ case PT_MV_DOUBLE:
+ g_print (" PT_MV_DOUBLE");
+ break;
+ case PT_MV_CURRENCY:
+ g_print (" PT_MV_CURRENCY");
+ break;
+ case PT_MV_APPTIME:
+ g_print (" PT_MV_APPTIME");
+ break;
+ case PT_MV_I8:
+ g_print (" PT_MV_I8");
+ break;
+ case PT_MV_UNICODE:
+ g_print (" PT_MV_UNICODE (%d items)", lpProp->value.MVszW.cValues);
+ for (j = 0; j < lpProp->value.MVszW.cValues; j++) {
+ g_print ("\n item[%d] = '%s'", j, lpProp->value.MVszW.strings[j].lppszW ? lpProp->value.MVszW.strings[j].lppszW : "[NULL]");
+ }
+ break;
+ case PT_MV_SYSTIME:
+ g_print (" PT_MV_SYSTIME");
+ break;
+ case PT_MV_CLSID:
+ g_print (" PT_MV_CLSID");
+ break;
+ case PT_MV_BINARY:
+ g_print (" PT_MV_BINARY (%d items)", lpProp->value.MVbin.cValues);
+ for (j = 0; j < lpProp->value.MVbin.cValues; j++) {
+ g_print ("\n item[%d] (size %d)\n", j, lpProp->value.MVbin.bin[j].cb);
+ dump_bin (lpProp->value.MVbin.bin[j].lpb, lpProp->value.MVbin.bin[j].cb, " ");
+ }
+ g_print ("\n---");
+ break;
+ default:
+ g_print (" - Unknown type 0x%04X", lpProp->ulPropTag & 0xFFFF);
+ }
+ }
+ }
+ g_print ("\n");
+}
diff --git a/src/libexchangemapi/exchange-mapi-debug.h b/src/libexchangemapi/exchange-mapi-debug.h
new file mode 100644
index 0000000..ba86421
--- /dev/null
+++ b/src/libexchangemapi/exchange-mapi-debug.h
@@ -0,0 +1,35 @@
+/*
+ * This program 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 of the License, or (at your option) version 3.
+ *
+ * This program 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 the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 2011 Red Hat, Inc. (www.redhat.com)
+ *
+ */
+
+/* debugging stuff for evolution-mapi */
+
+#ifndef EXCHANGE_MAPI_DEBUG_H
+#define EXCHANGE_MAPI_DEBUG_H
+
+#include "exchange-mapi-connection.h"
+
+G_BEGIN_DECLS
+
+gboolean exchange_mapi_debug_is_enabled (void);
+void exchange_mapi_debug_print (const gchar *format, ...);
+void exchange_mapi_debug_dump_properties (ExchangeMapiConnection *conn, mapi_id_t fid, struct mapi_SPropValue_array *properties);
+
+G_END_DECLS
+
+#endif /* EXCHANGE_MAPI_DEBUG_H */
diff --git a/src/libexchangemapi/exchange-mapi-mail-utils.c b/src/libexchangemapi/exchange-mapi-mail-utils.c
index 5ff3da1..1697af3 100644
--- a/src/libexchangemapi/exchange-mapi-mail-utils.c
+++ b/src/libexchangemapi/exchange-mapi-mail-utils.c
@@ -73,7 +73,7 @@ fetch_props_to_mail_item_cb (FetchItemsCallbackData *item_data, gpointer data)
g_return_val_if_fail (data != NULL, FALSE);
if (camel_debug_start("mapi:folder")) {
- exchange_mapi_debug_property_dump (item_data->properties);
+ exchange_mapi_debug_dump_properties (item_data->conn, item_data->fid, item_data->properties);
camel_debug_end();
}
diff --git a/src/libexchangemapi/exchange-mapi-utils.c b/src/libexchangemapi/exchange-mapi-utils.c
index bb9ea69..813fee3 100644
--- a/src/libexchangemapi/exchange-mapi-utils.c
+++ b/src/libexchangemapi/exchange-mapi-utils.c
@@ -392,206 +392,6 @@ exchange_mapi_util_free_stream_list (GSList **stream_list)
}
static void
-dump_bin (const uint8_t *bin, uint32_t bin_sz, const gchar *line_prefix)
-{
- gint k, l, last;
-
- if (!bin) {
- g_print ("NULL");
- return;
- }
-
- g_print ("%s", line_prefix);
-
- last = 0;
- for (k = 0; k < bin_sz; k++) {
- if ((k > 0 && (k % 16) == 0)) {
- g_print (" ");
- for (l = last; l < k; l++) {
- uint8_t u8 = bin[l];
-
- if ((l % 8) == 0)
- g_print (" ");
- if (u8 <= 32 || u8 >= 128)
- g_print (".");
- else
- g_print ("%c", u8);
- }
-
- last = l;
- g_print ("\n%s", line_prefix);
- } else if (k > 0 && (k % 8) == 0) {
- g_print (" ");
- }
- g_print (" %02X", bin[k]);
- }
-
- if (last < k) {
- l = k;
-
- while ((l % 16) != 0) {
- g_print (" ");
- if (l > 0 && (l % 8) == 0)
- g_print (" ");
- l++;
- }
-
- g_print (" ");
- for (l = last; l < k; l++) {
- uint8_t u8 = bin[l];
-
- if ((l % 8) == 0)
- g_print (" ");
- if (u8 <= 32 || u8 >= 128)
- g_print (".");
- else
- g_print ("%c", u8);
- }
- }
-}
-
-void
-exchange_mapi_debug_property_dump (struct mapi_SPropValue_array *properties)
-{
- gint i = 0;
-
- for (i = 0; i < properties->cValues; i++) {
- for (i = 0; i < properties->cValues; i++) {
- struct mapi_SPropValue *lpProp = &properties->lpProps[i];
- const gchar *tmp = get_proptag_name (lpProp->ulPropTag);
- gchar t_str[26];
- gint j = 0;
- if (tmp && *tmp)
- g_print("\n%s \t",tmp);
- else
- g_print("\n0x%08X \t", lpProp->ulPropTag);
- switch (lpProp->ulPropTag & 0xFFFF) {
- case PT_UNSPECIFIED:
- g_print (" PT_UNSPECIFIED");
- break;
- case PT_NULL:
- g_print (" PT_NULL");
- break;
- case PT_BOOLEAN:
- g_print(" (bool) - %d", (bool) lpProp->value.b);
- break;
- case PT_I2:
- g_print(" (uint16_t) - %d", lpProp->value.i);
- break;
- case PT_LONG:
- g_print(" (long) - %u", lpProp->value.l);
- break;
- case PT_FLOAT:
- g_print (" PT_FLOAT");
- break;
- case PT_DOUBLE:
- g_print (" (double) - %lf", (double)lpProp->value.dbl);
- break;
- case PT_CURRENCY:
- g_print (" PT_CURRENCY");
- break;
- case PT_APPTIME:
- g_print (" PT_APPTIME");
- case PT_I8:
- g_print (" (gint) - 0x%016" G_GINT64_MODIFIER "X", lpProp->value.d);
- break;
- case PT_SYSTIME: {
- struct timeval t;
- struct tm tm;
- if (get_mapi_SPropValue_array_date_timeval (&t, properties, lpProp->ulPropTag) == MAPI_E_SUCCESS) {
- gmtime_r (&(t.tv_sec), &tm);
- strftime (t_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
- g_print (" (struct FILETIME *) - %p\t (struct timeval) %s\t", &lpProp->value.ft, t_str);
- }
- }
- break;
- case PT_ERROR:
- g_print (" (error) - "/* , lpProp->value.err */);
- break;
- case PT_STRING8:
- g_print(" (string) - %s", lpProp->value.lpszA ? lpProp->value.lpszA : "null" );
- break;
- case PT_UNICODE:
- if (lpProp)
- g_print(" (unicodestring) - %s", lpProp->value.lpszW ? lpProp->value.lpszW : lpProp->value.lpszA ? lpProp->value.lpszA : "null");
- break;
- case PT_OBJECT:
- g_print (" PT_OBJECT");
- break;
- case PT_CLSID:
- g_print (" PT_CLSID");
- break;
- case PT_SVREID:
- g_print (" PT_SVREID");
- break;
- case PT_SRESTRICT:
- g_print (" PT_SRESTRICT");
- break;
- case PT_ACTIONS:
- g_print (" PT_ACTIONS");
- break;
- case PT_BINARY:
- g_print(" (struct SBinary_short *) - %p Binary data follows (size %d): \n", &lpProp->value.bin, lpProp->value.bin.cb);
- dump_bin (lpProp->value.bin.lpb, lpProp->value.bin.cb, " ");
- break;
- case PT_MV_STRING8:
- g_print(" (struct mapi_SLPSTRArray *) (%d items)", lpProp->value.MVszA.cValues);
- for (j = 0; j < lpProp->value.MVszA.cValues; j++) {
- g_print ("\n item[%d] = '%s'", j, lpProp->value.MVszA.strings[j].lppszA ? lpProp->value.MVszA.strings[j].lppszA : "[NULL]");
- }
- break;
- case PT_MV_SHORT:
- g_print (" PT_MV_SHORT");
- break;
- case PT_MV_LONG:
- g_print (" PT_MV_LONG");
- break;
- case PT_MV_FLOAT:
- g_print (" PT_MV_FLOAT");
- break;
- case PT_MV_DOUBLE:
- g_print (" PT_MV_DOUBLE");
- break;
- case PT_MV_CURRENCY:
- g_print (" PT_MV_CURRENCY");
- break;
- case PT_MV_APPTIME:
- g_print (" PT_MV_APPTIME");
- break;
- case PT_MV_I8:
- g_print (" PT_MV_I8");
- break;
- case PT_MV_UNICODE:
- g_print (" PT_MV_UNICODE (%d items)", lpProp->value.MVszW.cValues);
- for (j = 0; j < lpProp->value.MVszW.cValues; j++) {
- g_print ("\n item[%d] = '%s'", j, lpProp->value.MVszW.strings[j].lppszW ? lpProp->value.MVszW.strings[j].lppszW : "[NULL]");
- }
- break;
- case PT_MV_SYSTIME:
- g_print (" PT_MV_SYSTIME");
- break;
- case PT_MV_CLSID:
- g_print (" PT_MV_CLSID");
- break;
- case PT_MV_BINARY:
- g_print (" PT_MV_BINARY (%d items)", lpProp->value.MVbin.cValues);
- for (j = 0; j < lpProp->value.MVbin.cValues; j++) {
- g_print ("\n item[%d] (size %d)\n", j, lpProp->value.MVbin.bin[j].cb);
- dump_bin (lpProp->value.MVbin.bin[j].lpb, lpProp->value.MVbin.bin[j].cb, " ");
- }
- g_print ("\n---");
- break;
- default:
- g_print (" - Unknown type 0x%04X", lpProp->ulPropTag & 0xFFFF);
- }
- }
- }
- g_print ("\n");
-}
-
-/* Attention: Devs at work;-) */
-
-static void
exchange_mapi_util_bin_append_uint16 (TALLOC_CTX *mem_ctx, struct Binary_r *bin, const uint16_t val)
{
uint8_t *ptr = NULL;
diff --git a/src/libexchangemapi/exchange-mapi-utils.h b/src/libexchangemapi/exchange-mapi-utils.h
index b0ec1c6..eb21165 100644
--- a/src/libexchangemapi/exchange-mapi-utils.h
+++ b/src/libexchangemapi/exchange-mapi-utils.h
@@ -24,6 +24,7 @@
#ifndef EXCHANGE_MAPI_UTILS_H
#define EXCHANGE_MAPI_UTILS_H
+#include "exchange-mapi-debug.h"
#include "exchange-mapi-connection.h"
#include <camel/camel.h>
@@ -50,8 +51,6 @@ void exchange_mapi_util_free_attachment_list (GSList **attach_list);
void exchange_mapi_util_free_recipient_list (GSList **recip_list);
void exchange_mapi_util_free_stream_list (GSList **stream_list);
-void exchange_mapi_debug_property_dump (struct mapi_SPropValue_array *properties);
-
void exchange_mapi_util_recip_entryid_generate_smtp (TALLOC_CTX *mem_ctx, struct Binary_r *entryid, const gchar *display_name, const gchar *email);
void exchange_mapi_util_recip_entryid_generate_ex (TALLOC_CTX *mem_ctx, struct Binary_r *entryid, const gchar *exchange_dn);
gboolean exchange_mapi_util_recip_entryid_decode (ExchangeMapiConnection *conn, const struct Binary_r *entyrid, gchar **display_name, gchar **email);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]