From 6cefbdc9c8f3f3001373f10715361e2740c45395 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 01 Sep 2004 10:23:29 +0000 Subject: Mail fixes and libetpan updated --- (limited to 'kmicromail/libetpan/mh/mailmh.c') diff --git a/kmicromail/libetpan/mh/mailmh.c b/kmicromail/libetpan/mh/mailmh.c index d6ff950..119f217 100644 --- a/kmicromail/libetpan/mh/mailmh.c +++ b/kmicromail/libetpan/mh/mailmh.c @@ -723,8 +723,9 @@ int mailmh_folder_get_message_size(struct mailmh_folder * folder, return MAILMH_NO_ERROR; } -int mailmh_folder_add_message(struct mailmh_folder * folder, - const char * message, size_t size) +int mailmh_folder_add_message_uid(struct mailmh_folder * folder, + const char * message, size_t size, + uint32_t * pindex) { char * tmpname; int fd; @@ -809,6 +810,9 @@ int mailmh_folder_add_message(struct mailmh_folder * folder, data.data = msg_info; data.len = 0; + if (pindex != NULL) + * pindex = index; + r = chash_set(folder->fl_msgs_hash, &key, &data, NULL); if (r < 0) { carray_delete_fast(folder->fl_msgs_tab, msg_info->msg_array_index); @@ -825,8 +829,14 @@ int mailmh_folder_add_message(struct mailmh_folder * folder, return error; } -int mailmh_folder_add_message_file(struct mailmh_folder * folder, - int fd) +int mailmh_folder_add_message(struct mailmh_folder * folder, + const char * message, size_t size) +{ + return mailmh_folder_add_message_uid(folder, message, size, NULL); +} + +int mailmh_folder_add_message_file_uid(struct mailmh_folder * folder, + int fd, uint32_t * pindex) { char * message; struct stat buf; @@ -845,13 +855,19 @@ int mailmh_folder_add_message_file(struct mailmh_folder * folder, if (message == MAP_FAILED) return MAILMH_ERROR_FILE; - r = mailmh_folder_add_message(folder, message, buf.st_size); - + r = mailmh_folder_add_message_uid(folder, message, buf.st_size, pindex); + munmap(message, buf.st_size); return r; } +int mailmh_folder_add_message_file(struct mailmh_folder * folder, + int fd) +{ + return mailmh_folder_add_message_file_uid(folder, fd, NULL); +} + int mailmh_folder_remove_message(struct mailmh_folder * folder, uint32_t index) { -- cgit v0.9.0.2