aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog52
-rw-r--r--camel/camel-digest-folder.c17
-rw-r--r--camel/camel-disco-diary.c26
-rw-r--r--camel/camel-disco-folder.c26
-rw-r--r--camel/camel-disco-folder.h6
-rw-r--r--camel/camel-filter-driver.c12
-rw-r--r--camel/camel-folder.c46
-rw-r--r--camel/camel-folder.h4
-rw-r--r--camel/camel-vee-folder.c8
-rw-r--r--camel/camel-vtrash-folder.c20
-rw-r--r--camel/providers/imap/camel-imap-folder.c107
-rw-r--r--camel/providers/local/camel-maildir-folder.c7
-rw-r--r--camel/providers/local/camel-mbox-folder.c7
-rw-r--r--camel/providers/local/camel-mh-folder.c7
-rw-r--r--camel/providers/local/camel-spool-folder.c7
15 files changed, 257 insertions, 95 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 9cc4945557..d6d13dcc40 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,55 @@
+2002-05-13 Dan Winship <danw@ximian.com>
+
+ * 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.
+
2002-05-13 Not Zed <NotZed@Ximian.com>
* camel-folder-thread.c
diff --git a/camel/camel-digest-folder.c b/camel/camel-digest-folder.c
index def9b3904c..2454b0f637 100644
--- a/camel/camel-digest-folder.c
+++ b/camel/camel-digest-folder.c
@@ -57,10 +57,10 @@ static CamelMessageInfo *digest_get_message_info (CamelFolder *folder, const cha
static CamelMimeMessage *digest_get_message (CamelFolder *folder, const gchar *uid,
CamelException *ex);
static void digest_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
+ const CamelMessageInfo *info, char **appended_uid, CamelException *ex);
static void digest_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination, gboolean delete_originals,
- CamelException *ex);
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex);
static void
@@ -297,17 +297,22 @@ digest_get_full_name (CamelFolder *folder)
static void
digest_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex)
{
/* no-op */
+ if (appended_uid)
+ *appended_uid = NULL;
}
static void
digest_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination, gboolean delete_originals,
- CamelException *ex)
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex)
{
/* no-op */
+ if (transferred_uids)
+ *transferred_uids = NULL;
}
static CamelMimeMessage *
diff --git a/camel/camel-disco-diary.c b/camel/camel-disco-diary.c
index 198ec607c8..8c41f2a098 100644
--- a/camel/camel-disco-diary.c
+++ b/camel/camel-disco-diary.c
@@ -307,7 +307,7 @@ camel_disco_diary_replay (CamelDiscoDiary *diary, CamelException *ex)
case CAMEL_DISCO_DIARY_FOLDER_APPEND:
{
CamelFolder *folder;
- char *uid;
+ char *uid, *ret_uid;
CamelMimeMessage *message;
CamelMessageInfo *info;
@@ -328,18 +328,24 @@ camel_disco_diary_replay (CamelDiscoDiary *diary, CamelException *ex)
}
info = camel_folder_get_message_info (folder, uid);
- camel_folder_append_message (folder, message, info, ex);
- g_free (uid);
+ camel_folder_append_message (folder, message, info, &ret_uid, ex);
camel_folder_free_message_info (folder, info);
+ if (ret_uid) {
+ camel_disco_diary_uidmap_add (diary, uid, ret_uid);
+ g_free (ret_uid);
+ }
+ g_free (uid);
+
break;
}
case CAMEL_DISCO_DIARY_FOLDER_TRANSFER:
{
CamelFolder *source, *destination;
- GPtrArray *uids;
+ GPtrArray *uids, *ret_uids;
guint32 delete_originals;
+ int i;
source = diary_decode_folder (diary);
destination = diary_decode_folder (diary);
@@ -354,7 +360,17 @@ camel_disco_diary_replay (CamelDiscoDiary *diary, CamelException *ex)
continue;
}
- camel_folder_transfer_messages_to (source, uids, destination, delete_originals, ex);
+ camel_folder_transfer_messages_to (source, uids, destination, &ret_uids, delete_originals, ex);
+
+ if (ret_uids) {
+ for (i = 0; i < uids->len; i++) {
+ if (!ret_uids->pdata[i])
+ continue;
+ camel_disco_diary_uidmap_add (diary, uids->pdata[i], ret_uids->pdata[i]);
+ g_free (ret_uids->pdata[i]);
+ }
+ g_ptr_array_free (ret_uids, TRUE);
+ }
free_uids (uids);
break;
}
diff --git a/camel/camel-disco-folder.c b/camel/camel-disco-folder.c
index d7c385c60b..965ceb0864 100644
--- a/camel/camel-disco-folder.c
+++ b/camel/camel-disco-folder.c
@@ -39,9 +39,10 @@ static void disco_sync (CamelFolder *folder, gboolean expunge, CamelException *e
static void disco_expunge (CamelFolder *folder, CamelException *ex);
static void disco_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
+ const CamelMessageInfo *info, char **appended_uid, CamelException *ex);
static void disco_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
CamelFolder *destination,
+ GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
@@ -169,45 +170,52 @@ disco_expunge (CamelFolder *folder, CamelException *ex)
static void
disco_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex)
{
CamelDiscoStore *disco = CAMEL_DISCO_STORE (folder->parent_store);
switch (camel_disco_store_status (disco)) {
case CAMEL_DISCO_STORE_ONLINE:
- CDF_CLASS (folder)->append_online (folder, message, info, ex);
+ CDF_CLASS (folder)->append_online (folder, message, info,
+ appended_uid, ex);
break;
case CAMEL_DISCO_STORE_OFFLINE:
- CDF_CLASS (folder)->append_offline (folder, message, info, ex);
+ CDF_CLASS (folder)->append_offline (folder, message, info,
+ appended_uid, ex);
break;
case CAMEL_DISCO_STORE_RESYNCING:
- CDF_CLASS (folder)->append_resyncing (folder, message, info, ex);
+ CDF_CLASS (folder)->append_resyncing (folder, message, info,
+ appended_uid, ex);
break;
}
}
static void
disco_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination,
+ CamelFolder *dest, GPtrArray **transferred_uids,
gboolean delete_originals, CamelException *ex)
{
CamelDiscoStore *disco = CAMEL_DISCO_STORE (source->parent_store);
switch (camel_disco_store_status (disco)) {
case CAMEL_DISCO_STORE_ONLINE:
- CDF_CLASS (source)->transfer_online (source, uids, destination,
+ CDF_CLASS (source)->transfer_online (source, uids,
+ dest, transferred_uids,
delete_originals, ex);
break;
case CAMEL_DISCO_STORE_OFFLINE:
- CDF_CLASS (source)->transfer_offline (source, uids, destination,
+ CDF_CLASS (source)->transfer_offline (source, uids,
+ dest, transferred_uids,
delete_originals, ex);
break;
case CAMEL_DISCO_STORE_RESYNCING:
- CDF_CLASS (source)->transfer_resyncing (source, uids, destination,
+ CDF_CLASS (source)->transfer_resyncing (source, uids,
+ dest, transferred_uids,
delete_originals, ex);
break;
}
diff --git a/camel/camel-disco-folder.h b/camel/camel-disco-folder.h
index 9f6e8e2366..0d857c0b9b 100644
--- a/camel/camel-disco-folder.h
+++ b/camel/camel-disco-folder.h
@@ -60,26 +60,32 @@ typedef struct {
void (*append_online) (CamelFolder *folder,
CamelMimeMessage *message,
const CamelMessageInfo *info,
+ char **appended_uid,
CamelException *ex);
void (*append_offline) (CamelFolder *folder,
CamelMimeMessage *message,
const CamelMessageInfo *info,
+ char **appended_uid,
CamelException *ex);
void (*append_resyncing) (CamelFolder *folder,
CamelMimeMessage *message,
const CamelMessageInfo *info,
+ char **appended_uid,
CamelException *ex);
void (*transfer_online) (CamelFolder *source, GPtrArray *uids,
CamelFolder *destination,
+ GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
void (*transfer_offline) (CamelFolder *source, GPtrArray *uids,
CamelFolder *destination,
+ GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
void (*transfer_resyncing) (CamelFolder *source, GPtrArray *uids,
CamelFolder *destination,
+ GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index a2ba89c8ee..8df6a0d1b4 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -459,7 +459,7 @@ do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv
uids = g_ptr_array_new ();
g_ptr_array_add (uids, (char *) p->uid);
- camel_folder_transfer_messages_to (p->source, uids, outbox, FALSE, p->ex);
+ camel_folder_transfer_messages_to (p->source, uids, outbox, NULL, FALSE, p->ex);
g_ptr_array_free (uids, TRUE);
} else {
if (p->message == NULL)
@@ -470,7 +470,7 @@ do_copy (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv
continue;
}
- camel_folder_append_message (outbox, p->message, p->info, p->ex);
+ camel_folder_append_message (outbox, p->message, p->info, NULL, p->ex);
}
if (!camel_exception_is_set (p->ex))
@@ -510,7 +510,7 @@ do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv
uids = g_ptr_array_new ();
g_ptr_array_add (uids, (char *) p->uid);
- camel_folder_transfer_messages_to (p->source, uids, outbox, FALSE, p->ex);
+ camel_folder_transfer_messages_to (p->source, uids, outbox, NULL, FALSE, p->ex);
g_ptr_array_free (uids, TRUE);
} else {
if (p->message == NULL)
@@ -521,7 +521,7 @@ do_move (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFilterDriv
continue;
}
- camel_folder_append_message (outbox, p->message, p->info, p->ex);
+ camel_folder_append_message (outbox, p->message, p->info, NULL, p->ex);
}
if (!camel_exception_is_set (p->ex)) {
@@ -1230,7 +1230,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
uids = g_ptr_array_new ();
g_ptr_array_add (uids, (char *) p->uid);
- camel_folder_transfer_messages_to (p->source, uids, p->defaultfolder, FALSE, p->ex);
+ camel_folder_transfer_messages_to (p->source, uids, p->defaultfolder, NULL, FALSE, p->ex);
g_ptr_array_free (uids, TRUE);
} else {
if (p->message == NULL) {
@@ -1239,7 +1239,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
goto error;
}
- camel_folder_append_message (p->defaultfolder, p->message, p->info, p->ex);
+ camel_folder_append_message (p->defaultfolder, p->message, p->info, NULL, p->ex);
}
}
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);
}
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index f2f6e59347..e437b1d87a 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -96,6 +96,7 @@ typedef struct {
void (*append_message) (CamelFolder *folder,
CamelMimeMessage *message,
const CamelMessageInfo *info,
+ char **appended_uid,
CamelException *ex);
guint32 (*get_permanent_flags) (CamelFolder *folder);
@@ -147,6 +148,7 @@ typedef struct {
void (*transfer_messages_to) (CamelFolder *source,
GPtrArray *uids,
CamelFolder *destination,
+ GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
@@ -221,6 +223,7 @@ void camel_folder_set_message_user_tag (CamelFolder *folder,
void camel_folder_append_message (CamelFolder *folder,
CamelMimeMessage *message,
const CamelMessageInfo *info,
+ char **appended_uid,
CamelException *ex);
@@ -261,6 +264,7 @@ void camel_folder_ref_message_info (CamelFolder *folder, CamelMessageInfo *i
void camel_folder_transfer_messages_to (CamelFolder *source,
GPtrArray *uids,
CamelFolder *dest,
+ GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 785d70b057..11912e3637 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -54,8 +54,8 @@ static void vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
static void vee_expunge (CamelFolder *folder, CamelException *ex);
static CamelMimeMessage *vee_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex);
-static void vee_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex);
-static void vee_transfer_messages_to(CamelFolder *source, GPtrArray *uids, CamelFolder *dest, gboolean delete_originals, CamelException *ex);
+static void vee_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, CamelException *ex);
+static void vee_transfer_messages_to(CamelFolder *source, GPtrArray *uids, CamelFolder *dest, GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex);
static GPtrArray *vee_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
static GPtrArray *vee_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex);
@@ -732,13 +732,13 @@ vee_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name
}
static void
-vee_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex)
+vee_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, CamelException *ex)
{
camel_exception_set(ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot copy or move messages into a Virtual Folder"));
}
static void
-vee_transfer_messages_to (CamelFolder *folder, GPtrArray *uids, CamelFolder *dest, gboolean delete_originals, CamelException *ex)
+vee_transfer_messages_to (CamelFolder *folder, GPtrArray *uids, CamelFolder *dest, GPtrArray **transferred_uids, gboolean delete_originals, CamelException *ex)
{
camel_exception_set(ex, CAMEL_EXCEPTION_SYSTEM, _("Cannot copy or move messages into a Virtual Folder"));
}
diff --git a/camel/camel-vtrash-folder.c b/camel/camel-vtrash-folder.c
index 5b09047abb..5c6e993c4f 100644
--- a/camel/camel-vtrash-folder.c
+++ b/camel/camel-vtrash-folder.c
@@ -36,8 +36,11 @@
static CamelVeeFolderClass *camel_vtrash_folder_parent;
static void vtrash_append_message (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
-static void vtrash_transfer_messages_to (CamelFolder *folder, GPtrArray *uids, CamelFolder *dest, gboolean delete_originals, CamelException *ex);
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex);
+static void vtrash_transfer_messages_to (CamelFolder *folder, GPtrArray *uids,
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex);
static void
camel_vtrash_folder_class_init (CamelVTrashFolderClass *klass)
@@ -102,7 +105,9 @@ camel_vtrash_folder_new (CamelStore *parent_store, const char *name)
}
static void
-vtrash_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex)
+vtrash_append_message (CamelFolder *folder, CamelMimeMessage *message,
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex)
{
/* no-op */
}
@@ -120,7 +125,7 @@ transfer_messages(CamelFolder *folder, struct _transfer_data *md, CamelException
int i;
if (!camel_exception_is_set (ex))
- camel_folder_transfer_messages_to(md->folder, md->uids, md->dest, md->delete, ex);
+ camel_folder_transfer_messages_to(md->folder, md->uids, md->dest, NULL, md->delete, ex);
for (i=0;i<md->uids->len;i++)
g_free(md->uids->pdata[i]);
@@ -130,7 +135,9 @@ transfer_messages(CamelFolder *folder, struct _transfer_data *md, CamelException
}
static void
-vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *dest, gboolean delete_originals, CamelException *ex)
+vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex)
{
CamelVeeMessageInfo *mi;
int i;
@@ -143,6 +150,9 @@ vtrash_transfer_messages_to (CamelFolder *source, GPtrArray *uids, CamelFolder *
* since a store should never have more than one).
*/
+ if (transferred_uids)
+ *transferred_uids = NULL;
+
if (CAMEL_IS_VTRASH_FOLDER (dest)) {
/* Copy to trash is meaningless. */
if (!delete_originals)
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 487944999d..3a1a62205b 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -87,22 +87,25 @@ static void imap_rename (CamelFolder *folder, const char *new);
static CamelMimeMessage *imap_get_message (CamelFolder *folder, const gchar *uid,
CamelException *ex);
static void imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex);
static void imap_append_offline (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex);
static void imap_append_resyncing (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex);
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex);
static void imap_transfer_online (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination,
+ CamelFolder *dest, GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
static void imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination,
+ CamelFolder *dest, GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
static void imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination,
+ CamelFolder *dest, GPtrArray **transferred_uids,
gboolean delete_originals,
CamelException *ex);
@@ -955,7 +958,8 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
static void
imap_append_offline (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex)
{
CamelImapStore *imap_store = CAMEL_IMAP_STORE (folder->parent_store);
CamelImapMessageCache *cache = CAMEL_IMAP_FOLDER (folder)->cache;
@@ -981,7 +985,10 @@ imap_append_offline (CamelFolder *folder, CamelMimeMessage *message,
camel_disco_diary_log (CAMEL_DISCO_STORE (imap_store)->diary,
CAMEL_DISCO_DIARY_FOLDER_APPEND, folder, uid);
- g_free (uid);
+ if (appended_uid)
+ *appended_uid = uid;
+ else
+ g_free (uid);
}
static CamelImapResponse *
@@ -1064,7 +1071,8 @@ do_append (CamelFolder *folder, CamelMimeMessage *message,
static void
imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
CamelImapResponse *response;
@@ -1085,8 +1093,12 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
CAMEL_IMAP_FOLDER (folder)->cache, uid,
"", CAMEL_DATA_WRAPPER (message), ex);
CAMEL_IMAP_FOLDER_UNLOCK (folder, cache_lock);
- g_free (uid);
- }
+ if (appended_uid)
+ *appended_uid = uid;
+ else
+ g_free (uid);
+ } else if (appended_uid)
+ *appended_uid = NULL;
camel_imap_response_free (store, response);
@@ -1098,7 +1110,8 @@ imap_append_online (CamelFolder *folder, CamelMimeMessage *message,
static void
imap_append_resyncing (CamelFolder *folder, CamelMimeMessage *message,
- const CamelMessageInfo *info, CamelException *ex)
+ const CamelMessageInfo *info, char **appended_uid,
+ CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
CamelImapResponse *response;
@@ -1116,10 +1129,13 @@ imap_append_resyncing (CamelFolder *folder, CamelMimeMessage *message,
camel_imap_message_cache_copy (imap_folder->cache, olduid,
imap_folder->cache, uid, ex);
CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
-
- camel_disco_diary_uidmap_add (CAMEL_DISCO_STORE (store)->diary,
- olduid, uid);
- }
+
+ if (appended_uid)
+ *appended_uid = uid;
+ else
+ g_free (uid);
+ } else if (appended_uid)
+ *appended_uid = NULL;
camel_imap_response_free (store, response);
}
@@ -1127,12 +1143,12 @@ imap_append_resyncing (CamelFolder *folder, CamelMimeMessage *message,
static void
imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination, gboolean delete_originals,
- CamelException *ex)
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (source->parent_store);
CamelImapMessageCache *sc = CAMEL_IMAP_FOLDER (source)->cache;
- CamelImapMessageCache *dc = CAMEL_IMAP_FOLDER (destination)->cache;
+ CamelImapMessageCache *dc = CAMEL_IMAP_FOLDER (dest)->cache;
CamelFolderChangeInfo *changes;
CamelMimeMessage *message;
CamelMessageInfo *mi;
@@ -1146,9 +1162,14 @@ imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
*/
CAMEL_IMAP_STORE_LOCK (store, command_lock);
CAMEL_IMAP_FOLDER_LOCK (source, cache_lock);
- CAMEL_IMAP_FOLDER_LOCK (destination, cache_lock);
+ CAMEL_IMAP_FOLDER_LOCK (dest, cache_lock);
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ if (transferred_uids) {
+ *transferred_uids = g_ptr_array_new ();
+ g_ptr_array_set_size (*transferred_uids, uids->len);
+ }
+
changes = camel_folder_change_info_new ();
for (i = 0; i < uids->len; i++) {
uid = uids->pdata[i];
@@ -1160,31 +1181,33 @@ imap_transfer_offline (CamelFolder *source, GPtrArray *uids,
g_return_if_fail (mi != NULL);
destuid = g_strdup_printf ("copy-%s:%s", source->full_name, uid);
- camel_imap_summary_add_offline (destination->summary, destuid, message, mi);
+ camel_imap_summary_add_offline (dest->summary, destuid, message, mi);
camel_imap_message_cache_copy (sc, uid, dc, destuid, ex);
camel_folder_summary_info_free (source->summary, mi);
camel_object_unref (CAMEL_OBJECT (message));
camel_folder_change_info_add_uid (changes, destuid);
- g_free (destuid);
+ if (transferred_uids)
+ (*transferred_uids)->pdata[i] = destuid;
+ else
+ g_free (destuid);
if (delete_originals)
camel_folder_delete_message (source, uid);
}
- CAMEL_IMAP_FOLDER_UNLOCK (destination, cache_lock);
+ CAMEL_IMAP_FOLDER_UNLOCK (dest, cache_lock);
CAMEL_IMAP_FOLDER_UNLOCK (source, cache_lock);
- camel_object_trigger_event (CAMEL_OBJECT (destination),
- "folder_changed", changes);
+ camel_object_trigger_event (CAMEL_OBJECT (dest), "folder_changed", changes);
camel_folder_change_info_free (changes);
camel_disco_diary_log (CAMEL_DISCO_STORE (store)->diary,
CAMEL_DISCO_DIARY_FOLDER_TRANSFER,
- source, destination, uids, delete_originals);
+ source, dest, uids, delete_originals);
}
-
+
static void
handle_copyuid (CamelImapResponse *response, CamelFolder *source,
CamelFolder *destination)
@@ -1265,8 +1288,8 @@ do_copy (CamelFolder *source, GPtrArray *uids,
static void
imap_transfer_online (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination, gboolean delete_originals,
- CamelException *ex)
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (source->parent_store);
int count, i;
@@ -1276,28 +1299,32 @@ imap_transfer_online (CamelFolder *source, GPtrArray *uids,
if (camel_exception_is_set (ex))
return;
- count = camel_folder_summary_count (destination->summary);
+ count = camel_folder_summary_count (dest->summary);
/* Now copy the messages */
- do_copy (source, uids, destination, ex);
+ do_copy (source, uids, dest, ex);
if (camel_exception_is_set (ex))
return;
/* Make the destination notice its new messages */
- if (store->current_folder != destination ||
- camel_folder_summary_count (destination->summary) == count)
- camel_folder_refresh_info (destination, ex);
+ if (store->current_folder != dest ||
+ camel_folder_summary_count (dest->summary) == count)
+ camel_folder_refresh_info (dest, ex);
if (delete_originals) {
for (i = 0; i < uids->len; i++)
camel_folder_delete_message (source, uids->pdata[i]);
}
+
+ /* FIXME */
+ if (transferred_uids)
+ *transferred_uids = NULL;
}
static void
imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids,
- CamelFolder *destination, gboolean delete_originals,
- CamelException *ex)
+ CamelFolder *dest, GPtrArray **transferred_uids,
+ gboolean delete_originals, CamelException *ex)
{
CamelDiscoDiary *diary = CAMEL_DISCO_STORE (source->parent_store)->diary;
GPtrArray *realuids;
@@ -1334,7 +1361,7 @@ imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids,
/* If we saw any real UIDs, do a COPY */
if (i != first) {
- do_copy (source, realuids, destination, ex);
+ do_copy (source, realuids, dest, ex);
g_ptr_array_set_size (realuids, 0);
if (i == uids->len || camel_exception_is_set (ex))
break;
@@ -1353,7 +1380,7 @@ imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids,
info = camel_folder_get_message_info (source, uid);
g_return_if_fail (info != NULL);
- imap_append_online (destination, message, info, ex);
+ imap_append_online (dest, message, info, NULL, ex);
camel_folder_free_message_info (source, info);
camel_object_unref (CAMEL_OBJECT (message));
if (delete_originals)
@@ -1363,6 +1390,10 @@ imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids,
}
g_ptr_array_free (realuids, FALSE);
+
+ /* FIXME */
+ if (transferred_uids)
+ *transferred_uids = NULL;
}
static GPtrArray *
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index 7bf998bff9..05fdd70e10 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -52,7 +52,7 @@ static CamelLocalFolderClass *parent_class = NULL;
static CamelLocalSummary *maildir_create_summary(const char *path, const char *folder, CamelIndex *index);
-static void maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
+static void maildir_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, char **appended_uid, CamelException * ex);
static CamelMimeMessage *maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
static void maildir_finalize(CamelObject * object);
@@ -126,7 +126,7 @@ static CamelLocalSummary *maildir_create_summary(const char *path, const char *f
}
static void
-maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex)
+maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, CamelException *ex)
{
CamelMaildirFolder *maildir_folder = (CamelMaildirFolder *)folder;
CamelLocalFolder *lf = (CamelLocalFolder *)folder;
@@ -168,6 +168,9 @@ maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const Ca
((CamelLocalFolder *)maildir_folder)->changes);
camel_folder_change_info_clear (((CamelLocalFolder *)maildir_folder)->changes);
+ if (appended_uid)
+ *appended_uid = g_strdup(camel_message_info_uid(mi));
+
return;
fail_write:
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index bef6b64436..0d4a61739d 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -58,7 +58,7 @@ static void mbox_unlock(CamelLocalFolder *lf);
static void mbox_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value);
static void mbox_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
-static void mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex);
+static void mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, char **appended_uid, CamelException *ex);
static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex);
static CamelLocalSummary *mbox_create_summary(const char *path, const char *folder, CamelIndex *index);
@@ -172,7 +172,7 @@ static void mbox_unlock(CamelLocalFolder *lf)
}
static void
-mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex)
+mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, char **appended_uid, CamelException *ex)
{
CamelLocalFolder *lf = (CamelLocalFolder *)folder;
CamelStream *output_stream = NULL, *filter_stream = NULL;
@@ -257,6 +257,9 @@ mbox_append_message(CamelFolder *folder, CamelMimeMessage * message, const Camel
camel_folder_change_info_clear(lf->changes);
}
+ if (appended_uid)
+ *appended_uid = g_strdup(camel_message_info_uid(mi));
+
return;
fail_write:
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index 3d08bdb60a..396435da0e 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -52,7 +52,7 @@ static CamelLocalFolderClass *parent_class = NULL;
static CamelLocalSummary *mh_create_summary(const char *path, const char *folder, CamelIndex *index);
-static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
+static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, char **appended_uid, CamelException * ex);
static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
static void mh_finalize(CamelObject * object);
@@ -121,7 +121,7 @@ static CamelLocalSummary *mh_create_summary(const char *path, const char *folder
}
static void
-mh_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, CamelException *ex)
+mh_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, CamelException *ex)
{
CamelMhFolder *mh_folder = (CamelMhFolder *)folder;
CamelLocalFolder *lf = (CamelLocalFolder *)folder;
@@ -159,6 +159,9 @@ mh_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMe
((CamelLocalFolder *)mh_folder)->changes);
camel_folder_change_info_clear (((CamelLocalFolder *)mh_folder)->changes);
+ if (appended_uid)
+ *appended_uid = g_strdup(camel_message_info_uid(mi));
+
return;
fail_write:
diff --git a/camel/providers/local/camel-spool-folder.c b/camel/providers/local/camel-spool-folder.c
index 3728b26fa2..a519c58683 100644
--- a/camel/providers/local/camel-spool-folder.c
+++ b/camel/providers/local/camel-spool-folder.c
@@ -66,7 +66,7 @@ static GPtrArray *spool_search_by_expression(CamelFolder *folder, const char *ex
static GPtrArray *spool_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex);
static void spool_search_free(CamelFolder *folder, GPtrArray * result);
-static void spool_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex);
+static void spool_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, char **appended_uid, CamelException *ex);
static CamelMimeMessage *spool_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex);
static void spool_set_message_user_flag(CamelFolder *folder, const char *uid, const char *name, gboolean value);
static void spool_set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
@@ -423,7 +423,7 @@ spool_search_free(CamelFolder *folder, GPtrArray * result)
}
static void
-spool_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, CamelException *ex)
+spool_append_message(CamelFolder *folder, CamelMimeMessage * message, const CamelMessageInfo * info, char **appended_uid, CamelException *ex)
{
CamelSpoolFolder *lf = (CamelSpoolFolder *)folder;
CamelStream *output_stream = NULL, *filter_stream = NULL;
@@ -508,6 +508,9 @@ spool_append_message(CamelFolder *folder, CamelMimeMessage * message, const Came
camel_folder_change_info_clear(lf->changes);
}
+ if (appended_uid)
+ *appended_uid = g_strdup(camel_message_info_uid(mi));
+
return;
fail_write: