#include "pop.h"
#include "mutt_crypt.h"
+#include "lib/mem.h"
+#include "lib/str.h"
+#include "lib/intl.h"
+
#include <string.h>
#include <unistd.h>
* -2 - invalid command or execution error,
* -3 - error writing to tempfile
*/
-static int pop_read_header (POP_DATA * pop_data, HEADER * h)
+static pop_query_status pop_read_header (POP_DATA * pop_data, HEADER * h)
{
FILE *f;
int index;
pop_query_status ret;
+ cmd_status status;
long length;
char buf[LONG_STRING];
char tempfile[_POSIX_PATH_MAX];
mutt_mktemp (tempfile);
if (!(f = safe_fopen (tempfile, "w+"))) {
mutt_perror (tempfile);
- return -3;
+ return PFD_FUNCT_ERROR;
}
snprintf (buf, sizeof (buf), "LIST %d\r\n", h->refno);
snprintf (buf, sizeof (buf), "TOP %d 0\r\n", h->refno);
ret = pop_fetch_data (pop_data, buf, NULL, fetch_message, f);
- if (pop_data->cmd_top == 2) {
+ if (pop_data->cmd_top == CMD_UNKNOWN) {
if (ret == PQ_OK) {
- pop_data->cmd_top = 1;
+ pop_data->cmd_top = CMD_AVAILABLE;
dprint (1, (debugfile, "pop_read_header: set TOP capability\n"));
}
if (ret == PQ_ERR) {
- pop_data->cmd_top = 0;
+ pop_data->cmd_top = CMD_NOT_AVAILABLE;
dprint (1, (debugfile, "pop_read_header: unset TOP capability\n"));
snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),
new_count = ctx->msgcount;
ctx->msgcount = old_count;
- if (pop_data->cmd_uidl == 2) {
+ if (pop_data->cmd_uidl == CMD_UNKNOWN) {
if (ret == PQ_OK) {
- pop_data->cmd_uidl = 1;
+ pop_data->cmd_uidl = CMD_AVAILABLE;
dprint (1, (debugfile, "pop_fetch_headers: set UIDL capability\n"));
}
- if (ret == PQ_ERR && pop_data->cmd_uidl == 2) {
- pop_data->cmd_uidl = 0;
+ if (ret == PQ_ERR && pop_data->cmd_uidl == CMD_UNKNOWN) {
+ pop_data->cmd_uidl = CMD_NOT_AVAILABLE;
dprint (1, (debugfile, "pop_fetch_headers: unset UIDL capability\n"));
snprintf (pop_data->err_msg, sizeof (pop_data->err_msg),