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.
13 #include <lib-ui/curses.h>
16 #include <lib-sys/mutt_socket.h>
19 #define POP_SSL_PORT 995
21 /* number of entries in the hash table */
22 #define POP_CACHE_LEN 10
24 /* maximal length of the server response (RFC1939) */
25 #define POP_CMD_RESPONSE 512
47 typedef enum pop_query_status_e {
48 PFD_FUNCT_ERROR = -3, /* pop_fetch_data uses pop_query_status and this return value */
50 PQ_NOT_CONNECTED = -1,
54 typedef enum cmd_status_e {
55 CMD_NOT_AVAILABLE = 0,
57 CMD_UNKNOWN /* unknown whether it is available or not */
62 unsigned int status:2;
63 unsigned int capabilities:1;
64 unsigned int use_stls:2;
65 cmd_status cmd_capa; /* optional command CAPA */
66 cmd_status cmd_stls; /* optional command STLS */
67 cmd_status cmd_user; /* optional command USER */
68 cmd_status cmd_uidl; /* optional command UIDL */
69 cmd_status cmd_top; /* optional command TOP */
70 unsigned int resp_codes:1; /* server supports extended response codes */
71 unsigned int expire:1; /* expire is greater than 0 */
72 unsigned int clear_cache:1;
75 time_t login_delay; /* minimal login delay capability */
76 char *auth_list; /* list of auth mechanisms */
78 char err_msg[POP_CMD_RESPONSE];
79 POP_CACHE cache[POP_CACHE_LEN];
83 /* do authentication, using named method or any available if method is NULL */
84 pop_auth_res_t (*authenticate) (POP_DATA *, const char *);
85 /* name of authentication method supported, NULL means variable. If this
86 * is not null, authenticate may ignore the second parameter. */
91 int pop_authenticate (POP_DATA *);
92 void pop_apop_timestamp (POP_DATA *, char *);
95 #define pop_query(A,B,C) pop_query_d(A,B,C,NULL)
96 int pop_parse_path (const char *, ACCOUNT *);
97 int pop_connect (POP_DATA *);
98 pop_query_status pop_open_connection (POP_DATA *);
99 pop_query_status pop_query_d (POP_DATA *, char *, size_t, const char *);
100 pop_query_status pop_fetch_data (POP_DATA *, const char *, progress_t*,
101 int (*funct) (char *, void *), void *);
102 pop_query_status pop_reconnect (CONTEXT *);
103 void pop_logout (CONTEXT *);
104 void pop_error (POP_DATA *, char *);
107 int pop_check_mailbox (CONTEXT *, int *, int);
108 int pop_open_mailbox (CONTEXT *);
109 pop_query_status pop_sync_mailbox (CONTEXT *, int, int *);
110 int pop_fetch_message (MESSAGE *, CONTEXT *, int);
111 void pop_close_mailbox (CONTEXT *);
112 void pop_fetch_mail (void);