/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2005-2012 DINH Viet Hoa and the Claws Mail team
+ * Copyright (C) 2005-2016 DINH Viet Hoa and the Claws Mail team
*
* 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
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#ifdef HAVE_CONFIG_H
int i = 0;
if (size > 8192) {
- log_print(LOG_PROTOCOL, "IMAP4%c [CMD data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [CMD data - %zd bytes]\n", direction?'>':'<', size);
return;
}
buf = malloc(size+1);
lines = g_strsplit(buf, "\n", -1);
while (lines[i] && *lines[i]) {
- log_print(LOG_PROTOCOL, "IMAP4%c %s\n", direction?'>':'<', lines[i]);
+ log_print(LOG_PROTOCOL, "IMAP%c %s\n", direction?'>':'<', lines[i]);
i++;
}
g_strfreev(lines);
int i = 0;
if (size > 128 && !direction) {
- log_print(LOG_PROTOCOL, "IMAP4%c [FETCH data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [FETCH data - %zd bytes]\n", direction?'>':'<', size);
return;
}
if (direction != 0 || (buf[0] == '*' && buf[1] == ' ') || size < 32) {
while (lines[i] && *lines[i]) {
- log_print(LOG_PROTOCOL, "IMAP4%c %s\n", direction?'>':'<', lines[i]);
+ log_print(LOG_PROTOCOL, "IMAP%c %s\n", direction?'>':'<', lines[i]);
i++;
}
} else {
- log_print(LOG_PROTOCOL, "IMAP4%c [data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [data - %zd bytes]\n", direction?'>':'<', size);
}
g_strfreev(lines);
free(buf);
int i = 0;
if (size > 8192) {
- log_print(LOG_PROTOCOL, "IMAP4%c [UID data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [UID data - %zd bytes]\n", direction?'>':'<', size);
return;
}
buf = malloc(size+1);
while (lines[i] && *lines[i]) {
int llen = strlen(lines[i]);
if (llen < 64)
- log_print(LOG_PROTOCOL, "IMAP4%c %s\n", direction?'>':'<', lines[i]);
+ log_print(LOG_PROTOCOL, "IMAP%c %s\n", direction?'>':'<', lines[i]);
else {
gchar tmp[64];
strncpy2(tmp, lines[i], 63);
- log_print(LOG_PROTOCOL, "IMAP4%c %s[... - %d bytes more]\n", direction?'>':'<', tmp,
+ log_print(LOG_PROTOCOL, "IMAP%c %s[... - %d bytes more]\n", direction?'>':'<', tmp,
llen-64);
}
i++;
int i = 0;
if (size > 8192) {
- log_print(LOG_PROTOCOL, "IMAP4%c [APPEND data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [APPEND data - %zd bytes]\n", direction?'>':'<', size);
return;
} else if (direction == 0 && size > 64) {
- log_print(LOG_PROTOCOL, "IMAP4%c [APPEND data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [APPEND data - %zd bytes]\n", direction?'>':'<', size);
return;
}
buf = malloc(size+1);
if (direction == 0 || (buf[0] == '*' && buf[1] == ' ') || size < 64) {
while (lines[i] && *lines[i]) {
- log_print(LOG_PROTOCOL, "IMAP4%c %s\n", direction?'>':'<', lines[i]);
+ log_print(LOG_PROTOCOL, "IMAP%c %s\n", direction?'>':'<', lines[i]);
i++;
}
} else {
- log_print(LOG_PROTOCOL, "IMAP4%c [data - %zd bytes]\n", direction?'>':'<', size);
+ log_print(LOG_PROTOCOL, "IMAP%c [data - %zd bytes]\n", direction?'>':'<', size);
}
g_strfreev(lines);
free(buf);
chash_delete(imap_hash, &key, NULL);
- debug_print("remove thread");
+ debug_print("remove thread\n");
}
static struct etpan_thread * get_thread(Folder * folder)
debug_print("generic_cb\n");
if (op->imap && op->imap->imap_response_info &&
op->imap->imap_response_info->rsp_alert) {
- log_error(LOG_PROTOCOL, "IMAP4< Alert: %s\n",
+ log_error(LOG_PROTOCOL, "IMAP< Alert: %s\n",
op->imap->imap_response_info->rsp_alert);
g_timeout_add(10, cb_show_error, NULL);
}
old_debug = mailstream_debug;
mailstream_debug = 0;
#endif
- if (!strcmp(param->type, "LOGIN"))
+ if (!strcmp(param->type, "plaintext"))
r = mailimap_login(param->imap,
param->login, param->password);
else if (!strcmp(param->type, "GSSAPI"))
debug_print("imap login - begin\n");
+ if (!folder)
+ return MAILIMAP_ERROR_INVAL;
+
param.imap = get_imap(folder);
param.login = login;
param.password = password;
r = mailimap_starttls(param->imap);
result->error = r;
- debug_print("imap starttls run - end %i\n", r);
+ debug_print("imap STARTTLS run - end %i\n", r);
if (r == 0) {
mailimap *imap = param->imap;
plain_low = mailstream_get_low(imap->imap_stream);
fd = mailstream_low_get_fd(plain_low);
if (fd == -1) {
- debug_print("imap starttls run - can't get fd\n");
+ debug_print("imap STARTTLS run - can't get fd\n");
result->error = MAILIMAP_ERROR_STREAM;
return;
}
tls_low = mailstream_low_tls_open_with_callback(fd, etpan_connect_ssl_context_cb, param->account);
if (tls_low == NULL) {
- debug_print("imap starttls run - can't tls_open\n");
+ debug_print("imap STARTTLS run - can't tls_open\n");
result->error = MAILIMAP_ERROR_STREAM;
return;
}
struct starttls_result result;
gboolean accept_if_valid = FALSE;
- debug_print("imap starttls - begin\n");
+ debug_print("imap STARTTLS - begin\n");
param.imap = get_imap(folder);
param.server = host;
if (threaded_run(folder, ¶m, &result, starttls_run))
return MAILIMAP_ERROR_INVAL;
- debug_print("imap starttls - end\n");
+ debug_print("imap STARTTLS - end\n");
if (result.error == 0 && param.imap && !etpan_skip_ssl_cert_check) {
if (etpan_certificate_check(param.imap->imap_stream, host, port,
fetch_result = NULL;
mailstream_logger = imap_logger_noop;
- log_print(LOG_PROTOCOL, "IMAP4- [fetching UIDs...]\n");
+ log_print(LOG_PROTOCOL, "IMAP- [fetching UIDs...]\n");
r = imap_get_messages_list(param->imap, param->first_index,
&fetch_result);
param.first_index = first_index;
mailstream_logger = imap_logger_noop;
- log_print(LOG_PROTOCOL, "IMAP4- [fetching flags...]\n");
+ log_print(LOG_PROTOCOL, "IMAP- [fetching flags...]\n");
threaded_run(folder, ¶m, &result, fetch_uid_flags_run);
r = imap_add_envelope_fetch_att(fetch_type);
else
r = imap_add_header_fetch_att(fetch_type);
-
+
+ if (r != MAILIMAP_NO_ERROR) {
+ debug_print("add fetch attr: %d\n", r);
+ return r;
+ }
+
mailstream_logger = imap_logger_fetch;
r = mailimap_uid_fetch(imap, set, fetch_type, &fetch_result);