forked from neomutt/neomutt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpop.h
133 lines (117 loc) · 3.52 KB
/
pop.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* @file
* POP network mailbox
*
* @authors
* Copyright (C) 2000-2003 Vsevolod Volkov <[email protected]>
*
* @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/>.
*/
#ifndef _MUTT_POP_H
#define _MUTT_POP_H
#include <stdbool.h>
#include <time.h>
#include "mx.h"
struct Account;
struct Context;
struct Progress;
#define POP_PORT 110
#define POP_SSL_PORT 995
/* number of entries in the hash table */
#define POP_CACHE_LEN 10
/* maximal length of the server response (RFC1939) */
#define POP_CMD_RESPONSE 512
/**
* enum PopStatus - POP server responses
*/
enum PopStatus
{
POP_NONE = 0,
POP_CONNECTED,
POP_DISCONNECTED,
POP_BYE
};
/**
* enum PopAuthRes - POP authentication responses
*/
enum PopAuthRes
{
POP_A_SUCCESS = 0,
POP_A_SOCKET,
POP_A_FAILURE,
POP_A_UNAVAIL
};
/**
* struct PopCache - POP-specific email cache
*/
struct PopCache
{
unsigned int index;
char *path;
};
/**
* struct PopData - POP-specific server data
*/
struct PopData
{
struct Connection *conn;
unsigned int status : 2;
bool capabilities : 1;
unsigned int use_stls : 2;
bool cmd_capa : 1; /**< optional command CAPA */
bool cmd_stls : 1; /**< optional command STLS */
unsigned int cmd_user : 2; /**< optional command USER */
unsigned int cmd_uidl : 2; /**< optional command UIDL */
unsigned int cmd_top : 2; /**< optional command TOP */
bool resp_codes : 1; /**< server supports extended response codes */
bool expire : 1; /**< expire is greater than 0 */
bool clear_cache : 1;
size_t size;
time_t check_time;
time_t login_delay; /**< minimal login delay capability */
char *auth_list; /**< list of auth mechanisms */
char *timestamp;
struct BodyCache *bcache; /**< body cache */
char err_msg[POP_CMD_RESPONSE];
struct PopCache cache[POP_CACHE_LEN];
};
/**
* struct PopAuth - POP authentication multiplexor
*/
struct PopAuth
{
/* do authentication, using named method or any available if method is NULL */
enum PopAuthRes (*authenticate)(struct PopData *, const char *);
/* name of authentication method supported, NULL means variable. If this
* is not null, authenticate may ignore the second parameter. */
const char *method;
};
/* pop_auth.c */
int pop_authenticate(struct PopData *pop_data);
void pop_apop_timestamp(struct PopData *pop_data, char *buf);
/* pop_lib.c */
#define pop_query(A, B, C) pop_query_d(A, B, C, NULL)
int pop_parse_path(const char *path, struct Account *acct);
int pop_connect(struct PopData *pop_data);
int pop_open_connection(struct PopData *pop_data);
int pop_query_d(struct PopData *pop_data, char *buf, size_t buflen, char *msg);
int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progressbar,
int (*funct)(char *, void *), void *data);
int pop_reconnect(struct Context *ctx);
void pop_logout(struct Context *ctx);
/* pop.c */
void pop_fetch_mail(void);
extern struct MxOps mx_pop_ops;
#endif /* _MUTT_POP_H */