summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-11-12 16:27:49 +0200
committerSergey Poznyakoff <gray@gnu.org>2020-11-12 16:43:10 +0200
commitcccd16edee101cf7df37ba2b52e259e581023197 (patch)
tree97e0d8c42c05e7cfcbbfe296a1cd3c008afe7754
parent7b2f2049e941500944ca6d34f4a3ff34779acee4 (diff)
downloadmailutils-cccd16edee101cf7df37ba2b52e259e581023197.tar.gz
mailutils-cccd16edee101cf7df37ba2b52e259e581023197.tar.bz2
Don't assume any special meaning of the X-Imapbase header in the library.
This starts a series of commits whose purpose is to clean up the mess with the uid and uidvalidity attributes. The way these attributes are stored depends on the mailbox type. The libmailutils library contained some historical left-overs that assumed that the X-Imapbase header of the first message in the mailbox contained the value of the uidvalidity and next uid. These left-overs are removed. * include/mailutils/message.h (mu_message_scan): Remove uidvalidity. * libmailutils/mailbox/msgscan.c: Remove special handling for the X-Imapbase header. * libmailutils/base/amd.c (_amd_message_save) (amd_scan_message): Remove special handling for X-Imapbase.
-rw-r--r--include/mailutils/message.h1
-rw-r--r--libmailutils/base/amd.c5
-rw-r--r--libmailutils/mailbox/msgscan.c11
3 files changed, 3 insertions, 14 deletions
diff --git a/include/mailutils/message.h b/include/mailutils/message.h
index a5dc4741f..a62544ed3 100644
--- a/include/mailutils/message.h
+++ b/include/mailutils/message.h
@@ -97,7 +97,6 @@ struct mu_message_scan
size_t header_lines;
size_t body_lines;
int attr_flags;
- unsigned long uidvalidity;
};
int mu_stream_scan_message (mu_stream_t stream, struct mu_message_scan *sp);
diff --git a/libmailutils/base/amd.c b/libmailutils/base/amd.c
index 21c6370ba..c808de419 100644
--- a/libmailutils/base/amd.c
+++ b/libmailutils/base/amd.c
@@ -860,8 +860,6 @@ _amd_message_save (struct _amd_data *amd, struct _amd_message *mhm,
break;
if (!(mu_c_strncasecmp (buf, "status:", 7) == 0
- || mu_c_strncasecmp (buf, "x-imapbase:", 11) == 0
- || mu_c_strncasecmp (buf, "x-uid:", 6) == 0
|| mu_c_strncasecmp (buf,
MU_HEADER_ENV_DATE ":", sizeof (MU_HEADER_ENV_DATE)) == 0
|| mu_c_strncasecmp (buf,
@@ -1659,8 +1657,7 @@ amd_scan_message (struct _amd_message *mhm)
mu_string_to_flags (buf, &mhm->attr_flags);
mhm->attr_flags |= deleted;
}
- else if (!(amd_capa & MU_AMD_IMAPBASE) &&
- mu_c_strncasecmp (buf, "x-imapbase:", 11) == 0)
+ else if (!(amd_capa & MU_AMD_IMAPBASE))
{
if (_amd_prop_fetch_ulong (amd, _MU_AMD_PROP_UIDVALIDITY,
NULL))
diff --git a/libmailutils/mailbox/msgscan.c b/libmailutils/mailbox/msgscan.c
index d4258c185..6a3aa9ae7 100644
--- a/libmailutils/mailbox/msgscan.c
+++ b/libmailutils/mailbox/msgscan.c
@@ -24,6 +24,7 @@
#include <mailutils/stream.h>
#include <mailutils/message.h>
#include <mailutils/attribute.h>
+#include <mailutils/header.h>
#include <mailutils/cstr.h>
int
@@ -38,7 +39,6 @@ mu_stream_scan_message (mu_stream_t stream, struct mu_message_scan *sp)
size_t blines = 0;
size_t body_start = 0;
int attr_flags = 0;
- unsigned long uidvalidity = 0;
if (sp->flags & MU_SCAN_SEEK)
{
@@ -74,14 +74,8 @@ mu_stream_scan_message (mu_stream_t stream, struct mu_message_scan *sp)
hlines++;
/* Process particular attributes */
- if (mu_c_strncasecmp (buf, "status:", 7) == 0)
+ if (mu_c_strncasecmp (buf, MU_HEADER_STATUS ":", 7) == 0)
mu_string_to_flags (buf, &attr_flags);
- else if (mu_c_strncasecmp (buf, "x-imapbase:", 11) == 0)
- {
- char *p;
- uidvalidity = strtoul (buf + 11, &p, 10);
- /* second number is next uid. Ignored */
- }
}
else
{
@@ -100,7 +94,6 @@ mu_stream_scan_message (mu_stream_t stream, struct mu_message_scan *sp)
sp->header_lines = hlines;
sp->body_lines = blines;
sp->attr_flags = attr_flags;
- sp->uidvalidity = uidvalidity;
}
return status;
}

Return to:

Send suggestions and report system problems to the System administrator.