Compare commits

...

12 Commits

Author SHA1 Message Date
c310862d2c win32: Add files for appx building
This is quite sloppy but it should get the job done.
2021-10-11 15:42:38 -05:00
aabe3438fa ci: Don't install libproxy-dev 2021-10-07 14:05:47 -05:00
6fd8a8f9bf python: Open all scripts with utf-8 encoding 2021-10-02 09:49:17 -05:00
40399b1cb6 Bump version to 2.16.0 2021-10-01 14:52:09 -05:00
dd6f53f504 Fix user list not tracking mode changes
The `PREFIX` key in `ISUPPORT` (usually) takes the form
`(modes)prefixes` e.g. `(ov)@+`. The current implementation will
therefore set `serv->nick_modes` to a string like `"(ov"` instead
of the desired `"ov"`. This causes the nick list to not properly
update with which users have which prefix modes. Skip over the
initial `'('` so we capture the correct modes and fix that issue.
2021-10-01 14:50:44 -05:00
3f07670b34 win32: Update to OpenSSL 1.1 2021-10-01 13:47:42 -05:00
2985dde7f0 Explicitly set app icon in notifications 2021-10-01 11:56:49 -05:00
8239fbd041 Be a bit less insulting about servers with longer line lengths. 2021-08-24 16:40:54 -05:00
899b4cd3eb Increase the linebuf length to fit a full message including tags. 2021-08-24 16:40:54 -05:00
ef0e670392 Remove some weird guesswork on the 004 numeric. (#2621)
Bahamut and ircu both send 005 MODES and ELIST so this is entirely
unnecessary. The other IRCd checked for here is for a dead network.

While we're editing this code fix HexChat on servers that can only
support one mode at a time (these are mostly gateway servers).
2021-08-23 10:34:13 -05:00
69ce388a87 actions: Add MSYS2 builder 2021-07-15 20:59:27 -05:00
fee86de499 fish: Misc test cleanups 2021-07-15 20:59:19 -05:00
63 changed files with 234 additions and 316 deletions

40
.github/workflows/msys-build.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: MSYS2 Build
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-python3-cffi
mingw-w64-x86_64-meson
mingw-w64-x86_64-gtk2
mingw-w64-x86_64-luajit
mingw-w64-x86_64-desktop-file-utils
- name: Configure
run: >-
meson build
-Dtext-frontend=true
-Ddbus=disabled
-Dwith-upd=false
-Dwith-perl=false
- name: Build
run: ninja -C build
- name: Test
run: ninja -C build test
- name: Install
run: ninja -C build install

View File

@ -10,7 +10,7 @@ jobs:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y meson libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev libluajit-5.1-dev libpci-dev libperl-dev libproxy-dev libssl-dev python3-dev python3-cffi mono-devel desktop-file-utils
sudo apt-get install -y meson libcanberra-dev libdbus-glib-1-dev libglib2.0-dev libgtk2.0-dev libluajit-5.1-dev libpci-dev libperl-dev libssl-dev python3-dev python3-cffi mono-devel desktop-file-utils
- name: Configure
run: meson build -Dtext=true -Dtheme-manager=true -Dauto_features=enabled

View File

@ -28,7 +28,7 @@ jobs:
Invoke-WebRequest https://dl.hexchat.net/misc/idpsetup-1.5.1.exe -OutFile deps\idpsetup.exe
& deps\idpsetup.exe /VERYSILENT
Invoke-WebRequest https://dl.hexchat.net/gtk/gtk-${{ matrix.platform }}-2018-08-29.7z -OutFile deps\gtk-${{ matrix.arch }}.7z
Invoke-WebRequest https://dl.hexchat.net/gtk/gtk-${{ matrix.platform }}-2018-08-29-openssl1.1.7z -OutFile deps\gtk-${{ matrix.arch }}.7z
& 7z.exe x deps\gtk-${{ matrix.arch }}.7z -oC:\gtk-build\gtk
Invoke-WebRequest https://dl.hexchat.net/gtk-win32/gendef-20111031.7z -OutFile deps\gendef.7z
@ -55,9 +55,28 @@ jobs:
msbuild win32\hexchat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=${{ matrix.platform }}
shell: cmd
- name: Creating Appx
run: |
cp -r ..\hexchat-build\${{ matrix.platform }}\rel ..\hexchat-appx
.\win32\version-template.ps1 win32\AppxManifest.xml.in $(Join-Path $(Resolve-Path ..\hexchat-appx) AppxManifest.xml)
cd ..\hexchat-appx
rm plugins\hcperl.dll
rm plugins\hcpython2.dll
rm plugins\hcpython3.dll
rm plugins\hcupd.dll
rm -r python
rm *.pyd
rm WinSparkle.dll
rm portable-mode
rm hexchat-text.exe
rm thememan.exe
makeappx pack /d . /p hexchat-${{ matrix.arch }}.appx
shell: powershell
- name: Preparing Artifacts
run: |
move ..\hexchat-build\${{ matrix.platform }}\HexChat*.exe .\
move ..\hexchat-appx\hexchat-${{ matrix.arch }}.appx .\
move ..\hexchat-build .\
shell: cmd
@ -68,5 +87,10 @@ jobs:
- uses: actions/upload-artifact@v2
with:
name: Build Files ${{ matrix.arch }}
name: Build Files ${{ matrix.arch }}
path: hexchat-build
- uses: actions/upload-artifact@v2
with:
name: Appx Files ${{ matrix.arch }}
path: hexchat-${{ matrix.arch }}.appx

View File

@ -26,6 +26,22 @@
<id>hexchat.desktop</id>
</provides>
<releases>
<release date="2021-10-01" version="2.16.0">
<description>
<p>This is a feature release:</p>
<ul>
<li>Add support for IRCv3 SETNAME, invite-notify, account-tag, standard replies, and UTF8ONLY</li>
<li>Add support for strikethrough formatting</li>
<li>Fix text clipping issues by respecting font line height</li>
<li>Fix URLs not being escaped when opened</li>
<li>Fix possible hang when showing notifications</li>
<li>Print ChanServ notices in the front tab by default</li>
<li>Update network list</li>
<li>python: Rewrite plugin improving memory usage and compatibility</li>
<li>fishlim: Add support for CBC and other improvements</li>
</ul>
</description>
</release>
<release date="2019-12-20" version="2.14.3">
<description>
<p>This is a bug-fix release:</p>

View File

@ -1,5 +1,5 @@
project('hexchat', 'c',
version: '2.14.3',
version: '2.16.0',
meson_version: '>= 0.47.0',
default_options: [
'c_std=gnu89',
@ -22,7 +22,7 @@ dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus'))
global_deps = []
if cc.get_id() == 'msvc'
libssl_dep = cc.find_library('libeay32')
libssl_dep = cc.find_library('libssl')
else
libssl_dep = dependency('openssl', version: '>= 0.9.8',
required: get_option('tls'))

View File

@ -29,7 +29,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;HAVE_DH_SET0_PQG;HAVE_DH_GET0_KEY;HAVE_DH_SET0_KEY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -40,7 +40,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;FISHLIM_EXPORTS;HAVE_DH_SET0_PQG;HAVE_DH_GET0_KEY;HAVE_DH_SET0_KEY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);..\..\src\common;$(HexChatLib);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>

View File

@ -1,17 +1,15 @@
subdir('old_version')
fishlim_test_sources = [
'tests.c',
'fake/keystore.c',
'mock-keystore.c',
'../fish.c',
'../utils.c',
]
fishlim_tests = executable('fishlim_tests', fishlim_test_sources,
dependencies: [libgio_dep, libssl_dep],
link_with : fishlim_old_lib
dependencies: [libgio_dep, libssl_dep, hexchat_plugin_dep],
include_directories: include_directories('..'),
)
test('Fishlim Tests', fishlim_tests,
timeout: 90
protocol: 'tap',
)

View File

@ -1,5 +1,4 @@
/*
Copyright (c) 2010 Samuel Lidén Borell <samuel@kodafritt.se>
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -22,26 +21,31 @@
*/
#include "../../fish.h"
#include "fish.h"
/**
* Extracts a key from the key store file.
*/
char *keystore_get_key(const char *nick, enum fish_mode *mode) {
char *
keystore_get_key(const char *nick, enum fish_mode *mode)
{
return NULL;
}
/**
* Sets a key in the key store file.
*/
gboolean keystore_store_key(const char *nick, const char *key, enum fish_mode mode) {
gboolean
keystore_store_key(const char *nick, const char *key, enum fish_mode mode)
{
return TRUE;
}
/**
* Deletes a nick from the key store.
*/
gboolean keystore_delete_nick(const char *nick) {
gboolean
keystore_delete_nick(const char *nick)
{
return TRUE;
}

View File

@ -1,155 +0,0 @@
/*
Copyright (c) 2010 Samuel Lidén Borell <samuel@kodafritt.se>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifdef __APPLE__
#define __AVAILABILITYMACROS__
#define DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER
#endif
#include <stdlib.h>
#include <string.h>
#include <openssl/blowfish.h>
#include "fish.h"
#define IB 64
static const char fish_base64[64] = "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
static const signed char fish_unbase64[256] = {
IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB,
IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB,IB,IB,
/* ! " # $ % & ' ( ) * + , - . / */
IB,IB,IB,IB,IB,IB,IB,IB, IB,IB,IB,IB,IB,IB, 0, 1,
/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
2, 3, 4, 5, 6, 7, 8, 9, 10,11,IB,IB,IB,IB,IB,IB,
/* @ A B C D E F G H I J K L M N O */
IB,38,39,40,41,42,43,44, 45,46,47,48,49,50,51,52,
/* P Q R S T U V W X Y Z [ \ ] ^ _*/
53,54,55,56,57,58,59,60, 61,62,63,IB,IB,IB,IB,IB,
/* ` a b c d e f g h i j k l m n o */
IB,12,13,14,15,16,17,18, 19,20,21,22,23,24,25,26,
/* p q r s t u v w x y z { | } ~ <del> */
27,28,29,30,31,32,33,34, 35,36,37,IB,IB,IB,IB,IB,
};
#define GET_BYTES(dest, source) do { \
*((dest)++) = ((source) >> 24) & 0xFF; \
*((dest)++) = ((source) >> 16) & 0xFF; \
*((dest)++) = ((source) >> 8) & 0xFF; \
*((dest)++) = (source) & 0xFF; \
} while (0);
char *__old_fish_encrypt(const char *key, size_t keylen, const char *message) {
BF_KEY bfkey;
size_t messagelen;
size_t i;
int j;
char *encrypted;
char *end;
unsigned char bit;
unsigned char word;
unsigned char d;
BF_set_key(&bfkey, keylen, (const unsigned char*)key);
messagelen = strlen(message);
if (messagelen == 0) return NULL;
encrypted = g_malloc(((messagelen - 1) / 8) * 12 + 12 + 1); /* each 8-byte block becomes 12 bytes */
end = encrypted;
while (*message) {
/* Read 8 bytes (a Blowfish block) */
BF_LONG binary[2] = { 0, 0 };
unsigned char c;
for (i = 0; i < 8; i++) {
c = message[i];
binary[i >> 2] |= c << 8*(3 - (i&3));
if (c == '\0') break;
}
message += 8;
/* Encrypt block */
BF_encrypt(binary, &bfkey);
/* Emit FiSH-BASE64 */
bit = 0;
word = 1;
for (j = 0; j < 12; j++) {
d = fish_base64[(binary[word] >> bit) & 63];
*(end++) = d;
bit += 6;
if (j == 5) {
bit = 0;
word = 0;
}
}
/* Stop if a null terminator was found */
if (c == '\0') break;
}
*end = '\0';
return encrypted;
}
char *__old_fish_decrypt(const char *key, size_t keylen, const char *data) {
BF_KEY bfkey;
size_t i;
char *decrypted;
char *end;
unsigned char bit;
unsigned char word;
unsigned char d;
BF_set_key(&bfkey, keylen, (const unsigned char*)key);
decrypted = g_malloc(strlen(data) + 1);
end = decrypted;
while (*data) {
/* Convert from FiSH-BASE64 */
BF_LONG binary[2] = { 0, 0 };
bit = 0;
word = 1;
for (i = 0; i < 12; i++) {
d = fish_unbase64[(const unsigned char)*(data++)];
if (d == IB) goto decrypt_end;
binary[word] |= (unsigned long)d << bit;
bit += 6;
if (i == 5) {
bit = 0;
word = 0;
}
}
/* Decrypt block */
BF_decrypt(binary, &bfkey);
/* Copy to buffer */
GET_BYTES(end, binary[0]);
GET_BYTES(end, binary[1]);
}
decrypt_end:
*end = '\0';
return decrypted;
}

View File

@ -1,37 +0,0 @@
/*
Copyright (c) 2010 Samuel Lidén Borell <samuel@kodafritt.se>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#ifndef FISH_OLD_H
#define FISH_OLD_H
#include <stddef.h>
#include <glib.h>
char *__old_fish_encrypt(const char *key, size_t keylen, const char *message);
char *__old_fish_decrypt(const char *key, size_t keylen, const char *data);
#endif

View File

@ -1,4 +0,0 @@
fishlim_old_lib = shared_library('fishlim_old_lib',
['fish.c'],
dependencies: [libgio_dep, libssl_dep],
)

View File

@ -1,5 +1,4 @@
/*
Copyright (c) 2020 <bakasura@protonmail.ch>
Permission is hereby granted, free of charge, to any person obtaining a copy
@ -22,22 +21,19 @@
*/
#ifndef PLUGIN_HEXCHAT_FISHLIM_TEST_H
#define PLUGIN_HEXCHAT_FISHLIM_TEST_H
// Libs
#include <glib.h>
// Project Libs
#include "../fish.h"
#include "../utils.h"
#include "old_version/fish.h"
#include "fish.h"
#include "utils.h"
/**
* Auxiliary function: Generate a random string
* @param out Preallocated string to fill
* @param len Size of bytes to fill
*/
void random_string(char *out, size_t len) {
static void
random_string(char *out, size_t len)
{
GRand *rand = NULL;
int i = 0;
@ -51,13 +47,14 @@ void random_string(char *out, size_t len) {
g_rand_free(rand);
}
/**
* Check encrypt and decrypt in ECB mode and compare with old implementation
* Check encrypt and decrypt in ECB mode
*/
void __ecb(void) {
char *bo64 = NULL, *b64 = NULL;
char *deo = NULL, *de = NULL;
static void
test_ecb(void)
{
char *b64 = NULL;
char *de = NULL;
int key_len, message_len = 0;
char key[57];
char message[1000];
@ -71,36 +68,20 @@ void __ecb(void) {
random_string(message, message_len);
/* Encrypt */
bo64 = __old_fish_encrypt(key, key_len, message);
g_assert_nonnull(bo64);
b64 = fish_encrypt(key, key_len, message, message_len, FISH_ECB_MODE);
g_assert_nonnull(b64);
g_assert_cmpuint(g_strcmp0(b64, bo64), == , 0);
/* Decrypt */
/* Linear */
deo = __old_fish_decrypt(key, key_len, bo64);
de = fish_decrypt_str(key, key_len, b64, FISH_ECB_MODE);
g_assert_nonnull(deo);
g_assert_nonnull(de);
g_assert_cmpuint(g_strcmp0(de, message), == , 0);
g_assert_cmpuint(g_strcmp0(deo, message), == , 0);
g_assert_cmpuint(g_strcmp0(de, deo), == , 0);
g_free(deo);
g_assert_cmpstr (de, ==, message);
g_free(de);
/* Mixed */
deo = __old_fish_decrypt(key, key_len, b64);
de = fish_decrypt_str(key, key_len, bo64, FISH_ECB_MODE);
g_assert_nonnull(deo);
g_assert_nonnull(de);
g_assert_cmpuint(g_strcmp0(de, message), == , 0);
g_assert_cmpuint(g_strcmp0(deo, message), == , 0);
g_assert_cmpuint(g_strcmp0(de, deo), == , 0);
g_free(deo);
de = fish_decrypt_str(key, key_len, b64, FISH_ECB_MODE);
g_assert_cmpstr (de, ==, message);
g_free(de);
/* Free */
g_free(bo64);
g_free(b64);
}
}
@ -109,7 +90,9 @@ void __ecb(void) {
/**
* Check encrypt and decrypt in CBC mode
*/
void __cbc(void) {
static void
test_cbc(void)
{
char *b64 = NULL;
char *de = NULL;
int key_len, message_len = 0;
@ -131,11 +114,9 @@ void __cbc(void) {
/* Decrypt */
/* Linear */
de = fish_decrypt_str(key, key_len, b64, FISH_CBC_MODE);
g_assert_nonnull(de);
g_assert_cmpuint(g_strcmp0(de, message), == , 0);
g_assert_cmpstr (de, ==, message);
g_free(de);
/* Free */
g_free(b64);
}
}
@ -144,13 +125,14 @@ void __cbc(void) {
/**
* Check the calculation of final length from an encoded string in Base64
*/
void __base64_len(void) {
static void
test_base64_len (void)
{
char *b64 = NULL;
int i, message_len = 0;
char message[1000];
for (i = 0; i < 10; ++i) {
for (message_len = 1; message_len < 1000; ++message_len) {
random_string(message, message_len);
b64 = g_base64_encode((const unsigned char *) message, message_len);
@ -164,7 +146,9 @@ void __base64_len(void) {
/**
* Check the calculation of final length from an encoded string in BlowcryptBase64
*/
void __base64_fish_len(void) {
static void
test_base64_fish_len (void)
{
char *b64 = NULL;
int i, message_len = 0;
char message[1000];
@ -181,11 +165,12 @@ void __base64_fish_len(void) {
}
}
/**
* Check the calculation of final length from an encrypted string in ECB mode
*/
void __base64_ecb_len(void) {
static void
test_base64_ecb_len(void)
{
char *b64 = NULL;
int key_len, message_len = 0;
char key[57];
@ -209,7 +194,9 @@ void __base64_ecb_len(void) {
/**
* Check the calculation of final length from an encrypted string in CBC mode
*/
void __base64_cbc_len(void) {
static void
test_base64_cbc_len(void)
{
char *b64 = NULL;
int key_len, message_len = 0;
char key[57];
@ -233,7 +220,9 @@ void __base64_cbc_len(void) {
/**
* Check the calculation of length limit for a plaintext in each encryption mode
*/
void __max_text_command_len(void) {
static void
test_max_text_command_len(void)
{
int max_encoded_len, plaintext_len;
enum fish_mode mode;
@ -248,7 +237,9 @@ void __max_text_command_len(void) {
/**
* Check the calculation of length limit for a plaintext in each encryption mode
*/
void __foreach_utf8_data_chunks(void) {
static void
test_foreach_utf8_data_chunks(void)
{
GRand *rand = NULL;
GString *chunks = NULL;
int tests, max_chunks_len, chunks_len;
@ -277,21 +268,19 @@ void __foreach_utf8_data_chunks(void) {
}
}
int main(int argc, char *argv[]) {
int
main(int argc, char *argv[]) {
g_test_init(&argc, &argv, NULL);
g_test_add_func("/fishlim/__ecb", __ecb);
g_test_add_func("/fishlim/__cbc", __ecb);
g_test_add_func("/fishlim/__base64_len", __base64_len);
g_test_add_func("/fishlim/__base64_fish_len", __base64_fish_len);
g_test_add_func("/fishlim/__base64_ecb_len", __base64_ecb_len);
g_test_add_func("/fishlim/__base64_cbc_len", __base64_cbc_len);
g_test_add_func("/fishlim/__max_text_command_len", __max_text_command_len);
g_test_add_func("/fishlim/__foreach_utf8_data_chunks", __foreach_utf8_data_chunks);
g_test_add_func("/fishlim/ecb", test_ecb);
g_test_add_func("/fishlim/cbc", test_cbc);
g_test_add_func("/fishlim/base64_len", test_base64_len);
g_test_add_func("/fishlim/base64_fish_len", test_base64_fish_len);
g_test_add_func("/fishlim/base64_ecb_len", test_base64_ecb_len);
g_test_add_func("/fishlim/base64_cbc_len", test_base64_cbc_len);
g_test_add_func("/fishlim/max_text_command_len", test_max_text_command_len);
g_test_add_func("/fishlim/foreach_utf8_data_chunks", test_foreach_utf8_data_chunks);
return g_test_run();
}
#endif //PLUGIN_HEXCHAT_FISHLIM_TEST_H

View File

@ -146,7 +146,7 @@ class Plugin:
def loadfile(self, filename):
try:
self.filename = filename
with open(filename) as f:
with open(filename, encoding='utf-8') as f:
data = f.read()
compiled = compile_file(data, filename)
exec(compiled, self.globals)

View File

@ -503,7 +503,7 @@ typedef struct server
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 linebuf[8704]; /* RFC says 512 chars including \r\n, IRCv3 message tags add 8191, plus the NUL byte */
char *last_away_reason;
int pos; /* current position in linebuf */
int nickcount;

View File

@ -67,8 +67,8 @@ send_channel_modes (session *sess, char *tbuf, char *word[], int wpos,
int usable_modes, orig_len, len, wlen, i, max;
server *serv = sess->server;
/* sanity check. IRC RFC says three per line. */
if (serv->modes_per_line < 3)
/* sanity check. IRC RFC says three per line but some servers may support less. */
if (serv->modes_per_line < 1)
serv->modes_per_line = 3;
if (modes_per_line < 1)
modes_per_line = serv->modes_per_line;
@ -880,7 +880,7 @@ inbound_005 (server * serv, char *word[], const message_tags_data *tags_data)
g_free (serv->nick_prefixes);
g_free (serv->nick_modes);
serv->nick_prefixes = g_strdup (pre + 1);
serv->nick_modes = g_strdup (tokvalue);
serv->nick_modes = g_strdup (tokvalue + 1);
} else
{
/* bad! some ircds don't give us the modes. */

View File

@ -503,22 +503,6 @@ process_numeric (session * sess, int n,
goto def;
case 4: /* check the ircd type */
serv->use_listargs = FALSE;
serv->modes_per_line = 3; /* default to IRC RFC */
if (strncmp (word[5], "bahamut", 7) == 0) /* DALNet */
{
serv->use_listargs = TRUE; /* use the /list args */
} else if (strncmp (word[5], "u2.10.", 6) == 0) /* Undernet */
{
serv->use_listargs = TRUE; /* use the /list args */
serv->modes_per_line = 6; /* allow 6 modes per line */
} else if (strncmp (word[5], "glx2", 4) == 0)
{
serv->use_listargs = TRUE; /* use the /list args */
}
goto def;
case 5:
inbound_005 (serv, word, tags_data);
goto def;

View File

@ -362,7 +362,7 @@ server_read (GIOChannel *source, GIOCondition condition, server *serv)
serv->linebuf[serv->pos] = lbuf[i];
if (serv->pos >= (sizeof (serv->linebuf) - 1))
fprintf (stderr,
"*** HEXCHAT WARNING: Buffer overflow - shit server!\n");
"*** HEXCHAT WARNING: Buffer overflow - non-compliant server!\n");
else
serv->pos++;
}
@ -772,7 +772,7 @@ server_connect_success (server *serv)
/* it'll be a memory leak, if connection isn't terminated by
server_cleanup() */
if ((err = _SSL_set_verify (serv->ctx, ssl_cb_verify, NULL)))
if ((err = _SSL_set_verify (serv->ctx, ssl_cb_verify)))
{
EMIT_SIGNAL (XP_TE_CONNFAIL, serv->server_session, err, NULL,
NULL, NULL, 0);
@ -1770,6 +1770,7 @@ server_set_defaults (server *serv)
serv->chanmodes = g_strdup ("beI,k,l");
serv->nick_prefixes = g_strdup ("@%+");
serv->nick_modes = g_strdup ("ohv");
serv->modes_per_line = 3; /* https://datatracker.ietf.org/doc/html/rfc1459#section-4.2.3.1 */
serv->sasl_mech = MECH_PLAIN;
if (!serv->encoding)
@ -1778,6 +1779,7 @@ server_set_defaults (server *serv)
serv->nickcount = 1;
serv->end_of_motd = FALSE;
serv->sent_capend = FALSE;
serv->use_listargs = FALSE;
serv->is_away = FALSE;
serv->supports_watch = FALSE;
serv->supports_monitor = FALSE;

View File

@ -321,23 +321,22 @@ _SSL_socket (SSL_CTX *ctx, int sd)
char *
_SSL_set_verify (SSL_CTX *ctx, void *verify_callback, char *cacert)
_SSL_set_verify (SSL_CTX *ctx, void *verify_callback)
{
#ifdef DEFAULT_CERT_FILE
if (!SSL_CTX_load_verify_locations (ctx, DEFAULT_CERT_FILE, NULL))
{
__SSL_fill_err_buf ("SSL_CTX_load_verify_locations");
return (err_buf);
}
#else
if (!SSL_CTX_set_default_verify_paths (ctx))
{
__SSL_fill_err_buf ("SSL_CTX_set_default_verify_paths");
return (err_buf);
}
/*
if (cacert)
{
if (!SSL_CTX_load_verify_locations (ctx, cacert, NULL))
{
__SSL_fill_err_buf ("SSL_CTX_load_verify_locations");
return (err_buf);
}
}
*/
#endif
SSL_CTX_set_verify (ctx, SSL_VERIFY_PEER, verify_callback);
return (NULL);

View File

@ -45,7 +45,7 @@ SSL_CTX *_SSL_context_init (void (*info_cb_func));
#define _SSL_context_free(a) SSL_CTX_free(a);
SSL *_SSL_socket (SSL_CTX *ctx, int sd);
char *_SSL_set_verify (SSL_CTX *ctx, void *(verify_callback), char *cacert);
char *_SSL_set_verify (SSL_CTX *ctx, void *(verify_callback));
/*
int SSL_connect(SSL *);
int SSL_accept(SSL *);

View File

@ -55,7 +55,7 @@ notification_backend_show (const char *title, const char *text)
g_variant_builder_init (&params, G_VARIANT_TYPE ("(susssasa{sv}i)"));
g_variant_builder_add (&params, "s", "hexchat"); /* App name */
g_variant_builder_add (&params, "u", 0); /* ID, 0 means don't replace */
g_variant_builder_add (&params, "s", ""); /* App icon (set from hints instead) */
g_variant_builder_add (&params, "s", "io.github.Hexchat"); /* App icon */
g_variant_builder_add (&params, "s", title);
g_variant_builder_add (&params, "s", text);
g_variant_builder_add (&params, "as", NULL); /* Actions */

52
win32/AppxManifest.xml.in Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3"
xmlns:uap10="http://schemas.microsoft.com/appx/manifest/uap/windows10/10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" IgnorableNamespaces="uap uap3 uap10 rescap">
<Identity Name="39215TingPing.HexChat" Publisher="CN=0330FC06-4EE0-4AAB-8FB9-F9B6C1FA037F" Version="<#= [string]::Join('.', $versionParts) #>.0" ProcessorArchitecture="x86" />
<Properties>
<DisplayName>HexChat</DisplayName>
<PublisherDisplayName>TingPing</PublisherDisplayName>
<Description>Chat Client</Description>
<Logo>Assets\StoreLogo.png</Logo>
<uap10:PackageIntegrity>
<uap10:Content Enforcement="on" />
</uap10:PackageIntegrity>
</Properties>
<Resources>
<Resource Language="en-us" />
<Resource uap:Scale="100" />
<Resource uap:Scale="125" />
<Resource uap:Scale="150" />
<Resource uap:Scale="200" />
<Resource uap:Scale="400" />
</Resources>
<Dependencies>
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.17763.0" MaxVersionTested="10.0.19041.1" />
<PackageDependency Name="Microsoft.VCLibs.140.00.UWPDesktop" MinVersion="14.0.24217.0" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" />
</Dependencies>
<Capabilities>
<rescap:Capability Name="runFullTrust" />
</Capabilities>
<Applications>
<Application Id="HexChat" Executable="hexchat.exe" EntryPoint="Windows.FullTrustApplication">
<uap:VisualElements DisplayName="HexChat" Description="HexChat" BackgroundColor="transparent" Square150x150Logo="Assets\AppMedTile.png" Square44x44Logo="Assets\AppList.png">
</uap:VisualElements>
<Extensions>
<uap3:Extension Category="windows.protocol">
<uap3:Protocol Name="irc" Parameters="--url=&quot;%1&quot;">
<uap:DisplayName>IRC</uap:DisplayName>
<uap:Logo>Assets\irc.png</uap:Logo>
</uap3:Protocol>
</uap3:Extension>
<uap3:Extension Category="windows.protocol">
<uap3:Protocol Name="ircs" Parameters="--url=&quot;%1&quot;">
<uap:DisplayName>IRCS</uap:DisplayName>
<uap:Logo>Assets\irc.png</uap:Logo>
</uap3:Protocol>
</uap3:Extension>
</Extensions>
</Application>
</Applications>
</Package>

BIN
win32/Assets/AppList.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
win32/Assets/AppMedTile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
win32/Assets/StoreLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
win32/Assets/irc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@ -40,7 +40,8 @@
<None Include="$(DepsRoot)\bin\gthread-2.0-0.dll" />
<None Include="$(DepsRoot)\bin\gtk-win32-2.0.dll" />
<None Include="$(DepsRoot)\bin\iconv.dll" />
<None Include="$(DepsRoot)\bin\libeay32.dll" />
<None Include="$(DepsRoot)\bin\libcrypto*.dll" />
<None Include="$(DepsRoot)\bin\libssl*.dll" />
<None Include="$(DepsRoot)\bin\libenchant.dll" />
<None Include="$(DepsRoot)\bin\ffi-7.dll" />
<None Include="$(DepsRoot)\bin\intl.dll" />
@ -50,12 +51,12 @@
<None Include="$(DepsRoot)\bin\pangocairo-1.0-0.dll" />
<None Include="$(DepsRoot)\bin\pangoft2-1.0-0.dll" />
<None Include="$(DepsRoot)\bin\pangowin32-1.0-0.dll" />
<None Include="$(DepsRoot)\bin\ssleay32.dll" />
<None Include="$(DepsRoot)\bin\zlib1.dll" />
<None Include="$(WinSparklePath)\WinSparkle.dll" />
<None Include="$(HexChatBin)thememan.exe" />
<None Include="changelog.url" />
<None Include="readme.url" />
<None Include="..\Assets\*" />
<None Include="$(DepsRoot)\bin\lua51.dll" />
<None Include="$(DepsRoot)\bin\girepository-1.0-1.dll" />

View File

@ -15,7 +15,7 @@
<!-- G_DISABLE_DEPRECATED is unfeasible due to g_completion_* -->
<!-- must be buildable with GSEAL_ENABLE in the future, xtext, setup, and chanview-tabs stand in the way -->
<OwnFlags>GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline</OwnFlags>
<OwnFlags>GTK_DISABLE_DEPRECATED;GDK_PIXBUF_DISABLE_DEPRECATED;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;GTK_DISABLE_SINGLE_INCLUDES;HAVE_X509_GET_SIGNATURE_NID;HAVE_SSL_CTX_GET_SSL_METHOD;DEFAULT_CERT_FILE="cert.pem";HAVE_STRTOULL;strtoull=_strtoui64;strcasecmp=stricmp;strncasecmp=strnicmp;__inline__=__inline</OwnFlags>
<!-- FIXME: Add ability to use debug builds -->
<DepsRoot>$(YourDepsPath)\$(PlatformName)\release</DepsRoot>
<GendefPath>$(YourGendefPath)</GendefPath>
@ -33,7 +33,7 @@
<LuaLib>lua51</LuaLib>
<Glib>$(DepsRoot)\include\glib-2.0;$(DepsRoot)\lib\glib-2.0\include;$(DepsRoot)\include\libxml2</Glib>
<Gtk>$(DepsRoot)\include\gtk-2.0;$(DepsRoot)\lib\gtk-2.0\include;$(DepsRoot)\include\atk-1.0;$(DepsRoot)\include\cairo;$(DepsRoot)\include\pango-1.0;$(DepsRoot)\include\gdk-pixbuf-2.0</Gtk>
<DepLibs>gtk-win32-2.0.lib;gdk-win32-2.0.lib;atk-1.0.lib;gio-2.0.lib;gdk_pixbuf-2.0.lib;pangowin32-1.0.lib;pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;gobject-2.0.lib;gmodule-2.0.lib;glib-2.0.lib;intl.lib;libxml2.lib;libeay32.lib;ssleay32.lib;wininet.lib;winmm.lib;ws2_32.lib</DepLibs>
<DepLibs>gtk-win32-2.0.lib;gdk-win32-2.0.lib;atk-1.0.lib;gio-2.0.lib;gdk_pixbuf-2.0.lib;pangowin32-1.0.lib;pangocairo-1.0.lib;pango-1.0.lib;cairo.lib;gobject-2.0.lib;gmodule-2.0.lib;glib-2.0.lib;intl.lib;libxml2.lib;libcrypto.lib;libssl.lib;ssleay32.lib;wininet.lib;winmm.lib;ws2_32.lib</DepLibs>
<DataDir>$(SolutionDir)..\data\\</DataDir>
<HexChatBuild>$(SolutionDir)..\..\hexchat-build</HexChatBuild>
<HexChatBin>$(HexChatBuild)\$(PlatformName)\bin\</HexChatBin>

View File

@ -138,7 +138,13 @@ Source: "gspawn-win32-helper-console.exe"; DestDir: "{app}"; Flags: ignoreversio
Source: "gthread-2.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "gtk-win32-2.0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "iconv.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libeay32.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
#if APPARCH == "x64"
Source: "libcrypto-1_1-x64.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libssl-1_1-x64.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
#else
Source: "libcrypto-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "libssl-1_1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
#endif
Source: "libenchant.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "ffi-7.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "intl.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
@ -148,7 +154,6 @@ Source: "pango-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: l
Source: "pangocairo-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pangoft2-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "pangowin32-1.0-0.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "ssleay32.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "plugins\hcnotifications-winrt.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: libs