X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=pop%2Fpop.c;h=c67cd7ebe1f072f0543f78d1a2dc692fe9e0f554;hb=2f928128cac1c0bc2ce2465671e5abe2a9671d28;hp=9eb61725781317d54ee9286c29dc05b9486e5d87;hpb=cc917eda58cb573cd3f56337dfe088a94e23649c;p=apps%2Fmadmutt.git diff --git a/pop/pop.c b/pop/pop.c index 9eb6172..c67cd7e 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), @@ -119,7 +124,7 @@ static int fetch_uidl (char *line, void *data) sscanf (line, "%d %s", &index, line); for (i = 0; i < ctx->msgcount; i++) - if (!mutt_strcmp (line, ctx->hdrs[i]->data)) + if (!safe_strcmp (line, ctx->hdrs[i]->data)) break; if (i == ctx->msgcount) { @@ -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),