4 |
|
|
5 |
#include <stdio.h> |
#include <stdio.h> |
6 |
#include <sys/types.h> |
#include <sys/types.h> |
7 |
|
#include <limits.h> |
8 |
|
|
9 |
#include "config.h" |
#include "config.h" |
10 |
#include "account.h" |
#include "account.h" |
43 |
#define SSL_CERT_ACTION_CONTINUE 0 |
#define SSL_CERT_ACTION_CONTINUE 0 |
44 |
#define SSL_CERT_ACTION_ABORT 1 |
#define SSL_CERT_ACTION_ABORT 1 |
45 |
|
|
|
/* Flags that control the program's execution options. */ |
|
|
#define OPTION_DEBUG 0x0001 |
|
|
#define OPTION_ERRORS 0x0002 |
|
|
#define OPTION_EXPUNGE 0x0004 |
|
|
#define OPTION_HEADERS 0x0008 |
|
|
#define OPTION_NAMESPACE 0x0010 |
|
|
#define OPTION_SUBSCRIBE 0x0020 |
|
|
#define OPTION_PASSWORD_EDITOR 0x0040 |
|
|
#define OPTION_DAEMON_MODE 0x0080 |
|
|
#define OPTION_PEEK 0x0100 |
|
|
|
|
46 |
/* Other flags. */ |
/* Other flags. */ |
47 |
#define FLAG_DAEMON_MODE 0x01 |
#define FLAG_DAEMON_MODE 0x01 |
48 |
#define FLAG_TTY 0x02 |
#define FLAG_TTY 0x02 |
107 |
#define plural(A) ((A) == 1 ? "" : "s") |
#define plural(A) ((A) == 1 ? "" : "s") |
108 |
|
|
109 |
|
|
110 |
|
/* Program's options. */ |
111 |
|
typedef struct opts { |
112 |
|
int debug; /* Debugging level (1..2). */ |
113 |
|
int verbosity; /* Verbosity level (-2..2). */ |
114 |
|
int timeout; /* Server non-response timeout in seconds. */ |
115 |
|
int daemon; /* Daemon mode interval. */ |
116 |
|
int headers; /* Print messages headers to stdout. */ |
117 |
|
int errors; /* Errors appended to logfile. */ |
118 |
|
int namespace; /* Apply mailbox namespace automatically. */ |
119 |
|
int expunge; /* Expunge messages after they are marked |
120 |
|
* deleted. */ |
121 |
|
int subscribe; /* Subscribe newly created mailboxes. */ |
122 |
|
int peek; /* Do not mark messages seen when their |
123 |
|
* headers are received. */ |
124 |
|
int passwd_editor; /* Enter interactive password editor. */ |
125 |
|
char charset[CHARSET_LEN]; /* Search criteria character set. */ |
126 |
|
char logfile[PATH_MAX]; /* Log file for filtering information. */ |
127 |
|
} opts_t; |
128 |
|
|
129 |
/* IMAP connection. */ |
/* IMAP connection. */ |
130 |
typedef struct conn { |
typedef struct conn { |
131 |
int sock; /* Socket. */ |
int sock; /* Socket. */ |
273 |
int copy_response(conn_t * conn, unsigned int tag); |
int copy_response(conn_t * conn, unsigned int tag); |
274 |
|
|
275 |
/* socket.c */ |
/* socket.c */ |
276 |
int |
int |
277 |
init_connection(conn_t * conn, char *serv, unsigned short int port, unsigned int protocol); |
init_connection(conn_t * conn, char *serv, unsigned short int port, unsigned int protocol); |
278 |
#ifdef SSL_TLS |
#ifdef SSL_TLS |
279 |
int init_secure_connection(conn_t * conn, unsigned int protocol); |
int init_secure_connection(conn_t * conn, unsigned int protocol); |
280 |
#endif |
#endif |