X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pop%2Fpop.c;h=b2edb9634d38d27662824d3e2dea000403ec9f66;hp=9eb61725781317d54ee9286c29dc05b9486e5d87;hb=203e950e3d3c76795fa49895d040f732adad2049;hpb=cc917eda58cb573cd3f56337dfe088a94e23649c diff --git a/pop/pop.c b/pop/pop.c index 9eb6172..b2edb96 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -16,6 +16,10 @@ #include "pop.h" #include "mutt_crypt.h" +#include "lib/mem.h" +#include "lib/str.h" +#include "lib/intl.h" + #include #include @@ -39,11 +43,12 @@ static int fetch_message (char *line, void *file) * -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]; @@ -51,7 +56,7 @@ static int pop_read_header (POP_DATA * pop_data, HEADER * h) 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); @@ -62,15 +67,15 @@ static int pop_read_header (POP_DATA * pop_data, HEADER * h) 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), @@ -168,15 +173,15 @@ static int pop_fetch_headers (CONTEXT * ctx) 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),