evolution-data-server r8385 - trunk/servers/groupwise



Author: kmaraas
Date: Thu Jan 17 13:15:19 2008
New Revision: 8385
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8385&view=rev

Log:
2008-01-15  Dan Winship  <danw gnome org>

	* e-gw-message.c: Update for libsoup 2.4

	* soup-soap-message.c: 
	* soup-soap-response.c: Moved here from libsoup. (FIXME: integrate
	with the rest of libegroupwise better.)

	* *.h: tweak soup-soap includes

Modified:
   trunk/servers/groupwise/ChangeLog
   trunk/servers/groupwise/Makefile.am
   trunk/servers/groupwise/e-gw-connection.c
   trunk/servers/groupwise/e-gw-connection.h
   trunk/servers/groupwise/e-gw-container.h
   trunk/servers/groupwise/e-gw-filter.h
   trunk/servers/groupwise/e-gw-item.h
   trunk/servers/groupwise/e-gw-message.c
   trunk/servers/groupwise/e-gw-message.h
   trunk/servers/groupwise/e-gw-proxy.h
   trunk/servers/groupwise/e-gw-sendoptions.h
   trunk/servers/groupwise/libegroupwise.pc.in

Modified: trunk/servers/groupwise/Makefile.am
==============================================================================
--- trunk/servers/groupwise/Makefile.am	(original)
+++ trunk/servers/groupwise/Makefile.am	Thu Jan 17 13:15:19 2008
@@ -46,6 +46,8 @@
 	e-gw-recur-utils.h			\
 	e-gw-proxy.h				\
 	e-gw-proxy.c				\
+	soup-soap-message.c			\
+	soup-soap-response.c			\
 	build-timestamp.h
 
 libegroupwise_1_2_la_LIBADD =						\
@@ -65,7 +67,9 @@
 	e-gw-sendoptions.h			\
 	e-gw-filter.h                        	\
 	e-gw-recur-utils.h			\
-	e-gw-proxy.h				
+	e-gw-proxy.h				\
+	soup-soap-message.h			\
+	soup-soap-response.h
 
 %-$(API_VERSION).pc: %.pc
 	 cp $< $@

Modified: trunk/servers/groupwise/e-gw-connection.c
==============================================================================
--- trunk/servers/groupwise/e-gw-connection.c	(original)
+++ trunk/servers/groupwise/e-gw-connection.c	Thu Jan 17 13:15:19 2008
@@ -27,9 +27,8 @@
 #include <string.h>
 #include <ctype.h>
 #include <glib/gi18n-lib.h>
-#include <libsoup/soup-session-sync.h>
-#include <libsoup/soup-soap-message.h>
-#include <libsoup/soup-misc.h>
+#include <libsoup/soup.h>
+#include "soup-soap-message.h"
 #include "e-gw-connection.h"
 #include "e-gw-message.h"
 #include "e-gw-filter.h"
@@ -401,6 +400,17 @@
 	priv->categories_by_name = NULL;
 	priv->book_list = NULL;
 	priv->opts = NULL;
+
+	if (g_getenv ("GROUPWISE_DEBUG")) {
+		if (atoi (g_getenv ("GROUPWISE_DEBUG")) == 1) {
+			SoupLogger *logger;
+
+			logger = soup_logger_new (SOUP_LOGGER_LOG_BODY,
+						  SOUP_LOGGER_LOG_BODY);
+			soup_logger_attach (logger, priv->soup_session);
+			g_object_unref (logger);
+		}
+	}
 }
 
 GType

Modified: trunk/servers/groupwise/e-gw-connection.h
==============================================================================
--- trunk/servers/groupwise/e-gw-connection.h	(original)
+++ trunk/servers/groupwise/e-gw-connection.h	Thu Jan 17 13:15:19 2008
@@ -25,7 +25,7 @@
 #define E_GW_CONNECTION_H
 
 #include <glib-object.h>
-#include <libsoup/soup-soap-message.h>
+#include "soup-soap-message.h"
 #include "e-gw-proxy.h"
 #include "e-gw-container.h"
 #include "e-gw-item.h"

Modified: trunk/servers/groupwise/e-gw-container.h
==============================================================================
--- trunk/servers/groupwise/e-gw-container.h	(original)
+++ trunk/servers/groupwise/e-gw-container.h	Thu Jan 17 13:15:19 2008
@@ -24,8 +24,8 @@
 #ifndef E_GW_CONTAINER_H
 #define E_GW_CONTAINER_H
 
