Commit 268030e3 268030e3a835a8251b83fc0b27b5f7080ca7b288 by Sergey Poznyakoff

(util_get_message): Expanded semantics of the last

argument. It now contains flags that control how
util_get_message operates. Flags are a bitwise sum of the
following:
	MSG_ALL		Return any message (deleted or not)
	MSG_NODELETED	Do not return deleted messages.
	MSG_SILENT	Do not output warnings about deleted
			messages.
1 parent b481b31e
......@@ -1225,7 +1225,7 @@ util_header_expand (header_t *phdr)
}
int
util_get_message (mailbox_t mbox, size_t msgno, message_t *msg, int delflag)
util_get_message (mailbox_t mbox, size_t msgno, message_t *msg, int flag)
{
int status;
......@@ -1243,9 +1243,11 @@ util_get_message (mailbox_t mbox, size_t msgno, message_t *msg, int delflag)
return status;
}
if (delflag && util_isdeleted (*msg))
if ((flag & MSG_NODELETED) && util_isdeleted (*msg))
{
util_error ("%d: Inappropriate message (has been deleted)");
if (!(flag & MSG_SILENT))
util_error ("%lu: Inappropriate message (has been deleted)",
(unsigned long) msgno);
return ENOENT;
}
return 0;
......