47 Commits

Author SHA1 Message Date
ba2871dc55 Fix installer offline docs extraction 2026-06-09 13:02:36 -06:00
a14080523e Fix Flatpak workflow indentation 2026-06-09 12:27:03 -06:00
a5cc0c6776 Fix offline docs install paths 2026-06-09 12:09:14 -06:00
337d7684e4 fix download path 2026-06-04 14:44:56 -06:00
deepend-tildeclub
090b39f78b Merge pull request #266 from ZoiteChat/network-meter-alignment
Align text network meter columns
2026-06-02 15:41:57 -06:00
3722de6b13 Align text network meter columns 2026-06-02 14:49:29 -06:00
deepend-tildeclub
d93c9aa780 Merge pull request #255 from ZoiteChat/kde-dialog-native-controls
Use native file chooser dialogs everywhere
2026-05-26 13:14:24 -06:00
ea56504aee Use native file chooser dialogs everywhere 2026-05-26 02:24:06 -06:00
46b91edfdf Bundle Perl paths into AppImage runtime 2026-05-25 23:08:41 -06:00
deepend-tildeclub
d2dfde519d Merge pull request #253 from ZoiteChat/timedate-tooltop
Add timestamp/date hover tooltips
2026-05-25 15:58:40 -06:00
1eac56f22c Add timestamp/date hover tooltips 2026-05-25 14:49:30 -06:00
deepend-tildeclub
fb491a6bb2 Merge pull request #249 from ZoiteChat/lost-connection-fixes
Add configurable stale-link ping checks
2026-05-25 12:21:45 -06:00
3da7c89b66 Add configurable stale-link ping checks 2026-05-25 11:43:10 -06:00
deepend-tildeclub
e842cf3a57 Merge pull request #248 from ZoiteChat/scroll-speed-fix
Fix xtext wheel scroll speed handling + prefs slider
2026-05-25 10:29:40 -06:00
85b0e8f1a6 Fix xtext wheel scroll speed handling + prefs slider 2026-05-25 09:45:22 -06:00
deepend-tildeclub
b8e03ff6c1 Merge pull request #247 from ZoiteChat/fishlim-fixes
Fix FiSHLiM OpenSSL provider/context init issues
2026-05-25 02:24:32 -06:00
54b1703d67 Make FiSHLiM OpenSSL provider loading non-fatal 2026-05-25 02:13:24 -06:00
15d647a0ec Fix detached tab reattach UAF crash path 2026-05-22 14:50:44 -06:00
deepend-tildeclub
353558ddb3 Merge pull request #243 from sney/project-readme
Project readme updates
2026-05-22 09:24:37 -06:00
Jesse Rhodes
9f58d30050 Add more short description. 2026-05-22 09:47:13 -04:00
Jesse Rhodes
4f0632cdf1 Update existing links. 2026-05-22 09:44:29 -04:00
Jesse Rhodes
ff8ba71948 Remove link to incomplete/outdated (?) troubleshooting guide. 2026-05-22 09:41:23 -04:00
Jesse Rhodes
a367591327 Fix download link 404. 2026-05-22 09:38:07 -04:00
Jesse Rhodes
c91925fbc2 Match intro to distro package short descriptions. 2026-05-22 09:36:44 -04:00
479f1649ef Bump release metadata to 2.18.1 2026-05-21 18:11:33 -06:00
deepend-tildeclub
06f69184b6 Merge pull request #239 from ZoiteChat/size_t_int_fixes
Size t int fixes
2026-05-21 17:10:07 -06:00
deepend-tildeclub
3471d9a57c Merge pull request #241 from ZoiteChat/win32-relax-arch-check
Use x64compatible for Windows installer arch checks
2026-05-21 17:09:51 -06:00
28d4035477 Use x64compatible for Windows installer arch checks 2026-05-21 02:50:49 -06:00
deepend-tildeclub
3e1d151efd Merge pull request #240 from ZoiteChat/win32-dependency-update
Use new GTK3 bundle zip in Windows CI
2026-05-21 02:21:51 -06:00
556cfc3036 Use new GTK3 bundle zip in Windows CI 2026-05-20 21:25:37 -06:00
c49b757be6 Clamp Win32 sysinfo UTF length casts 2026-05-20 15:51:07 -06:00
cec7e2caf3 Use size_t for strlen length temporaries 2026-05-20 15:34:19 -06:00
9a0c07a461 Clean up Win32 size/length casts 2026-05-20 15:22:06 -06:00
c7064c18b9 Clamp spell-provider length casts on Win32 2026-05-20 14:51:06 -06:00
deepend-tildeclub
fb897310c8 Merge pull request #238 from ZoiteChat/win32-taskbar-icon-identity
Set Windows AppUserModelID before GTK startup
2026-05-20 11:56:38 -06:00
5944849326 Guard fullscreen menu sync against null session 2026-05-20 10:34:35 -06:00
1255f1e6c7 Fix Win taskbar toggle restore check 2026-05-20 10:19:51 -06:00
d7bc09d859 Fix Win minimize-to-tray taskbar bounce 2026-05-20 09:46:33 -06:00
f84a448351 Fix Win tray restore timer loop/reentry 2026-05-19 21:39:02 -06:00
7e34690e0c Set Windows AppUserModelID before GTK startup 2026-05-19 17:20:08 -06:00
deepend-tildeclub
6f6d378600 Merge pull request #237 from ZoiteChat/ddh-null-gdkwindow
Guard GTK drag/drop handlers against null GdkWindow
2026-05-19 15:55:21 -06:00
deepend-tildeclub
216b463b8f Merge pull request #236 from ZoiteChat/native-dialog-box
Make native file chooser modal on Windows
2026-05-19 15:55:01 -06:00
4ad84cb5e5 Guard GTK drag/drop handlers against null GdkWindow 2026-05-19 15:46:06 -06:00
19e0946717 Make native file chooser modal on Windows 2026-05-19 15:11:55 -06:00
0de1ad06cd Null-safe /set string preference rendering 2026-05-19 15:07:21 -06:00
deepend-tildeclub
72427006dd Merge pull request #231 from mlt/py-eol
fix(python): concatenate bytes in compile_line of py console
2026-05-12 15:34:31 -06:00
Mikhail Titov
23d0963c2d fix(python): decode the console input to str in _on_say_command 2026-05-10 23:57:43 -05:00
43 changed files with 617 additions and 235 deletions

View File

