POP helper routines. More...
#include "config.h"
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "conn/lib.h"
#include "question/lib.h"
#include "progress/lib.h"
#include "adata.h"
#include "edata.h"
#include "mutt_account.h"
#include "mutt_logging.h"
Go to the source code of this file.
Functions | |
const char * | pop_get_field (enum ConnAccountField field, void *gf_data) |
Get connection login credentials - Implements ConnAccount::get_field() -. | |
int | pop_parse_path (const char *path, struct ConnAccount *cac) |
Parse a POP mailbox name. | |
static void | pop_error (struct PopAccountData *adata, char *msg) |
Copy error message to err_msg buffer. | |
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 | pop_capabilities (struct PopAccountData *adata, int mode) |
Get capabilities from a POP server. | |
int | pop_connect (struct PopAccountData *adata) |
Open connection. | |
int | pop_open_connection (struct PopAccountData *adata) |
Open connection and authenticate. | |
void | pop_logout (struct Mailbox *m) |
Logout from a POP server. | |
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. | |
static int | check_uidl (const char *line, void *data) |
Parse UIDL response - Implements pop_fetch_t -. | |
int | pop_reconnect (struct Mailbox *m) |
Reconnect and verify indexes if connection was lost. | |
POP helper routines.
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.c.
int pop_parse_path | ( | const char * | path, |
struct ConnAccount * | cac | ||
) |
Parse a POP mailbox name.
path | Path to parse |
cac | Account to store details |
0 | success |
-1 | error |
Split a POP path into host, port, username and password
Definition at line 83 of file lib.c.
|
static |
Copy error message to err_msg buffer.
adata | POP Account data |
msg | Error message to save |
Definition at line 123 of file lib.c.
|
static |
Get capabilities from a POP server.
adata | POP Account data |
mode | Initial capabilities |
0 | Successful |
-1 | Connection lost |
-2 | Execution error |
Definition at line 203 of file lib.c.
int pop_connect | ( | struct PopAccountData * | adata | ) |
Open connection.
adata | POP Account data |
0 | Successful |
-1 | Connection lost |
-2 | Invalid response |
Definition at line 282 of file lib.c.
int pop_open_connection | ( | struct PopAccountData * | adata | ) |
Open connection and authenticate.
adata | POP Account data |
0 | Successful |
-1 | Connection lost |
-2 | Invalid command or execution error |
-3 | Authentication cancelled |
Definition at line 317 of file lib.c.
void pop_logout | ( | struct Mailbox * | m | ) |
Logout from a POP server.
m | Mailbox |
Definition at line 425 of file lib.c.
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.
adata | POP Account data |
buf | Buffer to send/store data |
buflen | Buffer length |
msg | Progress message |
0 | Successful |
-1 | Connection lost |
-2 | Invalid command or execution error |
Definition at line 466 of file lib.c.
int pop_fetch_data | ( | struct PopAccountData * | adata, |
const char * | query, | ||
struct Progress * | progress, | ||
pop_fetch_t | callback, | ||
void * | data | ||
) |
Read Headers with callback function.
adata | POP Account data |
query | POP query to send to server |
progress | Progress bar |
callback | Function called for each header read |
data | Data to pass to the callback |
0 | Successful |
-1 | Connection lost |
-2 | Invalid command or execution error |
-3 | Error in callback(*line, *data) |
This function calls callback(*line, *data) for each received line, callback(NULL, *data) if rewind(*data) needs, exits when fail or done.
Definition at line 511 of file lib.c.
int pop_reconnect | ( | struct Mailbox * | m | ) |
Reconnect and verify indexes if connection was lost.
m | Mailbox |
0 | Success |
-1 | Error |
Definition at line 609 of file lib.c.