-#include <libsoup/soup-soap-response.h>
-#include <libsoup/soup-soap-message.h>
+#include "soup-soap-response.h"
+#include "soup-soap-message.h"
 
 G_BEGIN_DECLS
 

Modified: trunk/servers/groupwise/e-gw-filter.h
==============================================================================
--- trunk/servers/groupwise/e-gw-filter.h	(original)
+++ trunk/servers/groupwise/e-gw-filter.h	Thu Jan 17 13:15:19 2008
@@ -25,8 +25,8 @@
 #define E_GW_FILTER_H
 
 
-#include <libsoup/soup-soap-message.h>
-#include <libsoup/soup-soap-response.h>
+#include "soup-soap-message.h"
+#include "soup-soap-response.h"
 
 G_BEGIN_DECLS
 

Modified: trunk/servers/groupwise/e-gw-item.h
==============================================================================
--- trunk/servers/groupwise/e-gw-item.h	(original)
+++ trunk/servers/groupwise/e-gw-item.h	Thu Jan 17 13:15:19 2008
@@ -24,8 +24,8 @@
 #ifndef E_GW_ITEM_H
 #define E_GW_ITEM_H
 
-#include <libsoup/soup-soap-message.h>
-#include <libsoup/soup-soap-response.h>
+#include "soup-soap-message.h"
+#include "soup-soap-response.h"
 #include "e-gw-recur-utils.h"
 
 G_BEGIN_DECLS

Modified: trunk/servers/groupwise/e-gw-message.c
==============================================================================
--- trunk/servers/groupwise/e-gw-message.c	(original)
+++ trunk/servers/groupwise/e-gw-message.c	Thu Jan 17 13:15:19 2008
@@ -26,49 +26,6 @@
 #include <libsoup/soup-uri.h>
 #include "e-gw-message.h"
 
-static void
-print_header (gpointer name, gpointer value, gpointer data)
-{
-	g_print ("%s: %s\n", (char *) name, (char *) value);
-}
-
-static void
-debug_handler (SoupMessage *msg, gpointer user_data)
-{
-	g_print ("%d %s\nSOAP-Debug: %p @ %lu\n",
-                msg->status_code, msg->reason_phrase,
-                msg, time (NULL));
-
-	/* print headers */
-	soup_message_foreach_header (msg->response_headers, print_header, NULL);
-
-	/* print response */
-	if (msg->response.length) {
-		fputc ('\n', stdout);
-		fwrite (msg->response.body, 1, msg->response.length, stdout);
-		fputc ('\n', stdout);
-	}
-}
-
-static void
-setup_debug (SoupSoapMessage *msg)
-{
-	const SoupUri *suri;
-
-	suri = soup_message_get_uri (SOUP_MESSAGE (msg));
-	g_print ("%s %s%s%s HTTP/1.1\nSOAP-Debug: %p @ %lu\n",
-		 SOUP_MESSAGE (msg)->method, suri->path,
-		 suri->query ? "?" : "",
-		 suri->query ? suri->query : "",
-		 msg, (unsigned long) time (NULL));
-
-	/* print message headers */
-	print_header ("Host", suri->host, NULL);
-	soup_message_foreach_header (SOUP_MESSAGE (msg)->request_headers, print_header, NULL);
-
-	soup_message_add_handler (SOUP_MESSAGE (msg), SOUP_HANDLER_POST_BODY, debug_handler, NULL);
-}
-
 SoupSoapMessage *
 e_gw_message_new_with_header (const char *uri, const char *session_id, const char *method_name)
 {
@@ -80,16 +37,11 @@
 		return NULL;
 	}
 
