diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-12-07 04:48:14 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2010-12-07 04:48:14 +0000 |
commit | 14c652150c9a6339c792eb1911da809327237123 (patch) | |
tree | ad1bfa3e8818651ae8e4026f7571ec6392fb45b0 /src | |
parent | 3a54dc9a9d8e28b9415552512d45d172528d1a78 (diff) |
added SOCKS4/5 proxy support.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2733 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/inc.c | 21 | ||||
-rw-r--r-- | src/send_message.c | 15 |
2 files changed, 28 insertions, 8 deletions
@@ -45,6 +45,7 @@ #include "account.h" #include "procmsg.h" #include "socket.h" +#include "socks.h" #include "pop.h" #include "recv.h" #include "mbox.h" @@ -842,22 +843,24 @@ static IncState inc_pop3_session_do(IncSession *session) { Pop3Session *pop3_session = POP3_SESSION(session->session); IncProgressDialog *inc_dialog = (IncProgressDialog *)session->data; + PrefsAccount *ac = pop3_session->ac_prefs; + SocksInfo *socks_info = NULL; gchar *buf; debug_print(_("getting new messages of account %s...\n"), - pop3_session->ac_prefs->account_name); + ac->account_name); if (pop3_session->auth_only) buf = g_strdup_printf(_("%s: Authenticating with POP3"), - pop3_session->ac_prefs->recv_server); + ac->recv_server); else buf = g_strdup_printf(_("%s: Retrieving new messages"), - pop3_session->ac_prefs->recv_server); + ac->recv_server); gtk_window_set_title(GTK_WINDOW(inc_dialog->dialog->window), buf); g_free(buf); buf = g_strdup_printf(_("Connecting to POP3 server: %s..."), - pop3_session->ac_prefs->recv_server); + ac->recv_server); log_message("%s\n", buf); progress_dialog_set_label(inc_dialog->dialog, buf); g_free(buf); @@ -865,11 +868,15 @@ static IncState inc_pop3_session_do(IncSession *session) session_set_timeout(SESSION(pop3_session), prefs_common.io_timeout_secs * 1000); + if (ac->use_socks && ac->use_socks_for_recv) { + socks_info = socks_info_new(ac->socks_type, ac->proxy_host, ac->proxy_port, ac->use_proxy_auth ? ac->proxy_name : NULL, ac->use_proxy_auth ? ac->proxy_pass : NULL); + } + GTK_EVENTS_FLUSH(); - if (session_connect(SESSION(pop3_session), - SESSION(pop3_session)->server, - SESSION(pop3_session)->port) < 0) { + if (session_connect_full(SESSION(pop3_session), + SESSION(pop3_session)->server, + SESSION(pop3_session)->port, socks_info) < 0) { log_warning(_("Can't connect to POP3 server: %s:%d\n"), SESSION(pop3_session)->server, SESSION(pop3_session)->port); diff --git a/src/send_message.c b/src/send_message.c index dbce695d..86e21260 100644 --- a/src/send_message.c +++ b/src/send_message.c @@ -53,6 +53,7 @@ #include "alertpanel.h" #include "manage_window.h" #include "socket.h" +#include "socks.h" #include "utils.h" #include "inc.h" #include "mainwindow.h" @@ -614,6 +615,7 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp) { Session *session; SMTPSession *smtp_session; + SocksInfo *socks_info = NULL; FILE *out_fp; gushort port; SendProgressDialog *dialog; @@ -731,9 +733,20 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp) session_set_timeout(session, prefs_common.io_timeout_secs * 1000); + if (ac_prefs->use_socks && ac_prefs->use_socks_for_send) { + socks_info = socks_info_new(ac_prefs->socks_type, + ac_prefs->proxy_host, + ac_prefs->proxy_port, + ac_prefs->use_proxy_auth + ? ac_prefs->proxy_name : NULL, + ac_prefs->use_proxy_auth + ? ac_prefs->proxy_pass : NULL); + } + inc_lock(); - if (session_connect(session, ac_prefs->smtp_server, port) < 0) { + if (session_connect_full(session, ac_prefs->smtp_server, port, + socks_info) < 0) { manage_window_focus_in(dialog->dialog->window, NULL, NULL); send_put_error(session); manage_window_focus_out(dialog->dialog->window, NULL, NULL); |