X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pop%2Fpop.c;h=bba466f36e8aa5509accf98b55cf824dbb1c866e;hp=b8e9e064f4d500bf780bdd693ca5fa9d78858999;hb=344312314eec327c3bf47f86950a5ad6c616e031;hpb=8e037c67a88cb4680c4391134c578e3b55a80f8a diff --git a/pop/pop.c b/pop/pop.c index b8e9e06..bba466f 100644 --- a/pop/pop.c +++ b/pop/pop.c @@ -12,6 +12,9 @@ #endif #include +#include +#include +#include #include "mutt.h" #include "mx.h" @@ -19,9 +22,6 @@ #include "mutt_crypt.h" #include "mutt_curses.h" -#include "lib/mem.h" -#include "lib/str.h" -#include "lib/intl.h" #include "lib/debug.h" #include @@ -132,7 +132,7 @@ static int fetch_uidl (char *line, void *data) sscanf (line, "%d %s", &index, line); for (i = 0; i < ctx->msgcount; i++) - if (!str_cmp (line, ctx->hdrs[i]->data)) + if (!m_strcmp(line, ctx->hdrs[i]->data)) break; if (i == ctx->msgcount) { @@ -143,7 +143,7 @@ static int fetch_uidl (char *line, void *data) ctx->msgcount++; ctx->hdrs[i] = mutt_new_header (); - ctx->hdrs[i]->data = str_dup (line); + ctx->hdrs[i]->data = m_strdup(line); } else if (ctx->hdrs[i]->index != index - 1) pop_data->clear_cache = 1; @@ -249,9 +249,9 @@ int pop_open_mailbox (CONTEXT * ctx) return -1; p_delete(&ctx->path); - ctx->path = str_dup (buf); + ctx->path = m_strdup(buf); - pop_data = mem_calloc (1, sizeof (POP_DATA)); + pop_data = p_new(POP_DATA, 1); pop_data->conn = conn; ctx->data = pop_data; @@ -260,7 +260,7 @@ int pop_open_mailbox (CONTEXT * ctx) conn->data = pop_data; - FOREVER { + for (;;) { if (pop_reconnect (ctx) != PQ_OK) return -1; @@ -355,7 +355,7 @@ int pop_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) } } - FOREVER { + for (;;) { if (pop_reconnect (ctx) != PQ_OK) return -1; @@ -406,7 +406,7 @@ int pop_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) * portion of the headers, those required for the main display. */ cache->index = h->index; - cache->path = str_dup (path); + cache->path = m_strdup(path); rewind (msg->fp); uidl = h->data; mutt_free_envelope (&h->env); @@ -441,7 +441,7 @@ pop_query_status pop_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) pop_data->check_time = 0; - FOREVER { + for (;;) { if (pop_reconnect (ctx) != PQ_OK) return PQ_NOT_CONNECTED; @@ -455,7 +455,7 @@ pop_query_status pop_sync_mailbox (CONTEXT * ctx, int unused, int *index_hint) } if (ret == PQ_OK) { - strfcpy (buf, "QUIT\r\n", sizeof (buf)); + m_strcpy(buf, sizeof(buf), "QUIT\r\n"); ret = pop_query (pop_data, buf, sizeof (buf)); } @@ -526,7 +526,7 @@ void pop_fetch_mail (void) return; } - url = p = mem_calloc (strlen (PopHost) + 7, sizeof (char)); + url = p = p_new(char, strlen (PopHost) + 7); if (url_check_scheme (PopHost) == U_UNKNOWN) { strcpy (url, "pop://"); /* __STRCPY_CHECKED__ */ p = strchr (url, '\0'); @@ -544,7 +544,7 @@ void pop_fetch_mail (void) if (!conn) return; - pop_data = mem_calloc (1, sizeof (POP_DATA)); + pop_data = p_new(POP_DATA, 1); pop_data->conn = conn; if (pop_open_connection (pop_data) < 0) { @@ -558,7 +558,7 @@ void pop_fetch_mail (void) mutt_message _("Checking for new messages..."); /* find out how many messages are in the mailbox. */ - strfcpy (buffer, "STAT\r\n", sizeof (buffer)); + m_strcpy(buffer, sizeof(buffer), "STAT\r\n"); ret = pop_query (pop_data, buffer, sizeof (buffer)); if (ret == PQ_NOT_CONNECTED) goto fail; @@ -571,7 +571,7 @@ void pop_fetch_mail (void) /* only get unread messages */ if (msgs > 0 && option (OPTPOPLAST)) { - strfcpy (buffer, "LAST\r\n", sizeof (buffer)); + m_strcpy(buffer, sizeof(buffer), "LAST\r\n"); ret = pop_query (pop_data, buffer, sizeof (buffer)); if (ret == PQ_NOT_CONNECTED) goto fail; @@ -640,14 +640,14 @@ void pop_fetch_mail (void) if (rset) { /* make sure no messages get deleted */ - strfcpy (buffer, "RSET\r\n", sizeof (buffer)); + m_strcpy(buffer, sizeof(buffer), "RSET\r\n"); if (pop_query (pop_data, buffer, sizeof (buffer)) == PQ_NOT_CONNECTED) goto fail; } finish: /* exit gracefully */ - strfcpy (buffer, "QUIT\r\n", sizeof (buffer)); + m_strcpy(buffer, sizeof(buffer), "QUIT\r\n"); if (pop_query (pop_data, buffer, sizeof (buffer)) == PQ_NOT_CONNECTED) goto fail; mutt_socket_close (conn);