diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-07-01 09:35:19 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-07-01 09:35:19 +0800 |
commit | f278d3041bc2829db097cc0e5cf99ba443501a9a (patch) | |
tree | 8014fb0a1fa2fc17589391eb10773e7b9fd75f59 /camel/camel-folder.c | |
parent | c07840479d0b23443c06e20599bf4948e6d3509b (diff) | |
download | gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.tar gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.tar.gz gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.tar.bz2 gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.tar.lz gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.tar.xz gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.tar.zst gsoc2013-evolution-f278d3041bc2829db097cc0e5cf99ba443501a9a.zip |
New function, to copy a message from one folder to another. The default
2000-06-30 Jeffrey Stedfast <fejj@helixcode.com>
* camel-folder.c (camel_folder_copy_message_to): New function, to
copy a message from one folder to another. The default
implementation just uses append_message, but providers can
implement more efficient versions for use when both folders are on
the same store.
* broken-date-parser.[c,h]: Utilities for parsing broken
date strings.
* providers/imap/camel-imap-folder.c (imap_move_message_to):
(imap_copy_message_to): Implemented.
* camel-mime-utils.c (header_decode_date): Wrote some code to try
and un-mangle broken date formats and then parse that new string
instead.
svn path=/trunk/; revision=3841
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r-- | camel/camel-folder.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 39415e16cd..877ceae7db 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -122,6 +122,11 @@ static const CamelMessageInfo *summary_get_by_uid (CamelFolder *folder, static GList *search_by_expression (CamelFolder *folder, const char *exp, CamelException *ex); +static void copy_message_to (CamelFolder *source, + const char *uid, + CamelFolder *dest, + CamelException *ex); + static void move_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, @@ -164,6 +169,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class) camel_folder_class->free_summary = free_summary; camel_folder_class->search_by_expression = search_by_expression; camel_folder_class->summary_get_by_uid = summary_get_by_uid; + camel_folder_class->copy_message_to = copy_message_to; camel_folder_class->move_message_to = move_message_to; /* virtual method overload */ @@ -1022,6 +1028,50 @@ camel_folder_search_by_expression (CamelFolder *folder, const char *expression, static void +copy_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, + CamelException *ex) +{ + CamelMimeMessage *msg; + + /* Default implementation. */ + + msg = camel_folder_get_message_by_uid (source, uid, ex); + if (!msg) + return; + camel_folder_append_message (dest, msg, ex); + gtk_object_unref (GTK_OBJECT (msg)); + if (camel_exception_is_set (ex)) + return; +} + +/** + * camel_folder_copy_message_to: + * @source: source folder + * @uid: UID of message in @source + * @dest: destination folder + * @ex: a CamelException + * + * This copies a message from one folder to another. If the @source and + * @dest folders have the same parent_store, this may be more efficient + * than a camel_folder_append_message(). + **/ +void +camel_folder_copy_message_to (CamelFolder *source, const char *uid, + CamelFolder *dest, CamelException *ex) +{ + g_return_if_fail (CAMEL_IS_FOLDER (source)); + g_return_if_fail (CAMEL_IS_FOLDER (dest)); + g_return_if_fail (uid != NULL); + + if (source->parent_store == dest->parent_store) { + return CF_CLASS (source)->copy_message_to (source, uid, + dest, ex); + } else + return copy_message_to (source, uid, dest, ex); +} + + +static void move_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, CamelException *ex) { |