Commit c77752c0 c77752c0d745b87789118aee9b5601cd2aa7e89d by Alain Magloire

attribute.c mbx_unix.c

bug in *_unset_attributes and mailbox_expunge.
1 parent 90780cf7
......@@ -63,7 +63,7 @@ attribute_set_answered (attribute_t attr)
{
if (attr == NULL)
return EINVAL;
attr->flag|= MU_ATTRIBUTE_ANSWERED;
attr->flag |= MU_ATTRIBUTE_ANSWERED;
return 0;
}
......@@ -173,7 +173,7 @@ attribute_unset_seen (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_SEEN;
attr->flag &= ~MU_ATTRIBUTE_SEEN;
return 0;
}
......@@ -182,7 +182,7 @@ attribute_unset_answered (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_ANSWERED;
attr->flag &= ~MU_ATTRIBUTE_ANSWERED;
return 0;
}
......@@ -191,7 +191,7 @@ attribute_unset_flagged (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_FLAGGED;
attr->flag &= ~MU_ATTRIBUTE_FLAGGED;
return 0;
}
......@@ -200,7 +200,7 @@ attribute_unset_read (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_READ;
attr->flag &= ~MU_ATTRIBUTE_READ;
return 0;
}
......@@ -209,7 +209,7 @@ attribute_unset_deleted (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_DELETED;
attr->flag &= ~MU_ATTRIBUTE_DELETED;
return 0;
}
......@@ -218,7 +218,7 @@ attribute_unset_draft (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_DRAFT;
attr->flag &= ~MU_ATTRIBUTE_DRAFT;
return 0;
}
......@@ -227,7 +227,7 @@ attribute_unset_recent (attribute_t attr)
{
if (attr == NULL)
return 0;
attr->flag ^= MU_ATTRIBUTE_RECENT;
attr->flag &= ~MU_ATTRIBUTE_RECENT;
return 0;
}
......
......@@ -584,8 +584,8 @@ mailbox_unix_readhdr (mailbox_t mbox, char *buf, size_t len,
/* Set the attribute */
else if (strncmp (buf, "Status:", 7) == 0)
{
mum->hdr_status = ftell (mud->file);
mum->hdr_status_end = mum->hdr_status + strlen (buf);
mum->hdr_status_end = ftell (mud->file);
mum->hdr_status = mum->hdr_status_end - strlen (buf);
sep = strchr(buf, ':'); /* pass the ':' */
if (strchr (sep, 'R') != NULL)
attribute_set_read (mum->old_attr);
......@@ -976,7 +976,7 @@ mailbox_unix_expunge (mailbox_t mbox)
if (attribute_is_deleted (mum->new_attr))
continue;
/* add a NL separtor between messages */
/* add a NL separator between messages */
if (first)
first = 0;
else
......@@ -1036,6 +1036,12 @@ mailbox_unix_expunge (mailbox_t mbox)
fputc ('\n', tmpfile);
total++;
}
/* skip the status field */
if (fseek (mud->file, current, SEEK_SET) == -1)
{
status = errno;
goto bailout;
}
}
else /* attribute did not change */
{
......