author | zautrix <zautrix> | 2004-09-01 10:23:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-01 10:23:29 (UTC) |
commit | 6cefbdc9c8f3f3001373f10715361e2740c45395 (patch) (side-by-side diff) | |
tree | cb2c36f57620e698913c27ca4ebe59e4a7c9d46e /kmicromail/libetpan/maildir | |
parent | b9257cb225cd29bab5d96fcdaf557926603ee587 (diff) | |
download | kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.zip kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.tar.gz kdepimpi-6cefbdc9c8f3f3001373f10715361e2740c45395.tar.bz2 |
Mail fixes and libetpan updated
-rw-r--r-- | kmicromail/libetpan/maildir/maildir.c | 33 | ||||
-rw-r--r-- | kmicromail/libetpan/maildir/maildir.h | 7 |
2 files changed, 33 insertions, 7 deletions
diff --git a/kmicromail/libetpan/maildir/maildir.c b/kmicromail/libetpan/maildir/maildir.c index 320ef81..0e038b1 100644 --- a/kmicromail/libetpan/maildir/maildir.c +++ b/kmicromail/libetpan/maildir/maildir.c @@ -431,6 +431,7 @@ static char * libetpan_basename(char * filename) #endif -int maildir_message_add(struct maildir * md, - const char * message, size_t size) +int maildir_message_add_uid(struct maildir * md, + const char * message, size_t size, + char * uid, size_t max_uid_len) { char path_new[PATH_MAX]; @@ -454,5 +455,6 @@ int maildir_message_add(struct maildir * md, /* write to tmp/ with a classic temporary file */ - snprintf(tmpname, sizeof(tmpname), "%s/tmp/etpan-maildir-XXXXXX", md->mdir_path); + snprintf(tmpname, sizeof(tmpname), "%s/tmp/etpan-maildir-XXXXXX", + md->mdir_path); fd = mkstemp(tmpname); if (fd < 0) { @@ -522,5 +524,8 @@ int maildir_message_add(struct maildir * md, goto unlink_tmp; } - + + if (uid != NULL) + strncpy(uid, delivery_new_basename, max_uid_len); + unlink(delivery_tmp_name); free(delivery_tmp_name); @@ -540,5 +545,13 @@ int maildir_message_add(struct maildir * md, } -int maildir_message_add_file(struct maildir * md, int fd) +int maildir_message_add(struct maildir * md, + const char * message, size_t size) +{ + return maildir_message_add_uid(md, message, size, + NULL, 0); +} + +int maildir_message_add_file_uid(struct maildir * md, int fd, + char * uid, size_t max_uid_len) { char * message; @@ -553,11 +566,17 @@ int maildir_message_add_file(struct maildir * md, int fd) return MAILDIR_ERROR_FILE; - r = maildir_message_add(md, message, buf.st_size); + r = maildir_message_add_uid(md, message, buf.st_size, uid, max_uid_len); munmap(message, buf.st_size); - + return r; } +int maildir_message_add_file(struct maildir * md, int fd) +{ + return maildir_message_add_file_uid(md, fd, + NULL, 0); +} + char * maildir_message_get(struct maildir * md, const char * uid) { diff --git a/kmicromail/libetpan/maildir/maildir.h b/kmicromail/libetpan/maildir/maildir.h index b782484..268dda1 100644 --- a/kmicromail/libetpan/maildir/maildir.h +++ b/kmicromail/libetpan/maildir/maildir.h @@ -46,7 +46,14 @@ void maildir_free(struct maildir * md); int maildir_update(struct maildir * md); +int maildir_message_add_uid(struct maildir * md, + const char * message, size_t size, + char * uid, size_t max_uid_len); + int maildir_message_add(struct maildir * md, const char * message, size_t size); +int maildir_message_add_file_uid(struct maildir * md, int fd, + char * uid, size_t max_uid_len); + int maildir_message_add_file(struct maildir * md, int fd); |