#include <stdbool.h>
#include "core/lib.h"
#include "mx.h"
Go to the source code of this file.
POP network mailbox
- Authors
-
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file lib.h.
◆ pop_fetch_mail()
void pop_fetch_mail |
( |
void |
| ) |
|
Fetch messages and save them in $spool_file.
Definition at line 509 of file pop.c.
519 int last = 0, msgs, bytes, rset = 0, ret;
526 strcpy(url,
"pop://");
527 p = strchr(url,
'\0');
566 sscanf(buf,
"+OK %d %d", &msgs, &bytes);
576 sscanf(buf,
"+OK %d", &last);
593 bool old_append = m_spool->
append;
599 snprintf(msgbuf,
sizeof(msgbuf),
600 ngettext(
"Reading new messages (%d byte)...",
601 "Reading new messages (%d bytes)...", bytes),
605 for (
int i = last + 1; i <= msgs; i++)
610 snprintf(buf,
sizeof(buf),
"RETR %d\r\n", i);
628 if ((ret == 0) && (delanswer ==
MUTT_YES))
631 snprintf(buf,
sizeof(buf),
"DELE %d\r\n", i);
632 ret =
pop_query(adata, buf,
sizeof(buf));
637 m_spool->
append = old_append;
655 "%s [%d of %d messages read]", msgs - last),
656 msgbuf, i - last, msgs - last);
659 m_spool->
append = old_append;
666 if (
pop_query(adata, buf,
sizeof(buf)) == -1)
673 if (
pop_query(adata, buf,
sizeof(buf)) == -1)
◆ pop_path_probe()
enum MailboxType pop_path_probe |
( |
const char * |
path, |
|
|
const struct stat * |
st |
|
) |
| |
◆ MxPopOps
Login details for a remote server.
An open network connection (socket)
QuadOption
Possible values for a quad-option.
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
bool append
Mailbox is opened in append mode.
bool C_PopLast
Config: (pop) Use the 'LAST' command to fetch new mail.
int pop_parse_path(const char *path, struct ConnAccount *cac)
Parse a POP mailbox name.
enum UrlScheme url_check_scheme(const char *str)
Check the protocol of a URL.
char err_msg[POP_CMD_RESPONSE]
@ U_UNKNOWN
Url wasn't recognised.
@ MUTT_POP
'POP3' Mailbox type
static int fetch_message(const char *line, void *data)
write line to file - Implements pop_fetch_t
int mutt_socket_close(struct Connection *conn)
Close a socket.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
int pop_open_connection(struct PopAccountData *adata)
Open connection and authenticate.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
struct PopAccountData * pop_adata_new(void)
Create a new PopAccountData object.
int mx_msg_commit(struct Mailbox *m, struct Message *msg)
Commit a message to a folder - Wrapper for MxOps::msg_commit()
char * path
path to temp file
enum MxStatus mx_mbox_close(struct Context **ptr)
Save changes and close mailbox.
void pop_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free()
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
#define MUTT_OPEN_NO_FLAGS
No flags are set.
#define MUTT_ADD_FROM
add a From_ line
FILE * fp
pointer to the message data
unsigned char C_PopDelete
Config: (pop) After downloading POP messages, delete them on the server.
char * C_PopHost
Config: (pop) Url of the POP server.
WHERE char * C_SpoolFile
Config: Inbox.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
struct Context * mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
#define pop_query(adata, buf, buflen)
void * adata
Private data (for Mailbox backends)
int pop_fetch_data(struct PopAccountData *adata, const char *query, struct Progress *progress, pop_fetch_t callback, void *data)
Read Headers with callback function.
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
#define mutt_message(...)
struct Message * mx_msg_open_new(struct Mailbox *m, const struct Email *e, MsgOpenFlags flags)
Open a new message.
struct Connection * mutt_conn_find(const struct ConnAccount *cac)
Find a connection from a list.
POP-specific Account data -.
A local copy of an email.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)