#include "tags.h"
#include "main.h"
#include "passwordstore.h"
+#include "file-utils.h"
typedef struct _IMAPFolder IMAPFolder;
typedef struct _IMAPSession IMAPSession;
const PrefsAccount *account)
{
IMAPSession *session;
+ ProxyInfo *proxy_info = NULL;
gushort port;
int r;
int authenticated = FALSE;
"Do you want to continue connecting to this "
"server? The communication would not be "
"secure."),
- GTK_STOCK_CANCEL, _("Con_tinue connecting"),
- NULL, FALSE, NULL, ALERT_WARNING,
- G_ALERTDEFAULT) != G_ALERTALTERNATE)
+ GTK_STOCK_CANCEL, _("Con_tinue connecting"), NULL,
+ ALERTFOCUS_FIRST, FALSE, NULL, ALERT_WARNING) != G_ALERTALTERNATE)
return NULL;
}
port = account->set_imapport ? account->imapport
log_message(LOG_PROTOCOL, "%s\n", buf);
g_free(buf);
+ if (account->use_proxy) {
+ if (account->use_default_proxy) {
+ proxy_info = (ProxyInfo *)&(prefs_common.proxy_info);
+ if (proxy_info->use_proxy_auth)
+ proxy_info->proxy_pass = passwd_store_get(PWS_CORE, PWS_CORE_PROXY,
+ PWS_CORE_PROXY_PASS);
+ } else {
+ proxy_info = (ProxyInfo *)&(account->proxy_info);
+ if (proxy_info->use_proxy_auth)
+ proxy_info->proxy_pass = passwd_store_get_account(account->account_id,
+ PWS_ACCOUNT_PROXY_PASS);
+ }
+ }
+
#ifndef G_OS_WIN32
if (account->set_tunnelcmd) {
r = imap_threaded_connect_cmd(folder,
#endif
{
#ifdef USE_GNUTLS
+
if (ssl_type == SSL_TUNNEL) {
r = imap_threaded_connect_ssl(folder,
account->recv_server,
- port);
+ port,
+ proxy_info);
}
else
#endif
{
r = imap_threaded_connect(folder,
account->recv_server,
- port);
+ port,
+ proxy_info);
}
}
session_init(SESSION(session), account, FALSE);
SESSION(session)->type = SESSION_IMAP;
SESSION(session)->server = g_strdup(account->recv_server);
- SESSION(session)->port = port;
+ SESSION(session)->port = port;
SESSION(session)->sock = NULL;
-
+ SESSION(session)->proxy_info = proxy_info;
SESSION(session)->destroy = imap_session_destroy;
session->capability = NULL;
-
session->authenticated = authenticated;
session->mbox = NULL;
session->exists = 0;
session->uidplus = FALSE;
session->cmd_count = 1;
}
+ SESSION(session)->use_tls_sni = account->use_tls_sni;
#endif
+
log_message(LOG_PROTOCOL, "IMAP connection is %s-authenticated\n",
(session->authenticated) ? "pre" : "un");
if (filename == NULL)
return -1;
- fp = g_fopen(filename, "rb");
+ fp = claws_fopen(filename, "rb");
if (!fp)
return -1;
- while (fgets(buf, sizeof (buf), fp) != NULL) {
+ while (claws_fgets(buf, sizeof (buf), fp) != NULL) {
cnt += strlen(buf);
if (!strstr(buf, "\r\n") && strstr(buf, "\n"))
cnt++;
}
- fclose(fp);
+ claws_fclose(fp);
return cnt;
}
ok = file_strip_crs(filename);
if (ok == 0 && cached && cached->size <= have_size) {
/* we have it all and stripped */
- debug_print("...fully cached in fact (%u/%zd); setting flag.\n",
+ debug_print("...fully cached in fact (%u/%"G_GOFFSET_FORMAT"); setting flag.\n",
have_size, cached->size);
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
}
size = get_file_size_with_crs(filename);
}
g_free(filename);
- debug_print("msg %d cached, has size %d, full should be %zd.\n", uid, size, cached->size);
+ debug_print("msg %d cached, has size %d, full should be %"G_GOFFSET_FORMAT".\n", uid, size, cached->size);
if (cached && size >= cached->size) {
cached->total_size = cached->size;
procmsg_msginfo_set_flags(cached, MSG_FULLY_CACHED, 0);
}
if (!item || ((item->path || root_folder) &&
- strcmp2(item->path, root_folder) != 0)) {
+ g_strcmp0(item->path, root_folder) != 0)) {
folder_tree_destroy(folder);
item = folder_item_new(folder, folder->name, root_folder);
item->folder = folder;
new_item = NULL;
for (cur = item_list; cur != NULL; cur = cur->next) {
FolderItem *cur_item = FOLDER_ITEM(cur->data);
- if (!strcmp2(old_item->path, cur_item->path)) {
+ if (!g_strcmp0(old_item->path, cur_item->path)) {
new_item = cur_item;
break;
}
for (node = item->node->children; node != NULL;
node = node->next) {
- if (!strcmp2(FOLDER_ITEM(node->data)->path,
+ if (!g_strcmp0(FOLDER_ITEM(node->data)->path,
cur_item->path)) {
new_item = FOLDER_ITEM(node->data);
folder_item_destroy(cur_item);
}
folder_item_destroy(cur_item);
oldlitem = g_list_find_custom(
- child_list, tmp, (GCompareFunc)strcmp2);
+ child_list, tmp, (GCompareFunc)g_strcmp0);
if (oldlitem) {
child_list = g_list_remove_link(child_list, oldlitem);
g_free(oldlitem->data);
strtailchomp(new_name, '/');
if (strcasecmp(dirpath, "INBOX") != 0) {
- GPtrArray *argbuf;
int r;
clist * lep_list;
- argbuf = g_ptr_array_new();
r = imap_threaded_list(folder, "", imap_path, &lep_list);
if (r != MAILIMAP_NO_ERROR) {
imap_handle_error(SESSION(session), NULL, r);
log_warning(LOG_PROTOCOL, _("can't create mailbox: LIST failed\n"));
g_free(imap_path);
g_free(dirpath);
- ptr_array_free_strings(argbuf);
- g_ptr_array_free(argbuf, TRUE);
return NULL;
}
gint ok;
if (!strcmp(type, "plaintext") && imap_has_capability(session, "LOGINDISABLED")) {
- gint ok = MAILIMAP_ERROR_BAD_STATE;
+ ok = MAILIMAP_ERROR_BAD_STATE;
if (imap_has_capability(session, "STARTTLS")) {
#ifdef USE_GNUTLS
log_warning(LOG_PROTOCOL, _("Server requires STARTTLS to log in.\n"));
/*
* NEW and DELETED flags are not syncronized
* - The NEW/RECENT flags in IMAP folders can not really be directly
- * modified by Sylpheed
- * - The DELETE/DELETED flag in IMAP and Sylpheed don't have the same
+ * modified by Claws Mail
+ * - The DELETE/DELETED flag in IMAP and Claws Mail do not have the same
* meaning, in IMAP it always removes the messages from the FolderItem
- * in Sylpheed it can mean to move the message to trash
+ * in Claws Mail it can mean to move the message to Trash
*/
typedef struct _get_flags_data {