From 51ae33cbe8a29c6502f16cd1bc57e5535e0b4e64 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Mon, 22 Oct 2012 15:55:43 +0200 Subject: Variable cleanup for the rest --- src/common/cfgfiles.c | 183 +++++++++++++++++++++++++------------------------- src/common/dcc.c | 22 +++--- src/common/msproxy.c | 14 ++-- src/common/notify.c | 2 +- src/common/outbound.c | 6 +- src/common/server.c | 52 +++++++------- src/common/servlist.c | 2 +- src/common/text.c | 38 +++++------ src/common/url.c | 10 +-- src/common/xchat.c | 8 +-- src/common/xchat.h | 125 ++++++++++++++++------------------ 11 files changed, 227 insertions(+), 235 deletions(-) (limited to 'src/common') diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 7e6f7278..73b3f7eb 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -547,65 +547,66 @@ const struct prefs vars[] = {"irc_who_join", P_OFFINT (hex_irc_who_join), TYPE_BOOL}, {"irc_whois_front", P_OFFINT (hex_irc_whois_front), TYPE_BOOL}, - {"net_auto_reconnect", P_OFFINT (autoreconnect), TYPE_BOOL}, - {"net_auto_reconnectonfail", P_OFFINT (autoreconnectonfail), TYPE_BOOL}, - {"net_bind_host", P_OFFSET (hostname), TYPE_STR}, - {"net_ping_timeout", P_OFFINT (pingtimeout), TYPE_INT}, - {"net_proxy_auth", P_OFFINT (proxy_auth), TYPE_BOOL}, - {"net_proxy_host", P_OFFSET (proxy_host), TYPE_STR}, - {"net_proxy_pass", P_OFFSET (proxy_pass), TYPE_STR}, - {"net_proxy_port", P_OFFINT (proxy_port), TYPE_INT}, - {"net_proxy_type", P_OFFINT (proxy_type), TYPE_INT}, - {"net_proxy_use", P_OFFINT (proxy_use), TYPE_INT}, - {"net_proxy_user", P_OFFSET (proxy_user), TYPE_STR}, - {"net_reconnect_delay", P_OFFINT (recon_delay), TYPE_INT}, - {"net_throttle", P_OFFINT (throttle), TYPE_BOOL}, - - {"notify_timeout", P_OFFINT (notify_timeout), TYPE_INT}, - {"notify_whois_online", P_OFFINT (whois_on_notifyonline), TYPE_BOOL}, - - {"perl_warnings", P_OFFINT (perlwarnings), TYPE_BOOL}, - - {"sound_command", P_OFFSET (soundcmd), TYPE_STR}, - {"sound_dir", P_OFFSET (sounddir), TYPE_STR}, - {"stamp_log", P_OFFINT (timestamp_logs), TYPE_BOOL}, - {"stamp_log_format", P_OFFSET (timestamp_log_format), TYPE_STR}, - {"stamp_text", P_OFFINT (timestamp), TYPE_BOOL}, - {"stamp_text_format", P_OFFSET (stamp_format), TYPE_STR}, - - {"text_autocopy_color", P_OFFINT (autocopy_color), TYPE_BOOL}, - {"text_autocopy_stamp", P_OFFINT (autocopy_stamp), TYPE_BOOL}, - {"text_autocopy_text", P_OFFINT (autocopy_text), TYPE_BOOL}, - {"text_background", P_OFFSET (background), TYPE_STR}, - {"text_color_nicks", P_OFFINT (colorednicks), TYPE_BOOL}, - {"text_font", P_OFFSET (font_normal), TYPE_STR}, - {"text_font_main", P_OFFSET (font_main), TYPE_STR}, - {"text_font_alternative", P_OFFSET (font_alternative), TYPE_STR}, - {"text_indent", P_OFFINT (indent_nicks), TYPE_BOOL}, - {"text_max_indent", P_OFFINT (max_auto_indent), TYPE_INT}, - {"text_max_lines", P_OFFINT (max_lines), TYPE_INT}, - {"text_replay", P_OFFINT (text_replay), TYPE_BOOL}, - {"text_search_case_match", P_OFFINT (text_search_case_match), TYPE_BOOL}, - {"text_search_backward", P_OFFINT (text_search_backward), TYPE_BOOL}, - {"text_search_highlight_all", P_OFFINT (text_search_highlight_all), TYPE_BOOL}, - {"text_search_follow", P_OFFINT (text_search_follow), TYPE_BOOL}, - {"text_search_regexp", P_OFFINT (text_search_regexp), TYPE_BOOL}, - {"text_show_marker", P_OFFINT (show_marker), TYPE_BOOL}, - {"text_show_sep", P_OFFINT (show_separator), TYPE_BOOL}, - {"text_spell_langs", P_OFFSET (spell_langs), TYPE_STR}, - {"text_stripcolor_msg", P_OFFINT (text_stripcolor_msg), TYPE_BOOL}, - {"text_stripcolor_replay", P_OFFINT (text_stripcolor_replay), TYPE_BOOL}, - {"text_stripcolor_topic", P_OFFINT (text_stripcolor_topic), TYPE_BOOL}, - {"text_thin_sep", P_OFFINT (thin_separator), TYPE_BOOL}, - {"text_tint_blue", P_OFFINT (tint_blue), TYPE_INT}, - {"text_tint_green", P_OFFINT (tint_green), TYPE_INT}, - {"text_tint_red", P_OFFINT (tint_red), TYPE_INT}, - {"text_transparent", P_OFFINT (transparent), TYPE_BOOL}, - {"text_wordwrap", P_OFFINT (wordwrap), TYPE_BOOL}, - - {"url_grabber", P_OFFINT (url_grabber), TYPE_BOOL}, - {"url_grabber_limit", P_OFFINT (url_grabber_limit), TYPE_INT}, - {"url_logging", P_OFFINT (url_logging), TYPE_BOOL}, + {"net_auto_reconnect", P_OFFINT (hex_net_auto_reconnect), TYPE_BOOL}, + {"net_auto_reconnectonfail", P_OFFINT (hex_net_auto_reconnectonfail), TYPE_BOOL}, + {"net_bind_host", P_OFFSET (hex_net_bind_host), TYPE_STR}, + {"net_ping_timeout", P_OFFINT (hex_net_ping_timeout), TYPE_INT}, + {"net_proxy_auth", P_OFFINT (hex_net_proxy_auth), TYPE_BOOL}, + {"net_proxy_host", P_OFFSET (hex_net_proxy_host), TYPE_STR}, + {"net_proxy_pass", P_OFFSET (hex_net_proxy_pass), TYPE_STR}, + {"net_proxy_port", P_OFFINT (hex_net_proxy_port), TYPE_INT}, + {"net_proxy_type", P_OFFINT (hex_net_proxy_type), TYPE_INT}, + {"net_proxy_use", P_OFFINT (hex_net_proxy_use), TYPE_INT}, + {"net_proxy_user", P_OFFSET (hex_net_proxy_user), TYPE_STR}, + {"net_reconnect_delay", P_OFFINT (hex_net_reconnect_delay), TYPE_INT}, + {"net_throttle", P_OFFINT (hex_net_throttle), TYPE_BOOL}, + + {"notify_timeout", P_OFFINT (hex_notify_timeout), TYPE_INT}, + {"notify_whois_online", P_OFFINT (hex_notify_whois_online), TYPE_BOOL}, + + {"perl_warnings", P_OFFINT (hex_perl_warnings), TYPE_BOOL}, + + {"sound_command", P_OFFSET (hex_sound_command), TYPE_STR}, + {"sound_dir", P_OFFSET (hex_sound_dir), TYPE_STR}, + + {"stamp_log", P_OFFINT (hex_stamp_log), TYPE_BOOL}, + {"stamp_log_format", P_OFFSET (hex_stamp_log_format), TYPE_STR}, + {"stamp_text", P_OFFINT (hex_stamp_text), TYPE_BOOL}, + {"stamp_text_format", P_OFFSET (hex_stamp_text_format), TYPE_STR}, + + {"text_autocopy_color", P_OFFINT (hex_text_autocopy_color), TYPE_BOOL}, + {"text_autocopy_stamp", P_OFFINT (hex_text_autocopy_stamp), TYPE_BOOL}, + {"text_autocopy_text", P_OFFINT (hex_text_autocopy_text), TYPE_BOOL}, + {"text_background", P_OFFSET (hex_text_background), TYPE_STR}, + {"text_color_nicks", P_OFFINT (hex_text_color_nicks), TYPE_BOOL}, + {"text_font", P_OFFSET (hex_text_font), TYPE_STR}, + {"text_font_main", P_OFFSET (hex_text_font_main), TYPE_STR}, + {"text_font_alternative", P_OFFSET (hex_text_font_alternative), TYPE_STR}, + {"text_indent", P_OFFINT (hex_text_indent), TYPE_BOOL}, + {"text_max_indent", P_OFFINT (hex_text_max_indent), TYPE_INT}, + {"text_max_lines", P_OFFINT (hex_text_max_lines), TYPE_INT}, + {"text_replay", P_OFFINT (hex_text_replay), TYPE_BOOL}, + {"text_search_case_match", P_OFFINT (hex_text_search_case_match), TYPE_BOOL}, + {"text_search_backward", P_OFFINT (hex_text_search_backward), TYPE_BOOL}, + {"text_search_highlight_all", P_OFFINT (hex_text_search_highlight_all), TYPE_BOOL}, + {"text_search_follow", P_OFFINT (hex_text_search_follow), TYPE_BOOL}, + {"text_search_regexp", P_OFFINT (hex_text_search_regexp), TYPE_BOOL}, + {"text_show_marker", P_OFFINT (hex_text_show_marker), TYPE_BOOL}, + {"text_show_sep", P_OFFINT (hex_text_show_sep), TYPE_BOOL}, + {"text_spell_langs", P_OFFSET (hex_text_spell_langs), TYPE_STR}, + {"text_stripcolor_msg", P_OFFINT (hex_text_stripcolor_msg), TYPE_BOOL}, + {"text_stripcolor_replay", P_OFFINT (hex_text_stripcolor_replay), TYPE_BOOL}, + {"text_stripcolor_topic", P_OFFINT (hex_text_stripcolor_topic), TYPE_BOOL}, + {"text_thin_sep", P_OFFINT (hex_text_thin_sep), TYPE_BOOL}, + {"text_tint_blue", P_OFFINT (hex_text_tint_blue), TYPE_INT}, + {"text_tint_green", P_OFFINT (hex_text_tint_green), TYPE_INT}, + {"text_tint_red", P_OFFINT (hex_text_tint_red), TYPE_INT}, + {"text_transparent", P_OFFINT (hex_text_transparent), TYPE_BOOL}, + {"text_wordwrap", P_OFFINT (hex_text_wordwrap), TYPE_BOOL}, + + {"url_grabber", P_OFFINT (hex_url_grabber), TYPE_BOOL}, + {"url_grabber_limit", P_OFFINT (hex_url_grabber_limit), TYPE_INT}, + {"url_logging", P_OFFINT (hex_url_logging), TYPE_BOOL}, {0, 0, 0}, }; @@ -655,32 +656,32 @@ load_config (void) /* put in default values, anything left out is automatically zero */ prefs.local_ip = 0xffffffff; prefs.hex_irc_join_delay = 3; - prefs.show_marker = 1; + prefs.hex_text_show_marker = 1; prefs.hex_gui_tab_newtofront = 2; prefs.hex_completion_amount = 5; prefs.hex_away_timeout = 60; prefs.hex_away_size_max = 300; prefs.hex_away_track = 1; - prefs.timestamp_logs = 1; + prefs.hex_stamp_log = 1; prefs.hex_gui_tab_trunc = 20; prefs.hex_dcc_auto_resume = 1; prefs.hex_away_show_once = 1; - prefs.indent_nicks = 1; - prefs.thin_separator = 1; + prefs.hex_text_indent = 1; + prefs.hex_text_thin_sep = 1; prefs.hex_identd = 1; #ifndef WIN32 prefs.hex_dcc_fast_send = 1; #endif - prefs.wordwrap = 1; + prefs.hex_text_wordwrap = 1; prefs.hex_gui_autoopen_dialog = 1; prefs.hex_gui_input_spell = 1; prefs.hex_gui_lang = 15; - prefs.autoreconnect = 1; - prefs.recon_delay = 10; - prefs.autocopy_text = 1; - prefs.text_replay = 1; - prefs.text_stripcolor_replay = 1; - prefs.text_stripcolor_topic = 1; + prefs.hex_net_auto_reconnect = 1; + prefs.hex_net_reconnect_delay = 10; + prefs.hex_text_autocopy_text = 1; + prefs.hex_text_replay = 1; + prefs.hex_text_stripcolor_replay = 1; + prefs.hex_text_stripcolor_topic = 1; prefs.hex_gui_tab_chans = 1; prefs.hex_gui_tab_layout = 2; /* 0=Tabs 1=Reserved 2=Tree */ prefs.hex_gui_tab_icons = 1; @@ -689,11 +690,11 @@ load_config (void) prefs.hex_gui_tab_newtofront = 2; prefs.hex_gui_tab_server = 1; prefs.hex_gui_tab_dialogs = 1; - /* prefs.colorednicks = 1; */ + /* prefs.hex_text_color_nicks = 1; */ prefs.hex_gui_input_style = 1; prefs.hex_gui_ulist_style = 1; prefs.hex_dcc_permissions = 0600; - prefs.max_lines = 500; + prefs.hex_text_max_lines = 500; prefs.hex_gui_win_width = 640; prefs.hex_gui_win_height = 400; prefs.hex_gui_dialog_width = 500; @@ -702,15 +703,15 @@ load_config (void) prefs.hex_gui_quit_dialog = 1; prefs.hex_dcc_timeout = 180; prefs.hex_dcc_stall_timeout = 60; - prefs.notify_timeout = 15; - prefs.tint_red = - prefs.tint_green = - prefs.tint_blue = 195; + prefs.hex_notify_timeout = 15; + prefs.hex_text_tint_red = + prefs.hex_text_tint_green = + prefs.hex_text_tint_blue = 195; prefs.auto_indent = 1; - prefs.max_auto_indent = 256; - prefs.show_separator = 1; + prefs.hex_text_max_indent = 256; + prefs.hex_text_show_sep = 1; prefs.hex_dcc_blocksize = 1024; - prefs.throttle = 1; + prefs.hex_net_throttle = 1; /*FIXME*/ prefs.hex_flood_msg_time = 30; prefs.hex_flood_msg_time = 5; prefs.hex_flood_ctcp_time = 30; @@ -739,13 +740,13 @@ load_config (void) prefs.hex_input_flash_priv = prefs.hex_input_flash_hilight = 1; prefs.hex_input_tray_priv = prefs.hex_input_tray_hilight = 1; prefs.hex_dcc_auto_recv = 2; /* browse mode */ - prefs.url_grabber = 1; - prefs.url_grabber_limit = 100; /* 0 means unlimited */ - prefs.text_search_follow = 1; - prefs.timestamp = 1; - strcpy (prefs.spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); - strcpy (prefs.stamp_format, "[%H:%M:%S] "); - strcpy (prefs.timestamp_log_format, "%b %d %H:%M:%S "); + prefs.hex_url_grabber = 1; + prefs.hex_url_grabber_limit = 100; /* 0 means unlimited */ + prefs.hex_text_search_follow = 1; + prefs.hex_stamp_text = 1; + strcpy (prefs.hex_text_spell_langs, g_getenv ("LC_ALL") ? g_getenv ("LC_ALL") : "en_US"); + strcpy (prefs.hex_stamp_text_format, "[%H:%M:%S] "); + strcpy (prefs.hex_stamp_log_format, "%b %d %H:%M:%S "); strcpy (prefs.hex_irc_logmask, "%n-%c.log"); strcpy (prefs.hex_completion_suffix, ","); strcpy (prefs.hex_input_command_char, "/"); @@ -757,7 +758,7 @@ load_config (void) strcpy (prefs.hex_irc_real_name, realname); strcpy (prefs.hex_irc_user_name, username); #ifdef WIN32 - strcpy (prefs.sounddir, "./sounds"); + strcpy (prefs.hex_sound_dir, "./sounds"); { char out[256]; @@ -771,16 +772,16 @@ load_config (void) } } #else - snprintf (prefs.sounddir, sizeof (prefs.sounddir), "%s/sounds", get_xdir_utf8 ()); + snprintf (prefs.hex_sound_dir, sizeof (prefs.hex_sound_dir), "%s/sounds", get_xdir_utf8 ()); snprintf (prefs.hex_dcc_dir, sizeof (prefs.hex_dcc_dir), "%s/downloads", get_xdir_utf8 ()); #endif strcpy (prefs.hex_gui_ulist_doubleclick, "QUOTE WHOIS %s %s"); strcpy (prefs.hex_away_reason, _("I'm busy")); strcpy (prefs.hex_irc_quit_reason, _("Leaving")); strcpy (prefs.hex_irc_part_reason, prefs.hex_irc_quit_reason); - strcpy (prefs.font_normal, DEF_FONT); - strcpy (prefs.font_main, DEF_FONT); - strcpy (prefs.font_alternative, DEF_FONT_ALTER); + strcpy (prefs.hex_text_font, DEF_FONT); + strcpy (prefs.hex_text_font_main, DEF_FONT); + strcpy (prefs.hex_text_font_alternative, DEF_FONT_ALTER); strcpy (prefs.hex_dnsprogram, "host"); strcpy (prefs.hex_irc_no_hilight, "NickServ,ChanServ,InfoServ,N,Q"); diff --git a/src/common/dcc.c b/src/common/dcc.c index b697402e..1b775897 100644 --- a/src/common/dcc.c +++ b/src/common/dcc.c @@ -319,7 +319,7 @@ dcc_lookup_proxy (char *host, struct sockaddr_in *addr) return FALSE; } -#define DCC_USE_PROXY() (prefs.proxy_host[0] && prefs.proxy_type>0 && prefs.proxy_type<5 && prefs.proxy_use!=1) +#define DCC_USE_PROXY() (prefs.hex_net_proxy_host[0] && prefs.hex_net_proxy_type>0 && prefs.hex_net_proxy_type<5 && prefs.hex_net_proxy_use!=1) static int dcc_connect_sok (struct DCC *dcc) @@ -335,12 +335,12 @@ dcc_connect_sok (struct DCC *dcc) addr.sin_family = AF_INET; if (DCC_USE_PROXY ()) { - if (!dcc_lookup_proxy (prefs.proxy_host, &addr)) + if (!dcc_lookup_proxy (prefs.hex_net_proxy_host, &addr)) { closesocket (sok); return -1; } - addr.sin_port = htons (prefs.proxy_port); + addr.sin_port = htons (prefs.hex_net_proxy_port); } else { @@ -1072,7 +1072,7 @@ static gboolean dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC *dcc) { struct proxy_state *proxy = dcc->proxy; - int auth = prefs.proxy_auth && prefs.proxy_user[0] && prefs.proxy_pass[0]; + int auth = prefs.hex_net_proxy_auth && prefs.hex_net_proxy_user[0] && prefs.hex_net_proxy_pass[0]; if (proxy->phase == 0) { @@ -1132,13 +1132,13 @@ dcc_socks5_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DC memset (proxy->buffer, 0, MAX_PROXY_BUFFER); /* form the UPA request */ - len_u = strlen (prefs.proxy_user); - len_p = strlen (prefs.proxy_pass); + len_u = strlen (prefs.hex_net_proxy_user); + len_p = strlen (prefs.hex_net_proxy_pass); proxy->buffer[0] = 1; proxy->buffer[1] = len_u; - memcpy (proxy->buffer + 2, prefs.proxy_user, len_u); + memcpy (proxy->buffer + 2, prefs.hex_net_proxy_user, len_u); proxy->buffer[2 + len_u] = len_p; - memcpy (proxy->buffer + 3 + len_u, prefs.proxy_pass, len_p); + memcpy (proxy->buffer + 3 + len_u, prefs.hex_net_proxy_pass, len_p); proxy->buffersize = 3 + len_u + len_p; proxy->bufferused = 0; @@ -1283,10 +1283,10 @@ dcc_http_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n", net_ip(dcc->addr), dcc->port); - if (prefs.proxy_auth) + if (prefs.hex_net_proxy_auth) { n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s", - prefs.proxy_user, prefs.proxy_pass); + prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass); base64_encode (auth_data, auth_data2, n2); n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data); } @@ -1375,7 +1375,7 @@ dcc_proxy_connect (GIOChannel *source, GIOCondition condition, struct DCC *dcc) } memset (dcc->proxy, 0, sizeof (struct proxy_state)); - switch (prefs.proxy_type) + switch (prefs.hex_net_proxy_type) { case 1: return dcc_wingate_proxy_traverse (source, condition, dcc); case 2: return dcc_socks_proxy_traverse (source, condition, dcc); diff --git a/src/common/msproxy.c b/src/common/msproxy.c index 5103233a..01b6120a 100644 --- a/src/common/msproxy.c +++ b/src/common/msproxy.c @@ -124,7 +124,7 @@ traverse_msproxy (int sok, char *serverAddr, int port, struct msproxy_state_t *s guint32 destaddr; guint32 flags; - if (!prefs.proxy_auth || !prefs.proxy_user[0] || !prefs.proxy_pass[0] ) + if (!prefs.hex_net_proxy_auth || !prefs.hex_net_proxy_user[0] || !prefs.hex_net_proxy_pass[0] ) return 1; /* MS proxy protocol implementation currently doesn't support IPv6 */ @@ -158,8 +158,8 @@ traverse_msproxy (int sok, char *serverAddr, int port, struct msproxy_state_t *s req.packet.hello.magic45 = htons(0x4400); req.packet.hello.magic50 = htons(0x3900); data = req.packet.hello.data; - strcpy (data, prefs.proxy_user); /* Append a username */ - data += strlen (prefs.proxy_user)+2; /* +2 automatically creates second empty string */ + strcpy (data, prefs.hex_net_proxy_user); /* Append a username */ + data += strlen (prefs.hex_net_proxy_user)+2; /* +2 automatically creates second empty string */ strcpy (data, MSPROXY_EXECUTABLE); /* Append an application name */ data += strlen (MSPROXY_EXECUTABLE)+1; strcpy (data, hostname); /* Append a hostname */ @@ -290,13 +290,13 @@ traverse_msproxy (int sok, char *serverAddr, int port, struct msproxy_state_t *s req.packet.auth2.ntlm_resp.len = 24; /* Fill in NTLM response security buffer */ req.packet.auth2.ntlm_resp.alloc = 24; req.packet.auth2.ntlm_resp.offset = data - req.packet.auth2.NTLMSSP; - ntlm_smb_nt_encrypt(prefs.proxy_pass, challenge, data); /* Append an NTLM response */ + ntlm_smb_nt_encrypt(prefs.hex_net_proxy_pass, challenge, data); /* Append an NTLM response */ data += 24; } else { req.packet.auth2.lm_resp.len = 24; /* Fill in LM response security buffer */ req.packet.auth2.lm_resp.alloc = 24; req.packet.auth2.lm_resp.offset = data - req.packet.auth2.NTLMSSP; - ntlm_smb_encrypt(prefs.proxy_pass, challenge, data); /* Append an LM response */ + ntlm_smb_encrypt(prefs.hex_net_proxy_pass, challenge, data); /* Append an LM response */ data += 24; req.packet.auth2.ntlm_resp.len = 0; /* NTLM response is empty */ req.packet.auth2.ntlm_resp.alloc = 0; @@ -307,10 +307,10 @@ traverse_msproxy (int sok, char *serverAddr, int port, struct msproxy_state_t *s req.packet.auth2.ntdomain_buf.offset = data - req.packet.auth2.NTLMSSP; strcpy(data, ntdomain); data += req.packet.auth2.ntdomain_buf.len; - req.packet.auth2.username_buf.len = strlen(prefs.proxy_user); /* Username */ + req.packet.auth2.username_buf.len = strlen(prefs.hex_net_proxy_user); /* Username */ req.packet.auth2.username_buf.alloc = req.packet.auth2.username_buf.len; req.packet.auth2.username_buf.offset = data - req.packet.auth2.NTLMSSP; - strcpy(data, prefs.proxy_user); + strcpy(data, prefs.hex_net_proxy_user); data += req.packet.auth2.username_buf.len; req.packet.auth2.clienthost_buf.len = strlen(hostname); /* Hostname */ req.packet.auth2.clienthost_buf.alloc = req.packet.auth2.clienthost_buf.len; diff --git a/src/common/notify.c b/src/common/notify.c index 2c6eb6db..f9fbe121 100644 --- a/src/common/notify.c +++ b/src/common/notify.c @@ -239,7 +239,7 @@ notify_announce_online (server * serv, struct notify_per_server *servnot, fe_notify_update (nick); fe_notify_update (0); - if (prefs.whois_on_notifyonline) + if (prefs.hex_notify_whois_online) { /* Let's do whois with idle time (like in /quote WHOIS %s %s) */ diff --git a/src/common/outbound.c b/src/common/outbound.c index cb96f86c..bb652aad 100644 --- a/src/common/outbound.c +++ b/src/common/outbound.c @@ -2878,11 +2878,11 @@ cmd_quote (struct session *sess, char *tbuf, char *word[], char *word_eol[]) static int cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { - int tmp = prefs.recon_delay; + int tmp = prefs.hex_net_reconnect_delay; GSList *list; server *serv = sess->server; - prefs.recon_delay = 0; + prefs.hex_net_reconnect_delay = 0; if (!g_ascii_strcasecmp (word[2], "ALL")) { @@ -2923,7 +2923,7 @@ cmd_reconnect (struct session *sess, char *tbuf, char *word[], char *word_eol[]) { serv->auto_reconnect (serv, TRUE, -1); } - prefs.recon_delay = tmp; + prefs.hex_net_reconnect_delay = tmp; return TRUE; } diff --git a/src/common/server.c b/src/common/server.c index 7728a91a..8c831ad0 100644 --- a/src/common/server.c +++ b/src/common/server.c @@ -230,7 +230,7 @@ tcp_send_len (server *serv, char *buf, int len) char *dbuf; int noqueue = !serv->outbound_queue; - if (!prefs.throttle) + if (!prefs.hex_net_throttle) return server_send_real (serv, buf, len); dbuf = malloc (len + 2); /* first byte is the priority */ @@ -463,12 +463,12 @@ server_read (GIOChannel *source, GIOCondition condition, server *serv) server_disconnect (serv->server_session, FALSE, error); if (!servlist_cycle (serv)) { - if (prefs.autoreconnect) + if (prefs.hex_net_auto_reconnect) auto_reconnect (serv, FALSE, error); } } else { - if (prefs.autoreconnect) + if (prefs.hex_net_auto_reconnect) auto_reconnect (serv, FALSE, error); else server_disconnect (serv->server_session, FALSE, error); @@ -666,7 +666,7 @@ ssl_do_connect (server * serv) server_cleanup (serv); - if (prefs.autoreconnectonfail) + if (prefs.hex_net_auto_reconnectonfail) auto_reconnect (serv, FALSE, -1); return (0); /* remove it (0) */ @@ -789,7 +789,7 @@ ssl_do_connect (server * serv) NULL, NULL, 0); server_cleanup (serv); /* ->connecting = FALSE */ - if (prefs.autoreconnectonfail) + if (prefs.hex_net_auto_reconnectonfail) auto_reconnect (serv, FALSE, -1); return (0); /* remove it (0) */ @@ -839,7 +839,7 @@ auto_reconnect (server *serv, int send_quit, int err) if (serv->connected) server_disconnect (serv->server_session, send_quit, err); - del = prefs.recon_delay * 1000; + del = prefs.hex_net_reconnect_delay * 1000; if (del < 1000) del = 500; /* so it doesn't block the gui */ @@ -940,7 +940,7 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv) #endif EMIT_SIGNAL (XP_TE_UKNHOST, sess, NULL, NULL, NULL, NULL, 0); if (!servlist_cycle (serv)) - if (prefs.autoreconnectonfail) + if (prefs.hex_net_auto_reconnectonfail) auto_reconnect (serv, FALSE, -1); break; case '2': /* connection failed */ @@ -958,7 +958,7 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv) EMIT_SIGNAL (XP_TE_CONNFAIL, sess, errorstring (atoi (tbuf)), NULL, NULL, NULL, 0); if (!servlist_cycle (serv)) - if (prefs.autoreconnectonfail) + if (prefs.hex_net_auto_reconnectonfail) auto_reconnect (serv, FALSE, -1); break; case '3': /* gethostbyname finished */ @@ -1028,10 +1028,10 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv) waitline2 (source, tbuf, sizeof tbuf); prefs.local_ip = inet_addr (tbuf); break; - case '7': /* gethostbyname (prefs.hostname) failed */ + case '7': /* gethostbyname (prefs.hex_net_bind_host) failed */ sprintf (outbuf, _("Cannot resolve hostname %s\nCheck your IP Settings!\n"), - prefs.hostname); + prefs.hex_net_bind_host); PrintText (sess, outbuf); break; case '8': @@ -1225,7 +1225,7 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port) unsigned char *sc2; unsigned int packetlen, addrlen; unsigned char buf[260]; - int auth = prefs.proxy_auth && prefs.proxy_user[0] && prefs.proxy_pass[0]; + int auth = prefs.hex_net_proxy_auth && prefs.hex_net_proxy_user[0] && prefs.hex_net_proxy_pass[0]; sc1.version = 5; sc1.nmethods = 1; @@ -1261,13 +1261,13 @@ traverse_socks5 (int print_fd, int sok, char *serverAddr, int port) memset (buf, 0, sizeof(buf)); /* form the UPA request */ - len_u = strlen (prefs.proxy_user); - len_p = strlen (prefs.proxy_pass); + len_u = strlen (prefs.hex_net_proxy_user); + len_p = strlen (prefs.hex_net_proxy_pass); buf[0] = 1; buf[1] = len_u; - memcpy (buf + 2, prefs.proxy_user, len_u); + memcpy (buf + 2, prefs.hex_net_proxy_user, len_u); buf[2 + len_u] = len_p; - memcpy (buf + 3 + len_u, prefs.proxy_pass, len_p); + memcpy (buf + 3 + len_u, prefs.hex_net_proxy_pass, len_p); send (sok, buf, 3 + len_u + len_p, 0); if ( recv (sok, buf, 2, 0) != 2 ) @@ -1426,10 +1426,10 @@ traverse_http (int print_fd, int sok, char *serverAddr, int port) n = snprintf (buf, sizeof (buf), "CONNECT %s:%d HTTP/1.0\r\n", serverAddr, port); - if (prefs.proxy_auth) + if (prefs.hex_net_proxy_auth) { n2 = snprintf (auth_data2, sizeof (auth_data2), "%s:%s", - prefs.proxy_user, prefs.proxy_pass); + prefs.hex_net_proxy_user, prefs.hex_net_proxy_pass); base64_encode (auth_data, auth_data2, n2); n += snprintf (buf+n, sizeof (buf)-n, "Proxy-Authorization: Basic %s\r\n", auth_data); } @@ -1500,10 +1500,10 @@ server_child (server * serv) ns_server = net_store_new (); /* is a hostname set? - bind to it */ - if (prefs.hostname[0]) + if (prefs.hex_net_bind_host[0]) { ns_local = net_store_new (); - local_ip = net_resolve (ns_local, prefs.hostname, 0, &real_hostname); + local_ip = net_resolve (ns_local, prefs.hex_net_bind_host, 0, &real_hostname); if (local_ip != NULL) { snprintf (buf, sizeof (buf), "5\n%s\n", local_ip); @@ -1522,7 +1522,7 @@ server_child (server * serv) if (FALSE) ; #ifdef USE_LIBPROXY - else if (prefs.proxy_type == 5) + else if (prefs.hex_net_proxy_type == 5) { char **proxy_list; char *url, *proxy; @@ -1556,13 +1556,13 @@ server_child (server * serv) g_free (url); } #endif - else if (prefs.proxy_host[0] && - prefs.proxy_type > 0 && - prefs.proxy_use != 2) /* proxy is NOT dcc-only */ + else if (prefs.hex_net_proxy_host[0] && + prefs.hex_net_proxy_type > 0 && + prefs.hex_net_proxy_use != 2) /* proxy is NOT dcc-only */ { - proxy_type = prefs.proxy_type; - proxy_host = strdup (prefs.proxy_host); - proxy_port = prefs.proxy_port; + proxy_type = prefs.hex_net_proxy_type; + proxy_host = strdup (prefs.hex_net_proxy_host); + proxy_port = prefs.hex_net_proxy_port; } } diff --git a/src/common/servlist.c b/src/common/servlist.c index c243907b..5e693770 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -751,7 +751,7 @@ servlist_cycle (server *serv) net->selected = 0; } - del = prefs.recon_delay * 1000; + del = prefs.hex_net_reconnect_delay * 1000; if (del < 1000) del = 500; /* so it doesn't block the gui */ diff --git a/src/common/text.c b/src/common/text.c index e6b00df3..1076f8a0 100644 --- a/src/common/text.c +++ b/src/common/text.c @@ -157,7 +157,7 @@ file_to_buffer (char *file, int *len) return buf; } -/* shrink the file to roughly prefs.max_lines */ +/* shrink the file to roughly prefs.hex_text_max_lines */ static void scrollback_shrink (session *sess) @@ -204,7 +204,7 @@ scrollback_shrink (session *sess) if (*p == '\n') { line++; - if (line >= lines - prefs.max_lines && + if (line >= lines - prefs.hex_text_max_lines && p + 1 != buf + len) { p++; @@ -231,7 +231,7 @@ scrollback_save (session *sess, char *text) if (sess->text_scrollback == SET_DEFAULT) { - if (!prefs.text_replay) + if (!prefs.hex_text_replay) return; } else @@ -263,7 +263,7 @@ scrollback_save (session *sess, char *text) sess->scrollwritten++; - if ((sess->scrollwritten * 2 > prefs.max_lines && prefs.max_lines > 0) || + if ((sess->scrollwritten * 2 > prefs.hex_text_max_lines && prefs.hex_text_max_lines > 0) || sess->scrollwritten > 32000) scrollback_shrink (sess); } @@ -290,7 +290,7 @@ scrollback_load (session *sess) if (sess->text_scrollback == SET_DEFAULT) { - if (!prefs.text_replay) + if (!prefs.hex_text_replay) return; } else @@ -342,12 +342,12 @@ scrollback_load (session *sess) text = strchr (buf + 3, ' '); if (text) { - if (prefs.text_stripcolor_replay) + if (prefs.hex_text_stripcolor_replay) { text = strip_color (text + 1, -1, STRIP_COLOR); } fe_print_text (sess, text, stamp); - if (prefs.text_stripcolor_replay) + if (prefs.hex_text_stripcolor_replay) { g_free (text); } @@ -383,7 +383,7 @@ scrollback_load (session *sess) text = strchr (buf + 3, ' '); if (text) { - if (prefs.text_stripcolor_replay) + if (prefs.hex_text_stripcolor_replay) { text = strip_color (text + 1, -1, STRIP_COLOR); } @@ -391,7 +391,7 @@ scrollback_load (session *sess) cleaned_text = text_replace_non_bmp (text, -1, &cleaned_len); if (cleaned_text != NULL) { - if (prefs.text_stripcolor_replay) + if (prefs.hex_text_stripcolor_replay) { g_free (text); } @@ -400,7 +400,7 @@ scrollback_load (session *sess) #endif text_replace_non_bmp2 (text); fe_print_text (sess, text, stamp); - if (prefs.text_stripcolor_replay) + if (prefs.hex_text_stripcolor_replay) { g_free (text); } @@ -802,9 +802,9 @@ log_write (session *sess, char *text) g_free (file); } - if (prefs.timestamp_logs) + if (prefs.hex_stamp_log) { - len = get_stamp_str (prefs.timestamp_log_format, time (0), &stamp); + len = get_stamp_str (prefs.hex_stamp_log_format, time (0), &stamp); if (len) { write (sess->logfd, stamp, len); @@ -1866,7 +1866,7 @@ load_text_events () /* CL: format_event now handles filtering of arguments: - 1) if prefs.text_stripcolor_msg is set, filter all style control codes from arguments + 1) if prefs.hex_text_stripcolor_msg is set, filter all style control codes from arguments 2) always strip \010 (ATTR_HIDDEN) from arguments: it is only for use in the format string itself */ #define ARG_FLAG(argn) (1 << (argn)) @@ -1938,7 +1938,7 @@ format_event (session *sess, int index, char **args, char *o, int sizeofo, unsig o[oi++] = ' '; } else {*/ - if (prefs.indent_nicks) + if (prefs.hex_text_indent) o[oi++] = '\t'; else o[oi++] = ' '; @@ -2162,10 +2162,10 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d) { char *word[PDIWORDS]; int i; - unsigned int stripcolor_args = (prefs.text_stripcolor_msg ? 0xFFFFFFFF : 0); + unsigned int stripcolor_args = (prefs.hex_text_stripcolor_msg ? 0xFFFFFFFF : 0); char tbuf[NICKLEN + 4]; - if (prefs.colorednicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG)) + if (prefs.hex_text_color_nicks && (index == XP_TE_CHANACTION || index == XP_TE_CHANMSG)) { snprintf (tbuf, sizeof (tbuf), "\003%d%s", color_of (a), a); a = tbuf; @@ -2326,8 +2326,8 @@ sound_find_command (void) char *cmd; int i = 0; - if (prefs.soundcmd[0]) - return g_strdup (prefs.soundcmd); + if (prefs.hex_sound_command[0]) + return g_strdup (prefs.hex_sound_command); while (progs[i]) { @@ -2366,7 +2366,7 @@ sound_play (const char *file, gboolean quiet) #endif if (file[0] != '/') { - snprintf (wavfile, sizeof (wavfile), "%s/%s", prefs.sounddir, file); + snprintf (wavfile, sizeof (wavfile), "%s/%s", prefs.hex_sound_dir, file); } else { strncpy (wavfile, file, sizeof (wavfile)); diff --git a/src/common/url.c b/src/common/url.c index 1793717d..32d282db 100644 --- a/src/common/url.c +++ b/src/common/url.c @@ -103,7 +103,7 @@ url_add (char *urltext, int len) int size; /* we don't need any URLs if we have neither URL grabbing nor URL logging enabled */ - if (!prefs.url_grabber && !prefs.url_logging) + if (!prefs.hex_url_grabber && !prefs.hex_url_logging) { return; } @@ -127,13 +127,13 @@ url_add (char *urltext, int len) data[len - 1] = 0; } - if (prefs.url_logging) + if (prefs.hex_url_logging) { url_save_node (data); } /* the URL is saved already, only continue if we need the URL grabber too */ - if (!prefs.url_grabber) + if (!prefs.hex_url_grabber) { free (data); return; @@ -153,11 +153,11 @@ url_add (char *urltext, int len) size = tree_size (url_tree); /* 0 is unlimited */ - if (prefs.url_grabber_limit > 0 && size >= prefs.url_grabber_limit) + if (prefs.hex_url_grabber_limit > 0 && size >= prefs.hex_url_grabber_limit) { /* the loop is necessary to handle having the limit lowered while xchat is running */ - size -= prefs.url_grabber_limit; + size -= prefs.hex_url_grabber_limit; for(; size > 0; size--) { char *pos; diff --git a/src/common/xchat.c b/src/common/xchat.c index 343f84ff..722f4152 100644 --- a/src/common/xchat.c +++ b/src/common/xchat.c @@ -183,12 +183,12 @@ lag_check (void) if (serv->connected && serv->end_of_motd) { lag = now - serv->ping_recv; - if (prefs.pingtimeout && lag > prefs.pingtimeout && lag > 0) + if (prefs.hex_net_ping_timeout && lag > prefs.hex_net_ping_timeout && lag > 0) { sprintf (tbuf, "%d", lag); EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL, NULL, NULL, 0); - if (prefs.autoreconnect) + if (prefs.hex_net_auto_reconnect) serv->auto_reconnect (serv, FALSE, -1); } else { @@ -321,8 +321,8 @@ irc_init (session *sess) plugin_add (sess, NULL, NULL, dbus_plugin_init, NULL, NULL, FALSE); #endif - if (prefs.notify_timeout) - notify_tag = fe_timeout_add (prefs.notify_timeout * 1000, + if (prefs.hex_notify_timeout) + notify_tag = fe_timeout_add (prefs.hex_notify_timeout * 1000, notify_checklist, 0); fe_timeout_add (prefs.hex_away_timeout * 1000, away_check, 0); diff --git a/src/common/xchat.h b/src/common/xchat.h index e0ba1ff0..8438071a 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -95,7 +95,7 @@ struct nbexec { int myfd; int childpid; - int tochannel; /* making this int keeps the struct 4-byte aligned */ + int tochannel; /* making this int keeps the struct 4-byte aligned */ int iotag; char *linebuf; int buffill; @@ -105,7 +105,6 @@ struct nbexec struct hexchatprefs { /* these are the rebranded, consistent, sorted hexchat variables */ - char hex_away_reason[256]; char hex_completion_suffix[4]; /* Only ever holds a one-character string. */ char hex_dcc_completed_dir[PATHLEN + 1]; @@ -127,6 +126,19 @@ struct hexchatprefs char hex_irc_quit_reason[256]; char hex_irc_real_name[127]; char hex_irc_user_name[127]; + char hex_net_bind_host[127]; + char hex_net_proxy_host[64]; + char hex_net_proxy_pass[32]; + char hex_net_proxy_user[32]; + char hex_sound_command[PATHLEN + 1]; + char hex_sound_dir[PATHLEN + 1]; + char hex_stamp_log_format[64]; + char hex_stamp_text_format[64]; + char hex_text_background[PATHLEN + 1]; + char hex_text_font[4 * FONTNAMELEN + 1]; + char hex_text_font_main[FONTNAMELEN + 1]; + char hex_text_font_alternative[3 * FONTNAMELEN + 1]; + char hex_text_spell_langs[64]; int hex_away_size_max; int hex_away_timeout; @@ -143,9 +155,9 @@ struct hexchatprefs int hex_dcc_port_last; int hex_dcc_stall_timeout; int hex_dcc_timeout; - int hex_flood_ctcp_num; /*flood */ - int hex_flood_ctcp_time; /*seconds of floods */ - int hex_flood_msg_num; /*same deal */ + int hex_flood_ctcp_num; /*flood */ + int hex_flood_ctcp_time; /*seconds of floods */ + int hex_flood_msg_num; /*same deal */ int hex_flood_msg_time; int hex_gui_chanlist_maxusers; int hex_gui_chanlist_minusers; @@ -177,6 +189,18 @@ struct hexchatprefs int hex_input_balloon_time; int hex_irc_ban_type; int hex_irc_join_delay; + int hex_net_ping_timeout; + int hex_net_proxy_port; + int hex_net_proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */ + int hex_net_proxy_use; /* 0=all 1=IRC_ONLY 2=DCC_ONLY */ + int hex_net_reconnect_delay; + int hex_notify_timeout; + int hex_text_max_indent; + int hex_text_max_lines; + int hex_text_tint_blue; + int hex_text_tint_green; + int hex_text_tint_red; + int hex_url_grabber_limit; unsigned int hex_away_auto_unmark; unsigned int hex_away_omit_alerts; @@ -254,81 +278,48 @@ struct hexchatprefs unsigned int hex_irc_wallops; unsigned int hex_irc_who_join; unsigned int hex_irc_whois_front; - + unsigned int hex_net_auto_reconnect; + unsigned int hex_net_auto_reconnectonfail; + unsigned int hex_net_proxy_auth; + unsigned int hex_net_throttle; + unsigned int hex_notify_whois_online; + unsigned int hex_perl_warnings; + unsigned int hex_stamp_log; + unsigned int hex_stamp_text; + unsigned int hex_text_autocopy_color; + unsigned int hex_text_autocopy_stamp; + unsigned int hex_text_autocopy_text; + unsigned int hex_text_color_nicks; + unsigned int hex_text_indent; + unsigned int hex_text_replay; + unsigned int hex_text_search_case_match; + unsigned int hex_text_search_backward; + unsigned int hex_text_search_highlight_all; + unsigned int hex_text_search_follow; + unsigned int hex_text_search_regexp; + unsigned int hex_text_show_marker; + unsigned int hex_text_show_sep; + unsigned int hex_text_stripcolor_msg; + unsigned int hex_text_stripcolor_replay; + unsigned int hex_text_stripcolor_topic; + unsigned int hex_text_thin_sep; + unsigned int hex_text_transparent; + unsigned int hex_text_wordwrap; + unsigned int hex_url_grabber; + unsigned int hex_url_logging; /* these are the legacy variables */ - - char font_normal[4 * FONTNAMELEN + 1]; - char font_main[FONTNAMELEN + 1]; - char font_alternative[3 * FONTNAMELEN + 1]; - char spell_langs[64]; - char sounddir[PATHLEN + 1]; - char soundcmd[PATHLEN + 1]; - char background[PATHLEN + 1]; - char hostname[127]; - char stamp_format[64]; - char timestamp_log_format[64]; - - char proxy_host[64]; - int proxy_port; - int proxy_type; /* 0=disabled, 1=wingate 2=socks4, 3=socks5, 4=http */ - int proxy_use; /* 0=all 1=IRC_ONLY 2=DCC_ONLY */ - unsigned int proxy_auth; - char proxy_user[32]; - char proxy_pass[32]; - - int tint_red; - int tint_green; - int tint_blue; - - int max_auto_indent; - int max_lines; - int notify_timeout; - int recon_delay; guint32 local_ip; guint32 dcc_ip; - unsigned int autoreconnect; - unsigned int autoreconnectonfail; - unsigned int autocopy_text; - unsigned int autocopy_stamp; - unsigned int autocopy_color; - unsigned int colorednicks; - unsigned int transparent; - unsigned int text_stripcolor_msg; - unsigned int text_stripcolor_replay; - unsigned int text_stripcolor_topic; - unsigned int timestamp; - - unsigned int timestamp_logs; - unsigned int newtabstofront; - unsigned int hidever; - unsigned int indent_nicks; - unsigned int text_replay; - unsigned int show_marker; - unsigned int show_separator; - unsigned int thin_separator; unsigned int auto_indent; - unsigned int wordwrap; - unsigned int throttle; - unsigned int perlwarnings; - unsigned int pingtimeout; - unsigned int whois_on_notifyonline; unsigned int wait_on_exit; unsigned int utf8_locale; - unsigned int url_grabber; - unsigned int url_grabber_limit; - unsigned int url_logging; /* Tells us if we need to save, only when they've been edited. This is so that we continue using internal defaults (which can change in the next release) until the user edits them. */ unsigned int save_pevents:1; - unsigned int text_search_case_match; - unsigned int text_search_backward; - unsigned int text_search_highlight_all; - unsigned int text_search_follow; - unsigned int text_search_regexp; }; /* Session types */ -- cgit 1.4.1