2013-03-31 23:44:48 +04:00
|
|
|
/* HexChat
|
|
|
|
* Copyright (C) 1998-2010 Peter Zelezny.
|
|
|
|
* Copyright (C) 2009-2013 Berke Viktor.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-10-27 03:26:32 +04:00
|
|
|
#ifdef WIN32
|
|
|
|
#include "../../config-win32.h"
|
|
|
|
#else
|
2011-02-24 06:14:30 +03:00
|
|
|
#include "../../config.h"
|
2012-10-27 03:26:32 +04:00
|
|
|
#endif
|
2011-02-24 06:14:30 +03:00
|
|
|
|
2012-01-09 02:48:46 +04:00
|
|
|
#include <glib.h>
|
2012-11-03 21:24:25 +04:00
|
|
|
#include <glib/gstdio.h>
|
|
|
|
|
2011-02-24 06:14:30 +03:00
|
|
|
#include <time.h> /* need time_t */
|
|
|
|
|
2012-10-25 03:33:23 +04:00
|
|
|
#ifndef HEXCHAT_H
|
|
|
|
#define HEXCHAT_H
|
2011-02-24 06:14:30 +03:00
|
|
|
|
2014-01-29 21:16:36 +04:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
#ifdef __APPLE__
|
|
|
|
#define __AVAILABILITYMACROS__
|
|
|
|
#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2011-02-24 06:14:30 +03:00
|
|
|
#include "history.h"
|
|
|
|
|
|
|
|
#ifndef HAVE_SNPRINTF
|
|
|
|
#define snprintf g_snprintf
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HAVE_VSNPRINTF
|
2011-02-28 20:59:32 +03:00
|
|
|
#define vsnprintf _vsnprintf
|
|
|
|
#endif
|
2011-02-24 06:14:30 +03:00
|
|
|
|
|
|
|
#ifdef USE_DEBUG
|
2012-10-30 14:35:39 +04:00
|
|
|
#define malloc(n) hexchat_malloc(n, __FILE__, __LINE__)
|
|
|
|
#define realloc(n, m) hexchat_realloc(n, m, __FILE__, __LINE__)
|
|
|
|
#define free(n) hexchat_dfree(n, __FILE__, __LINE__)
|
|
|
|
#define strdup(n) hexchat_strdup(n, __FILE__, __LINE__)
|
|
|
|
void *hexchat_malloc (int size, char *file, int line);
|
|
|
|
void *hexchat_strdup (char *str, char *file, int line);
|
|
|
|
void hexchat_dfree (void *buf, char *file, int line);
|
|
|
|
void *hexchat_realloc (char *old, int len, char *file, int line);
|
2011-02-24 06:14:30 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef SOCKS
|
|
|
|
#ifdef __sgi
|
|
|
|
#include <sys/time.h>
|
|
|
|
#define INCLUDE_PROTOTYPES 1
|
|
|
|
#endif
|
|
|
|
#include <socks.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
#include <openssl/ssl.h> /* SSL_() */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __EMX__ /* for o/s 2 */
|
|
|
|
#define OFLAGS O_BINARY
|
2012-06-16 15:01:47 +04:00
|
|
|
#define g_ascii_strcasecmp stricmp
|
|
|
|
#define g_ascii_strncasecmp strnicmp
|
2011-02-24 06:14:30 +03:00
|
|
|
#define PATH_MAX MAXPATHLEN
|
|
|
|
#define FILEPATH_LEN_MAX MAXPATHLEN
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* force a 32bit CMP.L */
|
|
|
|
#define CMPL(a, c0, c1, c2, c3) (a == (guint32)(c0 | (c1 << 8) | (c2 << 16) | (c3 << 24)))
|
|
|
|
#define WORDL(c0, c1, c2, c3) (guint32)(c0 | (c1 << 8) | (c2 << 16) | (c3 << 24))
|
|
|
|
#define WORDW(c0, c1) (guint16)(c0 | (c1 << 8))
|
|
|
|
|
|
|
|
#ifdef WIN32 /* for win32 */
|
|
|
|
#define OFLAGS O_BINARY
|
2011-02-28 20:59:32 +03:00
|
|
|
#define sleep(t) Sleep(t*1000)
|
2011-02-24 06:14:30 +03:00
|
|
|
#include <direct.h>
|
|
|
|
#define F_OK 0
|
|
|
|
#define X_OK 1
|
|
|
|
#define W_OK 2
|
|
|
|
#define R_OK 4
|
|
|
|
#ifndef S_ISDIR
|
|
|
|
#define S_ISDIR(m) ((m) & _S_IFDIR)
|
|
|
|
#endif
|
|
|
|
#define NETWORK_PRIVATE
|
|
|
|
#else /* for unix */
|
|
|
|
#define OFLAGS 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define FONTNAMELEN 127
|
|
|
|
#define PATHLEN 255
|
|
|
|
#define DOMAINLEN 100
|
|
|
|
#define NICKLEN 64 /* including the NULL, so 63 really */
|
|
|
|
#define CHANLEN 300
|
|
|
|
#define PDIWORDS 32
|
|
|
|
#define USERNAMELEN 10
|
|
|
|
#define HIDDEN_CHAR 8 /* invisible character for xtext */
|
|
|
|
|
|
|
|
#if defined(ENABLE_NLS) && !defined(_)
|
|
|
|
# include <libintl.h>
|
|
|
|
# define _(x) gettext(x)
|
|
|
|
# ifdef gettext_noop
|
|
|
|
# define N_(String) gettext_noop (String)
|
|
|
|
# else
|
|
|
|
# define N_(String) (String)
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
#if !defined(_)
|
|
|
|
# define N_(String) (String)
|
|
|
|
# define _(x) (x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct nbexec
|
|
|
|
{
|
|
|
|
int myfd;
|
|
|
|
int childpid;
|
2012-10-22 17:55:43 +04:00
|
|
|
int tochannel; /* making this int keeps the struct 4-byte aligned */
|
2011-02-24 06:14:30 +03:00
|
|
|
int iotag;
|
|
|
|
char *linebuf;
|
|
|
|
int buffill;
|
|
|
|
struct session *sess;
|
|
|
|
};
|
|
|
|
|
2012-10-22 11:00:35 +04:00
|
|
|
struct hexchatprefs
|
2011-02-24 06:14:30 +03:00
|
|
|
{
|
2012-10-22 11:53:28 +04:00
|
|
|
/* these are the rebranded, consistent, sorted hexchat variables */
|
|
|
|
|
2012-10-22 22:00:08 +04:00
|
|
|
/* BOOLEANS */
|
2012-10-22 11:53:28 +04:00
|
|
|
unsigned int hex_away_auto_unmark;
|
|
|
|
unsigned int hex_away_omit_alerts;
|
|
|
|
unsigned int hex_away_show_once;
|
|
|
|
unsigned int hex_away_track;
|
2012-10-22 12:10:19 +04:00
|
|
|
unsigned int hex_completion_auto;
|
2012-10-22 14:10:55 +04:00
|
|
|
unsigned int hex_dcc_auto_chat;
|
|
|
|
unsigned int hex_dcc_auto_resume;
|
|
|
|
unsigned int hex_dcc_fast_send;
|
|
|
|
unsigned int hex_dcc_ip_from_server;
|
|
|
|
unsigned int hex_dcc_remove;
|
|
|
|
unsigned int hex_dcc_save_nick;
|
|
|
|
unsigned int hex_dcc_send_fillspaces;
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_autoopen_chat;
|
|
|
|
unsigned int hex_gui_autoopen_dialog;
|
|
|
|
unsigned int hex_gui_autoopen_recv;
|
|
|
|
unsigned int hex_gui_autoopen_send;
|
|
|
|
unsigned int hex_gui_compact;
|
2014-05-04 07:57:45 +04:00
|
|
|
unsigned int hex_gui_filesize_iec;
|
2013-04-14 07:03:54 +04:00
|
|
|
unsigned int hex_gui_focus_omitalerts;
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_hide_menu;
|
2013-10-02 11:47:07 +04:00
|
|
|
unsigned int hex_gui_input_attr;
|
2012-10-28 06:05:50 +04:00
|
|
|
unsigned int hex_gui_input_icon;
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_input_nick;
|
|
|
|
unsigned int hex_gui_input_spell;
|
|
|
|
unsigned int hex_gui_input_style;
|
|
|
|
unsigned int hex_gui_join_dialog;
|
|
|
|
unsigned int hex_gui_mode_buttons;
|
|
|
|
unsigned int hex_gui_quit_dialog;
|
2012-11-11 18:50:31 +04:00
|
|
|
/* unsigned int hex_gui_single; */
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_slist_fav;
|
|
|
|
unsigned int hex_gui_slist_skip;
|
|
|
|
unsigned int hex_gui_tab_chans;
|
|
|
|
unsigned int hex_gui_tab_dialogs;
|
|
|
|
unsigned int hex_gui_tab_dots;
|
|
|
|
unsigned int hex_gui_tab_icons;
|
2013-10-09 02:16:10 +04:00
|
|
|
unsigned int hex_gui_tab_scrollchans;
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_tab_server;
|
|
|
|
unsigned int hex_gui_tab_sort;
|
|
|
|
unsigned int hex_gui_tab_utils;
|
|
|
|
unsigned int hex_gui_topicbar;
|
|
|
|
unsigned int hex_gui_tray;
|
2012-12-21 04:39:52 +04:00
|
|
|
unsigned int hex_gui_tray_away;
|
2012-12-21 04:53:58 +04:00
|
|
|
unsigned int hex_gui_tray_blink;
|
2012-11-10 22:29:12 +04:00
|
|
|
unsigned int hex_gui_tray_close;
|
|
|
|
unsigned int hex_gui_tray_minimize;
|
|
|
|
unsigned int hex_gui_tray_quiet;
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_ulist_buttons;
|
2013-03-10 02:57:06 +04:00
|
|
|
unsigned int hex_gui_ulist_color;
|
2012-10-22 20:59:45 +04:00
|
|
|
unsigned int hex_gui_ulist_count;
|
2012-10-22 15:49:28 +04:00
|
|
|
unsigned int hex_gui_ulist_hide;
|
|
|
|
unsigned int hex_gui_ulist_icons;
|
|
|
|
unsigned int hex_gui_ulist_resizable;
|
|
|
|
unsigned int hex_gui_ulist_show_hosts;
|
|
|
|
unsigned int hex_gui_ulist_style;
|
|
|
|
unsigned int hex_gui_usermenu;
|
|
|
|
unsigned int hex_gui_win_modes;
|
|
|
|
unsigned int hex_gui_win_save;
|
|
|
|
unsigned int hex_gui_win_swap;
|
|
|
|
unsigned int hex_gui_win_ucount;
|
2012-10-22 16:18:20 +04:00
|
|
|
unsigned int hex_identd;
|
|
|
|
unsigned int hex_input_balloon_chans;
|
|
|
|
unsigned int hex_input_balloon_hilight;
|
|
|
|
unsigned int hex_input_balloon_priv;
|
|
|
|
unsigned int hex_input_beep_chans;
|
|
|
|
unsigned int hex_input_beep_hilight;
|
|
|
|
unsigned int hex_input_beep_priv;
|
|
|
|
unsigned int hex_input_filter_beep;
|
|
|
|
unsigned int hex_input_flash_chans;
|
|
|
|
unsigned int hex_input_flash_hilight;
|
|
|
|
unsigned int hex_input_flash_priv;
|
|
|
|
unsigned int hex_input_perc_ascii;
|
|
|
|
unsigned int hex_input_perc_color;
|
|
|
|
unsigned int hex_input_tray_chans;
|
|
|
|
unsigned int hex_input_tray_hilight;
|
|
|
|
unsigned int hex_input_tray_priv;
|
2012-10-22 16:50:36 +04:00
|
|
|
unsigned int hex_irc_auto_rejoin;
|
|
|
|
unsigned int hex_irc_conf_mode;
|
2013-10-18 07:43:58 +04:00
|
|
|
unsigned int hex_irc_hidehost;
|
2014-05-06 21:22:09 +04:00
|
|
|
unsigned int hex_irc_hide_nickchange;
|
2012-10-22 16:50:36 +04:00
|
|
|
unsigned int hex_irc_hide_version;
|
|
|
|
unsigned int hex_irc_invisible;
|
|
|
|
unsigned int hex_irc_logging;
|
|
|
|
unsigned int hex_irc_raw_modes;
|
|
|
|
unsigned int hex_irc_servernotice;
|
|
|
|
unsigned int hex_irc_skip_motd;
|
|
|
|
unsigned int hex_irc_wallops;
|
|
|
|
unsigned int hex_irc_who_join;
|
|
|
|
unsigned int hex_irc_whois_front;
|
2013-06-24 23:13:18 +04:00
|
|
|
unsigned int hex_irc_cap_server_time;
|
2012-10-22 17:55:43 +04:00
|
|
|
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_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;
|
2012-10-22 11:53:28 +04:00
|
|
|
|
2012-10-22 22:00:08 +04:00
|
|
|
/* NUMBERS */
|
|
|
|
int hex_away_size_max;
|
|
|
|
int hex_away_timeout;
|
|
|
|
int hex_completion_amount;
|
|
|
|
int hex_completion_sort;
|
|
|
|
int hex_dcc_auto_recv;
|
|
|
|
int hex_dcc_blocksize;
|
|
|
|
int hex_dcc_global_max_get_cps;
|
|
|
|
int hex_dcc_global_max_send_cps;
|
|
|
|
int hex_dcc_max_get_cps;
|
|
|
|
int hex_dcc_max_send_cps;
|
|
|
|
int hex_dcc_permissions;
|
|
|
|
int hex_dcc_port_first;
|
|
|
|
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_msg_time;
|
|
|
|
int hex_gui_chanlist_maxusers;
|
|
|
|
int hex_gui_chanlist_minusers;
|
|
|
|
int hex_gui_dialog_height;
|
|
|
|
int hex_gui_dialog_left;
|
|
|
|
int hex_gui_dialog_top;
|
|
|
|
int hex_gui_dialog_width;
|
|
|
|
int hex_gui_lagometer;
|
|
|
|
int hex_gui_lang;
|
2012-12-02 04:43:20 +04:00
|
|
|
int hex_gui_pane_divider_position;
|
2012-10-22 22:00:08 +04:00
|
|
|
int hex_gui_pane_left_size;
|
|
|
|
int hex_gui_pane_right_size;
|
|
|
|
int hex_gui_pane_right_size_min;
|
2013-07-25 04:47:01 +04:00
|
|
|
int hex_gui_search_pos;
|
2012-10-22 22:00:08 +04:00
|
|
|
int hex_gui_slist_select;
|
|
|
|
int hex_gui_tab_layout;
|
|
|
|
int hex_gui_tab_newtofront;
|
|
|
|
int hex_gui_tab_pos;
|
|
|
|
int hex_gui_tab_small;
|
|
|
|
int hex_gui_tab_trunc;
|
2013-09-27 07:24:27 +04:00
|
|
|
int hex_gui_transparency;
|
2012-10-22 22:00:08 +04:00
|
|
|
int hex_gui_throttlemeter;
|
|
|
|
int hex_gui_ulist_pos;
|
|
|
|
int hex_gui_ulist_sort;
|
|
|
|
int hex_gui_url_mod;
|
|
|
|
int hex_gui_win_height;
|
2013-09-20 01:52:17 +04:00
|
|
|
int hex_gui_win_fullscreen;
|
2012-10-22 22:00:08 +04:00
|
|
|
int hex_gui_win_left;
|
|
|
|
int hex_gui_win_state;
|
|
|
|
int hex_gui_win_top;
|
|
|
|
int hex_gui_win_width;
|
|
|
|
int hex_input_balloon_time;
|
|
|
|
int hex_irc_ban_type;
|
|
|
|
int hex_irc_join_delay;
|
2013-03-10 02:09:38 +04:00
|
|
|
int hex_irc_notice_pos;
|
2012-10-22 22:00:08 +04:00
|
|
|
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_url_grabber_limit;
|
|
|
|
|
|
|
|
/* STRINGS */
|
|
|
|
char hex_away_reason[256];
|
|
|
|
char hex_completion_suffix[4]; /* Only ever holds a one-character string. */
|
|
|
|
char hex_dcc_completed_dir[PATHLEN + 1];
|
|
|
|
char hex_dcc_dir[PATHLEN + 1];
|
|
|
|
char hex_dcc_ip[DOMAINLEN + 1];
|
|
|
|
char hex_gui_ulist_doubleclick[256];
|
|
|
|
char hex_input_command_char[4];
|
|
|
|
char hex_irc_extra_hilight[300];
|
|
|
|
char hex_irc_id_ntext[64];
|
|
|
|
char hex_irc_id_ytext[64];
|
|
|
|
char hex_irc_logmask[256];
|
|
|
|
char hex_irc_nick1[NICKLEN];
|
|
|
|
char hex_irc_nick2[NICKLEN];
|
|
|
|
char hex_irc_nick3[NICKLEN];
|
|
|
|
char hex_irc_nick_hilight[300];
|
|
|
|
char hex_irc_no_hilight[300];
|
|
|
|
char hex_irc_part_reason[256];
|
|
|
|
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_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];
|
|
|
|
|
2012-10-22 18:09:11 +04:00
|
|
|
/* these are the private variables */
|
2011-02-24 06:14:30 +03:00
|
|
|
guint32 local_ip;
|
|
|
|
guint32 dcc_ip;
|
|
|
|
|
2012-10-22 18:09:11 +04:00
|
|
|
unsigned int wait_on_exit; /* wait for logs to be flushed to disk IF we're connected */
|
2011-02-24 06:14:30 +03:00
|
|
|
unsigned int utf8_locale;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Session types */
|
|
|
|
#define SESS_SERVER 1
|
|
|
|
#define SESS_CHANNEL 2
|
|
|
|
#define SESS_DIALOG 3
|
|
|
|
#define SESS_NOTICES 4
|
|
|
|
#define SESS_SNOTICES 5
|
|
|
|
|
|
|
|
/* Per-Channel Settings */
|
|
|
|
#define SET_OFF 0
|
|
|
|
#define SET_ON 1
|
|
|
|
#define SET_DEFAULT 2 /* use global setting */
|
|
|
|
|
2012-12-25 09:33:57 +04:00
|
|
|
/* Priorities in the "interesting sessions" priority queue
|
|
|
|
* (see xchat.c:sess_list_by_lastact) */
|
|
|
|
#define LACT_NONE -1 /* no queues */
|
|
|
|
#define LACT_QUERY_HI 0 /* query with hilight */
|
|
|
|
#define LACT_QUERY 1 /* query with messages */
|
|
|
|
#define LACT_CHAN_HI 2 /* channel with hilight */
|
|
|
|
#define LACT_CHAN 3 /* channel with messages */
|
|
|
|
#define LACT_CHAN_DATA 4 /* channel with other data */
|
|
|
|
|
2012-08-29 06:10:03 +04:00
|
|
|
/* Moved from fe-gtk for use in outbound.c as well -- */
|
|
|
|
typedef enum gtk_xtext_search_flags_e {
|
|
|
|
case_match = 1,
|
|
|
|
backward = 2,
|
|
|
|
highlight = 4,
|
|
|
|
follow = 8,
|
|
|
|
regexp = 16
|
|
|
|
} gtk_xtext_search_flags;
|
|
|
|
|
2011-02-24 06:14:30 +03:00
|
|
|
typedef struct session
|
|
|
|
{
|
|
|
|
/* Per-Channel Alerts */
|
|
|
|
/* use a byte, because we need a pointer to each element */
|
|
|
|
guint8 alert_beep;
|
|
|
|
guint8 alert_taskbar;
|
|
|
|
guint8 alert_tray;
|
|
|
|
|
|
|
|
/* Per-Channel Settings */
|
|
|
|
guint8 text_hidejoinpart;
|
|
|
|
guint8 text_logging;
|
|
|
|
guint8 text_scrollback;
|
2013-06-07 01:47:01 +04:00
|
|
|
guint8 text_strip;
|
2011-02-24 06:14:30 +03:00
|
|
|
|
|
|
|
struct server *server;
|
|
|
|
void *usertree_alpha; /* pure alphabetical tree */
|
|
|
|
void *usertree; /* ordered with Ops first */
|
|
|
|
struct User *me; /* points to myself in the usertree */
|
|
|
|
char channel[CHANLEN];
|
|
|
|
char waitchannel[CHANLEN]; /* waiting to join channel (/join sent) */
|
|
|
|
char willjoinchannel[CHANLEN]; /* will issue /join for this channel */
|
|
|
|
char channelkey[64]; /* XXX correct max length? */
|
|
|
|
int limit; /* channel user limit */
|
|
|
|
int logfd;
|
|
|
|
int scrollfd; /* scrollback filedes */
|
|
|
|
int scrollwritten; /* number of lines written */
|
|
|
|
|
|
|
|
char lastnick[NICKLEN]; /* last nick you /msg'ed */
|
|
|
|
|
|
|
|
struct history history;
|
|
|
|
|
|
|
|
int ops; /* num. of ops in channel */
|
|
|
|
int hops; /* num. of half-oped users */
|
|
|
|
int voices; /* num. of voiced people */
|
|
|
|
int total; /* num. of users in channel */
|
|
|
|
|
|
|
|
char *quitreason;
|
|
|
|
char *topic;
|
|
|
|
char *current_modes; /* free() me */
|
|
|
|
|
|
|
|
int mode_timeout_tag;
|
|
|
|
|
|
|
|
struct session *lastlog_sess;
|
|
|
|
struct nbexec *running_exec;
|
|
|
|
|
|
|
|
struct session_gui *gui; /* initialized by fe_new_window */
|
|
|
|
struct restore_gui *res;
|
|
|
|
|
|
|
|
int type; /* SESS_* */
|
|
|
|
|
2012-12-25 09:33:57 +04:00
|
|
|
int lastact_idx; /* the sess_list_by_lastact[] index of the list we're in.
|
|
|
|
* For valid values, see defines of LACT_*. */
|
|
|
|
|
2011-02-24 06:14:30 +03:00
|
|
|
int new_data:1; /* new data avail? (purple tab) */
|
|
|
|
int nick_said:1; /* your nick mentioned? (blue tab) */
|
|
|
|
int msg_said:1; /* new msg available? (red tab) */
|
|
|
|
|
|
|
|
int ignore_date:1;
|
|
|
|
int ignore_mode:1;
|
|
|
|
int ignore_names:1;
|
|
|
|
int end_of_names:1;
|
|
|
|
int doing_who:1; /* /who sent on this channel */
|
|
|
|
int done_away_check:1; /* done checking for away status changes */
|
2012-08-29 06:10:03 +04:00
|
|
|
gtk_xtext_search_flags lastlog_flags;
|
2014-04-03 03:09:13 +04:00
|
|
|
void (*scrollback_replay_marklast) (struct session *sess);
|
2011-02-24 06:14:30 +03:00
|
|
|
} session;
|
|
|
|
|
|
|
|
struct msproxy_state_t
|
|
|
|
{
|
|
|
|
gint32 clientid;
|
|
|
|
gint32 serverid;
|
|
|
|
unsigned char seq_recv; /* seq number of last packet recv. */
|
|
|
|
unsigned char seq_sent; /* seq number of last packet sent. */
|
|
|
|
};
|
|
|
|
|
2013-09-02 22:24:37 +04:00
|
|
|
/* SASL Mechanisms */
|
|
|
|
#define MECH_PLAIN 0
|
|
|
|
#define MECH_BLOWFISH 1
|
|
|
|
#define MECH_AES 2
|
|
|
|
#define MECH_EXTERNAL 3
|
|
|
|
|
2011-02-24 06:14:30 +03:00
|
|
|
typedef struct server
|
|
|
|
{
|
|
|
|
/* server control operations (in server*.c) */
|
|
|
|
void (*connect)(struct server *, char *hostname, int port, int no_login);
|
|
|
|
void (*disconnect)(struct session *, int sendquit, int err);
|
|
|
|
int (*cleanup)(struct server *);
|
|
|
|
void (*flush_queue)(struct server *);
|
|
|
|
void (*auto_reconnect)(struct server *, int send_quit, int err);
|
|
|
|
/* irc protocol functions (in proto*.c) */
|
|
|
|
void (*p_inline)(struct server *, char *buf, int len);
|
|
|
|
void (*p_invite)(struct server *, char *channel, char *nick);
|
|
|
|
void (*p_cycle)(struct server *, char *channel, char *key);
|
|
|
|
void (*p_ctcp)(struct server *, char *to, char *msg);
|
|
|
|
void (*p_nctcp)(struct server *, char *to, char *msg);
|
|
|
|
void (*p_quit)(struct server *, char *reason);
|
|
|
|
void (*p_kick)(struct server *, char *channel, char *nick, char *reason);
|
|
|
|
void (*p_part)(struct server *, char *channel, char *reason);
|
|
|
|
void (*p_ns_identify)(struct server *, char *pass);
|
|
|
|
void (*p_ns_ghost)(struct server *, char *usname, char *pass);
|
|
|
|
void (*p_join)(struct server *, char *channel, char *key);
|
2013-05-14 18:40:32 +04:00
|
|
|
void (*p_join_list)(struct server *, GSList *favorites);
|
2011-02-24 06:14:30 +03:00
|
|
|
void (*p_login)(struct server *, char *user, char *realname);
|
|
|
|
void (*p_join_info)(struct server *, char *channel);
|
|
|
|
void (*p_mode)(struct server *, char *target, char *mode);
|
|
|
|
void (*p_user_list)(struct server *, char *channel);
|
|
|
|
void (*p_away_status)(struct server *, char *channel);
|
|
|
|
void (*p_whois)(struct server *, char *nicks);
|
|
|
|
void (*p_get_ip)(struct server *, char *nick);
|
|
|
|
void (*p_get_ip_uh)(struct server *, char *nick);
|
|
|
|
void (*p_set_back)(struct server *);
|
|
|
|
void (*p_set_away)(struct server *, char *reason);
|
|
|
|
void (*p_message)(struct server *, char *channel, char *text);
|
|
|
|
void (*p_action)(struct server *, char *channel, char *act);
|
|
|
|
void (*p_notice)(struct server *, char *channel, char *text);
|
|
|
|
void (*p_topic)(struct server *, char *channel, char *topic);
|
|
|
|
void (*p_list_channels)(struct server *, char *arg, int min_users);
|
|
|
|
void (*p_change_nick)(struct server *, char *new_nick);
|
|
|
|
void (*p_names)(struct server *, char *channel);
|
|
|
|
void (*p_ping)(struct server *, char *to, char *timestring);
|
|
|
|
/* void (*p_set_away)(struct server *);*/
|
|
|
|
int (*p_raw)(struct server *, char *raw);
|
|
|
|
int (*p_cmp)(const char *s1, const char *s2);
|
|
|
|
|
|
|
|
int port;
|
|
|
|
int sok; /* is equal to sok4 or sok6 (the one we are using) */
|
|
|
|
int sok4; /* tcp4 socket */
|
|
|
|
int sok6; /* tcp6 socket */
|
|
|
|
int proxy_type;
|
|
|
|
int proxy_sok; /* Additional information for MS Proxy beast */
|
|
|
|
int proxy_sok4;
|
|
|
|
int proxy_sok6;
|
|
|
|
struct msproxy_state_t msp_state;
|
|
|
|
int id; /* unique ID number (for plugin API) */
|
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
SSL *ssl;
|
|
|
|
int ssl_do_connect_tag;
|
|
|
|
#else
|
|
|
|
void *ssl;
|
|
|
|
#endif
|
|
|
|
int childread;
|
|
|
|
int childwrite;
|
|
|
|
int childpid;
|
|
|
|
int iotag;
|
|
|
|
int recondelay_tag; /* reconnect delay timeout */
|
|
|
|
int joindelay_tag; /* waiting before we send JOIN */
|
|
|
|
char hostname[128]; /* real ip number */
|
|
|
|
char servername[128]; /* what the server says is its name */
|
|
|
|
char password[86];
|
|
|
|
char nick[NICKLEN];
|
|
|
|
char linebuf[2048]; /* RFC says 512 chars including \r\n */
|
|
|
|
char *last_away_reason;
|
|
|
|
int pos; /* current position in linebuf */
|
|
|
|
int nickcount;
|
2013-05-11 01:52:47 +04:00
|
|
|
int loginmethod; /* see login_types[] */
|
2011-02-24 06:14:30 +03:00
|
|
|
|
|
|
|
char *chantypes; /* for 005 numeric - free me */
|
|
|
|
char *chanmodes; /* for 005 numeric - free me */
|
|
|
|
char *nick_prefixes; /* e.g. "*@%+" */
|
|
|
|
char *nick_modes; /* e.g. "aohv" */
|
|
|
|
char *bad_nick_prefixes; /* for ircd that doesn't give the modes */
|
|
|
|
int modes_per_line; /* 6 on undernet, 4 on efnet etc... */
|
|
|
|
|
|
|
|
void *network; /* points to entry in servlist.c or NULL! */
|
|
|
|
|
|
|
|
GSList *outbound_queue;
|
|
|
|
time_t next_send; /* cptr->since in ircu */
|
|
|
|
time_t prev_now; /* previous now-time */
|
|
|
|
int sendq_len; /* queue size */
|
|
|
|
int lag; /* milliseconds */
|
|
|
|
|
|
|
|
struct session *front_session; /* front-most window/tab */
|
|
|
|
struct session *server_session; /* server window/tab */
|
|
|
|
|
|
|
|
struct server_gui *gui; /* initialized by fe_new_server */
|
|
|
|
|
|
|
|
unsigned int ctcp_counter; /*flood */
|
|
|
|
time_t ctcp_last_time;
|
|
|
|
|
|
|
|
unsigned int msg_counter; /*counts the msg tab opened in a certain time */
|
|
|
|
time_t msg_last_time;
|
|
|
|
|
|
|
|
/*time_t connect_time;*/ /* when did it connect? */
|
2014-01-27 23:57:41 +04:00
|
|
|
unsigned long lag_sent; /* we are still waiting for this ping response*/
|
2011-02-24 06:14:30 +03:00
|
|
|
time_t ping_recv; /* when we last got a ping reply */
|
|
|
|
time_t away_time; /* when we were marked away */
|
|
|
|
|
|
|
|
char *encoding; /* NULL for system */
|
2013-05-12 07:44:32 +04:00
|
|
|
GSList *favlist; /* list of channels & keys to join */
|
2011-02-24 06:14:30 +03:00
|
|
|
|
|
|
|
unsigned int motd_skipped:1;
|
|
|
|
unsigned int connected:1;
|
|
|
|
unsigned int connecting:1;
|
|
|
|
unsigned int no_login:1;
|
|
|
|
unsigned int skip_next_userhost:1;/* used for "get my ip from server" */
|
|
|
|
unsigned int skip_next_whois:1; /* hide whois output */
|
|
|
|
unsigned int inside_whois:1;
|
|
|
|
unsigned int doing_dns:1; /* /dns has been done */
|
2013-10-21 06:29:16 +04:00
|
|
|
unsigned int retry_sasl:1; /* retrying another sasl mech */
|
2011-02-24 06:14:30 +03:00
|
|
|
unsigned int end_of_motd:1; /* end of motd reached (logged in) */
|
|
|
|
unsigned int sent_quit:1; /* sent a QUIT already? */
|
|
|
|
unsigned int use_listargs:1; /* undernet and dalnet need /list >0,<10000 */
|
|
|
|
unsigned int is_away:1;
|
|
|
|
unsigned int reconnect_away:1; /* whether to reconnect in is_away state */
|
|
|
|
unsigned int dont_use_proxy:1; /* to proxy or not to proxy */
|
|
|
|
unsigned int supports_watch:1; /* supports the WATCH command */
|
2013-04-04 02:51:54 +04:00
|
|
|
unsigned int supports_monitor:1; /* supports the MONITOR command */
|
2011-02-24 06:14:30 +03:00
|
|
|
unsigned int bad_prefix:1; /* gave us a bad PREFIX= 005 number */
|
|
|
|
unsigned int have_namesx:1; /* 005 tokens NAMESX and UHNAMES */
|
2013-03-12 10:21:18 +04:00
|
|
|
unsigned int have_awaynotify:1;
|
2011-02-24 06:14:30 +03:00
|
|
|
unsigned int have_uhnames:1;
|
|
|
|
unsigned int have_whox:1; /* have undernet's WHOX features */
|
|
|
|
unsigned int have_idmsg:1; /* freenode's IDENTIFY-MSG */
|
2013-04-04 01:10:09 +04:00
|
|
|
unsigned int have_accnotify:1; /* cap account-notify */
|
|
|
|
unsigned int have_extjoin:1; /* cap extended-join */
|
2013-06-23 19:24:30 +04:00
|
|
|
unsigned int have_server_time:1; /* cap server-time */
|
2012-10-25 18:17:21 +04:00
|
|
|
unsigned int have_sasl:1; /* SASL capability */
|
2011-02-24 06:14:30 +03:00
|
|
|
unsigned int have_except:1; /* ban exemptions +e */
|
Redesign the Ban List window. Closes Issues #303, #342, #427
This is a combination of 18 commits.
The first commit's message is:
Here is the initial banlist branch of RichardHitt/hexchat.
Changed files are only src/fe-gtk/{banlist.c,fe-gtk.h}.
This version works and contains my first efforts at selective
sensitization of radio buttons and control buttons.
From this point I intend to undertake a stepwise redesign.
Step 1 will be to make the existing banlist code work for
multiple simultaneous banlist windows (for different channels,
obviously). It will be a hackathon with the only goal of getting
it working.
Step 2 will be the objectization and alpha-stage tidying-up of
all the terrible looking stuff I will have done in Step 1.
This is the 2nd commit message:
Here's the post-Step-1 commit. It works for multiple banlist windows.
Note particularly what I've done to banlist.h.
Note that for many functions in banlist.c the argument is now
a banlist_info *, rather than a session *.
Note in banlist.c the initialization of array modes[] which
contains driving information for the checkboxes.
Of course those checkboxes aren't yet implemented. Maybe in Step 2
I will change to checkboxes from radio buttons; but definitely I will
change to letting modes[] drive processing.
This is the 3rd commit message:
Converted to checkboxes. Much additional work.
Note that the infrastructure for Auto-invite is not yet
present in the hexchat tree. I'm nearly done with banlist,
I think!
This is the 4th commit message:
Fleshed out 'invite'. Tagged masks uniformly, e.g. (b) (e) (I).
General cleanup, nearly at the point of beta quality.
This is the 5th commit message:
Added fourth mode type: quiet. Did lots and lots of cleanup. Beta-ready?
This is the 6th commit message:
Get the banlist timestamps properly sortable.
This is the 7th commit message:
Redesign the supports_foo() routines. Now they're responsible for setting
the flags in ->capable, ->readable, ->writeable.
This is the 8th commit message:
Deleted a couple of RBH comments.
This is the 9th commit message:
Now the ESC key will close the banlist window.
This is the 10th commit message:
Fix the fe-text occurrence of fe_add_ban_list().
This is the 11th commit message:
Fixed also fe_ban_list_end() and removed fe_is_banwindow().
This is the 12th commit message:
Use old-style initialization for array of structures modes[]
This is the 13th commit message:
Oops, incomplete regression of modes[] initialization. This fixes.
This is the 14th commit message:
Fixed strptime buy implementing a special version here.
Fixed column width concerns by setting resizable and autosize.
This is the 15th commit message:
Get rid of testing line.
This is the 16th commit message:
Changed to gtkutil_destroy_on_esc ()
This is the 17th commit message:
Remove no-longer-used functnion
This is the 18th commit message:
Minor cleanups to banlist.c, banlist.h
Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit.
Author: RichardHitt <rbh00@netcom.com>
Committer: Richard Hitt <rbh00@f17.rbh00.pacbell.net>
Not currently on any branch.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: src/common/fe.h
modified: src/common/hexchat.h
modified: src/common/inbound.c
modified: src/common/modes.c
modified: src/common/proto-irc.c
modified: src/common/server.c
modified: src/fe-gtk/banlist.c
modified: src/fe-gtk/banlist.h
modified: src/fe-gtk/fe-gtk.c
modified: src/fe-gtk/fe-gtk.h
modified: src/fe-gtk/maingui.c
modified: src/fe-text/fe-text.c
2013-03-05 12:13:51 +04:00
|
|
|
unsigned int have_invite:1; /* invite exemptions +I */
|
2013-09-02 22:24:37 +04:00
|
|
|
unsigned int have_cert:1; /* have loaded a cert */
|
2011-02-24 06:14:30 +03:00
|
|
|
unsigned int using_cp1255:1; /* encoding is CP1255/WINDOWS-1255? */
|
|
|
|
unsigned int using_irc:1; /* encoding is "IRC" (CP1252/UTF-8 hybrid)? */
|
|
|
|
unsigned int use_who:1; /* whether to use WHO command to get dcc_ip */
|
2013-09-02 22:24:37 +04:00
|
|
|
unsigned int sasl_mech; /* mechanism for sasl auth */
|
|
|
|
unsigned int sent_saslauth:1; /* have sent AUTHENICATE yet */
|
|
|
|
unsigned int sent_capend:1; /* have sent CAP END yet */
|
2011-02-24 06:14:30 +03:00
|
|
|
#ifdef USE_OPENSSL
|
|
|
|
unsigned int use_ssl:1; /* is server SSL capable? */
|
|
|
|
unsigned int accept_invalid_cert:1;/* ignore result of server's cert. verify */
|
|
|
|
#endif
|
|
|
|
} server;
|
|
|
|
|
|
|
|
typedef int (*cmd_callback) (struct session * sess, char *tbuf, char *word[],
|
|
|
|
char *word_eol[]);
|
|
|
|
|
|
|
|
struct commands
|
|
|
|
{
|
|
|
|
char *name;
|
|
|
|
cmd_callback callback;
|
|
|
|
char needserver;
|
|
|
|
char needchannel;
|
|
|
|
gint16 handle_quotes;
|
|
|
|
char *help;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct away_msg
|
|
|
|
{
|
|
|
|
struct server *server;
|
|
|
|
char nick[NICKLEN];
|
|
|
|
char *message;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* not just for popups, but used for usercommands, ctcp replies,
|
|
|
|
userlist buttons etc */
|
|
|
|
|
|
|
|
struct popup
|
|
|
|
{
|
|
|
|
char *cmd;
|
|
|
|
char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* CL: get a random int in the range [0..n-1]. DON'T use rand() % n, it gives terrible results. */
|
|
|
|
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))
|
|
|
|
|
2012-10-30 14:35:39 +04:00
|
|
|
#define hexchat_filename_from_utf8 g_filename_from_utf8
|
|
|
|
#define hexchat_filename_to_utf8 g_filename_to_utf8
|
2011-02-24 06:14:30 +03:00
|
|
|
|
|
|
|
#endif
|