@@ -62,6 +62,11 @@ jobs:
rm -rf AppDir
DESTDIR="${PWD}/AppDir" ninja -C build install
- name: Verify offline docs install
run: |
set -eux
test -f AppDir/usr/share/doc/zoitechat/html/index.html
- name: Bundle scripting runtimes in AppDir
run: |
set -eux
@@ -86,11 +91,21 @@ jobs:
cp -a /usr/lib/x86_64-linux-gnu/python3/dist-packages AppDir/usr/lib/x86_64-linux-gnu/python3/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl-base" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl-base AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/lib/x86_64-linux-gnu/perl5" ]; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/perl5 AppDir/usr/lib/x86_64-linux-gnu/
fi
if [ -d "/usr/share/perl" ]; then
install -d AppDir/usr/share
cp -a /usr/share/perl AppDir/usr/share/
@@ -100,6 +115,10 @@ jobs:
install -d AppDir/usr/share
cp -a /usr/share/perl5 AppDir/usr/share/
fi
perl -MFile::Spec -e 'print "Build host File::Spec: $INC{\"File/Spec.pm\"}\n"'
find AppDir/usr -path '*/File/Spec.pm' -print -quit | grep -q .
if compgen -G '/usr/lib/x86_64-linux-gnu/libpython3*.so*' > /dev/null; then
install -d AppDir/usr/lib/x86_64-linux-gnu
cp -a /usr/lib/x86_64-linux-gnu/libpython3*.so* AppDir/usr/lib/x86_64-linux-gnu/
@@ -162,7 +181,7 @@ jobs:
APPDIR="${APPDIR:-$(dirname "$(readlink -f "$0")")}"
export PATH="${PATH:-/usr/bin:/bin}:$APPDIR/usr/bin"
export PATH="$APPDIR/usr/bin:${PATH:-/usr/bin:/bin}"
export LD_LIBRARY_PATH="$APPDIR/usr/lib:$APPDIR/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
export XDG_DATA_DIRS="$APPDIR/usr/share:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
export GTK_EXE_PREFIX="$APPDIR/usr"
@@ -211,6 +230,23 @@ jobs:
unset GTK_MODULES
perl5lib_entries=""
for dir in \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl-base" \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl"/* \
"$APPDIR/usr/lib/x86_64-linux-gnu/perl5"/* \
"$APPDIR/usr/share/perl"/* \
"$APPDIR/usr/share/perl5"
do
if [ -d "$dir" ]; then
perl5lib_entries="${perl5lib_entries:+$perl5lib_entries:}$dir"
fi
done
if [ -n "$perl5lib_entries" ]; then
export PERL5LIB="$perl5lib_entries${PERL5LIB:+:$PERL5LIB}"
fi
export PYTHONHOME="$APPDIR/usr"
python_stdlib_dir="$(find "$APPDIR/usr/lib" -maxdepth 1 -type d -name 'python3.*' | head -n 1 || true)"
pythonpath_entries=""
@@ -256,7 +292,6 @@ jobs:
EOF
chmod +x AppRun
VERSION="$(git describe --tags --always)"
./linuxdeploy-x86_64.AppImage \

View File

@@ -37,6 +37,12 @@ jobs:
cache: false
restore-cache: false
- name: Verify offline docs install
run: |
flatpak --user install -y zoitechat.flatpak
app_dir="$(flatpak info --user --show-location net.zoite.Zoitechat)"
test -f "$app_dir/files/share/zoitechat/offline-docs/index.html"
- name: Upload Flatpak Bundle
id: upload_flatpak
uses: actions/upload-artifact@v6

View File

@@ -65,8 +65,8 @@ jobs:
Download-WithRetry -Url https://github.com/jrsoftware/issrc/releases/download/is-6_7_1/innosetup-6.7.1.exe -OutFile deps\innosetup-unicode.exe
& deps\innosetup-unicode.exe /VERYSILENT | Out-Null
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.0-pre1/GTK3_Gvsbuild_zoitechat-2.18.0-pre1_${{ matrix.platform }}.7z -OutFile deps\gtk-${{ matrix.arch }}.7z
& 7z.exe x deps\gtk-${{ matrix.arch }}.7z -oC:\gtk-build\gtk\x64\release
Download-WithRetry -Url https://github.com/ZoiteChat/gvsbuild/releases/download/zoitechat-2.18.1/GTK3_Gvsbuild_zoitechat-2.18.1_x64.zip -OutFile deps\gtk-${{ matrix.arch }}.zip
Expand-Archive -LiteralPath deps\gtk-${{ matrix.arch }}.zip -DestinationPath C:\gtk-build\gtk\x64\release -Force
Download-WithRetry -Url https://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-hicolor-icon-theme-0.18-1-any.pkg.tar.zst -OutFile deps\hicolor-icon-theme.pkg.tar.zst
python -c "import tarfile,zstandard,pathlib;archive=pathlib.Path(r'deps\\hicolor-icon-theme.pkg.tar.zst');target=pathlib.Path(r'C:\\gtk-build\\gtk\\x64\\release');dctx=zstandard.ZstdDecompressor();f=archive.open('rb');reader=dctx.stream_reader(f);tf=tarfile.open(fileobj=reader,mode='r|');[tf.extract(m,path=target) for m in tf if m.name.startswith('mingw64/share/icons/hicolor/')];tf.close();reader.close();f.close()"
@@ -132,6 +132,16 @@ jobs:
msbuild win32\zoitechat.sln /m /verbosity:minimal /p:Configuration=Release /p:Platform=${{ matrix.platform }}
shell: cmd
- name: Verify offline docs install
run: |
if not exist "..\zoitechat-build\${{ matrix.platform }}\rel\offline-docs\index.html" exit /b 1
findstr /C:"Name:" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss" | findstr /C:"docs"
findstr /C:"OFFLINEDOCSURL" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss"
findstr /C:"Source:" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss" | findstr /C:"offline-docs"
findstr /C:"offline-docs.tar.gz" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss"
findstr /C:"InstallOfflineDocs" "..\zoitechat-build\${{ matrix.platform }}\bin\zoitechat.iss"
shell: cmd
- name: Preparing Artifacts
run: |
move ..\zoitechat-build\${{ matrix.platform }}\ZoiteChat-*.exe .\

View File

@@ -1,7 +1,28 @@
ZoiteChat ChangeLog
=================
2.18.1 (2026-05-21)
-------------------
- Migrated D-Bus handling to GDBus.
- Enabled mouse wheel channel switching by default and consumed handled tab wheel events.
- Switched main panes to native GTK scrollbars.
- Tightened userlist button and meter layout.
- Made the native Windows file chooser modal.
- Set the Windows AppUserModelID before GTK startup.
- Updated Windows CI to use the new GTK3 bundle zip.
- Updated Windows installer architecture checks to use x64-compatible detection.
- Bumped the Flatpak Perl runtime to 5.42.2.
- Fixed palette color reads to preserve base GTK state.
- Fixed auto-replace whole-word matching.
- Fixed checksum file stream cleanup.
- Fixed byte handling in the Python console.
- Guarded GTK drag-and-drop handlers against null windows.
- Fixed size_t and integer handling issues.
- Removed the Winamp plugin.
2.18.0 (2026-04-20)
-------------------
- Added optional close buttons on tabs.
- Added Ctrl+W to close tabs and Ctrl+Shift+T to reopen recently closed tabs.
@@ -19,6 +40,7 @@ ZoiteChat ChangeLog
- Improved AppStream metainfo validation.
2.18.0~pre6 (2026-03-30)
------------------------
- Applied app theme CSS to the menubar consistently across the app.
- Restored horizontal separator lines in menus.

View File

@@ -7,3 +7,15 @@ if get_option('gtk-frontend')
subdir('misc')
subdir('man')
endif
offline_docs_url = get_option('offline-docs-url')
offline_docs = custom_target('offline-docs',
output: 'offline-docs.stamp',
command: [find_program('python3'), files('misc/fetch_offline_docs.py'), offline_docs_url, '@OUTDIR@', meson.source_root()],
build_by_default: true,
)
meson.add_install_script(
files('misc/install_offline_docs.py'),
join_paths(meson.current_build_dir(), 'offline-docs'),
offline_docs_dir,
)

View File

@@ -0,0 +1,89 @@
#!/usr/bin/env python3
import html
import io
import pathlib
import shutil
import sys
import tarfile
import tempfile
import urllib.error
import urllib.request
url = sys.argv[1]
out_dir = pathlib.Path(sys.argv[2])
source_dir = pathlib.Path(sys.argv[3]) if len(sys.argv) > 3 else pathlib.Path.cwd()
docs_dir = out_dir / "offline-docs"
if docs_dir.exists():
shutil.rmtree(docs_dir)
docs_dir.mkdir(parents=True, exist_ok=True)
def write_source_docs() -> None:
parts = [
'<!doctype html><html><head><meta charset="utf-8">'
"<title>ZoiteChat Documentation</title></head><body>"
"<h1>ZoiteChat Documentation</h1>"
]
for name in ("readme.md", "troubleshooting.md", "changelog.rst"):
path = source_dir / name
if path.exists():
parts.append(
f"<h2>{html.escape(name)}</h2>"
f"<pre>{html.escape(path.read_text(encoding='utf-8', errors='replace'))}</pre>"
)
parts.append("</body></html>")
(docs_dir / "index.html").write_text("\n".join(parts), encoding="utf-8")
def safe_extract(tar: tarfile.TarFile, target: pathlib.Path) -> None:
target = target.resolve()
for member in tar.getmembers():
member_path = (target / member.name).resolve()
if not str(member_path).startswith(str(target) + "/"):
raise tarfile.TarError(f"unsafe archive path: {member.name}")
tar.extractall(target)
def copy_index_tree(extracted_dir: pathlib.Path) -> bool:
indexes = sorted(extracted_dir.rglob("index.html"))
if not indexes:
return False
root = indexes[0].parent
for item in root.iterdir():
dest = docs_dir / item.name
if item.is_dir():
shutil.copytree(item, dest, dirs_exist_ok=True)
else:
shutil.copy2(item, dest)
return (docs_dir / "index.html").exists()
if url:
try:
with urllib.request.urlopen(url, timeout=30) as response:
data = response.read()
with tempfile.TemporaryDirectory() as tmp:
extract_dir = pathlib.Path(tmp)
with tarfile.open(fileobj=io.BytesIO(data), mode="r:gz") as tar:
safe_extract(tar, extract_dir)
if not copy_index_tree(extract_dir):
write_source_docs()
except (OSError, tarfile.TarError, urllib.error.URLError) as error:
print(f"offline docs download failed: {error}", file=sys.stderr)
write_source_docs()
else:
write_source_docs()
(out_dir / "offline-docs.stamp").write_text("ok", encoding="utf-8")

View File

@@ -0,0 +1,13 @@
#!/usr/bin/env python3
import os
import pathlib
import shutil
import sys
src = pathlib.Path(sys.argv[1])
dest = pathlib.Path(os.environ['MESON_INSTALL_DESTDIR_PREFIX']) / sys.argv[2]
if not (src / 'index.html').exists():
sys.exit(0)
if dest.exists():
shutil.rmtree(dest)
shutil.copytree(src, dest)

View File

@@ -29,6 +29,28 @@
<id>zoitechat.desktop</id>
</provides>
<releases>
<release date="2026-05-21" version="2.18.1">
<description>
<ul>
<li>Migrated D-Bus handling to GDBus.</li>
<li>Enabled mouse wheel channel switching by default and consumed handled tab wheel events.</li>
<li>Switched main panes to native GTK scrollbars.</li>
<li>Tightened userlist button and meter layout.</li>
<li>Made the native Windows file chooser modal.</li>
<li>Set the Windows AppUserModelID before GTK startup.</li>
<li>Updated Windows CI to use the new GTK3 bundle zip.</li>
<li>Updated Windows installer architecture checks to use x64-compatible detection.</li>
<li>Bumped the Flatpak Perl runtime to 5.42.2.</li>
<li>Fixed palette color reads to preserve base GTK state.</li>
<li>Fixed auto-replace whole-word matching.</li>
<li>Fixed checksum file stream cleanup.</li>
<li>Fixed byte handling in the Python console.</li>
<li>Guarded GTK drag-and-drop handlers against null windows.</li>
<li>Fixed size_t and integer handling issues.</li>
<li>Removed the Winamp plugin.</li>
</ul>
</description>
</release>
<release date="2026-04-20" version="2.18.0">
<description>
<p>Tabs and navigation:</p>

View File

@@ -56,7 +56,9 @@
"-Ddbus-service-use-appid=true",
"-Dwith-perl=perl",
"-Dwith-python=python3",
"-Dwith-lua=lua"
"-Dwith-lua=lua",
"-Doffline-docs-package=net.zoite.Zoitechat",
"-Doffline-docs-dir=share/zoitechat/offline-docs"
],
"build-options": {
"cflags": "-Wno-error=missing-include-dirs"

View File

@@ -1,5 +1,5 @@
project('zoitechat', 'c',
version: '2.18.0',
version: '2.18.1',
meson_version: '>= 0.55.0',
default_options: [
'c_std=c17',
@@ -32,8 +32,18 @@ config_h = configuration_data()
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat')
offline_docs_package = get_option('offline-docs-package')
if offline_docs_package == ''
offline_docs_package = meson.project_name()
endif
offline_docs_dir = get_option('offline-docs-dir')
if offline_docs_dir == ''
offline_docs_dir = join_paths(get_option('datadir'), 'doc', offline_docs_package, 'html')
endif
config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'),
get_option('datadir'), 'locale'))
config_h.set_quoted('ZOITECHATDOCDIR', join_paths(get_option('prefix'),
offline_docs_dir))
config_h.set10('ENABLE_NLS', true)
# Optional features

View File

@@ -62,3 +62,13 @@ option('with-upd', type: 'boolean',
option('with-perl-legacy-api', type: 'boolean', value: false,
description: 'Enables the legacy IRC perl module for compatibility with old scripts'
)
option('offline-docs-url', type: 'string', value: 'https://dl.zoitechat.org/offlinedocs/zoitechat-docs-html-2.18.1.tar.gz',
description: 'URL for offline documentation archive (tar.gz)'
)
option('offline-docs-package', type: 'string', value: '',
description: 'Package or app id to use under the installed documentation directory'
)
option('offline-docs-dir', type: 'string', value: '',
description: 'Installed offline documentation directory relative to prefix'
)

View File

@@ -66,4 +66,5 @@ build() {
package() {
meson install -C build --destdir "$pkgdir"
test -f "$pkgdir/usr/share/doc/zoitechat/html/index.html"
}

View File

@@ -91,27 +91,13 @@ static const signed char fish_unbase64[256] = {
#include <openssl/provider.h>
static OSSL_PROVIDER *legacy_provider;
static OSSL_PROVIDER *default_provider;
static OSSL_LIB_CTX *ossl_ctx;
#endif
int fish_init(void)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
ossl_ctx = OSSL_LIB_CTX_new();
if (!ossl_ctx)
return 0;
legacy_provider = OSSL_PROVIDER_load(ossl_ctx, "legacy");
if (!legacy_provider) {
fish_deinit();
return 0;
}
default_provider = OSSL_PROVIDER_load(ossl_ctx, "default");
if (!default_provider) {
fish_deinit();
return 0;
}
legacy_provider = OSSL_PROVIDER_load(NULL, "legacy");
default_provider = OSSL_PROVIDER_load(NULL, "default");
#endif
return 1;
}
@@ -129,10 +115,6 @@ void fish_deinit(void)
default_provider = NULL;
}
if (ossl_ctx) {
OSSL_LIB_CTX_free(ossl_ctx);
ossl_ctx = NULL;
}
#endif
}
@@ -278,7 +260,9 @@ char *fish_cipher(const char *plaintext, size_t plaintext_len, const char *key,
}
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
cipher = EVP_CIPHER_fetch(ossl_ctx, "BF-CBC", NULL);
cipher = EVP_CIPHER_fetch(NULL, "BF-CBC", NULL);
if (!cipher)
cipher = (EVP_CIPHER *) EVP_bf_cbc();
#else
cipher = (EVP_CIPHER *) EVP_bf_cbc();
#endif
@@ -286,7 +270,9 @@ char *fish_cipher(const char *plaintext, size_t plaintext_len, const char *key,
} else if (mode == EVP_CIPH_ECB_MODE) {
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
cipher = EVP_CIPHER_fetch(ossl_ctx, "BF-ECB", NULL);
cipher = EVP_CIPHER_fetch(NULL, "BF-ECB", NULL);
if (!cipher)
cipher = (EVP_CIPHER *) EVP_bf_ecb();
#else
cipher = (EVP_CIPHER *) EVP_bf_ecb();
#endif

View File

@@ -421,7 +421,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
zoitechat_commandf(ph, "quote NOTICE %s :DH1080_FINISH %s%s", sender, pub_key, (mode == FISH_CBC_MODE) ? " CBC" : "");
g_free(pub_key);
} else {
zoitechat_print(ph, "Failed to generate keys");
zoitechat_printf(ph, "Failed to generate keys");
goto cleanup;
}
} else if (!strcmp (dh_message, "DH1080_FINISH")) {
@@ -446,7 +446,7 @@ static int handle_keyx_notice(char *word[], char *word_eol[], void *userdata) {
zoitechat_printf(ph, "Stored new key for %s (%s)", sender, fish_modes[mode]);
g_free(secret_key);
} else {
zoitechat_print(ph, "Failed to create secret key!");
zoitechat_printf(ph, "Failed to create secret key!");
}
cleanup:
@@ -548,7 +548,7 @@ static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
}
if ((query_ctx && ctx_type != 3) || (!query_ctx && !irc_is_query(target))) {
zoitechat_print(ph, "You can only exchange keys with individuals");
zoitechat_printf(ph, "You can only exchange keys with individuals");
return ZOITECHAT_EAT_ALL;
}
@@ -560,7 +560,7 @@ static int handle_keyx(char *word[], char *word_eol[], void *userdata) {
g_free(pub_key);
} else {
zoitechat_print(ph, "Failed to generate keys");
zoitechat_printf(ph, "Failed to generate keys");
}
return ZOITECHAT_EAT_ALL;
@@ -577,7 +577,7 @@ static int handle_crypt_topic(char *word[], char *word_eol[], void *userdata) {
GSList *encrypted_list;
if (!*topic) {
zoitechat_print(ph, usage_topic);
zoitechat_printf(ph, "%s", usage_topic);
return ZOITECHAT_EAT_ALL;
}
@@ -624,7 +624,7 @@ static int handle_crypt_notice(char *word[], char *word_eol[], void *userdata) {
GSList *encrypted_list, *encrypted_item;
if (!*target || !*notice) {
zoitechat_print(ph, usage_notice);
zoitechat_printf(ph, "%s", usage_notice);
return ZOITECHAT_EAT_ALL;
}
@@ -676,7 +676,7 @@ static int handle_crypt_msg(char *word[], char *word_eol[], void *userdata) {
GSList *encrypted_list, *encrypted_item;
if (!*target || !*message) {
zoitechat_print(ph, usage_msg);
zoitechat_printf(ph, "%s", usage_msg);
return ZOITECHAT_EAT_ALL;
}
@@ -805,11 +805,15 @@ int zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
zoitechat_hook_server_attrs(ph, "TOPIC", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
zoitechat_hook_server_attrs(ph, "332", ZOITECHAT_PRI_NORM, handle_incoming, NULL);
if (!fish_init())
if (!fish_init()) {
zoitechat_printf(ph, "FiSHLiM failed to initialize crypto backend");
return 0;
}
if (!dh1080_init())
if (!dh1080_init()) {
zoitechat_printf(ph, "FiSHLiM failed to initialize DH1080");
return 0;
}
pending_exchanges = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);

View File

@@ -19,7 +19,7 @@ else:
if not hasattr(sys, 'argv'):
sys.argv = ['<zoitechat>']
VERSION = b'2.18.0'
VERSION = b'2.18.1'
PLUGIN_NAME = ffi.new('char[]', b'Python')
PLUGIN_DESC = ffi.new('char[]', b'Python %d.%d scripting interface' % (sys.version_info[0], sys.version_info[1]))
PLUGIN_VERSION = ffi.new('char[]', VERSION)
@@ -320,9 +320,9 @@ def _on_say_command(word, word_eol, userdata):
return 0
try:
python = _cstr(word_eol[1])
python = __decode(_cstr(word_eol[1]))
except Exception:
python = b''
python = ''
if not python:
return 1

View File

@@ -31,12 +31,19 @@
<br />
ZoiteChat is an HexChat based IRC client for Windows and UNIX-like operating systems.
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
For more information on ZoiteChat please read our [documentation](https://docs.zoitechat.org/):
- [Downloads](https://zoitechat.org/download)
ZoiteChat is a GTK3 IRC client based on HexChat, available for Windows and UNIX-like operating systems.
- [Troubleshooting](troubleshooting.md)
Features include HexChat-compatible Python, Perl and Lua scripting support, a plugin API,
multiple server/channel windows, spell checking, multiple authentication methods including SASL,
and customizable notifications.
See [IRCHelp.org](http://irchelp.org) for information about IRC in general.
For more information on ZoiteChat:
- [Main Documentation](https://docs.zoitechat.org/) and [FAQ](https://docs.zoitechat.org/en/latest/faq.html)
- [Downloads](https://zoitechat.org/download.php)
---

View File

@@ -447,6 +447,7 @@ const struct prefs vars[] =
{"gui_tab_layout", P_OFFINT (hex_gui_tab_layout), TYPE_INT},
{"gui_tab_closebuttons", P_OFFINT (hex_gui_tab_closebuttons), TYPE_BOOL},
{"gui_tab_middleclose", P_OFFINT (hex_gui_tab_middleclose), TYPE_BOOL},
{"gui_mouse_scroll_speed", P_OFFINT (hex_gui_mouse_scroll_speed), TYPE_INT},
{"gui_tab_newtofront", P_OFFINT (hex_gui_tab_newtofront), TYPE_INT},
{"gui_tab_pos", P_OFFINT (hex_gui_tab_pos), TYPE_INT},
{"gui_tab_scrollchans", P_OFFINT (hex_gui_tab_scrollchans), TYPE_BOOL},
@@ -548,6 +549,10 @@ const struct prefs vars[] =
#endif
{"net_bind_host", P_OFFSET (hex_net_bind_host), TYPE_STR},
{"net_ping_timeout", P_OFFINT (hex_net_ping_timeout), TYPE_INT, zoitechat_reinit_timers},
{"net_lag_check", P_OFFINT (hex_net_lag_check), TYPE_INT, zoitechat_reinit_timers},
{"net_keepalive_idle", P_OFFINT (hex_net_keepalive_idle), TYPE_INT},
{"net_keepalive_interval", P_OFFINT (hex_net_keepalive_interval), TYPE_INT},
{"net_keepalive_count", P_OFFINT (hex_net_keepalive_count), 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},
@@ -783,6 +788,7 @@ load_default_config(void)
prefs.hex_gui_tab_server = 1;
prefs.hex_gui_tab_sort = 1;
prefs.hex_gui_tab_scrollchans = 1;
prefs.hex_gui_mouse_scroll_speed = 10;
prefs.hex_gui_topicbar = 1;
prefs.hex_gui_transparency = 255;
prefs.hex_gui_tray = 1;
@@ -858,6 +864,10 @@ load_default_config(void)
prefs.hex_irc_ban_type = 1;
prefs.hex_irc_join_delay = 5;
prefs.hex_net_ping_timeout = 60;
prefs.hex_net_lag_check = 60;
prefs.hex_net_keepalive_idle = 60;
prefs.hex_net_keepalive_interval = 20;
prefs.hex_net_keepalive_count = 3;
prefs.hex_net_reconnect_delay = 10;
prefs.hex_notify_timeout = 15;
prefs.hex_text_max_indent = 256;
@@ -1168,8 +1178,11 @@ set_showval (session *sess, const struct prefs *var, char *tbuf)
switch (var->type)
{
case TYPE_STR:
sprintf (tbuf + len, "\0033:\017 %s\n", (char *) &prefs + var->offset);
break;
{
const char *value = (char *) &prefs + var->offset;
sprintf (tbuf + len, "\0033:\017 %s\n", value ? value : "");
}
break;
case TYPE_INT:
sprintf (tbuf + len, "\0033:\017 %d\n", *((int *) &prefs + var->offset));
break;

View File

@@ -34,6 +34,9 @@
#ifndef WIN32
#include <unistd.h>
#ifdef HAVE_NETINET_TCP_H
#include <netinet/tcp.h>
#endif
#endif
#define WANTSOCKET
@@ -43,6 +46,9 @@
#define NETWORK_PRIVATE
#include "network.h"
#include "zoitechat.h"
extern struct zoitechatprefs prefs;
#define RAND_INT(n) ((int)(rand() / (RAND_MAX + 1.0) * (n)))
@@ -58,6 +64,27 @@ net_set_socket_options (int sok)
setsockopt (sok, SOL_SOCKET, SO_REUSEADDR, (char *) &sw, sizeof (sw));
sw = 1;
setsockopt (sok, SOL_SOCKET, SO_KEEPALIVE, (char *) &sw, sizeof (sw));
#ifdef TCP_KEEPIDLE
{
int keepidle = prefs.hex_net_keepalive_idle;
if (keepidle > 0)
setsockopt (sok, IPPROTO_TCP, TCP_KEEPIDLE, (char *) &keepidle, sizeof (keepidle));
}
#endif
#ifdef TCP_KEEPINTVL
{
int keepintvl = prefs.hex_net_keepalive_interval;
if (keepintvl > 0)
setsockopt (sok, IPPROTO_TCP, TCP_KEEPINTVL, (char *) &keepintvl, sizeof (keepintvl));
}
#endif
#ifdef TCP_KEEPCNT
{
int keepcnt = prefs.hex_net_keepalive_count;
if (keepcnt > 0)
setsockopt (sok, IPPROTO_TCP, TCP_KEEPCNT, (char *) &keepcnt, sizeof (keepcnt));
}
#endif
}
char *

View File

@@ -4397,7 +4397,7 @@ void
check_special_chars (char *cmd, int do_ascii) /* check for %X */
{
int occur = 0;
int len = strlen (cmd);
size_t len = strlen (cmd);
char *buf, *utf;
char tbuf[4];
int i = 0, j = 0;

View File

@@ -1017,7 +1017,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
char *account;
char ip[128], nick[NICKLEN];
char *text, *ex;
int len = strlen (type);
size_t len = strlen (type);
/* fill in the "ip" and "nick" buffers */
ex = strchr (word[1], '!');

View File

@@ -22,6 +22,7 @@
#include <ctype.h>
#include <inttypes.h>
#include <limits.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
@@ -74,6 +75,18 @@ typedef struct
static bool string_builder_init (StringBuilder *builder);
static void string_builder_free (StringBuilder *builder);
static bool string_builder_append (StringBuilder *builder, const char *text);
static int size_to_int (size_t value);
static int
size_to_int (size_t value)
{
if (value > (size_t) INT_MAX)
{
return INT_MAX;
}
return (int) value;
}
char *
sysinfo_get_cpu (void)
@@ -511,6 +524,7 @@ static char *read_hdd_info (IWbemClassObject *object)
static char *bstr_to_utf8 (BSTR bstr)
{
int utf8_len;
int wide_len;
char *utf8;
if (bstr == NULL)
@@ -518,7 +532,8 @@ static char *bstr_to_utf8 (BSTR bstr)
return NULL;
}
utf8_len = WideCharToMultiByte (CP_UTF8, 0, bstr, SysStringLen (bstr), NULL, 0, NULL, NULL);
wide_len = size_to_int ((size_t) SysStringLen (bstr));
utf8_len = WideCharToMultiByte (CP_UTF8, 0, bstr, wide_len, NULL, 0, NULL, NULL);
if (utf8_len <= 0)
{
return NULL;
@@ -530,7 +545,7 @@ static char *bstr_to_utf8 (BSTR bstr)
return NULL;
}
if (WideCharToMultiByte (CP_UTF8, 0, bstr, SysStringLen (bstr), utf8, utf8_len, NULL, NULL) <= 0)
if (WideCharToMultiByte (CP_UTF8, 0, bstr, wide_len, utf8, utf8_len, NULL, NULL) <= 0)
{
free (utf8);
return NULL;

View File

@@ -321,7 +321,7 @@ url_check_line (char *buf)
for (i = 0; i < ARRAY_SIZE (commands); i++)
{
char *cmd = commands[i];
int len = strlen (cmd);
size_t len = strlen (cmd);
if (strncmp (cmd, po, len) == 0)
{

View File

@@ -98,7 +98,7 @@ path_part (char *file, char *path, int pathlen)
char * /* like strstr(), but nocase */
nocasestrstr (const char *s, const char *wanted)
{
register const int len = strlen (wanted);
register const size_t len = strlen (wanted);
if (len == 0)
return (char *)s;

View File

@@ -379,6 +379,7 @@ lag_check (void)
char tbuf[128];
time_t now = time (0);
time_t lag;
time_t ping_age;
tim = make_ping_time ();
@@ -388,7 +389,7 @@ lag_check (void)
if (serv->connected && serv->end_of_motd)
{
lag = now - serv->ping_recv;
if (prefs.hex_net_ping_timeout != 0 && lag > prefs.hex_net_ping_timeout && lag > 0)
if (serv->lag_sent && prefs.hex_net_ping_timeout != 0 && lag > prefs.hex_net_ping_timeout && lag > 0)
{
sprintf (tbuf, "%" G_GINT64_FORMAT, (gint64) lag);
EMIT_SIGNAL (XP_TE_PINGTIMEOUT, serv->server_session, tbuf, NULL,
@@ -398,11 +399,11 @@ lag_check (void)
}
else
{
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
serv->p_ping (serv, "", tbuf);
if (!serv->lag_sent)
ping_age = now - serv->ping_recv;
if (!serv->lag_sent && prefs.hex_net_lag_check > 0 && ping_age >= prefs.hex_net_lag_check)
{
g_snprintf (tbuf, sizeof (tbuf), "LAG%lu", tim);
serv->p_ping (serv, "", tbuf);
serv->lag_sent = tim;
fe_set_lag (serv, -1);
}
@@ -525,7 +526,7 @@ zoitechat_reinit_timers (void)
if ((prefs.hex_net_ping_timeout != 0 || prefs.hex_gui_lagometer)
&& lag_check_tag == 0)
{
lag_check_tag = fe_timeout_add_seconds (30, zoitechat_lag_check, NULL);
lag_check_tag = fe_timeout_add_seconds (1, zoitechat_lag_check, NULL);
}
else if ((!prefs.hex_net_ping_timeout && !prefs.hex_gui_lagometer)
&& lag_check_tag != 0)

View File

@@ -267,6 +267,7 @@ struct zoitechatprefs
int hex_gui_tab_layout;
int hex_gui_tab_closebuttons;
int hex_gui_tab_middleclose;
int hex_gui_mouse_scroll_speed;
int hex_gui_tab_newtofront;
int hex_gui_tab_pos;
int hex_gui_tab_small;
@@ -289,6 +290,10 @@ struct zoitechatprefs
int hex_irc_join_delay;
int hex_irc_notice_pos;
int hex_net_ping_timeout;
int hex_net_lag_check;
int hex_net_keepalive_idle;
int hex_net_keepalive_interval;
int hex_net_keepalive_count;
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 */

View File

@@ -452,7 +452,7 @@ void
fe_add_chan_list (server *serv, char *chan, char *users, char *topic)
{
chanlistrow *next_row;
int len = strlen (chan) + 1;
size_t len = strlen (chan) + 1;
/* we allocate the struct and channel string in one go */
next_row = g_malloc (sizeof (chanlistrow) + len);

View File

@@ -305,12 +305,14 @@ static gboolean
tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv)
{
int direction = cv_scroll_direction (event);
int i;
if (prefs.hex_gui_tab_scrollchans)
{
if (direction != 0)
{
mg_switch_page (1, direction);
for (i = 0; i < cv_scroll_step_count (); i++)
mg_switch_page (1, direction);
return TRUE;
}
}
@@ -318,12 +320,14 @@ tab_scroll_cb (GtkWidget *widget, GdkEventScroll *event, gpointer cv)
{
if (direction < 0)
{
tab_scroll_left_up_clicked (widget, cv);
for (i = 0; i < cv_scroll_step_count (); i++)
tab_scroll_left_up_clicked (widget, cv);
return TRUE;
}
else if (direction > 0)
{
tab_scroll_right_down_clicked (widget, cv);
for (i = 0; i < cv_scroll_step_count (); i++)
tab_scroll_right_down_clicked (widget, cv);
return TRUE;
}
}

View File

@@ -112,9 +112,11 @@ cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer user
if (prefs.hex_gui_tab_scrollchans)
{
int direction = cv_scroll_direction (event);
int i;
if (direction != 0)
mg_switch_page (1, direction);
for (i = 0; i < cv_scroll_step_count (); i++)
mg_switch_page (1, direction);
return direction != 0;
}

View File

@@ -126,6 +126,15 @@ cv_scroll_direction (GdkEventScroll *event)
}
}
static int
cv_scroll_step_count (void)
{
int speed = prefs.hex_gui_mouse_scroll_speed;
if (speed < 1)
speed = 1;
return (speed + 9) / 10;
}
/* ======= TABS ======= */

View File

@@ -124,6 +124,25 @@ create_msg_dialog (gchar *title, gchar *message)
static char *win32_argv0_dir;
static void
win32_set_appusermodelid (void)
{
HMODULE shell32;
HRESULT (WINAPI *set_appid) (PCWSTR);
shell32 = GetModuleHandleW (L"shell32.dll");
if (!shell32)
shell32 = LoadLibraryW (L"shell32.dll");
if (!shell32)
return;
set_appid = (HRESULT (WINAPI *) (PCWSTR)) GetProcAddress (shell32, "SetCurrentProcessExplicitAppUserModelID");
if (!set_appid)
return;
set_appid (L"ZoiteChat.Desktop.Notify");
}
static void
win32_set_gsettings_schema_dir (void)
{
@@ -422,6 +441,7 @@ fe_args (int argc, char *argv[])
#ifdef WIN32
win32_set_gsettings_schema_dir ();
win32_set_appusermodelid ();
win32_configure_pixbuf_loaders ();
/* this is mainly for irc:// URL handling. When windows calls us from */

View File

@@ -44,6 +44,7 @@ REM zoitechat.rc needs to be in UCS-2 or Resource Compiler will complain
powershell "Get-Content -Encoding UTF8 '$(ZoiteChatLib)zoitechat.rc.utf8' | Out-File '$(ZoiteChatLib)zoitechat.rc'; Remove-Item '$(ZoiteChatLib)zoitechat.rc.utf8'"
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-header --manual-register --sourcedir "$(DataDir)" --target "$(ZoiteChatLib)resources.h" "$(DataDir)zoitechat.gresource.xml"
"$(DepsRoot)\bin\glib-compile-resources.exe" --generate-source --manual-register --sourcedir "$(DataDir)" --target "$(ZoiteChatLib)resources.c" "$(DataDir)zoitechat.gresource.xml"
"$(Python3Path)\python.exe" "$(DataDir)misc\fetch_offline_docs.py" "$(OfflineDocsUrl)" "$(ZoiteChatRel)." "$(SolutionDir).."
]]></Command>
<Message>Build zoitechat.rc and gresource file</Message>
</PreBuildEvent>

View File

@@ -272,13 +272,6 @@ gtkutil_apply_palette (GtkWidget *widget, const GdkRGBA *bg, const GdkRGBA *fg,
theme_manager_apply_palette_widget (widget, bg, fg, font_desc);
}
static void
gtkutil_file_req_destroy (GtkWidget * wid, struct file_req *freq)
{
freq->callback (freq->userdata, NULL);
g_free (freq);
}
static void
gtkutil_check_file (char *filename, struct file_req *freq)
{
@@ -390,26 +383,6 @@ gtkutil_file_req_done_chooser (GtkFileChooser *fs, struct file_req *freq)
}
static void
gtkutil_file_req_done (GtkWidget * wid, struct file_req *freq)
{
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (freq->dialog), freq);
gtk_widget_destroy (freq->dialog);
}
static void
gtkutil_file_req_response (GtkWidget *dialog, gint res, struct file_req *freq)
{
if (res == GTK_RESPONSE_ACCEPT)
{
gtkutil_file_req_done (dialog, freq);
return;
}
gtk_widget_destroy (dialog);
}
#ifdef WIN32
static gboolean
gtkutil_native_dialog_unref_idle (gpointer native)
{
@@ -423,27 +396,16 @@ gtkutil_native_file_req_response (GtkNativeDialog *dialog, gint res, struct file
if (res == GTK_RESPONSE_ACCEPT)
gtkutil_file_req_done_chooser (GTK_FILE_CHOOSER (dialog), freq);
/* Match gtk dialog flow by always sending NULL to indicate completion. */
freq->callback (freq->userdata, NULL);
g_free (freq);
/*
* Defer unref until idle to avoid disposing the native chooser while
* still in the button-release signal stack on Windows.
*/
g_idle_add (gtkutil_native_dialog_unref_idle, dialog);
}
#endif
void
gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *userdata, char *filter, char *extensions,
int flags)
{
struct file_req *freq;
GtkWidget *dialog;
GtkFileFilter *filefilter;
char *token;
char *tokenbuffer;
const char *xdir;
GtkWindow *effective_parent = parent;
@@ -453,7 +415,6 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
xdir = get_xdir ();
#ifdef WIN32
{
GtkFileChooserNative *native = gtk_file_chooser_native_new (
title,
@@ -522,110 +483,14 @@ gtkutil_file_req (GtkWindow *parent, const char *title, void *callback, void *us
g_signal_connect (native, "response",
G_CALLBACK (gtkutil_native_file_req_response), freq);
if (flags & FRF_MODAL)
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (native), TRUE);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
return;
}
#endif
if (flags & FRF_WRITE)
{
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Save"), GTK_RESPONSE_ACCEPT,
NULL);
if (!(flags & FRF_NOASKOVERWRITE))
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
}
else
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Open"), GTK_RESPONSE_ACCEPT,
NULL);
theme_manager_attach_window (dialog);
if (filter && filter[0] && (flags & FRF_FILTERISINITIAL))
{
if (flags & FRF_WRITE)
{
char temp[1024];
path_part (filter, temp, sizeof (temp));
if (temp[0] && g_file_test (temp, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), temp);
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), file_part (filter));
}
else
{
if (g_file_test (filter, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), filter);
else if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
}
}
else if (!(flags & FRF_RECENTLYUSED))
{
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), xdir);
}
if (flags & FRF_MULTIPLE)
gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
if (flags & FRF_CHOOSEFOLDER)
gtk_file_chooser_set_action (GTK_FILE_CHOOSER (dialog), GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
if ((flags & FRF_EXTENSIONS || flags & FRF_MIMETYPES) && extensions != NULL)
{
filefilter = gtk_file_filter_new ();
tokenbuffer = g_strdup (extensions);
token = strtok (tokenbuffer, ";");
while (token != NULL)
{
if (flags & FRF_EXTENSIONS)
gtk_file_filter_add_pattern (filefilter, token);
else
gtk_file_filter_add_mime_type (filefilter, token);
token = strtok (NULL, ";");
}
g_free (tokenbuffer);
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filefilter);
}
if (xdir && xdir[0] && g_file_test (xdir, G_FILE_TEST_IS_DIR))
{
GError *shortcut_error = NULL;
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (dialog), xdir, &shortcut_error);
if (shortcut_error)
g_error_free (shortcut_error);
}
freq = g_new (struct file_req, 1);
freq->dialog = dialog;
freq->flags = flags;
freq->callback = callback;
freq->userdata = userdata;
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (gtkutil_file_req_response), freq);
g_signal_connect (G_OBJECT (dialog), "destroy",
G_CALLBACK (gtkutil_file_req_destroy), (gpointer) freq);
if (effective_parent)
gtk_window_set_transient_for (GTK_WINDOW (dialog), effective_parent);
if (flags & FRF_MODAL)
{
g_assert (effective_parent);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
}
gtk_widget_show (dialog);
}
static gboolean
@@ -972,7 +837,7 @@ gtkutil_copy_to_clipboard (GtkWidget *widget, GdkAtom selection,
win = gtk_widget_get_toplevel (GTK_WIDGET (widget));
if (gtk_widget_is_toplevel (win))
{
int len = strlen (str);
gint len = (gint) strlen (str);
if (selection)
{

View File

@@ -902,7 +902,12 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
(event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
prefs.hex_gui_tray_minimize && prefs.hex_gui_tray &&
gtkutil_tray_icon_supported (wid))
gtkutil_tray_icon_supported (wid)
#ifndef WIN32
)
#else
&& !gtk_window_is_active (wid))
#endif
{
tray_toggle_visibility (TRUE);
}
@@ -947,7 +952,8 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->window))
gtk_widget_queue_draw (sess->gui->window);
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
if (current_sess && current_sess->gui)
menu_set_fullscreen (current_sess->gui, prefs.hex_gui_win_fullscreen);
#ifdef G_OS_WIN32
mg_win32_allow_autohide_taskbar (wid, event);
@@ -2699,7 +2705,6 @@ mg_changui_destroy (session *sess)
/* it fixes: Gdk-CRITICAL **: gdk_colormap_get_screen: */
/* assertion `GDK_IS_COLORMAP (cmap)' failed */
ret = sess->gui->window;
g_free (sess->gui);
sess->gui = NULL;
}
return ret;
@@ -2721,13 +2726,17 @@ mg_link_irctab (session *sess, int focus)
return;
}
session_gui *old_gui;
mg_unpopulate (sess);
old_gui = sess->gui;
win = mg_changui_destroy (sess);
mg_changui_new (sess, sess->res, 1, focus);
/* the buffer is now attached to a different widget */
((xtext_buffer *)sess->res->buffer)->xtext = (GtkXText *)sess->gui->xtext;
if (win)
gtk_widget_destroy (win);
g_free (old_gui);
}
void
@@ -3462,7 +3471,7 @@ mg_create_infoframe (GtkWidget *box)
frame = gtk_frame_new (0);
gtk_frame_set_shadow_type ((GtkFrame*)frame, GTK_SHADOW_OUT);
gtk_box_pack_start (GTK_BOX (box), frame, FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), frame, TRUE, TRUE, 0);
hbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
gtk_container_add (GTK_CONTAINER (frame), hbox);
@@ -3483,7 +3492,7 @@ mg_create_meters (session_gui *gui, GtkWidget *parent_box)
if ((prefs.hex_gui_lagometer & 2) || (prefs.hex_gui_throttlemeter & 2))
{
infbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
infbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, TRUE, 0);
gtk_box_pack_start (GTK_BOX (box), infbox, 0, 0, 0);
}
@@ -4727,7 +4736,14 @@ mg_win32_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data)
{
if (strcmp (command, "__WIN32_TASKBAR_TOGGLE__") == 0)
{
if (gtk_widget_get_visible (current_sess->gui->window))
GdkWindowState state = 0;
GdkWindow *gdk_window = gtk_widget_get_window (current_sess->gui->window);
if (gdk_window)
state = gdk_window_get_state (gdk_window);
if (gtk_widget_get_visible (current_sess->gui->window)
&& (state & GDK_WINDOW_STATE_ICONIFIED) == 0)
fe_ctrl_gui (current_sess, FE_GUI_ICONIFY, 0);
else
fe_ctrl_gui (current_sess, FE_GUI_SHOW, 0);
@@ -5241,9 +5257,14 @@ static void
mg_handle_drop (GtkWidget *widget, int y, int *pos, int *other_pos)
{
int height;
GdkWindow *window;
session_gui *gui = current_sess->gui;
height = gdk_window_get_height (gtk_widget_get_window (widget));
window = gtk_widget_get_window (widget);
if (!window)
return;
height = gdk_window_get_height (window);
if (y < height / 2)
{
@@ -5321,6 +5342,9 @@ mg_drag_begin_cb (GtkWidget *widget, GdkDragContext *context, gpointer userdata)
return FALSE;
window = gtk_widget_get_window (widget);
if (!window)
return FALSE;
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
@@ -5398,11 +5422,16 @@ mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, gui
width = allocation.width;
height = allocation.height;
window = gtk_widget_get_window (widget);
if (!window)
return FALSE;
}
else
{
ox = oy = 0;
window = gtk_widget_get_window (widget);
if (!window)
return FALSE;
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
}

View File

@@ -1717,7 +1717,32 @@ menu_ctcpguiopen (void)
static void
menu_docs (GtkWidget *wid, gpointer none)
{
fe_open_url ("https://docs.zoitechat.org/en/latest/");
GNetworkMonitor *monitor;
char *offline_docs;
gboolean online;
offline_docs = g_build_filename (get_xdir (), "offline-docs", "index.html", NULL);
if (g_access (offline_docs, R_OK) == 0)
{
fe_open_url (offline_docs);
g_free (offline_docs);
return;
}
g_free (offline_docs);
offline_docs = g_build_filename (ZOITECHATDOCDIR, "index.html", NULL);
if (g_access (offline_docs, R_OK) == 0)
{
fe_open_url (offline_docs);
g_free (offline_docs);
return;
}
g_free (offline_docs);
online = TRUE;
monitor = g_network_monitor_get_default ();
if (monitor)
online = g_network_monitor_get_network_available (monitor);
if (online)
fe_open_url ("https://docs.zoitechat.org/en/latest/");
}
/*static void
@@ -2309,7 +2334,7 @@ menu_reorder (GtkMenu *menu, GtkWidget *item, int pos)
if (pos < 0) /* position offset from end/bottom */
{
GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
int length = g_list_length (children);
gint length = (gint) g_list_length (children);
g_list_free (children);
gtk_menu_reorder_child (menu, item, (length + pos) - 1);
@@ -2381,7 +2406,7 @@ menu_add_sub (GtkWidget *menu, menu_entry *me)
if (pos < 0) /* position offset from end/bottom */
{
GList *children = gtk_container_get_children (GTK_CONTAINER (menu));
int length = g_list_length (children);
gint length = (gint) g_list_length (children);
g_list_free (children);
pos = length + pos;

View File

@@ -920,7 +920,10 @@ tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data)
{
if (!tray_backend_is_embedded ())
{
tray_restore_timer = g_timeout_add(500, (GSourceFunc)tray_menu_try_restore, NULL);
if (!tray_restore_timer)
{
tray_restore_timer = g_timeout_add (500, (GSourceFunc) tray_menu_try_restore, NULL);
}
}
else
{
@@ -936,9 +939,10 @@ tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data)
static gboolean
tray_menu_try_restore (void)
{
tray_cleanup();
tray_init();
return TRUE;
tray_restore_timer = 0;
tray_cleanup ();
tray_init ();
return G_SOURCE_REMOVE;
}
static void

View File

@@ -193,6 +193,7 @@ static const setting appearance_advanced_settings[] =
{ST_HEADER, N_("Advanced"),0,0,0},
{ST_EFILE, N_ ("Background image:"), P_OFFSETNL (hex_text_background), 0, 0, sizeof prefs.hex_text_background},
{ST_HSCALE, N_("Window opacity:"), P_OFFINTNL(hex_gui_transparency),0,0,0},
{ST_HSCALE, N_("Mouse wheel scroll speed (Slower ← → Faster):"), P_OFFINTNL(hex_gui_mouse_scroll_speed), 0, 0, 100},
{ST_END, 0, 0, 0, 0, 0}
};
@@ -582,6 +583,7 @@ static const setting advanced_settings[] =
{ST_TOGGLE, N_("Display lists in compact mode"), P_OFFINTNL(hex_gui_compact), N_("Use less spacing between user list/channel tree rows."), 0, 0},
{ST_TOGGLE, N_("Use server time if supported"), P_OFFINTNL(hex_irc_cap_server_time), N_("Display timestamps obtained from server if it supports the time-server extension."), 0, 0},
{ST_TOGGLE, N_("Automatically reconnect to servers on disconnect"), P_OFFINTNL(hex_net_auto_reconnect), 0, 0, 1},
{ST_NUMBER, N_("Lag check interval:"), P_OFFINTNL(hex_net_lag_check), 0, (const char **)N_("seconds."), 9999},
{ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999},
{ST_NUMBER, N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999},
{ST_MENU, N_("Ban Type:"), P_OFFINTNL(hex_irc_ban_type), N_("Attempt to use this banmask when banning or quieting. (requires irc_who_join)"), bantypemenu, 0},
@@ -655,6 +657,11 @@ static const setting network_settings[] =
{ST_MENU, N_("Type:"), P_OFFINTNL(hex_net_proxy_type), 0, proxytypes, 0},
{ST_MENU, N_("Use proxy for:"), P_OFFINTNL(hex_net_proxy_use), 0, proxyuse, 0},
{ST_HEADER, N_("Connection Health"), 0, 0, 0, 0},
{ST_NUMBER, N_("TCP keepalive idle:"), P_OFFINTNL(hex_net_keepalive_idle), 0, (const char **)N_("seconds."), 7200},
{ST_NUMBER, N_("TCP keepalive interval:"), P_OFFINTNL(hex_net_keepalive_interval), 0, (const char **)N_("seconds."), 600},
{ST_NUMBER, N_("TCP keepalive probes:"), P_OFFINTNL(hex_net_keepalive_count), 0, 0, 20},
{ST_HEADER, N_("Proxy Authentication"), 0, 0, 0, 0},
{ST_TOGGLE, N_("Use authentication (HTTP or SOCKS5 only)"), P_OFFINTNL(hex_net_proxy_auth), 0, 0, 0},
{ST_ENTRY, N_("Username:"), P_OFFSETNL(hex_net_proxy_user), 0, 0, sizeof prefs.hex_net_proxy_user},
@@ -1364,7 +1371,7 @@ setup_entry_cb (GtkEntry *entry, setting *set)
int size;
int pos;
unsigned char *p = (unsigned char*)gtk_entry_get_text (entry);
int len = strlen (p);
size_t len = strlen ((const char *) p);
/* need to truncate? */
if (len >= set->extra)
@@ -2180,7 +2187,7 @@ unslash (char *dir)
{
if (dir[0])
{
int len = strlen (dir) - 1;
size_t len = strlen (dir) - 1;
#ifdef WIN32
if (dir[len] == '/' || dir[len] == '\\')
#else

View File

@@ -2300,6 +2300,12 @@ gtk_xtext_leave_notify (GtkWidget * widget, GdkEventCrossing * event)
xtext->hilight_ent = NULL;
}
if (xtext->tooltip_stamp_set)
{
gtk_widget_set_tooltip_text (widget, NULL);
xtext->tooltip_stamp_set = FALSE;
}
return FALSE;
}
@@ -2466,7 +2472,7 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
}
if (xtext->urlcheck_function == NULL)
return FALSE;
goto tooltip_check;
word_type = gtk_xtext_get_word_adjust (xtext, x, y, &word_ent, &offset, &len);
if (word_type > 0)
@@ -2504,6 +2510,46 @@ gtk_xtext_motion_notify (GtkWidget * widget, GdkEventMotion * event)
return FALSE;
}
tooltip_check:
if (xtext->buffer->time_stamp && xtext->buffer->indent > 0 && x >= 0 && x < xtext->stamp_width)
{
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
if (ent && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
{
char tooltip[96];
strftime_utf8 (tooltip, sizeof (tooltip), "%Y-%m-%d", ent->stamp);
gtk_widget_set_tooltip_text (widget, tooltip);
xtext->tooltip_stamp = ent->stamp;
xtext->tooltip_stamp_set = TRUE;
}
if (ent)
return FALSE;
}
else if (!xtext->buffer->time_stamp && x >= xtext->buffer->indent)
{
textentry *ent = gtk_xtext_find_char (xtext, x, y, NULL, NULL);
if (ent && ent->stamp && (!xtext->tooltip_stamp_set || xtext->tooltip_stamp != ent->stamp))
{
char tooltip[128];
char date[64];
char *stamp_text;
strftime_utf8 (date, sizeof (date), "%Y-%m-%d", ent->stamp);
xtext_get_stamp_str (ent->stamp, &stamp_text);
g_snprintf (tooltip, sizeof (tooltip), "%s %s", date, stamp_text);
gtk_widget_set_tooltip_text (widget, tooltip);
g_free (stamp_text);
xtext->tooltip_stamp = ent->stamp;
xtext->tooltip_stamp_set = TRUE;
}
if (ent)
return FALSE;
}
else if (xtext->tooltip_stamp_set)
{
gtk_widget_set_tooltip_text (widget, NULL);
xtext->tooltip_stamp_set = FALSE;
}
gtk_xtext_leave_notify (widget, NULL);
return FALSE;
@@ -2938,19 +2984,41 @@ gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
{
GtkXText *xtext = GTK_XTEXT (widget);
gfloat new_value;
gfloat step;
gdouble dx;
gdouble dy;
int direction = 0;
int speed = prefs.hex_gui_mouse_scroll_speed;
if (event->direction == GDK_SCROLL_UP) /* mouse wheel pageUp */
if (speed < 1)
speed = 1;
step = (xtext_adj_get_page_increment (xtext->adj) * speed) / 100.0f;
if (event->direction == GDK_SCROLL_SMOOTH &&
gdk_event_get_scroll_deltas ((GdkEvent *)event, &dx, &dy))
{
if (dy > 0)
direction = 1;
else if (dy < 0)
direction = -1;
}
else if (event->direction == GDK_SCROLL_UP)
direction = -1;
else if (event->direction == GDK_SCROLL_DOWN)
direction = 1;
if (direction < 0)
{
new_value = xtext_adj_get_value (xtext->adj) -
(xtext_adj_get_page_increment (xtext->adj) / 10);
step;
if (new_value < xtext_adj_get_lower (xtext->adj))
new_value = xtext_adj_get_lower (xtext->adj);
xtext_adj_set_value (xtext->adj, new_value);
}
else if (event->direction == GDK_SCROLL_DOWN) /* mouse wheel pageDn */
else if (direction > 0)
{
new_value = xtext_adj_get_value (xtext->adj) +
(xtext_adj_get_page_increment (xtext->adj) / 10);
step;
if (new_value > (xtext_adj_get_upper (xtext->adj) -
xtext_adj_get_page_size (xtext->adj)))
new_value = xtext_adj_get_upper (xtext->adj) -
@@ -2958,7 +3026,7 @@ gtk_xtext_scroll (GtkWidget *widget, GdkEventScroll *event)
xtext_adj_set_value (xtext->adj, new_value);
}
return FALSE;
return direction != 0;
}
static void

View File

@@ -190,6 +190,8 @@ struct _GtkXText
textentry *hilight_ent;
int hilight_start;
int hilight_end;
time_t tooltip_stamp;
unsigned int tooltip_stamp_set:1;
guint16 fontwidth[128]; /* each char's width, only the ASCII ones */

View File

@@ -313,7 +313,8 @@ fe_print_text (struct session *sess, char *text, time_t stamp,
gboolean no_activity)
{
int dotime = FALSE;
int comma, k, i = 0, j = 0, len = strlen (text);
int comma, k, i = 0, j = 0;
size_t len = strlen (text);
unsigned char *newtext = g_malloc (len + 1024);

View File

@@ -26,12 +26,19 @@
#include <windows.h>
#include <cstdlib>
#include <climits>
#include "typedef.h" // for ssize_t
#include <enchant-provider.h>
ENCHANT_PLUGIN_DECLARE ("win8")
static int
size_to_int (size_t value)
{
return value > static_cast<size_t>(INT_MAX) ? INT_MAX : static_cast<int>(value);
}
static char *
utf16_to_utf8 (const wchar_t * const str, bool from_bcp47)
{
@@ -136,7 +143,7 @@ static void
win8_dict_add_to_personal (EnchantDict *dict, const char *const word, size_t len)
{
auto checker = static_cast<ISpellChecker*>(dict->user_data);
wchar_t *wword = utf8_to_utf16 (word, static_cast<int>(len), false);
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
checker->Add (wword);
std::free (wword);
@@ -146,7 +153,7 @@ static void
win8_dict_add_to_session (EnchantDict *dict, const char *const word, size_t len)
{
auto checker = static_cast<ISpellChecker*>(dict->user_data);
wchar_t *wword = utf8_to_utf16 (word, static_cast<int>(len), false);
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
checker->Ignore (wword);
std::free (wword);
@@ -156,7 +163,7 @@ static int
win8_dict_check (EnchantDict *dict, const char *const word, size_t len)
{
auto checker = static_cast<ISpellChecker*>(dict->user_data);
wchar_t *wword = utf8_to_utf16 (word, static_cast<int>(len), false);
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
IEnumSpellingError *errors;
ISpellingError *error = nullptr;
HRESULT hr;
@@ -184,7 +191,7 @@ static char **
win8_dict_suggest (EnchantDict *dict, const char *const word, size_t len, size_t *out_n_suggs)
{
auto checker = static_cast<ISpellChecker*>(dict->user_data);
wchar_t *wword = utf8_to_utf16 (word, static_cast<int>(len), false);
wchar_t *wword = utf8_to_utf16 (word, size_to_int (len), false);
IEnumString *suggestions;
HRESULT hr;

View File

@@ -9,6 +9,7 @@
#define PACKAGE_VERSION "<#= [string]::Join('.', $versionParts) #>"
#define ZOITECHATLIBDIR ".\\plugins"
#define ZOITECHATSHAREDIR "."
#define ZOITECHATDOCDIR "offline-docs"
#define OLD_PERL
#define GETTEXT_PACKAGE "zoitechat"
#define PACKAGE_TARNAME "zoitechat-<#= [string]::Join('.', $versionParts) #>"

View File

@@ -1,5 +1,6 @@
#define APPNAM "ZoiteChat"
#define APPVER "<#= [string]::Join('.', $versionParts) #>"
#define OFFLINEDOCSURL "https://dl.zoitechat.org/offlinedocs/zoitechat-docs-html-" + APPVER + ".tar.gz"
; These are defined by our installer project at build time
;#define APPARCH "x64"
;#define PROJECTDIR "C:\...\zoitechat\win32\installer\"
@@ -30,8 +31,8 @@ PrivilegesRequired=none
ShowComponentSizes=no
CreateUninstallRegKey=not IsTaskSelected('portable')
Uninstallable=not IsTaskSelected('portable')
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
MinVersion=6.1
WizardImageFile={#PROJECTDIR}wizardimage.bmp
WizardSmallImageFile={#PROJECTDIR}wizardsmallimage.bmp
@@ -49,6 +50,7 @@ Name: "icons"; Description: "Create Shortcuts"; Types: custom; Flags: disablenou
Name: "icons\desktopicon"; Description: "Create Desktop Shortcut"; Types: custom; Flags: disablenouninstallwarning
Name: "icons\quicklaunchicon"; Description: "Create Quick Launch Shortcut"; Types: custom; Flags: disablenouninstallwarning
Name: "translations"; Description: "Translations"; Types: normal custom; Flags: disablenouninstallwarning
Name: "docs"; Description: "Offline Documentation"; Types: normal minimal custom; Flags: disablenouninstallwarning
Name: "spell"; Description: "Spelling Dictionaries"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins"; Description: "Plugins"; Types: custom; Flags: disablenouninstallwarning
Name: "plugins\checksum"; Description: "Checksum"; Types: custom; Flags: disablenouninstallwarning
@@ -95,6 +97,7 @@ Filename: "{sys}\WindowsPowerShell\v1.0\powershell.exe"; Parameters: "-NoProfile
[Dirs]
Name: "{userappdata}\ZoiteChat\gtk3-themes"; Components: themes
Name: "{app}\offline-docs"; Components: docs
[Files]
Source: "portable-mode"; DestDir: "{app}"; Tasks: portable
@@ -105,6 +108,7 @@ Source: "cert.pem"; DestDir: "{app}"; Flags: ignoreversion; Components: libs
Source: "share\xml\*"; DestDir: "{app}\share\xml"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
Source: "share\doc\zoitechat\*"; DestDir: "{app}\share\doc\zoitechat"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
Source: "share\doc\WinSparkle\*"; DestDir: "{app}\share\doc\WinSparkle"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: libs
Source: "offline-docs\*"; DestDir: "{app}\offline-docs"; Flags: ignoreversion createallsubdirs recursesubdirs; Components: docs
Source: "share\themes\MS-Windows\*"; DestDir: "{app}\share\themes\MS-Windows"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
Source: "share\glib-2.0\schemas\*"; DestDir: "{app}\share\glib-2.0\schemas"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
Source: "share\icons\hicolor\*"; DestDir: "{app}\share\icons\hicolor"; Flags: ignoreversion createallsubdirs recursesubdirs skipifsourcedoesntexist; Components: libs
@@ -314,7 +318,34 @@ begin
end;
/////////////////////////////////////////////////////////////////////
function InstallOfflineDocs(): Boolean;
var
Archive: String;
DocsDir: String;
ResultCode: Integer;
Script: String;
WorkDir: String;
begin
Result := True;
Archive := ExpandConstant('{tmp}\offline-docs.tar.gz');
DocsDir := ExpandConstant('{app}\offline-docs');
WorkDir := ExpandConstant('{tmp}\offline-docs-extract');
if not FileExists(Archive) then
Exit;
Script := 'Remove-Item -LiteralPath ''' + WorkDir + ''' -Recurse -Force -ErrorAction SilentlyContinue; ' +
'New-Item -ItemType Directory -LiteralPath ''' + WorkDir + ''' -Force | Out-Null; ' +
'tar -xzf ''' + Archive + ''' -C ''' + WorkDir + '''; ' +
'$i = Get-ChildItem -LiteralPath ''' + WorkDir + ''' -Recurse -Filter index.html | Select-Object -First 1; ' +
'if (-not $i) { exit 1 }; ' +
'Remove-Item -LiteralPath ''' + DocsDir + ''' -Recurse -Force -ErrorAction SilentlyContinue; ' +
'New-Item -ItemType Directory -LiteralPath ''' + DocsDir + ''' -Force | Out-Null; ' +
'Copy-Item -Path (Join-Path $i.DirectoryName ''*'') -Destination ''' + DocsDir + ''' -Recurse -Force';
if not Exec(ExpandConstant('{sys}\WindowsPowerShell\v1.0\powershell.exe'), '-NoProfile -ExecutionPolicy Bypass -Command "' + Script + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
Result := False
else
Result := ResultCode = 0;
end;
function CheckSpellInstall(): Boolean;
var
Version: TWindowsVersion;
@@ -351,6 +382,9 @@ begin
if IsComponentSelected('themes\windows10dark') then
idpAddFile('https://dl.zoitechat.zoite.net/themes/GTK3Themes/Windows-10-Dark-3.2.1-dark.zip', ExpandConstant('{tmp}\Windows-10-Dark-3.2.1-dark.zip'));
if IsComponentSelected('docs') then
idpAddFile('{#OFFLINEDOCSURL}', ExpandConstant('{tmp}\offline-docs.tar.gz'));
if not IsTaskSelected('portable') then
begin
@@ -419,6 +453,13 @@ begin
Exit;
end;
if IsComponentSelected('docs') and not FileExists(ExpandConstant('{tmp}\offline-docs.tar.gz')) then
begin
MsgBox('Offline documentation could not be downloaded. Please retry setup or rerun setup with Offline Documentation deselected.', mbError, MB_OK);
Result := False;
Exit;
end;
if IsComponentSelected('deps\vcredist2015') and not CheckVCInstall() and not FileExists(ExpandConstant('{tmp}\vcredist.exe')) then
begin
MsgBox('Visual C++ Redistributable could not be downloaded. Please retry setup or install it manually and rerun setup.', mbError, MB_OK);
@@ -497,4 +538,10 @@ begin
DeleteFile(ExpandConstant('{app}\portable-mode'));
end;
end;
if (CurStep=ssPostInstall) and IsComponentSelected('docs') then
begin
if not InstallOfflineDocs() then
MsgBox('Offline documentation could not be installed from the downloaded archive.', mbError, MB_OK);
end;
end;

View File

@@ -1 +1 @@
2.18.0
2.18.1