evolution r36050 - branches/mail-dbus-remoting/mail
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36050 - branches/mail-dbus-remoting/mail
- Date: Mon, 25 Aug 2008 18:17:19 +0000 (UTC)
Author: sragavan
Date: Mon Aug 25 18:17:19 2008
New Revision: 36050
URL: http://svn.gnome.org/viewvc/evolution?rev=36050&view=rev
Log:
Merge Bharath's changes for CamelSession
Modified:
branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
branches/mail-dbus-remoting/mail/camel-session-remote.c
branches/mail-dbus-remoting/mail/camel-session-remote.h
branches/mail-dbus-remoting/mail/camel-store-remote.h
Modified: branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote-impl.c (original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote-impl.c Mon Aug 25 18:17:19 2008
@@ -5,6 +5,8 @@
#include <glib.h>
#include "mail-dbus.h"
+#include <camel/camel-session.h>
+#include <camel/camel-store.h>
#define CAMEL_SESSION_OBJECT_PATH "/org/gnome/evolution/camel/session"
@@ -24,12 +26,70 @@
void *user_data)
{
const char *method = dbus_message_get_member (message);
+ DBusMessage *return_val;
+
+ CamelSession *session = NULL;
+ CamelStore *store = NULL;
printf ("D-Bus message: obj_path = '%s' interface = '%s' method = '%s' destination = '%s'\n",
dbus_message_get_path (message),
dbus_message_get_interface (message),
dbus_message_get_member (message),
dbus_message_get_destination (message));
+
+
+ return_val = dbus_message_new_method_return (message);
+
+ if (strcmp(dbus_message_get_member (message), "camel_session_construct") == 0) {
+ char *storage_path;
+ char *session_str;
+ gboolean ret;
+
+ ret = dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &session_str,
+ DBUS_TYPE_STRING, &storage_path,
+ DBUS_TYPE_INVALID);
+ if (!ret) {
+ g_warning ("Unable to get args\n");
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ camel_session_construct (session, storage_path);
+ dbus_message_append_args (return_val, DBUS_TYPE_INVALID);
+
+ } else if (strcmp(dbus_message_get_member (message), "camel_session_get_password") == 0) {
+ char *session_str, *store_str, *domain, *prompt, *item, *err;
+ const char *passwd;
+ guint32 flags;
+ gboolean ret;
+ CamelException *ex;
+
+ ret = dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &session_str,
+ DBUS_TYPE_STRING, &store_str,
+ DBUS_TYPE_STRING, &domain,
+ DBUS_TYPE_STRING, &prompt,
+ DBUS_TYPE_STRING, &item,
+ DBUS_TYPE_UINT32, &flags,
+ DBUS_TYPE_INVALID);
+
+ camel_exception_init (ex);
+
+ passwd = camel_session_get_password (session, store, domain, prompt, item, flags, ex);
+
+ if (ex)
+ err = g_strdup (camel_exception_get_description (ex));
+ else
+ err = g_strdup ("");
+ camel_exception_free (ex);
+
+ dbus_message_append_args (return_val, DBUS_TYPE_STRING, passwd, DBUS_TYPE_STRING, err, DBUS_TYPE_INVALID);
+ g_free (err);
+ }
+
+ dbus_connection_send (connection, return_val, NULL);
+ dbus_message_unref (return_val);
+ dbus_connection_flush(connection);
return DBUS_HANDLER_RESULT_HANDLED;
Modified: branches/mail-dbus-remoting/mail/camel-session-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.c (original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.c Mon Aug 25 18:17:19 2008
@@ -3,6 +3,73 @@
*
* */
+#include <mail-dbus.h>
+#include "camel-session-remote.h"
+#include "camel-store-remote.h"
+#include "camel/camel-types.h"
+
+#define CAMEL_SESSION_INTERFACE "org.gnome.evolution.camel.session.mail"
#define CAMEL_SESSION_OBJECT_PATH "/org/gnome/evolution/camel/session"
#define CAMEL_DBUS_NAME "org.gnome.evolution.camel"
+
+void
+camel_session_remote_construct (CamelSessionRemote *session,
+ const char *storage_path)
+{
+ gboolean ret;
+ DBusError error;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ CAMEL_SESSION_OBJECT_PATH,
+ CAMEL_SESSION_INTERFACE,
+ "camel_session_construct",
+ &error,
+ "ss", session->object_id, storage_path); /* Just string of base dir */
+
+ if (!ret) {
+ g_warning ("Error: Constructing camel session: %s\n", error.message);
+ return;
+ }
+
+ d(printf("Camel session constructed remotely\n"));
+
+}
+
+char *
+camel_session_remote_get_password (CamelSessionRemote *session,
+ CamelStoreRemote *service,
+ const char *domain,
+ const char *prompt,
+ const char *item,
+ guint32 flags,
+ CamelException *ex)
+{
+ gboolean ret;
+ DBusError error;
+ const char *passwd;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ CAMEL_SESSION_OBJECT_PATH,
+ CAMEL_SESSION_INTERFACE,
+ "camel_session_get_password",
+ &error,
+ "sssssu=>ss", session->object_id, service->object_id, domain, prompt, item, flags, &passwd, &ex); /* Just string of base dir */
+
+ if (!ret) {
+ g_warning ("Error: Camel session fetching password: %s\n", error.message);
+ return NULL;
+ }
+
+ d(printf("Camel session get password remotely\n"));
+
+ return passwd;
+}
+
+
Modified: branches/mail-dbus-remoting/mail/camel-session-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.h (original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.h Mon Aug 25 18:17:19 2008
@@ -3,6 +3,7 @@
*
* */
-typedef struct CamelSessionRemote {
+typedef struct {
char *object_id;
-};
+} CamelSessionRemote;
+
Modified: branches/mail-dbus-remoting/mail/camel-store-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-store-remote.h (original)
+++ branches/mail-dbus-remoting/mail/camel-store-remote.h Mon Aug 25 18:17:19 2008
@@ -3,6 +3,6 @@
*
* */
-typedef struct CamelStoreRemote {
+typedef struct {
char *object_id;
-};
+} CamelStoreRemote;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]