evolution r36253 - branches/mail-dbus-remoting/mail
- From: sragavan svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36253 - branches/mail-dbus-remoting/mail
- Date: Thu, 4 Sep 2008 02:57:55 +0000 (UTC)
Author: sragavan
Date: Thu Sep 4 02:57:55 2008
New Revision: 36253
URL: http://svn.gnome.org/viewvc/evolution?rev=36253&view=rev
Log:
Implement get_message. Text is geting passed right. But parser isn't working well.
Modified:
branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c
branches/mail-dbus-remoting/mail/camel-folder-remote.c
Modified: branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c (original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote-impl.c Thu Sep 4 02:57:55 2008
@@ -331,6 +331,50 @@
camel_vee_folder_set_expression ((CamelVeeFolder *) folder, query);
dbus_message_append_args (return_val, DBUS_TYPE_INVALID);
+ } else if (strcmp (method, "camel_folder_get_message") == 0) {
+ gboolean ret;
+ char *uid;
+ CamelMimeMessage *msg;
+ CamelStreamMem *mstream;
+ CamelDataWrapper *wrapper;
+ char *enc_ms;
+
+ 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);
+ msg = camel_folder_get_message (folder, uid, NULL);
+ if (msg) {
+
+ char *fromline = camel_mime_message_build_mbox_from(msg);
+ CamelMimeFilter *filter_from;
+ CamelStream *filter_stream;
+
+ mstream = (CamelStreamMem *) camel_stream_mem_new ();
+ camel_stream_write(mstream, fromline, strlen(fromline));
+
+ filter_stream = (CamelStream *) camel_stream_filter_new_with_stream(mstream);
+ filter_from = (CamelMimeFilter *) camel_mime_filter_from_new();
+ camel_stream_filter_add((CamelStreamFilter *) filter_stream, filter_from);
+ camel_object_unref (filter_from);
+
+ camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, filter_stream);
+ camel_stream_write (filter_stream, "\n", 1);
+ camel_stream_flush (filter_stream);
+
+ /* filter stream ref's the output stream itself, so we need to unref it too */
+ camel_object_unref (filter_stream);
+ g_free(fromline);
+
+ enc_ms = g_base64_encode (mstream->buffer->data, mstream->buffer->len);
+ camel_object_unref (mstream);
+ } else
+ enc_ms = g_strdup(" ");
+
+ dbus_message_append_args (return_val, DBUS_TYPE_STRING, &enc_ms, DBUS_TYPE_INVALID);
+ g_free(enc_ms);
+ camel_object_unref (msg);
} else if (strncmp (method, "camel_object", 12) == 0) {
return camel_object_signal_handler (connection, message, user_data, CAMEL_ROT_FOLDER);
} else
Modified: branches/mail-dbus-remoting/mail/camel-folder-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-folder-remote.c (original)
+++ branches/mail-dbus-remoting/mail/camel-folder-remote.c Thu Sep 4 02:57:55 2008
@@ -533,6 +533,51 @@
}
gpointer
+camel_folder_remote_get_message (CamelFolderRemote *folder, char *uid, CamelException *ex)
+{
+ gboolean ret;
+ DBusError error;
+ int ptr;
+ gpointer uids;
+ char *mem, *dmem;
+ CamelMimeMessage *msg;
+ CamelStreamMem *mstream;
+ CamelMimeParser *mp = camel_mime_parser_new();
+ int len = 0;
+
+ 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",
+ &error, "ss=>s", folder->object_id, uid, &mem);
+
+ if (!ret) {
+ g_warning ("Error: Camel folder get unread message count: %s\n", error.message);
+ return 0;
+ }
+ if (strcmp(mem, " ")) {
+ dmem = g_base64_decode (mem, &len);
+ printf("%s\n", dmem);
+ mstream = camel_stream_mem_new_with_buffer (mem, len);
+
+ camel_mime_parser_scan_from(mp, TRUE);
+ camel_mime_parser_init_with_stream(mp, mstream);
+ msg = camel_mime_message_new();
+ if (camel_mime_part_construct_from_parser((CamelMimePart *)msg, mp) == -1) {
+ g_warning ("error while parsing\n");
+ }
+ camel_object_unref(mp);
+ } else
+ msg = NULL;
+ d(printf("Camel folder get unread message count remotely\n"));
+
+ return msg;
+}
+
+gpointer
camel_folder_remote_search_by_expression (CamelFolderRemote *folder, char *exp, CamelException *ex)
{
gboolean ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]