[evolution-patches] debugging for GW messages



This patch makes debugging for GW be enabled based on an environment
variable, rather than on compile-time flags, so that people can enable
it easily.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/ChangeLog,v
retrieving revision 1.11
diff -u -p -r1.11 ChangeLog
--- ChangeLog	15 Mar 2004 03:53:41 -0000	1.11
+++ ChangeLog	17 Mar 2004 19:39:23 -0000
@@ -1,4 +1,12 @@
+2004-03-17  Rodrigo Moya <rodrigo ximian com>
+
+	* e-gw-message.c: use an environment variable for debugging.
+	(e_gw_message_new_with_header): setup debugging for message if
+	GROUPWISE_DEBUG environment variable is defined.
+	(e_gw_message_write_footer): ditto.
+
 2004-03-14  Harish K <kharish novell com>
+
 	* e-gw-connection.[ch] : Make view element an argument to the 
 	get_items call so the addressbook component can use it as well.
 	
Index: e-gw-connection.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-connection.c,v
retrieving revision 1.59
diff -u -p -r1.59 e-gw-connection.c
--- e-gw-connection.c	15 Mar 2004 03:53:41 -0000	1.59
+++ e-gw-connection.c	17 Mar 2004 19:39:24 -0000
@@ -898,6 +898,7 @@ e_gw_connection_get_session_id (EGwConne
 const char *
 e_gw_connection_get_user_name (EGwConnection *cnc)
 {
+	g_return_val_if_fail (cnc != NULL, NULL);
 	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
 
 	return (const char *) cnc->priv->user_name;
@@ -906,6 +907,7 @@ e_gw_connection_get_user_name (EGwConnec
 const char* 
 e_gw_connection_get_user_email (EGwConnection *cnc)
 {
+	g_return_val_if_fail (cnc != NULL, NULL);
 	g_return_val_if_fail (E_IS_GW_CONNECTION (cnc), NULL);
   
 	return (const char*) cnc->priv->user_email;
Index: e-gw-message.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/groupwise/e-gw-message.c,v
retrieving revision 1.13
diff -u -p -r1.13 e-gw-message.c
--- e-gw-message.c	11 Mar 2004 10:23:28 -0000	1.13
+++ e-gw-message.c	17 Mar 2004 19:39:24 -0000
@@ -25,8 +25,6 @@
 #include <libsoup/soup-uri.h>
 #include "e-gw-message.h"
 
-#ifdef G_ENABLE_DEBUG
-
 static void
 print_header (gpointer name, gpointer value, gpointer data)
 {
@@ -70,8 +68,6 @@ setup_debug (SoupSoapMessage *msg)
 	soup_message_add_handler (SOUP_MESSAGE (msg), SOUP_HANDLER_POST_BODY, debug_handler, NULL);
 }
 
-#endif
-
 SoupSoapMessage *
 e_gw_message_new_with_header (const char *uri, const char *session_id, const char *method_name)
 {
@@ -88,9 +84,8 @@ e_gw_message_new_with_header (const char
 				 "Evolution/" VERSION);
 	soup_message_add_header (SOUP_MESSAGE (msg)->request_headers, "SOAPAction", method_name);
 
-#ifdef G_ENABLE_DEBUG
-	setup_debug (msg);
-#endif
+	if (g_getenv ("GROUWISE_DEBUG"))
+		setup_debug (msg);
 
 	soup_soap_message_start_envelope (msg);
 	if (session_id && *session_id) {
@@ -139,11 +134,10 @@ e_gw_message_write_footer (SoupSoapMessa
 
 	soup_soap_message_persist (msg);
 
-#ifdef G_ENABLE_DEBUG
-	/* print request's body */
-	fputc ('\n', stdout);
-	fwrite (SOUP_MESSAGE (msg)->request.body, 1, SOUP_MESSAGE (msg)->request.length, stdout);
-	fputc ('\n', stdout);
-#endif
-
+	if (g_getenv ("GROUPWISE_DEBUG")) {
+		/* print request's body */
+		fputc ('\n', stdout);
+		fwrite (SOUP_MESSAGE (msg)->request.body, 1, SOUP_MESSAGE (msg)->request.length, stdout);
+		fputc ('\n', stdout);
+	}
 }


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