[evolution-mapi] Debug object properties from outside and change env variable names



commit dd30f433bfbdb25cecf3002193d2f9f5f951f41e
Author: Milan Crha <mcrha redhat com>
Date:   Thu Feb 23 17:00:46 2012 +0100

    Debug object properties from outside and change env variable names
    
    Use MAPI_DEBUG for properties debug and LIBMAPI_DEBUG for
    libmapi and RPC data debugging.

 src/addressbook/e-book-backend-mapi.c   |   15 ---------------
 src/addressbook/e-book-backend-mapi.h   |    1 -
 src/libexchangemapi/e-mapi-book-utils.c |   15 +++++++++++++++
 src/libexchangemapi/e-mapi-cal-utils.c  |   10 ++++++++++
 src/libexchangemapi/e-mapi-connection.c |    4 ++--
 src/libexchangemapi/e-mapi-debug.c      |    2 +-
 src/libexchangemapi/e-mapi-mail-utils.c |   10 ++++++++++
 7 files changed, 38 insertions(+), 19 deletions(-)
---
diff --git a/src/addressbook/e-book-backend-mapi.c b/src/addressbook/e-book-backend-mapi.c
index 856987b..2fb8378 100644
--- a/src/addressbook/e-book-backend-mapi.c
+++ b/src/addressbook/e-book-backend-mapi.c
@@ -1413,21 +1413,6 @@ e_book_backend_mapi_class_init (EBookBackendMAPIClass *klass)
 	klass->op_transfer_contacts		= NULL;
 }
 
