105 struct servent *service = getservbyname((url->
scheme ==
U_POP) ?
"pop3" :
"pop3s",
"tcp");
109 cac->
port = ntohs(service->s_port);
125 char *t = strchr(adata->
err_msg,
'\0');
158 adata->cmd_stls =
true;
205 char buf[1024] = { 0 };
208 if (
adata->capabilities)
214 adata->cmd_capa =
false;
215 adata->cmd_stls =
false;
219 adata->resp_codes =
false;
220 adata->expire =
true;
221 adata->login_delay = 0;
226 if ((mode == 0) ||
adata->cmd_capa)
233 adata->cmd_capa =
true;
242 if ((mode == 0) && !
adata->cmd_capa)
259 msg =
_(
"Unable to leave messages on server");
260 if (
adata->cmd_top == 0)
261 msg =
_(
"Command TOP is not supported by server");
262 if (
adata->cmd_uidl == 0)
263 msg =
_(
"Command UIDL is not supported by server");
264 if (msg &&
adata->cmd_capa)
269 adata->capabilities =
true;
284 char buf[1024] = { 0 };
298 *
adata->err_msg =
'\0';
319 char buf[1024] = { 0 };
334 if ((
adata->conn->ssf == 0) && (
adata->cmd_stls || c_ssl_force_tls))
338 if (
adata->use_stls == 0)
348 if (
adata->use_stls == 2)
362 mutt_error(
_(
"Could not negotiate TLS connection"));
377 if (c_ssl_force_tls && (
adata->conn->ssf == 0))
410 unsigned int n = 0,
size = 0;
411 sscanf(buf,
"+OK %u %u", &n, &
size);
432 char buf[1024] = { 0 };
479 char *c = strpbrk(buf,
" \r\n");
482 snprintf(
adata->err_msg,
sizeof(
adata->err_msg),
"%s: ", buf);
512 struct Progress *progress,
pop_fetch_t callback,
void *data)
514 char buf[1024] = { 0 };
536 if (!lenbuf && (buf[0] ==
'.'))
547 if ((
size_t) chunk >=
sizeof(buf))
554 if ((rc == 0) && (callback(inbuf, data) < 0))
583 unsigned int index = strtoul(line, &endp, 10);
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
struct Buffer * buf_init(struct Buffer *buf)
Initialise a new Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
ConnAccountField
Login credentials.
@ MUTT_CA_OAUTH_CMD
OAuth refresh command.
@ MUTT_CA_LOGIN
Login name.
@ MUTT_CA_HOST
Server name.
#define MUTT_ACCT_SSL
Account uses SSL/TLS.
Convenience wrapper for the core headers.
Structs that make up an email.
int mutt_ssl_starttls(struct Connection *conn)
Negotiate TLS over an already opened connection.
const char * pop_get_field(enum ConnAccountField field, void *gf_data)
Get connection login credentials - Implements ConnAccount::get_field() -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
static int fetch_capa(const char *line, void *data)
Parse CAPA response - Implements pop_fetch_t -.
static int fetch_auth(const char *line, void *data)
Parse AUTH response - Implements pop_fetch_t -.
static int check_uidl(const char *line, void *data)
Parse UIDL response - Implements pop_fetch_t -.
@ LL_DEBUG1
Log at debug level 1.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Convenience wrapper for the library headers.
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
char * mutt_str_skip_email_wsp(const char *s)
Skip over whitespace as defined by RFC5322.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
int mutt_account_fromurl(struct ConnAccount *cac, const struct Url *url)
Fill ConnAccount with information from url.
ConnAccount object used by POP and IMAP.
@ MUTT_ACCT_TYPE_POP
Pop Account.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
struct PopAccountData * pop_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
Pop-specific Account data.
void pop_apop_timestamp(struct PopAccountData *adata, char *buf)
Get the server timestamp for APOP authentication.
int pop_authenticate(struct PopAccountData *adata)
Authenticate with a POP server.
struct PopEmailData * pop_edata_get(struct Email *e)
Get the private data for this Email.
int pop_connect(struct PopAccountData *adata)
Open connection.
int pop_open_connection(struct PopAccountData *adata)
Open connection and authenticate.
int pop_parse_path(const char *path, struct ConnAccount *cac)
Parse a POP mailbox name.
static int pop_capabilities(struct PopAccountData *adata, int mode)
Get capabilities from a POP server.
static void pop_error(struct PopAccountData *adata, char *msg)
Copy error message to err_msg buffer.
int pop_query_d(struct PopAccountData *adata, char *buf, size_t buflen, char *msg)
Send data from buffer and receive answer to the same buffer.
int pop_fetch_data(struct PopAccountData *adata, const char *query, struct Progress *progress, pop_fetch_t callback, void *data)
Read Headers with callback function.
void pop_logout(struct Mailbox *m)
Logout from a POP server.
int pop_reconnect(struct Mailbox *m)
Reconnect and verify indexes if connection was lost.
#define pop_query(adata, buf, buflen)
int(* pop_fetch_t)(const char *str, void *data)
@ POP_DISCONNECTED
Disconnected from server.
@ POP_CONNECTED
Connected to server.
@ POP_NONE
No connected to server.
@ MUTT_PROGRESS_NET
Progress tracks bytes, according to $net_inc
struct Progress * progress_new(enum ProgressType type, size_t size)
Create a new Progress Bar.
void progress_free(struct Progress **ptr)
Free a Progress Bar.
void progress_set_message(struct Progress *progress, const char *fmt,...) __attribute__((__format__(__printf__
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
QuadOption
Possible values for a quad-option.
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
int mutt_socket_close(struct Connection *conn)
Close a socket.
void mutt_socket_empty(struct Connection *conn)
Clear out any queued data.
int mutt_socket_open(struct Connection *conn)
Simple wrapper.
int mutt_socket_readln_d(char *buf, size_t buflen, struct Connection *conn, int dbg)
Read a line from a socket.
#define MUTT_SOCK_LOG_FULL
#define mutt_socket_readln(buf, buflen, conn)
#define MUTT_SOCK_LOG_CMD
#define mutt_socket_send_d(conn, buf, dbg)
void * adata
Private data (for Mailbox backends)
Login details for a remote server.
const char * service
Name of the service, e.g. "imap".
const char *(* get_field)(enum ConnAccountField field, void *gf_data)
unsigned char type
Connection type, e.g. MUTT_ACCT_TYPE_IMAP.
MuttAccountFlags flags
Which fields are initialised, e.g. MUTT_ACCT_USER.
unsigned short port
Port to connect to.
void * edata
Driver-specific data.
int index
The absolute (unsorted) message number.
int msg_count
Total number of messages.
struct Email ** emails
Array of Emails.
bool readonly
Don't allow changes to the mailbox.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
POP-specific Account data -.
char err_msg[POP_CMD_RESPONSE]
POP-specific Email data -.
A parsed URL proto://user:password@host:port/path?a=1&b=2
enum UrlScheme scheme
Scheme, e.g. U_SMTPS.
struct Url * url_parse(const char *src)
Fill in Url.
void url_free(struct Url **ptr)
Free the contents of a URL.