Compare commits

...

18 Commits
master ... 2.14

Author SHA1 Message Date
Patrick Griffis b304cfe850 Bump version to 2.14.3 2019-12-20 22:38:06 -08:00
Adam Williamson ef1aad01bf Python plugin: Call EndInterpreter when deinit'ing the plugin
This fixes https://github.com/hexchat/hexchat/issues/2237 , a
commonly-encountered bug when using Hexchat 2.14 on Python 3.7.
Thanks to @ncoghlan for the fix.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2019-12-20 22:29:14 -08:00
Patrick Griffis 8e60546aea build: Fix some meson warnings 2019-12-20 22:28:16 -08:00
Patrick Griffis 29591e2b67 Follow more modern conventions for USER message
Closes #2399
2019-12-20 22:28:10 -08:00
Patrick Griffis 7da0a3aa2c Fix capability negotiation ending before sasl finishes with multi-line cap
Closes #2398
2019-12-20 22:27:58 -08:00
Simon Levermann 6a7a134170 Ignore some non-interesting filesystem types
Generally, how much space we have in squashfs, or tmpfs shouldn't
interest us. This becomes more relevant in distros like Ubuntu, where
snaps are a thing, and each snap mounts their own FS in a squashfs that
is always full, thus falsifying the output of sysinfo.
2019-12-20 22:27:52 -08:00
nia 60c9263d49 build: Make generated headers a dependency for users of common. 2019-12-20 22:27:19 -08:00
Stepan Broz 4ab756af7b Make dcc_ip being a per-server value.
Moved dcc_ip from prefs to sess->server.
2019-12-20 22:27:01 -08:00
Martin Weinelt 92f58b4420 servlist: add hackint irc network
- requires the use of TLS to connect on port 6697
- supports and encourages authentication via SASL PLAIN and EXTERNAL
2019-12-20 22:26:52 -08:00
Jared Shields b9d1efc2c2 Update servlist.c
Update servlist.c
2019-12-20 22:26:46 -08:00
cajuncooks 79f7ff888f Extend input box GTK theme workaround to include Yaru
Fixes #2305
2019-12-20 22:26:34 -08:00
linuxdaemon 3588c519c3 Remove : from various trailing parameters (#2301)
Partial fix for #2271 

This isn't an exhaustive list, but it's everything I could find. The bug still exists in the parser though, this is just a workaround for the moment
2019-12-20 22:26:28 -08:00
Mattia Rizzolo ce528b6af8 Fix compilation failure on non-linux, non-darwin, non-windows systems.
'gnu' => Hurd
'gnu/' => all the gnu/* stuff like gnu/kfreebsd

Signed-off-by: Mattia Rizzolo <mattia@mapreri.org>
2019-12-20 22:26:15 -08:00
Patrick Griffis a26cc20d21 Use prefix variable in pkgconfig file 2019-12-20 22:26:08 -08:00
Patrick Griffis 3099c652bb build: Silence some Meson warnings and bump requirement to 0.40.0 2019-12-20 22:25:57 -08:00
Patrick Griffis edc7ad83e3 Fix new stringop-truncation warnings 2019-12-20 22:25:50 -08:00
Patrick Griffis 996b29ccca sysinfo: Fixup formatting 2019-12-20 22:25:43 -08:00
Patrick Griffis 6a8b7013af sysinfo: Add support for /etc/os-release 2019-12-20 22:25:36 -08:00
22 changed files with 111 additions and 47 deletions

View File

@ -26,6 +26,19 @@
<id>hexchat.desktop</id>
</provides>
<releases>
<release date="2019-12-20" version="2.14.3">
<description>
<p>This is a bug-fix release:</p>
<ul>
<li>Fix various incorrect parsing of IRC messages relating to trailing parameters</li>
<li>Fix SASL negotiation combined with multi-line cap</li>
<li>Fix input box theming with Yaru theme</li>
<li>python: Work around Python 3.7 regression causing crash on unload</li>
<li>sysinfo: Add support for /etc/os-release</li>
<li>sysinfo: Ignore irrelevant mounts when calculating storage size</li>
</ul>
</description>
</release>
<release date="2018-08-29" version="2.14.2">
<description>
<p>This is a minor release:</p>

View File

@ -2,8 +2,8 @@ pkg_conf = configuration_data()
prefix = get_option('prefix')
pkg_conf.set('prefix', prefix)
pkg_conf.set('VERSION', meson.project_version())
pkg_conf.set('hexchatlibdir', join_paths(prefix, plugindir))
pkg_conf.set('includedir', join_paths(prefix, get_option('includedir')))
pkg_conf.set('hexchatlibdir', join_paths('${prefix}', plugindir))
pkg_conf.set('includedir', join_paths('${prefix}', get_option('includedir')))
configure_file(
input: 'hexchat-plugin.pc.in',

View File

@ -1,6 +1,6 @@
project('hexchat', 'c',
version: '2.14.2',
meson_version: '>= 0.38.0',
version: '2.14.3',
meson_version: '>= 0.40.0',
default_options: [
'c_std=gnu89',
'buildtype=debugoptimized',
@ -87,8 +87,6 @@ endif
global_cflags = []
test_cflags = [
'-pipe',
'-fPIE',
'-funsigned-char',
'-Wno-conversion',
'-Wno-pointer-sign',
@ -136,7 +134,13 @@ test_ldflags = [
'-Wl,--nxcompat',
]
foreach ldflag : test_ldflags
if cc.has_argument(ldflag) and cc.links('int main (void) { return 0; }', args: ldflag)
if meson.version().version_compare('>= 0.46.0')
has_arg = cc.has_link_argument(ldflag)
else
has_arg = cc.has_argument(ldflag)
endif
if has_arg and cc.links('int main (void) { return 0; }', args: ldflag)
global_ldflags += ldflag
endif
endforeach

View File

@ -2806,6 +2806,9 @@ hexchat_plugin_deinit(void)
xchatout_buffer = NULL;
if (interp_plugin) {
PyThreadState *tstate = ((PluginObject*)interp_plugin)->tstate;
PyThreadState_Swap(tstate);
Py_EndInterpreter(tstate);
Py_DECREF(interp_plugin);
interp_plugin = NULL;
}

View File

@ -13,13 +13,13 @@ sysinfo_includes = []
sysinfo_cargs = []
system = host_machine.system()
if system == 'linux' or system == 'darwin'
if system == 'linux' or system == 'gnu' or system.startswith('gnu/') or system == 'darwin'
sysinfo_includes += 'shared'
sysinfo_sources += [
'shared/df.c'
]
if system == 'linux'
if system == 'linux' or system == 'gnu' or system.startswith('gnu/')
libpci = dependency('libpci', required: false, method: 'pkg-config')
if libpci.found()
sysinfo_deps += libpci

View File

@ -26,7 +26,7 @@ int xs_parse_df(gint64 *out_total, gint64 *out_free)
FILE *pipe;
char buffer[bsize];
pipe = popen("df -k -l -P", "r");
pipe = popen("df -k -l -P --exclude-type=squashfs --exclude-type=devtmpfs --exclude-type=tmpfs", "r");
if(pipe==NULL)
return 1;

View File

@ -269,6 +269,16 @@ int xs_parse_meminfo(unsigned long long *mem_tot, unsigned long long *mem_free,
return 0;
}
static void strip_quotes(char *string)
{
size_t len = strlen(string);
if (string[len - 1] == '"')
string[--len] = '\0';
if (string[0] == '"')
memmove(string, string + 1, len);
}
int xs_parse_distro(char *name)
{
FILE *fp = NULL;
@ -320,6 +330,20 @@ int xs_parse_distro(char *name)
else
g_snprintf(buffer, bsize, "Gentoo Linux %s", keywords);
}
else if((fp = fopen("/etc/os-release", "r")) != NULL)
{
char name[bsize], version[bsize];
strcpy(name, "?");
strcpy(version, "?");
while(fgets(buffer, bsize, fp) != NULL)
{
find_match_char(buffer, "NAME=", name);
find_match_char(buffer, "VERSION=", version);
}
strip_quotes(name);
strip_quotes(version);
g_snprintf(buffer, bsize, "%s %s", name, version);
}
else
g_snprintf(buffer, bsize, "Unknown Distro");
if(fp != NULL)

View File

@ -142,7 +142,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
{
position = strstr(buffer, vendor);
position += 6;
strncpy(vendorname, position, bsize/2);
g_strlcpy(vendorname, position, sizeof (vendorname));
position = strstr(vendorname, "\n");
*(position) = '\0';
break;
@ -154,7 +154,7 @@ void pci_find_fullname(char *fullname, char *vendor, char *device)
{
position = strstr(buffer, device);
position += 6;
strncpy(devicename, position, bsize/2);
g_strlcpy(devicename, position, sizeof (devicename));
position = strstr(devicename, " (");
if (position == NULL)
position = strstr(devicename, "\n");

View File

@ -1006,7 +1006,7 @@ dcc_socks_proxy_traverse (GIOChannel *source, GIOCondition condition, struct DCC
sc.type = 1;
sc.port = htons (dcc->port);
sc.address = htonl (dcc->addr);
strncpy (sc.username, prefs.hex_irc_user_name, 9);
g_strlcpy (sc.username, prefs.hex_irc_user_name, sizeof (sc.username));
memcpy (proxy->buffer, &sc, sizeof (sc));
proxy->buffersize = 8 + strlen (sc.username) + 1;
proxy->bufferused = 0;
@ -1618,13 +1618,13 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
}
guint32
dcc_get_my_address (void) /* the address we'll tell the other person */
dcc_get_my_address (session *sess) /* the address we'll tell the other person */
{
struct hostent *dns_query;
guint32 addr = 0;
if (prefs.hex_dcc_ip_from_server && prefs.dcc_ip)
addr = prefs.dcc_ip;
if (prefs.hex_dcc_ip_from_server && sess->server->dcc_ip)
addr = sess->server->dcc_ip;
else if (prefs.hex_dcc_ip[0])
{
dns_query = gethostbyname ((const char *) prefs.hex_dcc_ip);
@ -1710,7 +1710,7 @@ dcc_listen_init (struct DCC *dcc, session *sess)
/*if we have a dcc_ip, we use that, so the remote client can connect*/
/*else we try to take an address from hex_dcc_ip*/
/*if something goes wrong we tell the client to connect to our LAN ip*/
dcc->addr = dcc_get_my_address ();
dcc->addr = dcc_get_my_address (sess);
/*if nothing else worked we use the address we bound to*/
if (dcc->addr == 0)

View File

@ -124,7 +124,7 @@ void dcc_chat (session *sess, char *nick, int passive);
void handle_dcc (session *sess, char *nick, char *word[], char *word_eol[],
const message_tags_data *tags_data);
void dcc_show_list (session *sess);
guint32 dcc_get_my_address (void);
guint32 dcc_get_my_address (session *sess);
void dcc_get_with_destfile (struct DCC *dcc, char *utf8file);
#endif

View File

@ -313,7 +313,6 @@ struct hexchatprefs
/* these are the private variables */
guint32 local_ip;
guint32 dcc_ip;
unsigned int wait_on_exit; /* wait for logs to be flushed to disk IF we're connected */
@ -482,6 +481,10 @@ typedef struct server
int proxy_sok4;
int proxy_sok6;
int id; /* unique ID number (for plugin API) */
/* dcc_ip moved from haxchatprefs to make it per-server */
guint32 dcc_ip;
#ifdef USE_OPENSSL
SSL_CTX *ctx;
SSL *ssl;
@ -575,6 +578,7 @@ typedef struct server
unsigned int sasl_mech; /* mechanism for sasl auth */
unsigned int sent_capend:1; /* have sent CAP END yet */
unsigned int waiting_on_cap:1; /* waiting on another line of CAP LS */
unsigned int waiting_on_sasl:1; /* waiting on sasl */
#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 */

View File

@ -1420,7 +1420,7 @@ inbound_foundip (session *sess, char *ip, const message_tags_data *tags_data)
HostAddr = gethostbyname (ip);
if (HostAddr)
{
prefs.dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr;
sess->server->dcc_ip = ((struct in_addr *) HostAddr->h_addr)->s_addr;
EMIT_SIGNAL_TIMESTAMP (XP_TE_FOUNDIP, sess->server->server_session,
inet_ntoa (*((struct in_addr *) HostAddr->h_addr)),
NULL, NULL, NULL, 0, tags_data->timestamp);
@ -1768,7 +1768,6 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
{
char buffer[500]; /* buffer for requesting capabilities and emitting the signal */
gboolean want_cap = FALSE; /* format the CAP REQ string based on previous capabilities being requested or not */
gboolean want_sasl = FALSE; /* CAP END shouldn't be sent when SASL is requested, it needs further responses */
char **extensions;
int i;
@ -1816,7 +1815,7 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
serv->sasl_mech = sasl_mech;
}
want_cap = TRUE;
want_sasl = TRUE;
serv->waiting_on_sasl = TRUE;
g_strlcat (buffer, "sasl ", sizeof(buffer));
continue;
}
@ -1842,7 +1841,7 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
tags_data->timestamp);
tcp_sendf (serv, "%s\r\n", g_strchomp (buffer));
}
if (!want_sasl && !serv->waiting_on_cap)
if (!serv->waiting_on_sasl && !serv->waiting_on_cap)
{
/* if we use SASL, CAP END is dealt via raw numerics */
serv->sent_capend = TRUE;
@ -1851,13 +1850,25 @@ inbound_cap_ls (server *serv, char *nick, char *extensions_str,
}
void
inbound_cap_nak (server *serv, const message_tags_data *tags_data)
inbound_cap_nak (server *serv, char *extensions_str, const message_tags_data *tags_data)
{
if (!serv->waiting_on_cap && !serv->sent_capend)
char **extensions;
int i;
extensions = g_strsplit (extensions_str, " ", 0);
for (i=0; extensions[i]; i++)
{
if (!g_strcmp0 (extensions[i], "sasl"))
serv->waiting_on_sasl = FALSE;
}
if (!serv->waiting_on_cap && !serv->waiting_on_sasl && !serv->sent_capend)
{
serv->sent_capend = TRUE;
tcp_send_len (serv, "CAP END\r\n", 9);
}
g_strfreev (extensions);
}
void

View File

@ -92,7 +92,7 @@ void inbound_cap_ack (server *serv, char *nick, char *extensions,
const message_tags_data *tags_data);
void inbound_cap_ls (server *serv, char *nick, char *extensions,
const message_tags_data *tags_data);
void inbound_cap_nak (server *serv, const message_tags_data *tags_data);
void inbound_cap_nak (server *serv, char *extensions, const message_tags_data *tags_data);
void inbound_cap_list (server *serv, char *nick, char *extensions,
const message_tags_data *tags_data);
void inbound_cap_del (server *serv, char *nick, char *extensions,

View File

@ -109,6 +109,7 @@ hexchat_common = static_library('hexchatcommon',
)
hexchat_common_dep = declare_dependency(
sources: [textevents] + marshal,
link_with: hexchat_common,
include_directories: common_includes,
compile_args: common_cflags,

View File

@ -735,6 +735,8 @@ handle_mode (server * serv, char *word[], char *word_eol[],
if (!(*word[i + offset]))
break;
num_args++;
if (word[i + offset][0] == ':')
break;
}
/* count the number of modes (without the -/+ chars */
@ -765,7 +767,7 @@ handle_mode (server * serv, char *word[], char *word_eol[],
if ((all_modes_have_args || mode_has_arg (serv, sign, *modes)) && arg < (num_args + 1))
{
arg++;
argstr = word[arg + offset];
argstr = STRIP_COLON(word, word_eol, arg+offset);
}
handle_single_mode (&mr, sign, *modes, nick, chan,
argstr, numeric_324 || prefs.hex_irc_raw_modes,

View File

@ -3287,7 +3287,7 @@ cmd_send (struct session *sess, char *tbuf, char *word[], char *word_eol[])
if (!word[2][0])
return FALSE;
addr = dcc_get_my_address ();
addr = dcc_get_my_address (sess);
if (addr == 0)
{
/* use the one from our connected server socket */

View File

@ -60,8 +60,8 @@ irc_login (server *serv, char *user, char *realname)
tcp_sendf (serv,
"NICK %s\r\n"
"USER %s %s %s :%s\r\n",
serv->nick, user, user, serv->servername, realname);
"USER %s 0 * :%s\r\n",
serv->nick, user, realname);
}
static void
@ -714,7 +714,7 @@ process_numeric (session * sess, int n,
break;
case 333:
inbound_topictime (serv, word[4], word[5], atol (word[6]), tags_data);
inbound_topictime (serv, word[4], word[5], atol (STRIP_COLON(word, word_eol, 6)), tags_data);
break;
#if 0
@ -726,7 +726,7 @@ process_numeric (session * sess, int n,
#endif
case 341: /* INVITE ACK */
EMIT_SIGNAL_TIMESTAMP (XP_TE_UINVITE, sess, word[4], word[5],
EMIT_SIGNAL_TIMESTAMP (XP_TE_UINVITE, sess, word[4], STRIP_COLON(word, word_eol, 5),
serv->servername, NULL, 0, tags_data->timestamp);
break;
@ -957,6 +957,7 @@ process_numeric (session * sess, int n,
EMIT_SIGNAL_TIMESTAMP (XP_TE_SASLRESPONSE, serv->server_session, word[1],
word[2], word[3], ++word_eol[4], 0,
tags_data->timestamp);
serv->waiting_on_sasl = FALSE;
if (!serv->sent_capend)
{
serv->sent_capend = TRUE;
@ -1142,7 +1143,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
{
case WORDL('A','C','C','O'):
inbound_account (serv, nick, word[3], tags_data);
inbound_account (serv, nick, STRIP_COLON(word, word_eol, 3), tags_data);
return;
case WORDL('A', 'U', 'T', 'H'):
@ -1150,7 +1151,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
return;
case WORDL('C', 'H', 'G', 'H'):
inbound_user_info (sess, NULL, word[3], word[4], NULL, nick, NULL,
inbound_user_info (sess, NULL, word[3], STRIP_COLON(word, word_eol, 4), NULL, nick, NULL,
NULL, 0xff, tags_data);
return;
@ -1330,7 +1331,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
}
else if (strncasecmp (word[4], "NAK", 3) == 0)
{
inbound_cap_nak (serv, tags_data);
inbound_cap_nak (serv, word[5][0] == ':' ? word_eol[5] + 1 : word_eol[5], tags_data);
}
else if (strncasecmp (word[4], "LIST", 4) == 0)
{

View File

@ -28,6 +28,8 @@
(time_t)0, /* timestamp */ \
}
#define STRIP_COLON(word, word_eol, idx) (word)[(idx)][0] == ':' ? (word_eol)[(idx)]+1 : (word)[(idx)]
/* Message tag information that might be passed along with a server message
*
* See http://ircv3.atheme.org/specification/capability-negotiation-3.1

View File

@ -1042,7 +1042,7 @@ traverse_socks (int print_fd, int sok, char *serverAddr, int port)
sc.type = 1;
sc.port = htons (port);
sc.address = inet_addr (serverAddr);
strncpy (sc.username, prefs.hex_irc_user_name, 9);
g_strlcpy (sc.username, prefs.hex_irc_user_name, sizeof (sc.username));
send (sok, (char *) &sc, 8 + strlen (sc.username) + 1, 0);
buf[1] = 0;

View File

@ -166,9 +166,6 @@ static const struct defaultserver def[] =
/* irc. points to chat. but many users and urls still reference it */
{0, "irc.freenode.net"},
{"Furnet", 0, 0, 0, 0, 0, TRUE},
{0, "irc.furnet.org"},
{"GalaxyNet", 0},
{0, "irc.galaxynet.org"},
@ -196,6 +193,11 @@ static const struct defaultserver def[] =
#endif
{0, "irc.globalgamers.net"},
#ifdef USE_OPENSSL
{"hackint", 0, 0, 0, LOGIN_SASL, 0, TRUE},
{0, "irc.hackint.org"},
#endif
{"Hashmark", 0},
{0, "irc.hashmark.net"},

View File

@ -293,10 +293,10 @@ create_input_style (GtkStyle *style)
GtkSettings *settings = gtk_settings_get_default ();
char *theme_name;
/* gnome-themes-standard 3.20 relies on images to do theming
/* gnome-themes-standard 3.20+ relies on images to do theming
* so we have to override that. */
g_object_get (settings, "gtk-theme-name", &theme_name, NULL);
if (g_str_has_prefix (theme_name, "Adwaita"))
if (g_str_has_prefix (theme_name, "Adwaita") || g_str_has_prefix (theme_name, "Yaru"))
gtk_rc_parse_string (adwaita_workaround_rc);
g_free (theme_name);

View File

@ -39,13 +39,9 @@ if gtk_dep.get_pkgconfig_variable('target') == 'x11'
hexchat_gtk_deps += dependency('x11')
endif
hexchat_gtk_cflags = [
'-fPIE'
]
hexchat_gtk_cflags = []
hexchat_gtk_ldflags = [
'-pie'
]
hexchat_gtk_ldflags = []
if get_option('with-libnotify')
hexchat_gtk_sources += 'notifications/notification-libnotify.c'
@ -89,6 +85,7 @@ executable('hexchat',
dependencies: hexchat_gtk_deps,
c_args: hexchat_gtk_cflags,
link_args: hexchat_gtk_ldflags,
pie: true,
install: true,
gui_app: true,
)