summaryrefslogtreecommitdiffabout
path: root/kmicromail/libetpan/mbox/mailmbox.c
Side-by-side diff
Diffstat (limited to 'kmicromail/libetpan/mbox/mailmbox.c') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libetpan/mbox/mailmbox.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/kmicromail/libetpan/mbox/mailmbox.c b/kmicromail/libetpan/mbox/mailmbox.c
index 280c313..b3fce02 100644
--- a/kmicromail/libetpan/mbox/mailmbox.c
+++ b/kmicromail/libetpan/mbox/mailmbox.c
@@ -196,8 +196,11 @@ int mailmbox_open(struct mailmbox_folder * folder)
{
int fd;
int read_only;
+ fd = -1;
+ read_only = TRUE;
+
if (!folder->mb_read_only) {
read_only = FALSE;
fd = open(folder->mb_filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
}
@@ -616,8 +619,10 @@ mailmbox_append_message_list_no_lock(struct mailmbox_folder * folder,
extra_size += get_fixed_message_size(info->ai_message, info->ai_size,
folder->mb_max_uid + i + 1,
folder->mb_no_uid);
extra_size += 2; /* CR LF */
+
+ info->ai_uid = folder->mb_max_uid + i + 1;
}
left = folder->mb_mapping_size;
crlf_count = 0;
@@ -743,10 +748,10 @@ mailmbox_append_message_list(struct mailmbox_folder * folder,
return res;
}
int
-mailmbox_append_message(struct mailmbox_folder * folder,
- const char * data, size_t len)
+mailmbox_append_message_uid(struct mailmbox_folder * folder,
+ const char * data, size_t len, unsigned int * puid)
{
carray * tab;
struct mailmbox_append_info * append_info;
int res;
@@ -770,9 +775,12 @@ mailmbox_append_message(struct mailmbox_folder * folder,
goto free_append_info;
}
r = mailmbox_append_message_list(folder, tab);
-
+
+ if (puid != NULL)
+ * puid = append_info->ai_uid;
+
mailmbox_append_info_free(append_info);
carray_free(tab);
return r;
@@ -784,8 +792,15 @@ mailmbox_append_message(struct mailmbox_folder * folder,
err:
return res;
}
+int
+mailmbox_append_message(struct mailmbox_folder * folder,
+ const char * data, size_t len)
+{
+ return mailmbox_append_message_uid(folder, data, len, NULL);
+}
+
/* ********************************************************************** */
int mailmbox_fetch_msg_no_lock(struct mailmbox_folder * folder,
uint32_t num, char ** result,