diff -ru weechat-0.2.3/doc/en/config.xml weechat-0.2.3.noproxy/doc/en/config.xml --- weechat-0.2.3/doc/en/config.xml 2007-01-05 23:33:05.000000000 +0600 +++ weechat-0.2.3.noproxy/doc/en/config.xml 2007-02-08 14:43:49.000000000 +0600 @@ -1105,6 +1105,13 @@ Name associated to IRC server (for display only) + +boolean + 'on' or 'off' + 'off' + never use proxy while connecting to server + + boolean 'on' or 'off' diff -ru weechat-0.2.3/doc/en/weechat_commands.xml weechat-0.2.3.noproxy/doc/en/weechat_commands.xml --- weechat-0.2.3/doc/en/weechat_commands.xml 2007-01-05 23:33:05.000000000 +0600 +++ weechat-0.2.3.noproxy/doc/en/weechat_commands.xml 2007-02-08 14:00:45.000000000 +0600 @@ -131,7 +131,7 @@ Without argument, /plugin command lists loaded plugins. -server [servername] | [servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 nick2 nick3] [-username username] [-realname realname] [-command command] [-autojoin channel[,channel]] ] | [del servername] +server [servername] | [servername hostname port [-auto | -noauto] [-noproxy] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 nick2 nick3] [-username username] [-realname realname] [-command command] [-autojoin channel[,channel]] ] | [del servername] list, add or remove servers diff -ru weechat-0.2.3/doc/en/weechat.en.xml weechat-0.2.3.noproxy/doc/en/weechat.en.xml --- weechat-0.2.3/doc/en/weechat.en.xml 2007-01-11 00:05:16.000000000 +0600 +++ weechat-0.2.3.noproxy/doc/en/weechat.en.xml 2007-02-08 14:00:11.000000000 +0600 @@ -3249,6 +3249,11 @@ int + proxy_disable + 1 if proxy should be disabled for the server even if proxy_use is ON, 0 otherwise + + + int autoconnect 1 if autoconnect at start-up, 0 otherwise diff -ru weechat-0.2.3/src/common/command.c weechat-0.2.3.noproxy/src/common/command.c --- weechat-0.2.3/src/common/command.c 2007-01-06 00:56:09.000000000 +0600 +++ weechat-0.2.3.noproxy/src/common/command.c 2007-02-08 14:44:53.000000000 +0600 @@ -147,7 +147,7 @@ "list|listfull|load|autoload|reload|unload %P", 0, 2, 0, weechat_cmd_plugin, NULL }, { "server", N_("list, add or remove servers"), N_("[servername] | " - "[servername hostname port [-auto | -noauto] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 " + "[servername hostname port [-auto | -noauto] [-noproxy] [-ipv6] [-ssl] [-pwd password] [-nicks nick1 " "nick2 nick3] [-username username] [-realname realname] " "[-command command] [-autojoin channel[,channel]] ] | " "[del servername]"), @@ -2683,6 +2683,8 @@ { if (argv[i][0] == '-') { + if (ascii_strcasecmp (argv[i], "-noproxy") == 0) + server_tmp.proxy_disable = 0; if (ascii_strcasecmp (argv[i], "-auto") == 0) server_tmp.autoconnect = 1; if (ascii_strcasecmp (argv[i], "-noauto") == 0) @@ -2775,7 +2777,8 @@ } /* create new server */ - new_server = server_new (server_tmp.name, server_tmp.autoconnect, + new_server = server_new (server_tmp.name, server_tmp.proxy_disable, + server_tmp.autoconnect, server_tmp.autoreconnect, server_tmp.autoreconnect_delay, 0, server_tmp.address, server_tmp.port, diff -ru weechat-0.2.3/src/common/session.c weechat-0.2.3.noproxy/src/common/session.c --- weechat-0.2.3/src/common/session.c 2007-01-06 00:56:25.000000000 +0600 +++ weechat-0.2.3.noproxy/src/common/session.c 2007-02-08 14:07:22.000000000 +0600 @@ -217,6 +217,7 @@ { rc = rc && (session_write_id (file, SESSION_OBJ_SERVER)); rc = rc && (session_write_str (file, SESSION_SERV_NAME, ptr_server->name)); + rc = rc && (session_write_int (file, SESSION_SERV_PROXY_DISABLE, ptr_server->proxy_disable)); rc = rc && (session_write_int (file, SESSION_SERV_AUTOCONNECT, ptr_server->autoconnect)); rc = rc && (session_write_int (file, SESSION_SERV_AUTORECONNECT, ptr_server->autoreconnect)); rc = rc && (session_write_int (file, SESSION_SERV_AUTORECONNECT_DELAY, ptr_server->autoreconnect_delay)); @@ -872,6 +873,9 @@ { case SESSION_SERV_END: return 1; + case SESSION_SERV_PROXY_DISABLE: + rc = rc && (session_read_int (file, &(session_current_server->proxy_disable))); + break; case SESSION_SERV_AUTOCONNECT: rc = rc && (session_read_int (file, &(session_current_server->autoconnect))); break; diff -ru weechat-0.2.3/src/common/session.h weechat-0.2.3.noproxy/src/common/session.h --- weechat-0.2.3/src/common/session.h 2007-01-06 00:57:20.000000000 +0600 +++ weechat-0.2.3.noproxy/src/common/session.h 2007-02-08 14:18:21.000000000 +0600 @@ -52,6 +52,7 @@ { SESSION_SERV_END = 0, SESSION_SERV_NAME, + SESSION_SERV_PROXY_DISABLE, SESSION_SERV_AUTOCONNECT, SESSION_SERV_AUTORECONNECT, SESSION_SERV_AUTORECONNECT_DELAY, diff -ru weechat-0.2.3/src/common/weechat.c weechat-0.2.3.noproxy/src/common/weechat.c --- weechat-0.2.3/src/common/weechat.c 2007-01-06 01:23:22.000000000 +0600 +++ weechat-0.2.3.noproxy/src/common/weechat.c 2007-02-08 13:49:25.000000000 +0600 @@ -413,7 +413,7 @@ } else { - if (!server_new (server_tmp.name, server_tmp.autoconnect, + if (!server_new (server_tmp.name, 0, server_tmp.autoconnect, server_tmp.autoreconnect, server_tmp.autoreconnect_delay, 1, server_tmp.address, server_tmp.port, diff -ru weechat-0.2.3/src/common/weeconfig.c weechat-0.2.3.noproxy/src/common/weeconfig.c --- weechat-0.2.3/src/common/weeconfig.c 2007-01-06 00:56:40.000000000 +0600 +++ weechat-0.2.3.noproxy/src/common/weeconfig.c 2007-02-08 14:06:04.000000000 +0600 @@ -950,6 +950,10 @@ N_("name associated to IRC server (for display only)"), OPTION_TYPE_STRING, 0, 0, 0, "", NULL, NULL, &(cfg_server.name), NULL }, + { "server_proxy_disable", N_("do not use proxy even when proxy_on = ON"), + N_("do not use proxy even when proxy_on = ON"), + OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, + NULL, NULL, &(cfg_server.proxy_disable), NULL, NULL }, { "server_autoconnect", N_("automatically connect to server"), N_("automatically connect to server when WeeChat is starting"), OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE, @@ -1506,6 +1510,8 @@ { if (ascii_strcasecmp (option_name, "server_name") == 0) return (void *)(&server->name); + if (ascii_strcasecmp (option_name, "server_proxy_disable") == 0) + return (void *)(&server->proxy_disable); if (ascii_strcasecmp (option_name, "server_autoconnect") == 0) return (void *)(&server->autoconnect); if (ascii_strcasecmp (option_name, "server_autoreconnect") == 0) @@ -1769,6 +1775,7 @@ return 0; } if (!server_new (cfg_server.name, + cfg_server.proxy_disable, cfg_server.autoconnect, cfg_server.autoreconnect, cfg_server.autoreconnect_delay, 0, cfg_server.address, cfg_server.port, cfg_server.ipv6, cfg_server.ssl, @@ -2269,6 +2276,7 @@ /* default server is freenode */ weechat_iconv_fprintf (file, "\n[server]\n"); weechat_iconv_fprintf (file, "server_name = \"freenode\"\n"); + weechat_iconv_fprintf (file, "server_proxy_disable = off\n"); weechat_iconv_fprintf (file, "server_autoconnect = on\n"); weechat_iconv_fprintf (file, "server_autoreconnect = on\n"); weechat_iconv_fprintf (file, "server_autoreconnect_delay = 30\n"); @@ -2482,6 +2490,8 @@ { weechat_iconv_fprintf (file, "\n[server]\n"); weechat_iconv_fprintf (file, "server_name = \"%s\"\n", ptr_server->name); + weechat_iconv_fprintf (file, "server_proxy_disable = %s\n", + (ptr_server->proxy_disable) ? "on" : "off"); weechat_iconv_fprintf (file, "server_autoconnect = %s\n", (ptr_server->autoconnect) ? "on" : "off"); weechat_iconv_fprintf (file, "server_autoreconnect = %s\n", diff -ru weechat-0.2.3/src/irc/irc-dcc.c weechat-0.2.3.noproxy/src/irc/irc-dcc.c --- weechat-0.2.3/src/irc/irc-dcc.c 2007-01-06 01:01:58.000000000 +0600 +++ weechat-0.2.3.noproxy/src/irc/irc-dcc.c 2007-02-08 14:38:50.000000000 +0600 @@ -288,7 +288,7 @@ char *ip4; int ret; - if (cfg_proxy_use) + if (server_use_proxy(ptr_dcc->server)) { memset (&addr, 0, sizeof (addr)); addr.sin_addr.s_addr = htonl (ptr_dcc->addr); diff -ru weechat-0.2.3/src/irc/irc-display.c weechat-0.2.3.noproxy/src/irc/irc-display.c --- weechat-0.2.3/src/irc/irc-display.c 2007-01-07 04:45:15.000000000 +0600 +++ weechat-0.2.3.noproxy/src/irc/irc-display.c 2007-02-08 14:10:20.000000000 +0600 @@ -383,6 +383,8 @@ _("connected") : _("not connected"), GUI_COLOR(COLOR_WIN_CHAT_DARK)); + gui_printf (NULL, " server_proxy_disable . . . : %s\n", + (server->proxy_disable) ? _("on") : _("off")); gui_printf (NULL, " server_autoconnect . . . . : %s%s\n", (server->autoconnect) ? _("on") : _("off"), (server->command_line) ? diff -ru weechat-0.2.3/src/irc/irc.h weechat-0.2.3.noproxy/src/irc/irc.h --- weechat-0.2.3/src/irc/irc.h 2007-01-06 01:02:27.000000000 +0600 +++ weechat-0.2.3.noproxy/src/irc/irc.h 2007-02-08 14:38:00.000000000 +0600 @@ -142,6 +142,7 @@ { /* user choices */ char *name; /* name of server (only for display) */ + int proxy_disable; /* = 1 if server is reachable w/o proxy */ int autoconnect; /* = 1 if auto connect at startup */ int autoreconnect; /* = 1 if auto reco when disconnected */ int autoreconnect_delay; /* delay before trying again reconnect */ @@ -359,7 +360,7 @@ extern void server_destroy (t_irc_server *); extern void server_free (t_irc_server *); extern void server_free_all (); -extern t_irc_server *server_new (char *, int, int, int, int, char *, int, int, int, +extern t_irc_server *server_new (char *, int, int, int, int, int, char *, int, int, int, char *, char *, char *, char *, char *, char *, char *, char *, int, char *, int, char *); extern char *server_get_charset_decode_iso (t_irc_server *); @@ -370,6 +371,7 @@ extern void server_sendf (t_irc_server *, char *, ...); extern void server_parse_message (char *, char **, char **, char **); extern void server_recv (t_irc_server *); +extern int server_use_proxy(t_irc_server *server); extern void server_child_read (t_irc_server *); extern int server_connect (t_irc_server *); extern void server_reconnect (t_irc_server *); diff -ru weechat-0.2.3/src/irc/irc-server.c weechat-0.2.3.noproxy/src/irc/irc-server.c --- weechat-0.2.3/src/irc/irc-server.c 2007-01-06 01:02:18.000000000 +0600 +++ weechat-0.2.3.noproxy/src/irc/irc-server.c 2007-02-08 14:37:27.000000000 +0600 @@ -74,6 +74,7 @@ { /* user choices */ server->name = NULL; + server->proxy_disable = 0; server->autoconnect = 0; server->autoreconnect = 1; server->autoreconnect_delay = 30; @@ -452,7 +453,7 @@ */ t_irc_server * -server_new (char *name, int autoconnect, int autoreconnect, +server_new (char *name, int proxy_disable, int autoconnect, int autoreconnect, int autoreconnect_delay, int command_line, char *address, int port, int ipv6, int ssl, char *password, char *nick1, char *nick2, char *nick3, char *username, @@ -467,19 +468,20 @@ #ifdef DEBUG weechat_log_printf ("Creating new server (name:%s, address:%s, port:%d, pwd:%s, " "nick1:%s, nick2:%s, nick3:%s, username:%s, realname:%s, " - "hostname: %s, command:%s, autojoin:%s, autorejoin:%s, " + "hostname: %s, command:%s, proxy_disable:%s, autojoin:%s, autorejoin:%s, " "notify_levels:%s)\n", name, address, port, (password) ? password : "", (nick1) ? nick1 : "", (nick2) ? nick2 : "", (nick3) ? nick3 : "", (username) ? username : "", (realname) ? realname : "", (hostname) ? hostname : "", (command) ? command : "", - (autojoin) ? autojoin : "", (autorejoin) ? "on" : "off", + (proxy_disable) ? "on" : "off", (autojoin) ? autojoin : "", (autorejoin) ? "on" : "off", (notify_levels) ? notify_levels : ""); #endif if ((new_server = server_alloc ())) { new_server->name = strdup (name); + new_server->proxy_disable = proxy_disable; new_server->autoconnect = autoconnect; new_server->autoreconnect = autoreconnect; new_server->autoreconnect_delay = autoreconnect_delay; @@ -1134,6 +1136,15 @@ } /* + * server_use_proxy : check if server should use proxy + */ + +int server_use_proxy(t_irc_server *server) +{ + return (cfg_proxy_use && !server->proxy_disable); +} + +/* * server_child_read: read connection progress from child process */ @@ -1175,7 +1186,7 @@ /* adress not found */ case '1': irc_display_prefix (server, server->buffer, PREFIX_ERROR); - if (cfg_proxy_use) + if (server_use_proxy(server)) gui_printf (server->buffer, _("%s proxy address \"%s\" not found\n"), WEECHAT_ERROR, server->address); @@ -1189,7 +1200,7 @@ /* IP address not found */ case '2': irc_display_prefix (server, server->buffer, PREFIX_ERROR); - if (cfg_proxy_use) + if (server_use_proxy(server)) gui_printf (server->buffer, _("%s proxy IP address not found\n"), WEECHAT_ERROR); else @@ -1201,7 +1212,7 @@ /* connection refused */ case '3': irc_display_prefix (server, server->buffer, PREFIX_ERROR); - if (cfg_proxy_use) + if (server_use_proxy(server)) gui_printf (server->buffer, _("%s proxy connection refused\n"), WEECHAT_ERROR); else @@ -1602,7 +1613,7 @@ res = NULL; res_local = NULL; - if (cfg_proxy_use) + if (server_use_proxy(server)) { /* get info about server */ memset (&hints, 0, sizeof (hints)); @@ -1745,7 +1756,7 @@ } #endif irc_display_prefix (server, server->buffer, PREFIX_INFO); - if (cfg_proxy_use) + if (server_use_proxy(server)) { gui_printf (server->buffer, _("%s: connecting to server %s:%d%s%s via %s proxy %s:%d%s...\n"), @@ -1808,7 +1819,7 @@ server->child_write = child_pipe[1]; /* create socket and set options */ - if (cfg_proxy_use) + if (server_use_proxy(server)) server->sock = socket ((cfg_proxy_ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0); else server->sock = socket ((server->ipv6) ? AF_INET6 : AF_INET, SOCK_STREAM, 0); @@ -2173,6 +2184,7 @@ server_print_log (t_irc_server *server) { weechat_log_printf ("[server %s (addr:0x%X)]\n", server->name, server); + weechat_log_printf (" proxy_disable . . . : %d\n", server->proxy_disable); weechat_log_printf (" autoconnect . . . . : %d\n", server->autoconnect); weechat_log_printf (" autoreconnect . . . : %d\n", server->autoreconnect); weechat_log_printf (" autoreconnect_delay : %d\n", server->autoreconnect_delay); diff -ru weechat-0.2.3/src/plugins/plugins-interface.c weechat-0.2.3.noproxy/src/plugins/plugins-interface.c --- weechat-0.2.3/src/plugins/plugins-interface.c 2007-01-06 01:05:05.000000000 +0600 +++ weechat-0.2.3.noproxy/src/plugins/plugins-interface.c 2007-02-08 14:19:30.000000000 +0600 @@ -889,6 +889,7 @@ if (new_server_info) { new_server_info->name = (ptr_server->name) ? strdup (ptr_server->name) : strdup (""); + new_server_info->proxy_disable = ptr_server->proxy_disable; new_server_info->autoconnect = ptr_server->autoconnect; new_server_info->autoreconnect = ptr_server->autoreconnect; new_server_info->autoreconnect_delay = ptr_server->autoreconnect_delay; diff -ru weechat-0.2.3/src/plugins/scripts/lua/weechat-lua.c weechat-0.2.3.noproxy/src/plugins/scripts/lua/weechat-lua.c --- weechat-0.2.3/src/plugins/scripts/lua/weechat-lua.c 2007-01-06 01:06:03.000000000 +0600 +++ weechat-0.2.3.noproxy/src/plugins/scripts/lua/weechat-lua.c 2007-02-08 14:16:23.000000000 +0600 @@ -1514,6 +1514,10 @@ lua_pushstring (lua_current_interpreter, ptr_server->name); lua_newtable (lua_current_interpreter); + lua_pushstring (lua_current_interpreter, "proxy_disable"); + lua_pushnumber (lua_current_interpreter, ptr_server->proxy_disable); + lua_rawset (lua_current_interpreter, -3); + lua_pushstring (lua_current_interpreter, "autoconnect"); lua_pushnumber (lua_current_interpreter, ptr_server->autoconnect); lua_rawset (lua_current_interpreter, -3); diff -ru weechat-0.2.3/src/plugins/scripts/perl/weechat-perl.c weechat-0.2.3.noproxy/src/plugins/scripts/perl/weechat-perl.c --- weechat-0.2.3/src/plugins/scripts/perl/weechat-perl.c 2007-01-06 01:05:32.000000000 +0600 +++ weechat-0.2.3.noproxy/src/plugins/scripts/perl/weechat-perl.c 2007-02-08 14:14:25.000000000 +0600 @@ -1354,6 +1354,7 @@ server_hash_member = (HV *) sv_2mortal((SV *) newHV()); + hv_store (server_hash_member, "proxy_disable", 13, newSViv (ptr_server->proxy_disable), 0); hv_store (server_hash_member, "autoconnect", 11, newSViv (ptr_server->autoconnect), 0); hv_store (server_hash_member, "autoreconnect", 13, newSViv (ptr_server->autoreconnect), 0); hv_store (server_hash_member, "autoreconnect_delay", 19, newSViv (ptr_server->autoreconnect_delay), 0); diff -ru weechat-0.2.3/src/plugins/scripts/python/weechat-python.c weechat-0.2.3.noproxy/src/plugins/scripts/python/weechat-python.c --- weechat-0.2.3/src/plugins/scripts/python/weechat-python.c 2007-01-06 01:05:39.000000000 +0600 +++ weechat-0.2.3.noproxy/src/plugins/scripts/python/weechat-python.c 2007-02-08 14:14:49.000000000 +0600 @@ -1307,6 +1307,8 @@ if (server_hash_member) { + PyDict_SetItem(server_hash_member, Py_BuildValue("s", "proxy_disable"), + Py_BuildValue("i", ptr_server->proxy_disable)); PyDict_SetItem(server_hash_member, Py_BuildValue("s", "autoconnect"), Py_BuildValue("i", ptr_server->autoconnect)); PyDict_SetItem(server_hash_member, Py_BuildValue("s", "autoreconnect"), diff -ru weechat-0.2.3/src/plugins/scripts/ruby/weechat-ruby.c weechat-0.2.3.noproxy/src/plugins/scripts/ruby/weechat-ruby.c --- weechat-0.2.3/src/plugins/scripts/ruby/weechat-ruby.c 2007-01-06 01:05:57.000000000 +0600 +++ weechat-0.2.3.noproxy/src/plugins/scripts/ruby/weechat-ruby.c 2007-02-08 14:15:09.000000000 +0600 @@ -1545,6 +1545,8 @@ if (server_hash_member) { + rb_hash_aset (server_hash_member, rb_str_new2("proxy_disable"), + INT2FIX(ptr_server->proxy_disable)); rb_hash_aset (server_hash_member, rb_str_new2("autoconnect"), INT2FIX(ptr_server->autoconnect)); rb_hash_aset (server_hash_member, rb_str_new2("autoreconnect"), diff -ru weechat-0.2.3/src/plugins/weechat-plugin.h weechat-0.2.3.noproxy/src/plugins/weechat-plugin.h --- weechat-0.2.3/src/plugins/weechat-plugin.h 2007-01-06 01:05:13.000000000 +0600 +++ weechat-0.2.3.noproxy/src/plugins/weechat-plugin.h 2007-02-08 14:12:05.000000000 +0600 @@ -82,6 +82,7 @@ struct t_plugin_server_info { char *name; /* name of server (only for display) */ + int proxy_disable; /* = 1 if server is reachable w/o proxy */ int autoconnect; /* = 1 if auto connect at startup */ int autoreconnect; /* = 1 if auto reco when disconnected */ int autoreconnect_delay; /* delay before trying again reconnect */