2 * Copyright notice from original mutt:
3 * Copyright (C) 2000-2003 Vsevolod Volkov <vvv@mutt.org.ua>
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
14 #include "mutt_socket.h"
17 #define POP_SSL_PORT 995
19 /* number of entries in the hash table */
20 #define POP_CACHE_LEN 10
22 /* maximal length of the server response (RFC1939) */
23 #define POP_CMD_RESPONSE 512
45 typedef enum pop_query_status_e {
46 PFD_FUNCT_ERROR = -3, /* pop_fetch_data uses pop_query_status and this return value */
48 PQ_NOT_CONNECTED = -1,
52 typedef enum cmd_status_e {
53 CMD_NOT_AVAILABLE = 0,
55 CMD_UNKNOWN /* unknown whether it is available or not */
60 unsigned int status:2;
61 unsigned int capabilities:1;
62 unsigned int use_stls:2;
63 cmd_status cmd_capa; /* optional command CAPA */
64 cmd_status cmd_stls; /* optional command STLS */
65 cmd_status cmd_user; /* optional command USER */
66 cmd_status cmd_uidl; /* optional command UIDL */
67 cmd_status cmd_top; /* optional command TOP */
68 unsigned int resp_codes:1; /* server supports extended response codes */
69 unsigned int expire:1; /* expire is greater than 0 */
70 unsigned int clear_cache:1;
73 time_t login_delay; /* minimal login delay capability */
74 char *auth_list; /* list of auth mechanisms */
76 char err_msg[POP_CMD_RESPONSE];
77 POP_CACHE cache[POP_CACHE_LEN];
81 /* do authentication, using named method or any available if method is NULL */
82 pop_auth_res_t (*authenticate) (POP_DATA *, const char *);
83 /* name of authentication method supported, NULL means variable. If this
84 * is not null, authenticate may ignore the second parameter. */
89 int pop_authenticate (POP_DATA *);
90 void pop_apop_timestamp (POP_DATA *, char *);
93 #define pop_query(A,B,C) pop_query_d(A,B,C,NULL)
94 int pop_parse_path (const char *, ACCOUNT *);
95 int pop_connect (POP_DATA *);
96 pop_query_status pop_open_connection (POP_DATA *);
97 pop_query_status pop_query_d (POP_DATA *, char *, size_t, char *);
98 pop_query_status pop_fetch_data (POP_DATA *, char *, char *, int (*funct) (char *, void *),
100 pop_query_status pop_reconnect (CONTEXT *);
101 void pop_logout (CONTEXT *);
102 void pop_error (POP_DATA *, char *);
105 int pop_check_mailbox (CONTEXT *, int *);
106 int pop_open_mailbox (CONTEXT *);
107 pop_query_status pop_sync_mailbox (CONTEXT *, int, int *);
108 int pop_fetch_message (MESSAGE *, CONTEXT *, int);
109 void pop_close_mailbox (CONTEXT *);
110 void pop_fetch_mail (void);