* -2 - invalid command or execution error,
* -3 - error writing to tempfile
*/
-static int pop_read_header(POP_DATA *pop_data, struct Header *h)
+static int pop_read_header(struct PopData *pop_data, struct Header *h)
{
FILE *f = NULL;
int ret, index;
{
int i, index;
struct Context *ctx = (struct Context *) data;
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
char *endp = NULL;
errno = 0;
static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data)
{
struct Context *ctx = NULL;
- POP_DATA *pop_data = NULL;
+ struct PopData *pop_data = NULL;
int i;
if (!(ctx = (struct Context *) data))
return -1;
- if (!(pop_data = (POP_DATA *) ctx->data))
+ if (!(pop_data = (struct PopData *) ctx->data))
return -1;
#ifdef USE_HCACHE
return snprintf(dest, destlen, "%s." HC_FEXT, path);
}
-static header_cache_t *pop_hcache_open(POP_DATA *pop_data, const char *path)
+static header_cache_t *pop_hcache_open(struct PopData *pop_data, const char *path)
{
struct CissUrl url;
char p[LONG_STRING];
{
int i, ret, old_count, new_count, deleted;
unsigned short hcached = 0, bcached;
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
struct Progress progress;
#ifdef USE_HCACHE
char buf[LONG_STRING];
struct Connection *conn = NULL;
struct Account acct;
- POP_DATA *pop_data = NULL;
+ struct PopData *pop_data = NULL;
struct CissUrl url;
if (pop_parse_path(ctx->path, &acct))
ctx->path = safe_strdup(buf);
ctx->realpath = safe_strdup(ctx->path);
- pop_data = safe_calloc(1, sizeof(POP_DATA));
+ pop_data = safe_calloc(1, sizeof(struct PopData));
pop_data->conn = conn;
ctx->data = pop_data;
}
/* delete all cached messages */
-static void pop_clear_cache(POP_DATA *pop_data)
+static void pop_clear_cache(struct PopData *pop_data)
{
int i;
/* close POP mailbox */
static int pop_close_mailbox(struct Context *ctx)
{
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
if (!pop_data)
return 0;
char buf[LONG_STRING];
char path[_POSIX_PATH_MAX];
struct Progress progressbar;
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
struct PopCache *cache = NULL;
struct Header *h = ctx->hdrs[msgno];
unsigned short bcache = 1;
{
int i, j, ret = 0;
char buf[LONG_STRING];
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
struct Progress progress;
#ifdef USE_HCACHE
header_cache_t *hc = NULL;
static int pop_check_mailbox(struct Context *ctx, int *index_hint)
{
int ret;
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
if ((pop_data->check_time + PopCheckTimeout) > time(NULL))
return 0;
struct Context ctx;
struct Message *msg = NULL;
struct Account acct;
- POP_DATA *pop_data = NULL;
+ struct PopData *pop_data = NULL;
if (!PopHost)
{
if (!conn)
return;
- pop_data = safe_calloc(1, sizeof(POP_DATA));
+ pop_data = safe_calloc(1, sizeof(struct PopData));
pop_data->conn = conn;
if (pop_open_connection(pop_data) < 0)
char *path;
};
-typedef struct
+struct PopData
{
struct Connection *conn;
unsigned int status : 2;
struct BodyCache *bcache; /* body cache */
char err_msg[POP_CMD_RESPONSE];
struct PopCache cache[POP_CACHE_LEN];
-} POP_DATA;
+};
struct PopAuth
{
/* do authentication, using named method or any available if method is NULL */
- pop_auth_res_t (*authenticate)(POP_DATA *, const char *);
+ pop_auth_res_t (*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(POP_DATA *pop_data);
-void pop_apop_timestamp(POP_DATA *pop_data, char *buf);
+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(POP_DATA *pop_data);
-int pop_open_connection(POP_DATA *pop_data);
-int pop_query_d(POP_DATA *pop_data, char *buf, size_t buflen, char *msg);
-int pop_fetch_data(POP_DATA *pop_data, char *query, struct Progress *progressbar,
+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);
#ifdef USE_SASL
/* SASL authenticator */
-static pop_auth_res_t pop_auth_sasl(POP_DATA *pop_data, const char *method)
+static pop_auth_res_t pop_auth_sasl(struct PopData *pop_data, const char *method)
{
sasl_conn_t *saslconn = NULL;
sasl_interact_t *interaction = NULL;
#endif
/* Get the server timestamp for APOP authentication */
-void pop_apop_timestamp(POP_DATA *pop_data, char *buf)
+void pop_apop_timestamp(struct PopData *pop_data, char *buf)
{
char *p1 = NULL, *p2 = NULL;
}
/* APOP authenticator */
-static pop_auth_res_t pop_auth_apop(POP_DATA *pop_data, const char *method)
+static pop_auth_res_t pop_auth_apop(struct PopData *pop_data, const char *method)
{
struct md5_ctx ctx;
unsigned char digest[16];
}
/* USER authenticator */
-static pop_auth_res_t pop_auth_user(POP_DATA *pop_data, const char *method)
+static pop_auth_res_t pop_auth_user(struct PopData *pop_data, const char *method)
{
char buf[LONG_STRING];
int ret;
* -2 - login failed,
* -3 - authentication canceled.
*/
-int pop_authenticate(POP_DATA *pop_data)
+int pop_authenticate(struct PopData *pop_data)
{
struct Account *acct = &pop_data->conn->account;
const struct PopAuth *authenticator = NULL;
}
/* Copy error message to err_msg buffer */
-static void pop_error(POP_DATA *pop_data, char *msg)
+static void pop_error(struct PopData *pop_data, char *msg)
{
char *t = NULL, *c = NULL, *c2 = NULL;
/* Parse CAPA output */
static int fetch_capa(char *line, void *data)
{
- POP_DATA *pop_data = (POP_DATA *) data;
+ struct PopData *pop_data = (struct PopData *) data;
char *c = NULL;
if (ascii_strncasecmp(line, "SASL", 4) == 0)
/* Fetch list of the authentication mechanisms */
static int fetch_auth(char *line, void *data)
{
- POP_DATA *pop_data = (POP_DATA *) data;
+ struct PopData *pop_data = (struct PopData *) data;
if (!pop_data->auth_list)
{
* -1 - connection lost,
* -2 - execution error.
*/
-static int pop_capabilities(POP_DATA *pop_data, int mode)
+static int pop_capabilities(struct PopData *pop_data, int mode)
{
char buf[LONG_STRING];
* -1 - connection lost,
* -2 - invalid response.
*/
-int pop_connect(POP_DATA *pop_data)
+int pop_connect(struct PopData *pop_data)
{
char buf[LONG_STRING];
* -2 - invalid command or execution error,
* -3 - authentication canceled.
*/
-int pop_open_connection(POP_DATA *pop_data)
+int pop_open_connection(struct PopData *pop_data)
{
int ret;
unsigned int n, size;
{
int ret = 0;
char buf[LONG_STRING];
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
if (pop_data->status == POP_CONNECTED)
{
* -1 - connection lost,
* -2 - invalid command or execution error.
*/
-int pop_query_d(POP_DATA *pop_data, char *buf, size_t buflen, char *msg)
+int pop_query_d(struct PopData *pop_data, char *buf, size_t buflen, char *msg)
{
int dbg = MUTT_SOCK_LOG_CMD;
char *c = NULL;
* -2 - invalid command or execution error,
* -3 - error in funct(*line, *data)
*/
-int pop_fetch_data(POP_DATA *pop_data, char *query, struct Progress *progressbar,
+int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progressbar,
int (*funct)(char *, void *), void *data)
{
char buf[LONG_STRING];
int pop_reconnect(struct Context *ctx)
{
int ret;
- POP_DATA *pop_data = (POP_DATA *) ctx->data;
+ struct PopData *pop_data = (struct PopData *) ctx->data;
struct Progress progressbar;
if (pop_data->status == POP_CONNECTED)