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
@@ -197,6 +197,9 @@ 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);
@@ -617,6 +620,8 @@ mailmbox_append_message_list_no_lock(struct mailmbox_folder * folder,
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;
@@ -744,8 +749,8 @@ mailmbox_append_message_list(struct mailmbox_folder * folder,
}
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;
@@ -771,7 +776,10 @@ mailmbox_append_message(struct mailmbox_folder * folder,
}
r = mailmbox_append_message_list(folder, tab);
-
+
+ if (puid != NULL)
+ * puid = append_info->ai_uid;
+
mailmbox_append_info_free(append_info);
carray_free(tab);
@@ -785,6 +793,13 @@ mailmbox_append_message(struct mailmbox_folder * folder,
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,