-	soup_message_add_header (SOUP_MESSAGE (msg)->request_headers, "Content-Type", "text/xml");
-	soup_message_add_header (SOUP_MESSAGE (msg)->request_headers, "User-Agent",
-				 "Evolution/" VERSION);
-	soup_message_add_header (SOUP_MESSAGE (msg)->request_headers,"Connection",  "Keep-Alive");
-	soup_message_add_header (SOUP_MESSAGE (msg)->request_headers, "SOAPAction", method_name);
-
-	if (g_getenv ("GROUPWISE_DEBUG")) {
-		if (atoi (g_getenv ("GROUPWISE_DEBUG")) == 1)
-			setup_debug (msg);
-	}
+	soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers, "Content-Type", "text/xml");
+	soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers, "User-Agent",
+				     "Evolution/" VERSION);
+	soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers,"Connection",  "Keep-Alive");
+	soup_message_headers_append (SOUP_MESSAGE (msg)->request_headers, "SOAPAction", method_name);
 
 	soup_soap_message_start_envelope (msg);
 	if (session_id && *session_id) {
@@ -158,13 +110,15 @@
 	soup_soap_message_persist (msg);
 
 	if (g_getenv ("GROUPWISE_DEBUG") && (atoi (g_getenv ("GROUPWISE_DEBUG")) == 1)) {
-		const char *header = soup_message_get_header (SOUP_MESSAGE (msg)->request_headers, "SOAPAction");
+		const char *header = soup_message_headers_get (SOUP_MESSAGE (msg)->request_headers, "SOAPAction");
+
+		soup_buffer_free (soup_message_body_flatten (SOUP_MESSAGE (msg)->request_body));
 		if (header && g_str_equal (header, "loginRequest")) {
 			gchar *body;
 			gchar *begin = NULL;
 			gchar *end = NULL;
 
-			body = g_strndup (SOUP_MESSAGE (msg)->request.body, SOUP_MESSAGE (msg)->request.length);
+			body = g_strdup (SOUP_MESSAGE (msg)->request_body->data);
 			begin = g_strrstr (body, "<types:password>");
 			if (begin)
 				begin = begin + strlen ("<types:password>");
@@ -176,7 +130,7 @@
 
 			}
 			fputc ('\n', stdout);
-			fwrite (body, 1, SOUP_MESSAGE (msg)->request.length, stdout);
+			fputs (body, stdout);
 			fputc ('\n', stdout);
 			g_free (body);
 		}
@@ -184,7 +138,7 @@
 
 			/* print request's body */
 			fputc ('\n', stdout);
-			fwrite (SOUP_MESSAGE (msg)->request.body, 1, SOUP_MESSAGE (msg)->request.length, stdout);
+			fputs (SOUP_MESSAGE (msg)->request_body->data, stdout);
 			fputc ('\n', stdout);
 		}
 	}

Modified: trunk/servers/groupwise/e-gw-message.h
==============================================================================
--- trunk/servers/groupwise/e-gw-message.h	(original)
+++ trunk/servers/groupwise/e-gw-message.h	Thu Jan 17 13:15:19 2008
@@ -24,7 +24,7 @@
 #ifndef E_GW_MESSAGE_H
 #define E_GW_MESSAGE_H
 
-#include <libsoup/soup-soap-message.h>
+#include "soup-soap-message.h"
 
 G_BEGIN_DECLS
 

Modified: trunk/servers/groupwise/e-gw-proxy.h
==============================================================================
--- trunk/servers/groupwise/e-gw-proxy.h	(original)
+++ trunk/servers/groupwise/e-gw-proxy.h	Thu Jan 17 13:15:19 2008
@@ -25,7 +25,7 @@
 #include <config.h>
 #endif
 
-#include <libsoup/soup-soap-message.h>
+#include "soup-soap-message.h"
 
 /*State of each proxy grant*/
 

Modified: trunk/servers/groupwise/e-gw-sendoptions.h
==============================================================================
--- trunk/servers/groupwise/e-gw-sendoptions.h	(original)
+++ trunk/servers/groupwise/e-gw-sendoptions.h	Thu Jan 17 13:15:19 2008
@@ -24,7 +24,7 @@
 #ifndef E_GW_SENDOPTIONS_H
 #define E_GW_SENDOPTIONS_H
 
-#include <libsoup/soup-soap-response.h>
+#include "soup-soap-response.h"
 
 G_BEGIN_DECLS
 

Modified: trunk/servers/groupwise/libegroupwise.pc.in
==============================================================================
--- trunk/servers/groupwise/libegroupwise.pc.in	(original)
+++ trunk/servers/groupwise/libegroupwise.pc.in	Thu Jan 17 13:15:19 2008
@@ -13,6 +13,6 @@
 Name: libegroupwise
 Description: Client library for accessing groupwise POA through SOAP interface
 Version: @VERSION@
-Requires: @LIBSOUP@ >= @LIBSOUP_REQUIRED@ 
+Requires: libsoup-2.4 >= @LIBSOUP_REQUIRED@ 
 Libs: -L${libdir} -legroupwise-1.2
 Cflags: -I${privincludedir}/groupwise



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