diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-11-15 10:53:38 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-11-15 10:53:38 +0200 |
commit | 8a566e1efceb79a25deab29a4e63fb10487cb931 (patch) | |
tree | f1bbd6277d8609dc46bcdb23b62b8ab56e51c664 | |
parent | 9bfb66497ca7245a07c4168d023824ee2a2622c7 (diff) | |
download | mailutils-8a566e1efceb79a25deab29a4e63fb10487cb931.tar.gz mailutils-8a566e1efceb79a25deab29a4e63fb10487cb931.tar.bz2 |
AMD API: provide function for resetting the uidvalidity value.
* include/mailutils/sys/amd.h (amd_reset_uidvalidity): New proto.
* libmailutils/base/amd.c (amd_reset_uidvalidity): New function.
* libproto/maildir/mbox.c (maildir_scan_unlocked): Use
amd_reset_uidvalidity.
-rw-r--r-- | include/mailutils/sys/amd.h | 1 | ||||
-rw-r--r-- | libmailutils/base/amd.c | 9 | ||||
-rw-r--r-- | libproto/maildir/mbox.c | 3 | ||||
-rw-r--r-- | libproto/maildir/tests/qget.at | 4 |
4 files changed, 11 insertions, 6 deletions
diff --git a/include/mailutils/sys/amd.h b/include/mailutils/sys/amd.h index 6ec00233d..cf1842ea3 100644 --- a/include/mailutils/sys/amd.h +++ b/include/mailutils/sys/amd.h @@ -128,5 +128,6 @@ struct _amd_message *_amd_get_message (struct _amd_data *amd, size_t msgno); int amd_msg_lookup (struct _amd_data *amd, struct _amd_message *msg, size_t *pret); int amd_remove_dir (const char *name); +void amd_reset_uidvalidity (struct _amd_data *amd); #endif diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c index 2e03d24a5..ddfb965de 100644 --- a/libmailutils/base/amd.c +++ b/libmailutils/base/amd.c @@ -31,6 +31,7 @@ #include <stdio.h> #include <time.h> #include <sys/stat.h> +#include <sys/time.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> @@ -2142,4 +2143,12 @@ amd_remove_dir (const char *name) return rc; } +void +amd_reset_uidvalidity (struct _amd_data *amd) +{ + struct timeval tv; + gettimeofday (&tv, NULL); + _amd_prop_store_off (amd, _MU_AMD_PROP_UIDVALIDITY, tv.tv_sec); +} + diff --git a/libproto/maildir/mbox.c b/libproto/maildir/mbox.c index db06fad42..0cfd79f9f 100644 --- a/libproto/maildir/mbox.c +++ b/libproto/maildir/mbox.c @@ -906,8 +906,7 @@ maildir_scan_unlocked (mu_mailbox_t mailbox, size_t *pcount, int do_notify) /* Reset uidvalidity if any of the UIDs changed */ if (md->needs_uid_fixup) { - // FIXME: Fix AMD API. - _amd_prop_store_off (&md->amd, _MU_AMD_PROP_UIDVALIDITY, time (NULL)); + amd_reset_uidvalidity (&md->amd); save_prop = 1; } diff --git a/libproto/maildir/tests/qget.at b/libproto/maildir/tests/qget.at index d7082f3ac..dfa404b2d 100644 --- a/libproto/maildir/tests/qget.at +++ b/libproto/maildir/tests/qget.at @@ -43,7 +43,3 @@ that's clear, at any rate... ]) AT_CLEANUP - -# Local Variables: -# mode: autotest -# End: |