diff options
author | Dan Winship <danw@src.gnome.org> | 2002-05-14 00:15:29 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2002-05-14 00:15:29 +0800 |
commit | c538852849865837c38a6603dcd4bf17124b03be (patch) | |
tree | f3db28826a6139478c155fb21088f8465a764b22 /camel/camel-folder.c | |
parent | 2711a779ae0870128998bca474a436f4b7458c97 (diff) | |
download | gsoc2013-evolution-c538852849865837c38a6603dcd4bf17124b03be.tar.gz gsoc2013-evolution-c538852849865837c38a6603dcd4bf17124b03be.tar.zst gsoc2013-evolution-c538852849865837c38a6603dcd4bf17124b03be.zip |
Add a "char **appended_uid" argument, for the caller to optionally pass in
* camel-folder.c (camel_folder_append_message): Add a "char
**appended_uid" argument, for the caller to optionally pass in a
variable to receive the UID of the appended message (if the
provider knows it).
(camel_folder_transfer_messages_to): Likewise, add "GPtrArray
**transferred_uids"
(transfer_messages_to): Update default implementation to handle
transferred_uids.
* camel-disco-folder.c (disco_append_message,
disco_transfer_messages_to): Update for API changes.
* camel-disco-diary.c (camel_disco_diary_replay): Update the
diary's temporary uid->real uid map when replaying appends and
transfers.
* providers/imap/camel-imap-folder.c (imap_append_offline,
imap_append_online, imap_transfer_offline): Pass back the new
UIDs, when requested and available.
(imap_append_resyncing): Pass back the new UIDs when requested and
available. Remove the diary uidmap managing code since
CamelDiscoDiary can handle that itself now.
(imap_transfer_online, imap_transfer_resyncing): Update for new
APIs, but don't actually pass back the new UIDs yet. (It's tricky
since the COPYUID response may not be in the same order as the
input uids.)
* providers/local/camel-maildir-folder.c (maildir_append_message):
Pass back the new UID if requested.
* providers/local/camel-mbox-folder.c (mbox_append_message):
Likewise.
* providers/local/camel-mh-folder.c (mh_append_message): Likewise.
* providers/local/camel-spool-folder.c (spool_append_message):
Likewise.
* camel-digest-folder.c (digest_append_message,
digest_transfer_messages_to): Update for API changes.
* camel-filter-driver.c (camel_filter_driver_filter_message,
do_copy, do_move): Update for API changes.
* camel-vee-folder.c (vee_append_message,
vee_transfer_messages_to): Likewise.
* camel-vtrash-folder.c (vtrash_append_message,
vtrash_transfer_messages_to): Likewise.
svn path=/trunk/; revision=16765
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r-- | camel/camel-folder.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 554c43a7f1..05d765ce7a 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -77,7 +77,8 @@ static void expunge (CamelFolder *folder, static void append_message (CamelFolder *folder, CamelMimeMessage *message, - const CamelMessageInfo *info, CamelException *ex); + const CamelMessageInfo *info, char **appended_uid, + CamelException *ex); static GPtrArray *get_uids (CamelFolder *folder); @@ -97,7 +98,8 @@ static GPtrArray *search_by_expression (CamelFolder *folder, const char *e static GPtrArray *search_by_uids (CamelFolder *folder, const char *exp, GPtrArray *uids, CamelException *ex); static void search_free (CamelFolder * folder, GPtrArray *result); -static void transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, gboolean delete_originals, CamelException *ex); +static void transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, + GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex); static void delete (CamelFolder *folder); static void folder_rename (CamelFolder *folder, const char *new); @@ -462,7 +464,8 @@ camel_folder_get_unread_message_count (CamelFolder *folder) static void append_message (CamelFolder *folder, CamelMimeMessage *message, - const CamelMessageInfo *info, CamelException *ex) + const CamelMessageInfo *info, char **appended_uid, + CamelException *ex) { camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID, _("Unsupported operation: append message: for %s"), @@ -481,6 +484,8 @@ append_message (CamelFolder *folder, CamelMimeMessage *message, * @message: message object * @info: message info with additional flags/etc to set on * new message, or %NULL + * @appended_uid: if non-%NULL, the UID of the appended message will + * be returned here, if it is known. * @ex: exception object * * Add a message to a folder. Only the flag and tag data from @info @@ -488,13 +493,14 @@ append_message (CamelFolder *folder, CamelMimeMessage *message, **/ void camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message, - const CamelMessageInfo *info, CamelException *ex) + const CamelMessageInfo *info, char **appended_uid, + CamelException *ex) { g_return_if_fail (CAMEL_IS_FOLDER (folder)); CAMEL_FOLDER_LOCK(folder, lock); - CF_CLASS (folder)->append_message (folder, message, info, ex); + CF_CLASS (folder)->append_message (folder, message, info, appended_uid, ex); CAMEL_FOLDER_UNLOCK(folder, lock); } @@ -1137,7 +1143,9 @@ camel_folder_search_free (CamelFolder *folder, GPtrArray *result) static void -transfer_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, gboolean delete_original, CamelException *ex) +transfer_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, + char **transferred_uid, gboolean delete_original, + CamelException *ex) { CamelMimeMessage *msg; CamelMessageInfo *info = NULL; @@ -1158,7 +1166,7 @@ transfer_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, gb if (info && info->flags & CAMEL_MESSAGE_DELETED) info->flags = info->flags & ~CAMEL_MESSAGE_DELETED; - camel_folder_append_message (dest, msg, info, ex); + camel_folder_append_message (dest, msg, info, transferred_uid, ex); camel_object_unref (CAMEL_OBJECT (msg)); if (delete_original && !camel_exception_is_set (ex)) @@ -1173,11 +1181,17 @@ transfer_message_to (CamelFolder *source, const char *uid, CamelFolder *dest, gb } static void -transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, gboolean delete_originals, CamelException *ex) +transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex) { CamelException local; + char **ret_uid = NULL; int i; + if (transferred_uids) { + *transferred_uids = g_ptr_array_new (); + g_ptr_array_set_size (*transferred_uids, uids->len); + } + camel_exception_init(&local); if (ex == NULL) ex = &local; @@ -1190,7 +1204,9 @@ transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, g camel_folder_freeze(source); } for (i = 0; i < uids->len && !camel_exception_is_set (ex); i++) { - transfer_message_to (source, uids->pdata[i], dest, delete_originals, ex); + if (transferred_uids) + ret_uid = (char **)&((*transferred_uids)->pdata[i]); + transfer_message_to (source, uids->pdata[i], dest, ret_uid, delete_originals, ex); camel_operation_progress(NULL, i * 100 / uids->len); } if (uids->len > 1) { @@ -1208,6 +1224,8 @@ transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, g * @source: source folder * @uids: message UIDs in @source * @dest: destination folder + * @transferred_uids: if non-%NULL, the UIDs of the resulting messages + * in @dest will be stored here, if known. * @delete_originals: whether or not to delete the original messages * @ex: a CamelException * @@ -1217,8 +1235,8 @@ transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, g **/ void camel_folder_transfer_messages_to (CamelFolder *source, GPtrArray *uids, - CamelFolder *dest, gboolean delete_originals, - CamelException *ex) + CamelFolder *dest, GPtrArray **transferred_uids, + gboolean delete_originals, CamelException *ex) { g_return_if_fail (CAMEL_IS_FOLDER (source)); g_return_if_fail (CAMEL_IS_FOLDER (dest)); @@ -1236,11 +1254,11 @@ camel_folder_transfer_messages_to (CamelFolder *source, GPtrArray *uids, * vtrash transfer method. */ if (CAMEL_IS_VTRASH_FOLDER (dest)) - CF_CLASS (dest)->transfer_messages_to (source, uids, dest, delete_originals, ex); + CF_CLASS (dest)->transfer_messages_to (source, uids, dest, transferred_uids, delete_originals, ex); else - CF_CLASS (source)->transfer_messages_to (source, uids, dest, delete_originals, ex); + CF_CLASS (source)->transfer_messages_to (source, uids, dest, transferred_uids, delete_originals, ex); } else - transfer_messages_to (source, uids, dest, delete_originals, ex); + transfer_messages_to (source, uids, dest, transferred_uids, delete_originals, ex); CAMEL_FOLDER_UNLOCK(source, lock); } |