-gboolean
-e_book_backend_mapi_debug_enabled (void)
-{
-	gint8 debug_enabled = -1;
-
-	if (debug_enabled == -1) {
-		if (g_getenv ("MAPI_DEBUG"))
-			debug_enabled = 1;
-		else
-			debug_enabled = 0;
-	}
-
-	return debug_enabled != 0;
-}
-
 const gchar *
 e_book_backend_mapi_get_book_uri (EBookBackendMAPI *ebma)
 {
diff --git a/src/addressbook/e-book-backend-mapi.h b/src/addressbook/e-book-backend-mapi.h
index ce3e2ba..49abb27 100644
--- a/src/addressbook/e-book-backend-mapi.h
+++ b/src/addressbook/e-book-backend-mapi.h
@@ -100,7 +100,6 @@ typedef struct
 
 GType e_book_backend_mapi_get_type (void);
 
-gboolean e_book_backend_mapi_debug_enabled (void);
 const gchar *e_book_backend_mapi_get_book_uri (EBookBackendMAPI *ebma);
 void e_book_backend_mapi_lock_connection (EBookBackendMAPI *ebma);
 void e_book_backend_mapi_unlock_connection (EBookBackendMAPI *ebma);
diff --git a/src/libexchangemapi/e-mapi-book-utils.c b/src/libexchangemapi/e-mapi-book-utils.c
index b403b58..eddd5c6 100644
--- a/src/libexchangemapi/e-mapi-book-utils.c
+++ b/src/libexchangemapi/e-mapi-book-utils.c
@@ -132,6 +132,11 @@ e_mapi_book_utils_contact_from_object (EMapiConnection *conn,
 
 	g_return_val_if_fail (object != NULL, NULL);
 
+	if (e_mapi_debug_is_enabled ()) {
+		printf ("%s:\n", G_STRFUNC);
+		e_mapi_debug_dump_object (object, TRUE, 3);
+	}
+
 	contact = e_contact_new ();
 	if (book_uri)
 		e_contact_set (contact, E_CONTACT_BOOK_URI, book_uri);
@@ -530,6 +535,11 @@ e_mapi_book_utils_contact_to_object (EContact *contact,
 		set_value (PidLidDistributionListMembers, members);
 		set_value (PidLidDistributionListChecksum, &crc32);
 
+		if (e_mapi_debug_is_enabled ()) {
+			printf ("%s:\n", G_STRFUNC);
+			e_mapi_debug_dump_object (object, TRUE, 3);
+		}
+
 		return TRUE;
 	}
 
@@ -631,6 +641,11 @@ e_mapi_book_utils_contact_to_object (EContact *contact,
 
 	#undef set_value
 
+	if (e_mapi_debug_is_enabled ()) {
+		printf ("%s:\n", G_STRFUNC);
+		e_mapi_debug_dump_object (object, TRUE, 3);
+	}
+
 	return TRUE;
 }
 
diff --git a/src/libexchangemapi/e-mapi-cal-utils.c b/src/libexchangemapi/e-mapi-cal-utils.c
index 9b635e8..6ebce46 100644
--- a/src/libexchangemapi/e-mapi-cal-utils.c
+++ b/src/libexchangemapi/e-mapi-cal-utils.c
@@ -859,6 +859,11 @@ e_mapi_cal_util_object_to_comp (EMapiConnection *conn,
 	g_return_val_if_fail (object != NULL, NULL);
 	g_return_val_if_fail (use_uid != NULL, NULL);
 
+	if (e_mapi_debug_is_enabled ()) {
+		printf ("%s:\n", G_STRFUNC);
+		e_mapi_debug_dump_object (object, TRUE, 3);
+	}
+
 	switch (kind) {
 		case ICAL_VEVENT_COMPONENT:
 		case ICAL_VTODO_COMPONENT:
@@ -2188,5 +2193,10 @@ e_mapi_cal_utils_comp_to_object (EMapiConnection *conn,
 
 	e_mapi_cal_utils_add_attachments (object, comp);
 
+	if (e_mapi_debug_is_enabled ()) {
+		printf ("%s:\n", G_STRFUNC);
+		e_mapi_debug_dump_object (object, TRUE, 3);
+	}
+
 	return TRUE;
 }
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index e1c0c71..535f8cc 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -6574,8 +6574,8 @@ mapi_profile_load (struct mapi_context *mapi_ctx, const gchar *profname, const g
 	e_mapi_debug_print("%s: Entering %s ", G_STRLOC, G_STRFUNC);
 
 	/* Initialize libmapi logger*/
-	if (g_getenv ("MAPI_DEBUG")) {
-		debug_log_level = atoi (g_getenv ("MAPI_DEBUG"));
+	if (g_getenv ("LIBMAPI_DEBUG")) {
+		debug_log_level = atoi (g_getenv ("LIBMAPI_DEBUG"));
 		SetMAPIDumpData (mapi_ctx, TRUE);
 		SetMAPIDebugLevel (mapi_ctx, debug_log_level);
 	}
diff --git a/src/libexchangemapi/e-mapi-debug.c b/src/libexchangemapi/e-mapi-debug.c
index fcf2f65..70349f9 100644
--- a/src/libexchangemapi/e-mapi-debug.c
+++ b/src/libexchangemapi/e-mapi-debug.c
@@ -27,7 +27,7 @@ e_mapi_debug_is_enabled (void)
 	static gchar enabled = -1;
 
 	if (enabled == -1)
-		enabled = g_getenv ("EXCHANGEMAPI_DEBUG") != NULL ? 1 : 0;
+		enabled = g_getenv ("MAPI_DEBUG") != NULL ? 1 : 0;
 
 	return enabled == 1;
 }
diff --git a/src/libexchangemapi/e-mapi-mail-utils.c b/src/libexchangemapi/e-mapi-mail-utils.c
index bf0e650..0a510d4 100644
--- a/src/libexchangemapi/e-mapi-mail-utils.c
+++ b/src/libexchangemapi/e-mapi-mail-utils.c
@@ -700,6 +700,11 @@ e_mapi_mail_utils_object_to_message (EMapiConnection *conn, /* const */ EMapiObj
 	g_return_val_if_fail (conn != NULL, NULL);
 	g_return_val_if_fail (object != NULL, NULL);
 
+	if (e_mapi_debug_is_enabled ()) {
+		printf ("%s:\n", G_STRFUNC);
+		e_mapi_debug_dump_object (object, TRUE, 3);
+	}
+
 	msg = camel_mime_message_new ();
 
 	str = e_mapi_util_find_array_propval (&object->properties, PidTagTransportMessageHeaders);
@@ -1648,5 +1653,10 @@ e_mapi_mail_utils_message_to_object (struct _CamelMimeMessage *message,
 
 	#undef set_value
 
+	if (e_mapi_debug_is_enabled ()) {
+		printf ("%s:\n", G_STRFUNC);
+		e_mapi_debug_dump_object (object, TRUE, 3);
+	}
+
 	return TRUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]