aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBharath Acharya <abharath@src.gnome.org>2008-08-29 17:53:04 +0800
committerBharath Acharya <abharath@src.gnome.org>2008-08-29 17:53:04 +0800
commitaf1c1ad55876e16fded556c72ff83db380a75641 (patch)
tree3d26b023b2de00691d03e6c2cf28dee22d44ad4f
parent778c8ed665b7232859dde5d7f11a5dd2a1cdfac9 (diff)
downloadgsoc2013-evolution-mmeeks-dbus-oddness.tar.gz
gsoc2013-evolution-mmeeks-dbus-oddness.tar.zst
gsoc2013-evolution-mmeeks-dbus-oddness.zip
The last set of funcs to be remoted I guess. Now lets move everything tommeeks-dbus-oddness
the remote funcs and Folder to Remote. svn path=/branches/mail-dbus-remoting/; revision=36198
-rw-r--r--mail/camel-folder-remote-impl.c45
-rw-r--r--mail/camel-folder-remote.c76
-rw-r--r--mail/camel-folder-remote.h9
3 files changed, 130 insertions, 0 deletions
diff --git a/mail/camel-folder-remote-impl.c b/mail/camel-folder-remote-impl.c
index b9cb348ec1..801211f145 100644
--- a/mail/camel-folder-remote-impl.c
+++ b/mail/camel-folder-remote-impl.c
@@ -237,6 +237,51 @@ dbus_listener_message_handler(DBusConnection * connection,
camel_folder_set_message_user_tag (folder, uid, name, user_tag);
dbus_message_append_args (return_val, DBUS_TYPE_INVALID);
+ } else if (strcmp(method, "camel_folder_expunge") == 0) {
+ gboolean ret;
+ char *err;
+ CamelException *ex;
+
+ ex = camel_exception_new ();
+
+ ret = dbus_message_get_args (message, NULL,
+ DBUS_TYPE_STRING, &folder_hash_key,
+ DBUS_TYPE_INVALID);
+ folder = g_hash_table_lookup (folder_hash, folder_hash_key);
+
+ camel_folder_expunge (folder, ex);
+
+ if (camel_exception_is_set(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, &err, DBUS_TYPE_INVALID);
+ } else if (strcmp(method, "camel_folder_has_search_capability") == 0) {
+ gboolean ret, has_search;
+
+ ret = dbus_message_get_args (message, NULL,
+ DBUS_TYPE_STRING, &folder_hash_key,
+ DBUS_TYPE_INVALID);
+ folder = g_hash_table_lookup (folder_hash, folder_hash_key);
+
+ has_search = camel_folder_has_search_capability (folder);
+ dbus_message_append_args (return_val, DBUS_TYPE_INT32, &has_search, DBUS_TYPE_INVALID);
+ } else if (strcmp(method, "camel_folder_get_message_flags") == 0) {
+ gboolean ret;
+ const char *uid;
+ guint32 message_flags;
+
+ ret = dbus_message_get_args (message, NULL,
+ DBUS_TYPE_STRING, &folder_hash_key,
+ DBUS_TYPE_STRING, &uid,
+ DBUS_TYPE_INVALID);
+ folder = g_hash_table_lookup (folder_hash, folder_hash_key);
+
+ message_flags = camel_folder_get_message_flags(folder, uid);
+ dbus_message_append_args (return_val, DBUS_TYPE_UINT32, &message_flags, DBUS_TYPE_INVALID);
} else if (strcmp (method, "camel_vee_folder_set_expression") == 0) {
gboolean ret;
const char *query;
diff --git a/mail/camel-folder-remote.c b/mail/camel-folder-remote.c
index 5ee474092a..9d39860dc4 100644
--- a/mail/camel-folder-remote.c
+++ b/mail/camel-folder-remote.c
@@ -399,6 +399,82 @@ camel_folder_remote_set_message_user_tag (CamelFolderRemote *folder, const char
d(printf("Camel folder set message user tag remotely\n"));
}
+void
+camel_folder_remote_expunge (CamelFolderRemote *folder, CamelException *ex)
+{
+ gboolean ret;
+ DBusError error;
+ char *err;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ CAMEL_FOLDER_OBJECT_PATH,
+ CAMEL_FOLDER_INTERFACE,
+ "camel_folder_expunge",
+ &error,
+ "s=>s", folder->object_id, &err);
+
+ if (!ret) {
+ g_warning ("Error: Camel folder expunge: %s\n", error.message);
+ return;
+ }
+
+ d(printf("Camel folder expunge remotely\n"));
+}
+
+gboolean
+camel_folder_remote_has_search_capability (CamelFolderRemote *folder)
+{
+ gboolean ret, has_search;
+ 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_FOLDER_OBJECT_PATH,
+ CAMEL_FOLDER_INTERFACE,
+ "camel_folder_has_search_capability",
+ &error,
+ "s=>i", folder->object_id, &has_search);
+
+ if (!ret) {
+ g_warning ("Error: Camel folder checking for search capability: %s\n", error.message);
+ return 0;
+ }
+
+ d(printf("Camel folder checking for search capability remotely\n"));
+ return has_search;
+}
+
+guint32
+camel_folder_remote_get_message_flags (CamelFolderRemote *folder, const char *uid)
+{
+ gboolean ret;
+ DBusError error;
+ guint32 message_flags;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ CAMEL_FOLDER_OBJECT_PATH,
+ CAMEL_FOLDER_INTERFACE,
+ "camel_folder_get_message_flags",
+ &error,
+ "ss=>u", folder->object_id, uid, &message_flags);
+
+ if (!ret) {
+ g_warning ("Error: Camel folder get message flags: %s\n", error.message);
+ return 0;
+ }
+
+ d(printf("Camel folder get message flags remotely\n"));
+
+ return message_flags;
+}
void
camel_folder_remote_set_vee_folder_expression (CamelFolderRemote *folder, const char *query)
diff --git a/mail/camel-folder-remote.h b/mail/camel-folder-remote.h
index 74963a9f98..ff74ec0e98 100644
--- a/mail/camel-folder-remote.h
+++ b/mail/camel-folder-remote.h
@@ -39,6 +39,15 @@ const char *camel_folder_remote_get_message_user_tag (CamelFolderRemote *folder,
void camel_folder_remote_set_message_user_tag (CamelFolderRemote *folder, const char *uid, const char *name, const char *value);
+void camel_folder_remote_expunge (CamelFolderRemote *folder, CamelException *ex);
+
+gboolean camel_folder_remote_has_search_capability (CamelFolderRemote *folder);
+
+guint32 camel_folder_remote_get_message_flags (CamelFolderRemote *folder, const char *uid);
+
+#define camel_folder_remote_delete_message(folder, uid) \
+ camel_folder_remote_set_message_flags (folder, uid, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_DELETED|CAMEL_MESSAGE_SEEN)
+
void camel_folder_remote_set_vee_folder_expression (CamelFolderRemote *folder, const char *query);
#endif