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
|
#ifndef IMAP_URLAUTH_FETCH_H
#define IMAP_URLAUTH_FETCH_H
struct imap_url;
struct imap_urlauth_context;
struct imap_urlauth_fetch;
enum imap_urlauth_fetch_flags {
/* Indicates that this is an extended request */
IMAP_URLAUTH_FETCH_FLAG_EXTENDED = 0x01,
/* Fetch body part unmodified */
IMAP_URLAUTH_FETCH_FLAG_BODY = 0x02,
/* Fetch body part as binary, i.e. without content encoding */
IMAP_URLAUTH_FETCH_FLAG_BINARY = 0x04,
/* Fetch IMAP bodypartstructure */
IMAP_URLAUTH_FETCH_FLAG_BODYPARTSTRUCTURE = 0x08,
};
struct imap_urlauth_fetch_reply {
const char *url;
enum imap_urlauth_fetch_flags flags;
struct istream *input;
uoff_t size;
const char *bodypartstruct;
const char *error;
bool succeeded:1;
bool binary_has_nuls:1;
};
/* Callback to handle fetch reply. Returns 1 if handled completely and ready
for next reply, 0 if not all data was processed, and -1 for error. If a
callback returns 0, imap_urlauth_fetch_continue() must be called once
new replies may be processed. If this is the last request to yield a reply,
argument last is TRUE. */
typedef int
imap_urlauth_fetch_callback_t(struct imap_urlauth_fetch_reply *reply,
bool last, void *context);
struct imap_urlauth_fetch *
imap_urlauth_fetch_init(struct imap_urlauth_context *uctx,
imap_urlauth_fetch_callback_t *callback, void *context);
void imap_urlauth_fetch_deinit(struct imap_urlauth_fetch **ufetch);
int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url,
enum imap_urlauth_fetch_flags url_flags);
int imap_urlauth_fetch_url_parsed(struct imap_urlauth_fetch *ufetch,
const char *url, struct imap_url *imap_url,
enum imap_urlauth_fetch_flags url_flags);
bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch);
bool imap_urlauth_fetch_is_pending(struct imap_urlauth_fetch *ufetch);
#endif
|