mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-06-10 00:40:18 +00:00
Compare commits
96 Commits
c123e93704
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9bed097ba | ||
| 5acb90025f | |||
|
|
2d12da79b0 | ||
|
|
bede379021 | ||
| 38acde1b20 | |||
| d0c4a5addd | |||
|
|
b8a7ccf005 | ||
| 68fc53585e | |||
| 26afc125c7 | |||
|
|
090b39f78b | ||
| 3722de6b13 | |||
|
|
d93c9aa780 | ||
| ea56504aee | |||
| 46b91edfdf | |||
|
|
d2dfde519d | ||
| 1eac56f22c | |||
|
|
fb491a6bb2 | ||
| 3da7c89b66 | |||
|
|
e842cf3a57 | ||
| 85b0e8f1a6 | |||
|
|
b8e03ff6c1 | ||
| 54b1703d67 | |||
| 15d647a0ec | |||
|
|
353558ddb3 | ||
|
|
9f58d30050 | ||
|
|
4f0632cdf1 | ||
|
|
ff8ba71948 | ||
|
|
a367591327 | ||
|
|
c91925fbc2 | ||
| 479f1649ef | |||
|
|
06f69184b6 | ||
|
|
3471d9a57c | ||
| 28d4035477 | |||
|
|
3e1d151efd | ||
| 556cfc3036 | |||
| c49b757be6 | |||
| cec7e2caf3 | |||
| 9a0c07a461 | |||
| c7064c18b9 | |||
|
|
fb897310c8 | ||
| 5944849326 | |||
| 1255f1e6c7 | |||
| d7bc09d859 | |||
| f84a448351 | |||
| 7e34690e0c | |||
|
|
6f6d378600 | ||
|
|
216b463b8f | ||
| 4ad84cb5e5 | |||
| 19e0946717 | |||
| 0de1ad06cd | |||
|
|
72427006dd | ||
|
|
0e5f702651 | ||
| 4f1b0fc838 | |||
|
|
23d0963c2d | ||
|
|
dcb35fb80f | ||
| b1768854c3 | |||
| 4ed4eaf8e8 | |||
|
|
d167b53b17 | ||
| 18eff80a30 | |||
| a44ec5f624 | |||
|
|
5da518f50e | ||
|
|
ebb11a8ac5 | ||
|
|
dd9c5db1aa | ||
| 984ac9763e | |||
|
|
ad67af2f8f | ||
| cc8460d366 | |||
| 1dc9b9c956 | |||
|
|
20b552ad9d | ||
|
|
12f4885ad7 | ||
| 9c1fdef286 | |||
| c125a154da | |||
| 028d768b23 | |||
| 42972e01b0 | |||
| 1bd37af7d0 | |||
| 5fad2d0c02 | |||
|
|
bd9adeb795 | ||
|
|
5fd3c7c9d9 | ||
| 937184429f | |||
| e31ccff3f8 | |||
| edaafba7eb | |||
| 87018fa7fe | |||
| 8fcec519d0 | |||
| aa52236c01 | |||
| cd5b61d9d0 | |||
| 4eefdd6011 | |||
|
|
21748b3133 | ||
|
|
e7db202f88 | ||
| a93e76eaf4 | |||
| 3c5bdb2ab2 | |||
| 8f7c40caf1 | |||
| 150ad62771 | |||
|
|
5e3715dc31 | ||
| 05648ba8e3 | |||
|
|
0956471a10 | ||
| 1f79e62f53 | |||
| e49333340f |
38
.github/workflows/appimage-build.yml
vendored
38
.github/workflows/appimage-build.yml
vendored
@@ -28,13 +28,13 @@ jobs:
|
||||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential pkg-config meson ninja-build cmake \
|
||||
gettext \
|
||||
libcanberra-dev libdbus-glib-1-dev libglib2.0-dev \
|
||||
libcanberra-dev libglib2.0-dev \
|
||||
libarchive-dev \
|
||||
libgtk-3-dev \
|
||||
libwayland-client0 libwayland-cursor0 libwayland-egl1 \
|
||||
libxkbcommon0 \
|
||||
libgtk-3-bin libglib2.0-bin shared-mime-info gsettings-desktop-schemas \
|
||||
libluajit-5.1-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
||||
liblua5.4-dev libpci-dev libperl-dev libssl-dev libayatana-appindicator3-dev \
|
||||
perl python3 python3-minimal python3-dev python3-cffi mono-devel desktop-file-utils \
|
||||
fonts-noto-color-emoji breeze-gtk-theme \
|
||||
patchelf file curl
|
||||
@@ -86,11 +86,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 +110,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 +176,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 +225,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 +287,6 @@ jobs:
|
||||
EOF
|
||||
chmod +x AppRun
|
||||
|
||||
|
||||
VERSION="$(git describe --tags --always)"
|
||||
|
||||
./linuxdeploy-x86_64.AppImage \
|
||||
|
||||
3
.github/workflows/flatpak-build.yml
vendored
3
.github/workflows/flatpak-build.yml
vendored
@@ -25,6 +25,9 @@ jobs:
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Generate PSL list
|
||||
run: curl -fsSL https://publicsuffix.org/list/public_suffix_list.dat -o src/common/public_suffix_list.dat
|
||||
|
||||
- name: Build Flatpak
|
||||
id: flatpak_builder
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
|
||||
2
.github/workflows/manjaro-package-build.yml
vendored
2
.github/workflows/manjaro-package-build.yml
vendored
@@ -32,10 +32,8 @@ jobs:
|
||||
glib2-devel \
|
||||
gtk3 \
|
||||
openssl \
|
||||
dbus-glib \
|
||||
libcanberra \
|
||||
libayatana-appindicator \
|
||||
luajit \
|
||||
iso-codes \
|
||||
lua \
|
||||
perl \
|
||||
|
||||
4
.github/workflows/windows-build.yml
vendored
4
.github/workflows/windows-build.yml
vendored
@@ -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()"
|
||||
|
||||
@@ -1,7 +1,46 @@
|
||||
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.
|
||||
- Expanded theme import support with .hct support in colors.conf import.
|
||||
- Added pevent import support from .hct theme files and improved import result messaging.
|
||||
- Expanded palette and selection CSS styling for better theme consistency.
|
||||
- Auto-sizes the topic bar to wrapped text for better multi-line topic handling.
|
||||
- Refined command-character parsing when pasting path-like text.
|
||||
- Tightened topic link detection and opening rules.
|
||||
- Added Public Suffix List validation for host links to reduce bad link matches.
|
||||
- Improved channel tree behavior by ignoring collapsed parent selections.
|
||||
- Sanitized the Linux open environment for AppImage builds and added safer fallback handling.
|
||||
- Labeled Windows installer runtimes with exact versions.
|
||||
- Fixed the notification icon and corrected the Flatpak screenshot asset.
|
||||
- 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.
|
||||
|
||||
@@ -22,7 +22,7 @@ if get_option('gtk-frontend')
|
||||
endif
|
||||
|
||||
desktop_conf = configuration_data()
|
||||
if dbus_glib_dep.found()
|
||||
if dbus_dep.found()
|
||||
desktop_conf.set('exec_command', 'zoitechat --existing %U')
|
||||
else
|
||||
desktop_conf.set('exec_command', 'zoitechat %U')
|
||||
|
||||
@@ -29,6 +29,58 @@
|
||||
<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>
|
||||
<ul>
|
||||
<li>Added optional close buttons on tabs.</li>
|
||||
<li>Added Ctrl+W to close tabs and Ctrl+Shift+T to reopen recently closed tabs.</li>
|
||||
<li>Improved channel tree behavior by ignoring collapsed parent selections.</li>
|
||||
</ul>
|
||||
<p>Themes and appearance:</p>
|
||||
<ul>
|
||||
<li>Expanded theme import support with .hct support in colors.conf import.</li>
|
||||
<li>Added pevent import support from .hct theme files and improved import result messaging.</li>
|
||||
<li>Expanded palette and selection CSS styling for better theme consistency.</li>
|
||||
<li>Auto-sizes the topic bar to wrapped text for better multi-line topic handling.</li>
|
||||
</ul>
|
||||
<p>Links and text handling:</p>
|
||||
<ul>
|
||||
<li>Refined command-character parsing when pasting path-like text.</li>
|
||||
<li>Tightened topic link detection and opening rules.</li>
|
||||
<li>Added Public Suffix List validation for host links to reduce bad link matches.</li>
|
||||
</ul>
|
||||
<p>Packaging and platform integration:</p>
|
||||
<ul>
|
||||
<li>Sanitized the Linux open environment for AppImage builds and added safer fallback handling.</li>
|
||||
<li>Labeled Windows installer runtimes with exact versions.</li>
|
||||
<li>Fixed the notification icon and corrected the Flatpak screenshot asset.</li>
|
||||
<li>Improved AppStream metainfo validation.</li>
|
||||
</ul>
|
||||
</description>
|
||||
</release>
|
||||
<release date="2026-03-30" version="2.18.0~pre6">
|
||||
<description>
|
||||
<p>GTK theme and UI:</p>
|
||||
|
||||
@@ -7,14 +7,13 @@
|
||||
"command": "zoitechat",
|
||||
"finish-args": [
|
||||
"--share=ipc",
|
||||
"--socket=x11",
|
||||
"--socket=wayland",
|
||||
"--socket=fallback-x11",
|
||||
"--share=network",
|
||||
"--socket=pulseaudio",
|
||||
"--filesystem=xdg-download",
|
||||
"--filesystem=xdg-data/themes:ro",
|
||||
"--filesystem=xdg-data/icons:ro",
|
||||
"--filesystem=~/.themes:ro",
|
||||
"--filesystem=~/.icons:ro",
|
||||
"--filesystem=xdg-run/tray-icon:create",
|
||||
"--env=GTK_CSD=1",
|
||||
"--talk-name=org.freedesktop.Notifications",
|
||||
@@ -34,7 +33,6 @@
|
||||
}
|
||||
},
|
||||
"modules": [
|
||||
"shared-modules/dbus-glib/dbus-glib.json",
|
||||
"shared-modules/lua5.4/lua-5.4.json",
|
||||
"shared-modules/libcanberra/libcanberra.json",
|
||||
"shared-modules/libayatana-appindicator/libayatana-appindicator-gtk3.json",
|
||||
@@ -45,9 +43,9 @@
|
||||
"buildsystem": "meson",
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/pavouk/lgi.git",
|
||||
"commit": "c9b8e4473c6421f2a215d8c06c0d94b86eb0b26a"
|
||||
"type": "archive",
|
||||
"url": "https://github.com/pavouk/lgi/archive/c9b8e4473c6421f2a215d8c06c0d94b86eb0b26a.tar.gz",
|
||||
"sha256": "db67b2b7ee89fa566f783486d56be7203552a997bc55f35020b57dd2776b9943"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
"sources": [
|
||||
{
|
||||
"type": "archive",
|
||||
"url": "https://www.cpan.org/src/5.0/perl-5.40.1.tar.xz",
|
||||
"sha256": "dfa20c2eef2b4af133525610bbb65dd13777ecf998c9c5b1ccf0d308e732ee3f"
|
||||
"url": "https://www.cpan.org/src/5.0/perl-5.42.2.tar.xz",
|
||||
"sha256": "0a585eeb9e363c0f80482ddb3571625250c2c86aeb408853e8ea50805cfb14bb"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
10
meson.build
10
meson.build
@@ -1,5 +1,5 @@
|
||||
project('zoitechat', 'c',
|
||||
version: '2.18.0~pre6',
|
||||
version: '2.18.1',
|
||||
meson_version: '>= 0.55.0',
|
||||
default_options: [
|
||||
'c_std=c17',
|
||||
@@ -18,7 +18,8 @@ libgmodule_dep = dependency('gmodule-2.0')
|
||||
|
||||
libcanberra_dep = dependency('libcanberra', version: '>= 0.22',
|
||||
required: get_option('libcanberra'))
|
||||
dbus_glib_dep = dependency('dbus-glib-1', required: get_option('dbus'))
|
||||
dbus_dep = dependency('gio-2.0', required: get_option('dbus'))
|
||||
libsecret_dep = dependency('libsecret-1', required: false)
|
||||
|
||||
global_deps = []
|
||||
if cc.get_id() == 'msvc'
|
||||
@@ -39,7 +40,8 @@ config_h.set10('ENABLE_NLS', true)
|
||||
# Optional features
|
||||
config_h.set('USE_OPENSSL', libssl_dep.found())
|
||||
config_h.set('USE_LIBCANBERRA', libcanberra_dep.found())
|
||||
config_h.set('USE_DBUS', dbus_glib_dep.found())
|
||||
config_h.set('USE_DBUS', dbus_dep.found())
|
||||
config_h.set('HAVE_LIBSECRET', libsecret_dep.found())
|
||||
config_h.set('USE_PLUGIN', get_option('plugin'))
|
||||
config_h.set('USE_GTK_FRONTEND', get_option('gtk-frontend'))
|
||||
|
||||
@@ -181,7 +183,7 @@ if meson.version().version_compare('>= 0.55.0')
|
||||
'GTK Frontend': get_option('gtk-frontend') ? 'enabled (GTK+ 3.22+)' : 'disabled',
|
||||
'TLS (openssl)': libssl_dep.found(),
|
||||
'Plugin Support': get_option('plugin'),
|
||||
'DBus Support': dbus_glib_dep.found(),
|
||||
'DBus Support': dbus_dep.found(),
|
||||
'libcanberra': libcanberra_dep.found(),
|
||||
}, section: 'Features')
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ option('with-exec', type: 'boolean',
|
||||
option('with-fishlim', type: 'boolean',
|
||||
description: 'Fish encryption plugin, requires openssl'
|
||||
)
|
||||
option('with-lua', type: 'string', value: 'luajit',
|
||||
option('with-lua', type: 'string', value: 'lua-5.4',
|
||||
description: 'Lua scripting plugin, value is pkg-config name to use or "false"'
|
||||
)
|
||||
option('with-perl', type: 'string', value: 'perl',
|
||||
@@ -59,9 +59,6 @@ option('with-sysinfo', type: 'boolean',
|
||||
option('with-upd', type: 'boolean',
|
||||
description: 'Update plugin, Windows only'
|
||||
)
|
||||
option('with-winamp', type: 'boolean',
|
||||
description: 'Winamp plugin, Windows only'
|
||||
)
|
||||
option('with-perl-legacy-api', type: 'boolean', value: false,
|
||||
description: 'Enables the legacy IRC perl module for compatibility with old scripts'
|
||||
)
|
||||
|
||||
@@ -8,7 +8,6 @@ arch=('x86_64')
|
||||
url='https://github.com/zoitechat/zoitechat'
|
||||
license=('GPL-2.0-or-later')
|
||||
depends=(
|
||||
'dbus-glib'
|
||||
'glib2'
|
||||
'gtk3'
|
||||
'iso-codes'
|
||||
|
||||
@@ -104,12 +104,14 @@ thread_sha256_file (GTask *task, GFile *file, gpointer task_data, GCancellable *
|
||||
g_checksum_update (checksum, buffer, ret);
|
||||
|
||||
if (error) {
|
||||
g_checksum_free (checksum);
|
||||
g_task_return_error (task, error);
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
g_task_return_pointer (task, g_strdup (g_checksum_get_string (checksum)), g_free);
|
||||
cleanup:
|
||||
g_input_stream_close(G_INPUT_STREAM(istream), NULL, NULL);
|
||||
g_object_unref(istream);
|
||||
g_checksum_free (checksum);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
if cc.get_id() == 'msvc'
|
||||
lua_dep = cc.find_library('lua51')
|
||||
else
|
||||
lua_dep = dependency(get_option('with-lua'))
|
||||
lua_opt = get_option('with-lua')
|
||||
lua_dep = dependency(lua_opt, required: false)
|
||||
if not lua_dep.found() and lua_opt == 'lua-5.4'
|
||||
foreach lua_name : ['lua5.4', 'lua-5.3', 'lua5.3', 'lua']
|
||||
lua_dep = dependency(lua_name, required: false)
|
||||
if lua_dep.found()
|
||||
break
|
||||
endif
|
||||
endforeach
|
||||
endif
|
||||
if not lua_dep.found()
|
||||
error('Dependency "' + lua_opt + '" not found')
|
||||
endif
|
||||
endif
|
||||
|
||||
shared_module('lua', 'lua.c',
|
||||
|
||||
@@ -9,9 +9,6 @@ if host_machine.system() == 'windows'
|
||||
subdir('upd')
|
||||
endif
|
||||
|
||||
if get_option('with-winamp')
|
||||
subdir('winamp')
|
||||
endif
|
||||
endif
|
||||
|
||||
if get_option('with-checksum')
|
||||
|
||||
@@ -19,7 +19,7 @@ else:
|
||||
if not hasattr(sys, 'argv'):
|
||||
sys.argv = ['<zoitechat>']
|
||||
|
||||
VERSION = b'2.18.0~pre6'
|
||||
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
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
shared_module('winamp', 'winamp.c',
|
||||
dependencies: [libgio_dep, zoitechat_plugin_dep],
|
||||
install: true,
|
||||
install_dir: plugindir,
|
||||
name_prefix: '',
|
||||
vs_module_defs: 'winamp.def',
|
||||
)
|
||||
@@ -1,153 +0,0 @@
|
||||
/********************* Winamp Plugin 0.3******************************
|
||||
*
|
||||
* Distribution: GPL
|
||||
*
|
||||
* Originally written by: Leo - leo.nard@free.fr
|
||||
* Modified by: SilvereX - SilvereX@karklas.mif.vu.lt
|
||||
* Modified again by: Derek Buitenhuis - daemon404@gmail.com
|
||||
* Modified yet again by: Berke Viktor - berkeviktor@aol.com
|
||||
*********************************************************************/
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include "zoitechat-plugin.h"
|
||||
|
||||
#define PLAYING 1
|
||||
#define PAUSED 3
|
||||
|
||||
static zoitechat_plugin *ph;
|
||||
|
||||
static int
|
||||
winamp(char *word[], char *word_eol[], void *userdata)
|
||||
{
|
||||
HWND hwndWinamp = FindWindowW(L"Winamp v1.x",NULL);
|
||||
|
||||
if (hwndWinamp)
|
||||
{
|
||||
if (!stricmp("PAUSE", word[2]))
|
||||
{
|
||||
if (SendMessage(hwndWinamp,WM_USER, 0, 104))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
|
||||
|
||||
if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
|
||||
zoitechat_printf(ph, "Winamp: playing");
|
||||
else
|
||||
zoitechat_printf(ph, "Winamp: paused");
|
||||
}
|
||||
}
|
||||
else if (!stricmp("STOP", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
|
||||
zoitechat_printf(ph, "Winamp: stopped");
|
||||
}
|
||||
else if (!stricmp("PLAY", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
|
||||
zoitechat_printf(ph, "Winamp: playing");
|
||||
}
|
||||
else if (!stricmp("NEXT", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
|
||||
zoitechat_printf(ph, "Winamp: next playlist entry");
|
||||
}
|
||||
else if (!stricmp("PREV", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
|
||||
zoitechat_printf(ph, "Winamp: previous playlist entry");
|
||||
}
|
||||
else if (!stricmp("START", word[2]))
|
||||
{
|
||||
SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
|
||||
zoitechat_printf(ph, "Winamp: playlist start");
|
||||
}
|
||||
else if (!word_eol[2][0])
|
||||
{
|
||||
wchar_t wcurrent_play[2048];
|
||||
char *current_play, *p;
|
||||
int len = GetWindowTextW(hwndWinamp, wcurrent_play, G_N_ELEMENTS(wcurrent_play));
|
||||
|
||||
current_play = g_utf16_to_utf8 (wcurrent_play, len, NULL, NULL, NULL);
|
||||
if (!current_play)
|
||||
{
|
||||
zoitechat_print (ph, "Winamp: Error getting song information.");
|
||||
return ZOITECHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
if (strchr(current_play, '-'))
|
||||
{
|
||||
/* Remove any trailing text and whitespace */
|
||||
p = current_play + strlen(current_play) - 8;
|
||||
while (p >= current_play)
|
||||
{
|
||||
if (!strnicmp(p, "- Winamp", 8))
|
||||
break;
|
||||
p--;
|
||||
}
|
||||
|
||||
if (p >= current_play)
|
||||
p--;
|
||||
|
||||
while (p >= current_play && *p == ' ')
|
||||
p--;
|
||||
*++p = '\0';
|
||||
|
||||
/* Ignore any leading track number */
|
||||
p = strstr (current_play, ". ");
|
||||
if (p)
|
||||
p += 2;
|
||||
else
|
||||
p = current_play;
|
||||
|
||||
if (*p != '\0')
|
||||
zoitechat_commandf (ph, "me is now playing: %s", p);
|
||||
else
|
||||
zoitechat_print (ph, "Winamp: No song information found.");
|
||||
g_free (current_play);
|
||||
}
|
||||
else
|
||||
zoitechat_print(ph, "Winamp: Nothing being played.");
|
||||
}
|
||||
else
|
||||
zoitechat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
zoitechat_print(ph, "Winamp not found.\n");
|
||||
}
|
||||
return ZOITECHAT_EAT_ALL;
|
||||
}
|
||||
|
||||
int
|
||||
zoitechat_plugin_init(zoitechat_plugin *plugin_handle,
|
||||
char **plugin_name,
|
||||
char **plugin_desc,
|
||||
char **plugin_version,
|
||||
char *arg)
|
||||
{
|
||||
ph = plugin_handle;
|
||||
|
||||
*plugin_name = "Winamp";
|
||||
*plugin_desc = "Winamp plugin for ZoiteChat";
|
||||
*plugin_version = "0.6";
|
||||
|
||||
zoitechat_hook_command (ph, "WINAMP", ZOITECHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
|
||||
zoitechat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
|
||||
|
||||
zoitechat_print (ph, "Winamp plugin loaded\n");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
zoitechat_plugin_deinit(void)
|
||||
{
|
||||
zoitechat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
|
||||
zoitechat_print (ph, "Winamp plugin unloaded\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
EXPORTS
|
||||
zoitechat_plugin_init
|
||||
zoitechat_plugin_deinit
|
||||
@@ -1,48 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Configuration">
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>winamp</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\..\win32\zoitechat.props" />
|
||||
<PropertyGroup>
|
||||
<TargetName>hcwinamp</TargetName>
|
||||
<OutDir>$(ZoiteChatRel)plugins\</OutDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(DepsRoot)\include;$(OpenSslInclude);$(Glib);..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<ModuleDefinitionFile>winamp.def</ModuleDefinitionFile>
|
||||
<AdditionalDependencies>$(DepLibs);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(DepsRoot)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="winamp.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="winamp.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="winamp.def">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="winamp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
readme.md
17
readme.md
@@ -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)
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -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},
|
||||
@@ -782,6 +787,8 @@ load_default_config(void)
|
||||
prefs.hex_gui_tab_middleclose = 1;
|
||||
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;
|
||||
@@ -857,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;
|
||||
@@ -1167,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;
|
||||
|
||||
@@ -29,8 +29,10 @@
|
||||
<ClInclude Include="plugin-timer.h" />
|
||||
<ClInclude Include="plugin.h" />
|
||||
<ClInclude Include="proto-irc.h" />
|
||||
<ClInclude Include="public_suffix_data.h" />
|
||||
<ClInclude Include="server.h" />
|
||||
<ClInclude Include="servlist.h" />
|
||||
<ClInclude Include="secretstore.h" />
|
||||
<ClInclude Include="ssl.h" />
|
||||
<ClInclude Include="scram.h" />
|
||||
<ClInclude Include="sysinfo\sysinfo.h" />
|
||||
@@ -67,6 +69,7 @@
|
||||
<ClCompile Include="proto-irc.c" />
|
||||
<ClCompile Include="server.c" />
|
||||
<ClCompile Include="servlist.c" />
|
||||
<ClCompile Include="secretstore.c" />
|
||||
<ClCompile Include="ssl.c" />
|
||||
<ClCompile Include="scram.c" />
|
||||
<ClCompile Include="sts.c" />
|
||||
@@ -109,6 +112,7 @@
|
||||
<Command><![CDATA[
|
||||
SET SOLUTIONDIR=$(SolutionDir)..\
|
||||
"$(Python3Path)\python.exe" $(ProjectDir)make-te.py "$(ProjectDir)textevents.in" "$(ZoiteChatLib)textevents.h" "$(ZoiteChatLib)textenums.h"
|
||||
"$(Python3Path)\python.exe" $(ProjectDir)gen-public-suffix.py "$(ZoiteChatLib)public_suffix_data.h"
|
||||
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\config.h.tt" "$(ZoiteChatLib)config.h"
|
||||
$(GlibGenMarshal) --prefix=_zoitechat_marshal --header "$(ProjectDir)marshalers.list" --output "$(ZoiteChatLib)marshal.h"
|
||||
$(GlibGenMarshal) --prefix=_zoitechat_marshal --body "$(ProjectDir)marshalers.list" --output "$(ZoiteChatLib)marshal.c"
|
||||
|
||||
@@ -65,12 +65,18 @@
|
||||
<ClInclude Include="proto-irc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="public_suffix_data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="server.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="servlist.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="secretstore.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ssl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -175,6 +181,9 @@
|
||||
<ClCompile Include="servlist.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="secretstore.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ssl.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -82,10 +82,6 @@ has_theme_argument (void)
|
||||
|
||||
void
|
||||
zoitechat_remote (void)
|
||||
/* TODO: dbus_g_connection_unref (connection) are commented because it makes
|
||||
* dbus to crash. Fixed in dbus >=0.70 ?!?
|
||||
* https://launchpad.net/distros/ubuntu/+source/dbus/+bug/54375
|
||||
*/
|
||||
{
|
||||
GDBusConnection *connection;
|
||||
GDBusProxy *dbus = NULL;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,203 +1,122 @@
|
||||
/* example.c - program to demonstrate some D-BUS stuffs.
|
||||
* Copyright (C) 2006 Claessens Xavier
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*
|
||||
* Claessens Xavier
|
||||
* xclaesse@gmail.com
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <gio/gio.h>
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
#include "../marshal.c"
|
||||
|
||||
#define DBUS_SERVICE "org.zoitechat.service"
|
||||
#define DBUS_REMOTE "/org/zoitechat/Remote"
|
||||
#define DBUS_REMOTE_CONNECTION_INTERFACE "org.zoitechat.connection"
|
||||
#define DBUS_REMOTE_PLUGIN_INTERFACE "org.zoitechat.plugin"
|
||||
#define DBUS_CONNECTION_PATH "/org/zoitechat"
|
||||
#define DBUS_CONNECTION_INTERFACE "org.zoitechat.connection"
|
||||
#define DBUS_PLUGIN_INTERFACE "org.zoitechat.plugin"
|
||||
|
||||
guint command_id;
|
||||
guint server_id;
|
||||
|
||||
static void
|
||||
write_error (const char *message,
|
||||
GError **error)
|
||||
{
|
||||
if (error == NULL || *error == NULL) {
|
||||
return;
|
||||
}
|
||||
g_printerr ("%s: %s\n", message, (*error)->message);
|
||||
g_clear_error (error);
|
||||
}
|
||||
|
||||
static void
|
||||
test_server_cb (DBusGProxy *proxy,
|
||||
char *word[],
|
||||
char *word_eol[],
|
||||
guint hook_id,
|
||||
guint context_id,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (hook_id == server_id) {
|
||||
g_print ("message: %s\n", word_eol[0]);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
test_command_cb (DBusGProxy *proxy,
|
||||
char *word[],
|
||||
char *word_eol[],
|
||||
guint hook_id,
|
||||
guint context_id,
|
||||
gpointer user_data)
|
||||
static gboolean
|
||||
call_sync (GDBusProxy *proxy, const char *method, GVariant *params, GVariant **out)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GVariant *result;
|
||||
|
||||
if (hook_id == command_id) {
|
||||
if (!dbus_g_proxy_call (proxy, "Unhook",
|
||||
&error,
|
||||
G_TYPE_UINT, hook_id,
|
||||
G_TYPE_INVALID, G_TYPE_INVALID)) {
|
||||
write_error ("Failed to complete unhook", &error);
|
||||
}
|
||||
/* Now if you write "/test blah" again in the ZoiteChat window
|
||||
* you'll get a "Unknown command" error message */
|
||||
g_print ("test command received: %s\n", word_eol[1]);
|
||||
if (!dbus_g_proxy_call (proxy, "Print",
|
||||
&error,
|
||||
G_TYPE_STRING, "test command succeed",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_INVALID)) {
|
||||
write_error ("Failed to complete Print", &error);
|
||||
}
|
||||
result = g_dbus_proxy_call_sync (proxy,
|
||||
method,
|
||||
params,
|
||||
G_DBUS_CALL_FLAGS_NONE,
|
||||
-1,
|
||||
NULL,
|
||||
&error);
|
||||
if (!result)
|
||||
{
|
||||
g_printerr ("%s failed: %s\n", method, error->message);
|
||||
g_clear_error (&error);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unload_cb (void)
|
||||
{
|
||||
g_print ("Good bye !\n");
|
||||
exit (EXIT_SUCCESS);
|
||||
if (out)
|
||||
*out = result;
|
||||
else
|
||||
g_variant_unref (result);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
DBusGConnection *connection;
|
||||
DBusGProxy *remote_object;
|
||||
GMainLoop *mainloop;
|
||||
gchar *path;
|
||||
GDBusConnection *connection;
|
||||
GDBusProxy *connection_proxy;
|
||||
GDBusProxy *plugin_proxy;
|
||||
GVariant *connect_result = NULL;
|
||||
gchar *remote_path = NULL;
|
||||
gchar *command = NULL;
|
||||
const char *path_tmp;
|
||||
int status = EXIT_FAILURE;
|
||||
GError *error = NULL;
|
||||
|
||||
#if ! GLIB_CHECK_VERSION (2, 36, 0)
|
||||
g_type_init ();
|
||||
#endif
|
||||
|
||||
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
if (connection == NULL) {
|
||||
write_error ("Couldn't connect to session bus", &error);
|
||||
connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
|
||||
if (!connection)
|
||||
{
|
||||
g_printerr ("Bus connection failed: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
remote_object = dbus_g_proxy_new_for_name (connection,
|
||||
DBUS_SERVICE,
|
||||
DBUS_REMOTE,
|
||||
DBUS_REMOTE_CONNECTION_INTERFACE);
|
||||
if (!dbus_g_proxy_call (remote_object, "Connect",
|
||||
&error,
|
||||
G_TYPE_STRING, argv[0],
|
||||
G_TYPE_STRING, "example",
|
||||
G_TYPE_STRING, "Example of a D-Bus client",
|
||||
G_TYPE_STRING, "1.0",
|
||||
G_TYPE_INVALID,
|
||||
G_TYPE_STRING, &path, G_TYPE_INVALID)) {
|
||||
write_error ("Failed to complete Connect", &error);
|
||||
|
||||
connection_proxy = g_dbus_proxy_new_sync (connection,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
NULL,
|
||||
DBUS_SERVICE,
|
||||
DBUS_CONNECTION_PATH,
|
||||
DBUS_CONNECTION_INTERFACE,
|
||||
NULL,
|
||||
&error);
|
||||
if (!connection_proxy)
|
||||
{
|
||||
g_printerr ("Connection proxy failed: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
g_object_unref (connection);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
g_object_unref (remote_object);
|
||||
|
||||
remote_object = dbus_g_proxy_new_for_name (connection,
|
||||
DBUS_SERVICE,
|
||||
path,
|
||||
DBUS_REMOTE_PLUGIN_INTERFACE);
|
||||
g_free (path);
|
||||
if (!call_sync (connection_proxy,
|
||||
"Connect",
|
||||
g_variant_new ("(ssss)", "example", "example", "GDBus example", "1.0"),
|
||||
&connect_result))
|
||||
goto cleanup;
|
||||
|
||||
if (!dbus_g_proxy_call (remote_object, "HookCommand",
|
||||
&error,
|
||||
G_TYPE_STRING, "test",
|
||||
G_TYPE_INT, 0,
|
||||
G_TYPE_STRING, "Simple D-BUS example",
|
||||
G_TYPE_INT, 1, G_TYPE_INVALID,
|
||||
G_TYPE_UINT, &command_id, G_TYPE_INVALID)) {
|
||||
write_error ("Failed to complete HookCommand", &error);
|
||||
return EXIT_FAILURE;
|
||||
g_variant_get (connect_result, "(&s)", &path_tmp);
|
||||
remote_path = g_strdup (path_tmp);
|
||||
g_variant_unref (connect_result);
|
||||
connect_result = NULL;
|
||||
|
||||
plugin_proxy = g_dbus_proxy_new_sync (connection,
|
||||
G_DBUS_PROXY_FLAGS_NONE,
|
||||
NULL,
|
||||
DBUS_SERVICE,
|
||||
remote_path,
|
||||
DBUS_PLUGIN_INTERFACE,
|
||||
NULL,
|
||||
&error);
|
||||
if (!plugin_proxy)
|
||||
{
|
||||
g_printerr ("Plugin proxy failed: %s\n", error->message);
|
||||
g_clear_error (&error);
|
||||
goto cleanup;
|
||||
}
|
||||
g_print ("Command hook id=%d\n", command_id);
|
||||
|
||||
if (!dbus_g_proxy_call (remote_object, "HookServer",
|
||||
&error,
|
||||
G_TYPE_STRING, "RAW LINE",
|
||||
G_TYPE_INT, 0,
|
||||
G_TYPE_INT, 0, G_TYPE_INVALID,
|
||||
G_TYPE_UINT, &server_id, G_TYPE_INVALID)) {
|
||||
write_error ("Failed to complete HookServer", &error);
|
||||
return EXIT_FAILURE;
|
||||
if (argc > 1)
|
||||
command = g_strjoinv (" ", &argv[1]);
|
||||
else
|
||||
command = g_strdup ("gui focus");
|
||||
|
||||
if (!call_sync (plugin_proxy, "Command", g_variant_new ("(s)", command), NULL))
|
||||
{
|
||||
g_object_unref (plugin_proxy);
|
||||
goto cleanup;
|
||||
}
|
||||
g_print ("Server hook id=%d\n", server_id);
|
||||
|
||||
dbus_g_object_register_marshaller (
|
||||
_zoitechat_marshal_VOID__POINTER_POINTER_UINT_UINT,
|
||||
G_TYPE_NONE,
|
||||
G_TYPE_STRV, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_UINT,
|
||||
G_TYPE_INVALID);
|
||||
call_sync (connection_proxy, "Disconnect", g_variant_new ("()"), NULL);
|
||||
status = EXIT_SUCCESS;
|
||||
g_object_unref (plugin_proxy);
|
||||
|
||||
dbus_g_object_register_marshaller (
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE,
|
||||
G_TYPE_INVALID);
|
||||
|
||||
dbus_g_proxy_add_signal (remote_object, "CommandSignal",
|
||||
G_TYPE_STRV,
|
||||
G_TYPE_STRV,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (remote_object, "CommandSignal",
|
||||
G_CALLBACK (test_command_cb),
|
||||
NULL, NULL);
|
||||
|
||||
dbus_g_proxy_add_signal (remote_object, "ServerSignal",
|
||||
G_TYPE_STRV,
|
||||
G_TYPE_STRV,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_UINT,
|
||||
G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (remote_object, "ServerSignal",
|
||||
G_CALLBACK (test_server_cb),
|
||||
NULL, NULL);
|
||||
|
||||
dbus_g_proxy_add_signal (remote_object, "UnloadSignal",
|
||||
G_TYPE_INVALID);
|
||||
dbus_g_proxy_connect_signal (remote_object, "UnloadSignal",
|
||||
G_CALLBACK (unload_cb),
|
||||
NULL, NULL);
|
||||
|
||||
/* Now you can write on the ZoiteChat windows: "/test arg1 arg2 ..." */
|
||||
mainloop = g_main_loop_new (NULL, FALSE);
|
||||
g_main_loop_run (mainloop);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
cleanup:
|
||||
g_free (command);
|
||||
g_free (remote_path);
|
||||
g_object_unref (connection_proxy);
|
||||
g_object_unref (connection);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
dbus_deps = [
|
||||
dbus_glib_dep
|
||||
]
|
||||
dbus_deps = []
|
||||
|
||||
dbus_sources = [
|
||||
'dbus-plugin.c',
|
||||
@@ -35,16 +33,8 @@ configure_file(
|
||||
install_dir: dbus_service_dir
|
||||
)
|
||||
|
||||
dbus_binding_tool = find_program('dbus-binding-tool')
|
||||
dbus_remote_object = custom_target('remote-object-glue',
|
||||
input: 'remote-object.xml',
|
||||
output: 'remote-object-glue.h',
|
||||
command: [dbus_binding_tool, '--prefix=remote_object', '--mode=glib-server',
|
||||
'--output=@OUTPUT@', '@INPUT@']
|
||||
)
|
||||
|
||||
zoitechat_dbus = static_library('zoitechatdbus',
|
||||
sources: [dbus_remote_object, marshal] + dbus_sources,
|
||||
sources: marshal + dbus_sources,
|
||||
c_args: dbus_cargs,
|
||||
dependencies: common_deps + dbus_deps,
|
||||
include_directories: dbus_includes,
|
||||
|
||||
@@ -304,29 +304,24 @@ dcc_check_timeouts (void)
|
||||
static int
|
||||
dcc_lookup_proxy (char *host, struct sockaddr_in *addr)
|
||||
{
|
||||
struct hostent *h;
|
||||
static char *cache_host = NULL;
|
||||
static guint32 cache_addr;
|
||||
|
||||
/* too lazy to thread this, so we cache results */
|
||||
if (cache_host)
|
||||
{
|
||||
if (strcmp (host, cache_host) == 0)
|
||||
{
|
||||
memcpy (&addr->sin_addr, &cache_addr, 4);
|
||||
addr->sin_addr.s_addr = cache_addr;
|
||||
return TRUE;
|
||||
}
|
||||
g_free (cache_host);
|
||||
cache_host = NULL;
|
||||
}
|
||||
|
||||
h = gethostbyname (host);
|
||||
if (h != NULL && h->h_length == 4 && h->h_addr_list[0] != NULL)
|
||||
if (net_lookup_ipv4 (host, &addr->sin_addr.s_addr))
|
||||
{
|
||||
memcpy (&addr->sin_addr, h->h_addr_list[0], 4);
|
||||
memcpy (&cache_addr, h->h_addr_list[0], 4);
|
||||
cache_addr = addr->sin_addr.s_addr;
|
||||
cache_host = g_strdup (host);
|
||||
/* cppcheck-suppress memleak */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1614,25 +1609,14 @@ dcc_accept (GIOChannel *source, GIOCondition condition, struct DCC *dcc)
|
||||
}
|
||||
|
||||
guint32
|
||||
dcc_get_my_address (session *sess) /* the address we'll tell the other person */
|
||||
dcc_get_my_address (session *sess)
|
||||
{
|
||||
struct hostent *dns_query;
|
||||
guint32 addr = 0;
|
||||
|
||||
if (prefs.hex_dcc_ip_from_server && sess->server->dcc_ip)
|
||||
addr = sess->server->dcc_ip;
|
||||
else if (prefs.hex_dcc_ip[0])
|
||||
{
|
||||
dns_query = gethostbyname ((const char *) prefs.hex_dcc_ip);
|
||||
|
||||
if (dns_query != NULL &&
|
||||
dns_query->h_length == 4 &&
|
||||
dns_query->h_addr_list[0] != NULL)
|
||||
{
|
||||
/*we're offered at least one IPv4 address: we take the first*/
|
||||
addr = *((guint32*) dns_query->h_addr_list[0]);
|
||||
}
|
||||
}
|
||||
net_lookup_ipv4 ((const char *) prefs.hex_dcc_ip, &addr);
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
71
src/common/gen-public-suffix.py
Normal file
71
src/common/gen-public-suffix.py
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
|
||||
URLS = (
|
||||
"https://raw.githubusercontent.com/publicsuffix/list/main/public_suffix_list.dat",
|
||||
"https://publicsuffix.org/list/public_suffix_list.dat",
|
||||
)
|
||||
|
||||
|
||||
def parse_rules(text: str):
|
||||
rules = []
|
||||
for raw in text.splitlines():
|
||||
line = raw.strip()
|
||||
if not line or line.startswith("//"):
|
||||
continue
|
||||
if " " in line or "\t" in line:
|
||||
line = line.split()[0]
|
||||
rules.append(line.lower())
|
||||
return sorted(set(rules))
|
||||
|
||||
|
||||
def emit_header(path: str, rules):
|
||||
with open(path, "w", encoding="utf-8", newline="\n") as out:
|
||||
out.write("#pragma once\n")
|
||||
out.write("static const char * const public_suffix_rules[] = {\n")
|
||||
for rule in rules:
|
||||
escaped = rule.replace("\\", "\\\\").replace('"', '\\"')
|
||||
out.write(f'\t"{escaped}",\n')
|
||||
out.write("};\n")
|
||||
out.write(
|
||||
"static const unsigned int public_suffix_rules_len = sizeof(public_suffix_rules) / sizeof(public_suffix_rules[0]);\n"
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) not in (2, 3):
|
||||
raise SystemExit("usage: gen-public-suffix.py <output> [source]")
|
||||
output = Path(sys.argv[1])
|
||||
sources = []
|
||||
if len(sys.argv) == 3:
|
||||
sources.append(Path(sys.argv[2]))
|
||||
sources.extend(
|
||||
[
|
||||
Path(__file__).with_name("public_suffix_list.dat"),
|
||||
Path("/usr/share/publicsuffix/public_suffix_list.dat"),
|
||||
Path("/app/share/publicsuffix/public_suffix_list.dat"),
|
||||
]
|
||||
)
|
||||
data = None
|
||||
for url in URLS:
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=30) as resp:
|
||||
data = resp.read().decode("utf-8")
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
if data is None:
|
||||
for source in sources:
|
||||
if source.exists():
|
||||
data = source.read_text(encoding="utf-8")
|
||||
break
|
||||
if data is None:
|
||||
raise SystemExit("unable to load public suffix list")
|
||||
rules = parse_rules(data)
|
||||
emit_header(str(output), rules)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "ignore.h"
|
||||
#include "fe.h"
|
||||
#include "modes.h"
|
||||
#include "network.h"
|
||||
#include "notify.h"
|
||||
#include "outbound.h"
|
||||
#include "inbound.h"
|
||||
@@ -1476,14 +1477,13 @@ inbound_uback (server *serv, const message_tags_data *tags_data)
|
||||
void
|
||||
inbound_foundip (session *sess, char *ip, const message_tags_data *tags_data)
|
||||
{
|
||||
struct hostent *HostAddr;
|
||||
struct in_addr addr;
|
||||
|
||||
HostAddr = gethostbyname (ip);
|
||||
if (HostAddr)
|
||||
if (net_lookup_ipv4 (ip, &addr.s_addr))
|
||||
{
|
||||
sess->server->dcc_ip = ((struct in_addr *) HostAddr->h_addr_list[0])->s_addr;
|
||||
sess->server->dcc_ip = addr.s_addr;
|
||||
EMIT_SIGNAL_TIMESTAMP (XP_TE_FOUNDIP, sess->server->server_session,
|
||||
inet_ntoa (*((struct in_addr *) HostAddr->h_addr_list[0])),
|
||||
inet_ntoa (addr),
|
||||
NULL, NULL, NULL, 0, tags_data->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ common_sources = [
|
||||
'util.c'
|
||||
]
|
||||
|
||||
secretstore_sources = files('secretstore.c')
|
||||
|
||||
common_sysinfo_deps = []
|
||||
libarchive_dep = dependency('libarchive', required: host_machine.system() != 'windows')
|
||||
|
||||
@@ -38,6 +40,9 @@ common_deps = [
|
||||
if libarchive_dep.found()
|
||||
common_deps += libarchive_dep
|
||||
endif
|
||||
if libsecret_dep.found()
|
||||
common_deps += libsecret_dep
|
||||
endif
|
||||
|
||||
common_includes = [
|
||||
config_h_include,
|
||||
@@ -96,6 +101,14 @@ marshal = [
|
||||
|
||||
make_te = find_program('make-te.py')
|
||||
|
||||
|
||||
python3 = find_program('python3', required: true)
|
||||
|
||||
public_suffix_data = custom_target('public_suffix_data_h',
|
||||
output: 'public_suffix_data.h',
|
||||
command: [python3, files('gen-public-suffix.py'), '@OUTPUT@']
|
||||
)
|
||||
|
||||
textevents = custom_target('textevents',
|
||||
input: 'textevents.in',
|
||||
output: ['textevents.h', 'textenums.h'],
|
||||
@@ -107,7 +120,7 @@ if libssl_dep.found()
|
||||
common_deps += libssl_dep
|
||||
endif
|
||||
|
||||
if dbus_glib_dep.found()
|
||||
if dbus_dep.found()
|
||||
subdir('dbus')
|
||||
common_deps += zoitechat_dbus_dep
|
||||
common_includes += include_directories('dbus')
|
||||
@@ -119,7 +132,7 @@ if get_option('plugin')
|
||||
endif
|
||||
|
||||
zoitechat_common = static_library('zoitechatcommon',
|
||||
sources: [textevents] + marshal + common_sources,
|
||||
sources: [textevents, public_suffix_data] + marshal + common_sources + secretstore_sources,
|
||||
include_directories: config_h_include,
|
||||
dependencies: common_deps + common_sysinfo_deps,
|
||||
c_args: common_cflags,
|
||||
@@ -127,7 +140,7 @@ zoitechat_common = static_library('zoitechatcommon',
|
||||
)
|
||||
|
||||
zoitechat_common_dep = declare_dependency(
|
||||
sources: [textevents] + marshal,
|
||||
sources: [textevents, public_suffix_data] + marshal,
|
||||
link_with: zoitechat_common,
|
||||
include_directories: common_includes,
|
||||
compile_args: common_cflags,
|
||||
|
||||
@@ -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 *
|
||||
@@ -69,6 +96,30 @@ net_ip (uint32_t addr)
|
||||
return inet_ntoa (ia);
|
||||
}
|
||||
|
||||
int
|
||||
net_lookup_ipv4 (const char *hostname, uint32_t *addr)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *res;
|
||||
struct sockaddr_in *sin;
|
||||
int ret;
|
||||
|
||||
memset (&hints, 0, sizeof (hints));
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_flags = AI_ADDRCONFIG;
|
||||
|
||||
ret = getaddrinfo (hostname, NULL, &hints, &res);
|
||||
if (ret != 0)
|
||||
return FALSE;
|
||||
|
||||
sin = (struct sockaddr_in *) res->ai_addr;
|
||||
*addr = sin->sin_addr.s_addr;
|
||||
freeaddrinfo (res);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
net_store_destroy (netstore * ns)
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ int net_connect (netstore *ns, int sok4, int sok6, int *sok_return);
|
||||
char *net_resolve (netstore *ns, char *hostname, int port, char **real_host);
|
||||
void net_bind (netstore *tobindto, int sok4, int sok6);
|
||||
char *net_ip (uint32_t addr);
|
||||
int net_lookup_ipv4 (const char *hostname, uint32_t *addr);
|
||||
void net_sockets (int *sok4, int *sok6);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4166,10 +4166,10 @@ const struct commands xc_cmds[] = {
|
||||
static int
|
||||
command_compare (const void *a, const void *b)
|
||||
{
|
||||
return g_ascii_strcasecmp (a, ((struct commands *)b)->name);
|
||||
return g_ascii_strcasecmp (a, ((const struct commands *)b)->name);
|
||||
}
|
||||
|
||||
static struct commands *
|
||||
static const struct commands *
|
||||
find_internal_command (char *name)
|
||||
{
|
||||
/* the "-1" is to skip the NULL terminator */
|
||||
@@ -4205,7 +4205,7 @@ usercommand_show_help (session *sess, char *name)
|
||||
static void
|
||||
help (session *sess, char *tbuf, char *helpcmd, int quiet)
|
||||
{
|
||||
struct commands *cmd;
|
||||
const struct commands *cmd;
|
||||
|
||||
if (plugin_show_help (sess, helpcmd))
|
||||
return;
|
||||
@@ -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;
|
||||
@@ -4763,7 +4763,7 @@ handle_command (session *sess, char *cmd, int check_spch)
|
||||
char *word[PDIWORDS+1];
|
||||
char *word_eol[PDIWORDS+1];
|
||||
static int command_level = 0;
|
||||
struct commands *int_cmd;
|
||||
const struct commands *int_cmd;
|
||||
char *pdibuf;
|
||||
char *tbuf;
|
||||
int len;
|
||||
|
||||
@@ -493,7 +493,6 @@ plugin_auto_load (session *sess)
|
||||
for_files (lib_dir, "hcperl.dll", plugin_auto_load_cb);
|
||||
for_files (lib_dir, "hcpython3.dll", plugin_auto_load_cb);
|
||||
for_files (lib_dir, "hcupd.dll", plugin_auto_load_cb);
|
||||
for_files (lib_dir, "hcwinamp.dll", plugin_auto_load_cb);
|
||||
for_files (lib_dir, "hcsysinfo.dll", plugin_auto_load_cb);
|
||||
#else
|
||||
for_files (lib_dir, "*."PLUGIN_SUFFIX, plugin_auto_load_cb);
|
||||
@@ -1214,8 +1213,6 @@ zoitechat_get_info (zoitechat_plugin *ph, const char *id)
|
||||
|
||||
case 0x4889ba9b: /* password */
|
||||
case 0x438fdf9: /* nickserv */
|
||||
if (sess->server->network)
|
||||
return ((ircnet *)sess->server->network)->pass;
|
||||
return NULL;
|
||||
|
||||
case 0xca022f43: /* server */
|
||||
|
||||
@@ -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], '!');
|
||||
|
||||
173
src/common/secretstore.c
Normal file
173
src/common/secretstore.c
Normal file
@@ -0,0 +1,173 @@
|
||||
#include "zoitechat.h"
|
||||
#include "cfgfiles.h"
|
||||
#include "secretstore.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#include <wincred.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBSECRET
|
||||
#include <libsecret/secret.h>
|
||||
#endif
|
||||
|
||||
static char *secretstore_target (const char *network_name)
|
||||
{
|
||||
return g_strdup_printf ("zoitechat/network/%s", network_name ? network_name : "default");
|
||||
}
|
||||
|
||||
int secretstore_is_keyring_available (void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return TRUE;
|
||||
#elif defined(HAVE_LIBSECRET)
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
char *secretstore_get_network_password (const char *network_name)
|
||||
{
|
||||
char *target;
|
||||
target = secretstore_target (network_name);
|
||||
#ifdef WIN32
|
||||
{
|
||||
PCREDENTIALA cred = NULL;
|
||||
char *ret = NULL;
|
||||
if (CredReadA (target, CRED_TYPE_GENERIC, 0, &cred))
|
||||
{
|
||||
ret = g_strndup ((const char *) cred->CredentialBlob, cred->CredentialBlobSize);
|
||||
CredFree (cred);
|
||||
}
|
||||
g_free (target);
|
||||
return ret;
|
||||
}
|
||||
#elif defined(HAVE_LIBSECRET)
|
||||
{
|
||||
static const SecretSchema schema = {
|
||||
"net.zoite.ZoiteChat.Network", SECRET_SCHEMA_NONE,
|
||||
{
|
||||
{ "network", SECRET_SCHEMA_ATTRIBUTE_STRING },
|
||||
{ NULL, 0 },
|
||||
}
|
||||
};
|
||||
char *ret = secret_password_lookup_sync (&schema, NULL, NULL, "network", target, NULL);
|
||||
g_free (target);
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
g_free (target);
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
int secretstore_set_network_password (const char *network_name, const char *password)
|
||||
{
|
||||
char *target;
|
||||
target = secretstore_target (network_name);
|
||||
#ifdef WIN32
|
||||
{
|
||||
CREDENTIALA cred;
|
||||
memset (&cred, 0, sizeof (cred));
|
||||
cred.Type = CRED_TYPE_GENERIC;
|
||||
cred.TargetName = target;
|
||||
cred.CredentialBlobSize = (DWORD) strlen (password);
|
||||
cred.CredentialBlob = (LPBYTE) password;
|
||||
cred.Persist = CRED_PERSIST_LOCAL_MACHINE;
|
||||
cred.UserName = "zoitechat";
|
||||
if (!CredWriteA (&cred, 0))
|
||||
{
|
||||
g_free (target);
|
||||
return FALSE;
|
||||
}
|
||||
g_free (target);
|
||||
return TRUE;
|
||||
}
|
||||
#elif defined(HAVE_LIBSECRET)
|
||||
{
|
||||
static const SecretSchema schema = {
|
||||
"net.zoite.ZoiteChat.Network", SECRET_SCHEMA_NONE,
|
||||
{
|
||||
{ "network", SECRET_SCHEMA_ATTRIBUTE_STRING },
|
||||
{ NULL, 0 },
|
||||
}
|
||||
};
|
||||
gboolean ok = secret_password_store_sync (&schema, SECRET_COLLECTION_DEFAULT,
|
||||
"ZoiteChat network password", password, NULL, NULL, "network", target, NULL);
|
||||
g_free (target);
|
||||
return ok;
|
||||
}
|
||||
#else
|
||||
g_free (target);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
int secretstore_delete_network_password (const char *network_name)
|
||||
{
|
||||
char *target;
|
||||
target = secretstore_target (network_name);
|
||||
#ifdef WIN32
|
||||
{
|
||||
gboolean ok = CredDeleteA (target, CRED_TYPE_GENERIC, 0);
|
||||
g_free (target);
|
||||
return ok;
|
||||
}
|
||||
#elif defined(HAVE_LIBSECRET)
|
||||
{
|
||||
static const SecretSchema schema = {
|
||||
"net.zoite.ZoiteChat.Network", SECRET_SCHEMA_NONE,
|
||||
{
|
||||
{ "network", SECRET_SCHEMA_ATTRIBUTE_STRING },
|
||||
{ NULL, 0 },
|
||||
}
|
||||
};
|
||||
gboolean ok = secret_password_clear_sync (&schema, NULL, NULL, "network", target, NULL);
|
||||
g_free (target);
|
||||
return ok;
|
||||
}
|
||||
#else
|
||||
g_free (target);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
int secretstore_require_unlock (const char *network_name)
|
||||
{
|
||||
#ifdef WIN32
|
||||
return TRUE;
|
||||
#elif defined(HAVE_LIBSECRET)
|
||||
{
|
||||
static const SecretSchema schema = {
|
||||
"net.zoite.ZoiteChat.Network", SECRET_SCHEMA_NONE,
|
||||
{
|
||||
{ "network", SECRET_SCHEMA_ATTRIBUTE_STRING },
|
||||
{ NULL, 0 },
|
||||
}
|
||||
};
|
||||
char *target;
|
||||
char *password;
|
||||
GError *error = NULL;
|
||||
target = secretstore_target (network_name);
|
||||
password = secret_password_lookup_sync (&schema, NULL, &error, "network", target, NULL);
|
||||
g_free (target);
|
||||
if (password)
|
||||
{
|
||||
memset (password, 0, strlen (password));
|
||||
g_free (password);
|
||||
return TRUE;
|
||||
}
|
||||
if (error)
|
||||
{
|
||||
g_error_free (error);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
#else
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
10
src/common/secretstore.h
Normal file
10
src/common/secretstore.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef ZOITECHAT_SECRETSTORE_H
|
||||
#define ZOITECHAT_SECRETSTORE_H
|
||||
|
||||
char *secretstore_get_network_password (const char *network_name);
|
||||
int secretstore_set_network_password (const char *network_name, const char *password);
|
||||
int secretstore_delete_network_password (const char *network_name);
|
||||
int secretstore_is_keyring_available (void);
|
||||
int secretstore_require_unlock (const char *network_name);
|
||||
|
||||
#endif
|
||||
@@ -881,7 +881,7 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
|
||||
if (prefs.hex_net_auto_reconnectonfail)
|
||||
auto_reconnect (serv, FALSE, -1);
|
||||
break;
|
||||
case '3': /* gethostbyname finished */
|
||||
case '3': /* resolver finished */
|
||||
waitline2 (source, host, sizeof host);
|
||||
waitline2 (source, ip, sizeof ip);
|
||||
waitline2 (source, outbuf, sizeof outbuf);
|
||||
@@ -932,7 +932,7 @@ server_read_child (GIOChannel *source, GIOCondition condition, server *serv)
|
||||
waitline2 (source, tbuf, sizeof tbuf);
|
||||
prefs.local_ip = inet_addr (tbuf);
|
||||
break;
|
||||
case '7': /* gethostbyname (prefs.hex_net_bind_host) failed */
|
||||
case '7': /* prefs.hex_net_bind_host resolve failed */
|
||||
sprintf (outbuf,
|
||||
_("Cannot resolve hostname %s\nCheck your IP Settings!\n"),
|
||||
prefs.hex_net_bind_host);
|
||||
|
||||
@@ -33,9 +33,152 @@
|
||||
#include "text.h"
|
||||
#include "util.h" /* token_foreach */
|
||||
#include "zoitechatc.h"
|
||||
#include "secretstore.h"
|
||||
|
||||
#include "servlist.h"
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/rand.h>
|
||||
#endif
|
||||
|
||||
char *
|
||||
servlist_password_encrypt_for_storage (const char *pass)
|
||||
{
|
||||
gchar *material;
|
||||
unsigned char salt[16];
|
||||
unsigned char iv[16];
|
||||
unsigned char key[32];
|
||||
unsigned char *ciphertext;
|
||||
int outlen1;
|
||||
int outlen2;
|
||||
int inlen;
|
||||
int cipherlen;
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
char *b64;
|
||||
char *ret;
|
||||
if (!pass || !*pass)
|
||||
return NULL;
|
||||
#ifdef USE_OPENSSL
|
||||
if (RAND_bytes (salt, sizeof (salt)) != 1 || RAND_bytes (iv, sizeof (iv)) != 1)
|
||||
return NULL;
|
||||
material = g_strdup_printf ("%s|%s", g_get_user_name (), get_xdir ());
|
||||
if (!PKCS5_PBKDF2_HMAC (material, -1, salt, sizeof (salt), 300000, EVP_sha256 (), sizeof (key), key))
|
||||
{
|
||||
g_free (material);
|
||||
return NULL;
|
||||
}
|
||||
g_free (material);
|
||||
inlen = (int) strlen (pass);
|
||||
ciphertext = g_malloc (inlen + EVP_MAX_BLOCK_LENGTH);
|
||||
ctx = EVP_CIPHER_CTX_new ();
|
||||
if (!ctx)
|
||||
{
|
||||
memset (key, 0, sizeof (key));
|
||||
g_free (ciphertext);
|
||||
return NULL;
|
||||
}
|
||||
if (EVP_EncryptInit_ex (ctx, EVP_aes_256_cbc (), NULL, key, iv) != 1 ||
|
||||
EVP_EncryptUpdate (ctx, ciphertext, &outlen1, (const unsigned char *) pass, inlen) != 1 ||
|
||||
EVP_EncryptFinal_ex (ctx, ciphertext + outlen1, &outlen2) != 1)
|
||||
{
|
||||
EVP_CIPHER_CTX_free (ctx);
|
||||
memset (key, 0, sizeof (key));
|
||||
g_free (ciphertext);
|
||||
return NULL;
|
||||
}
|
||||
EVP_CIPHER_CTX_free (ctx);
|
||||
cipherlen = outlen1 + outlen2;
|
||||
{
|
||||
gsize payload_len = sizeof (salt) + sizeof (iv) + (gsize) cipherlen;
|
||||
unsigned char *payload = g_malloc (payload_len);
|
||||
memcpy (payload, salt, sizeof (salt));
|
||||
memcpy (payload + sizeof (salt), iv, sizeof (iv));
|
||||
memcpy (payload + sizeof (salt) + sizeof (iv), ciphertext, cipherlen);
|
||||
b64 = g_base64_encode (payload, payload_len);
|
||||
memset (payload, 0, payload_len);
|
||||
g_free (payload);
|
||||
}
|
||||
memset (key, 0, sizeof (key));
|
||||
memset (ciphertext, 0, inlen + EVP_MAX_BLOCK_LENGTH);
|
||||
g_free (ciphertext);
|
||||
#else
|
||||
b64 = g_base64_encode ((const guchar *) pass, strlen (pass));
|
||||
#endif
|
||||
ret = g_strdup_printf ("enc:%s", b64);
|
||||
g_free (b64);
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
servlist_password_is_encrypted (const char *pass)
|
||||
{
|
||||
return pass && g_str_has_prefix (pass, "enc:");
|
||||
}
|
||||
|
||||
char *
|
||||
servlist_password_decrypt_for_storage (const char *enc)
|
||||
{
|
||||
guchar *raw;
|
||||
gsize len;
|
||||
char *ret;
|
||||
if (!enc || !*enc)
|
||||
return NULL;
|
||||
if (!g_str_has_prefix (enc, "enc:"))
|
||||
return g_strdup (enc);
|
||||
raw = g_base64_decode (enc + 4, &len);
|
||||
#ifdef USE_OPENSSL
|
||||
if (len <= 32)
|
||||
{
|
||||
g_free (raw);
|
||||
return NULL;
|
||||
}
|
||||
{
|
||||
unsigned char *salt = raw;
|
||||
unsigned char *iv = raw + 16;
|
||||
unsigned char *ciphertext = raw + 32;
|
||||
int cipherlen = (int) (len - 32);
|
||||
unsigned char key[32];
|
||||
gchar *material = g_strdup_printf ("%s|%s", g_get_user_name (), get_xdir ());
|
||||
unsigned char *plaintext = g_malloc ((gsize) cipherlen + 1);
|
||||
int outlen1;
|
||||
int outlen2;
|
||||
EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new ();
|
||||
if (!ctx || !PKCS5_PBKDF2_HMAC (material, -1, salt, 16, 300000, EVP_sha256 (), sizeof (key), key))
|
||||
{
|
||||
g_free (material);
|
||||
if (ctx)
|
||||
EVP_CIPHER_CTX_free (ctx);
|
||||
g_free (plaintext);
|
||||
g_free (raw);
|
||||
return NULL;
|
||||
}
|
||||
g_free (material);
|
||||
if (EVP_DecryptInit_ex (ctx, EVP_aes_256_cbc (), NULL, key, iv) != 1 ||
|
||||
EVP_DecryptUpdate (ctx, plaintext, &outlen1, ciphertext, cipherlen) != 1 ||
|
||||
EVP_DecryptFinal_ex (ctx, plaintext + outlen1, &outlen2) != 1)
|
||||
{
|
||||
EVP_CIPHER_CTX_free (ctx);
|
||||
memset (key, 0, sizeof (key));
|
||||
memset (plaintext, 0, (gsize) cipherlen + 1);
|
||||
g_free (plaintext);
|
||||
g_free (raw);
|
||||
return NULL;
|
||||
}
|
||||
EVP_CIPHER_CTX_free (ctx);
|
||||
memset (key, 0, sizeof (key));
|
||||
plaintext[outlen1 + outlen2] = 0;
|
||||
ret = g_strdup ((const char *) plaintext);
|
||||
memset (plaintext, 0, (gsize) cipherlen + 1);
|
||||
g_free (plaintext);
|
||||
}
|
||||
#else
|
||||
ret = g_strndup ((const char *) raw, len);
|
||||
#endif
|
||||
g_free (raw);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
struct defaultserver
|
||||
{
|
||||
@@ -344,10 +487,29 @@ servlist_connect (session *sess, ircnet *net, gboolean join)
|
||||
}
|
||||
|
||||
serv->password[0] = 0;
|
||||
|
||||
if (net->pass)
|
||||
if ((net->flags & FLAG_USE_KEYRING) && net->name)
|
||||
{
|
||||
safe_strcpy (serv->password, net->pass, sizeof (serv->password));
|
||||
char *stored_pass = secretstore_get_network_password (net->name);
|
||||
if (stored_pass && *stored_pass)
|
||||
{
|
||||
safe_strcpy (serv->password, stored_pass, sizeof (serv->password));
|
||||
}
|
||||
if (stored_pass)
|
||||
{
|
||||
memset (stored_pass, 0, strlen (stored_pass));
|
||||
g_free (stored_pass);
|
||||
}
|
||||
}
|
||||
else if (net->pass)
|
||||
{
|
||||
char *plain = servlist_password_decrypt_for_storage (net->pass);
|
||||
if (plain && *plain)
|
||||
safe_strcpy (serv->password, plain, sizeof (serv->password));
|
||||
if (plain)
|
||||
{
|
||||
memset (plain, 0, strlen (plain));
|
||||
g_free (plain);
|
||||
}
|
||||
}
|
||||
|
||||
if (net->flags & FLAG_USE_GLOBAL)
|
||||
@@ -982,24 +1144,6 @@ servlist_load (void)
|
||||
*
|
||||
* Should be removed at some point.
|
||||
*/
|
||||
case 'A':
|
||||
if (!net->pass)
|
||||
{
|
||||
net->pass = g_strdup (buf + 2);
|
||||
if (!net->logintype)
|
||||
{
|
||||
net->logintype = LOGIN_SASL;
|
||||
}
|
||||
}
|
||||
case 'B':
|
||||
if (!net->pass)
|
||||
{
|
||||
net->pass = g_strdup (buf + 2);
|
||||
if (!net->logintype)
|
||||
{
|
||||
net->logintype = LOGIN_NICKSERV;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buf[0] == 'N')
|
||||
|
||||
@@ -62,7 +62,8 @@ extern GSList *network_list;
|
||||
#define FLAG_USE_PROXY 16
|
||||
#define FLAG_ALLOW_INVALID 32
|
||||
#define FLAG_FAVORITE 64
|
||||
#define FLAG_COUNT 7
|
||||
#define FLAG_USE_KEYRING 128
|
||||
#define FLAG_COUNT 8
|
||||
|
||||
/* Login methods. Use server password by default - if we had a NickServ password, it'd be set to 2 already by servlist_load() */
|
||||
#define LOGIN_DEFAULT_REAL LOGIN_PASS /* this is to set the default login method for unknown servers */
|
||||
@@ -124,5 +125,8 @@ favchannel *servlist_favchan_copy (favchannel *fav);
|
||||
GSList *servlist_favchan_listadd (GSList *chanlist, char *channel, char *key);
|
||||
|
||||
gboolean joinlist_is_in_list (server *serv, char *channel);
|
||||
char *servlist_password_encrypt_for_storage (const char *pass);
|
||||
char *servlist_password_decrypt_for_storage (const char *pass);
|
||||
gboolean servlist_password_is_encrypted (const char *pass);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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;
|
||||
|
||||
148
src/common/url.c
148
src/common/url.c
@@ -20,12 +20,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <glib.h>
|
||||
#include "zoitechat.h"
|
||||
#include "zoitechatc.h"
|
||||
#include "cfgfiles.h"
|
||||
#include "fe.h"
|
||||
#include "tree.h"
|
||||
#include "url.h"
|
||||
#include "public_suffix_data.h"
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
@@ -35,6 +37,7 @@ GTree *url_btree = NULL;
|
||||
static gboolean regex_match (const GRegex *re, const char *word,
|
||||
int *start, int *end);
|
||||
static const GRegex *re_url (void);
|
||||
static const GRegex *re_url_no_scheme (void);
|
||||
static const GRegex *re_email (void);
|
||||
static const GRegex *re_nick (void);
|
||||
static const GRegex *re_channel (void);
|
||||
@@ -42,6 +45,8 @@ static gboolean match_nick (const char *word, int *start, int *end);
|
||||
static gboolean match_channel (const char *word, int *start, int *end);
|
||||
static gboolean match_url (const char *word, int *start, int *end);
|
||||
static gboolean match_email (const char *word, int *start, int *end);
|
||||
static gboolean host_has_public_suffix (const char *host);
|
||||
static gboolean host_has_public_suffix_range (const char *word, int start, int end);
|
||||
|
||||
static int
|
||||
url_free (char *url, void *data)
|
||||
@@ -266,7 +271,16 @@ match_channel (const char *word, int *start, int *end)
|
||||
static gboolean
|
||||
match_url (const char *word, int *start, int *end)
|
||||
{
|
||||
return regex_match (re_url (), word, start, end);
|
||||
if (regex_match (re_url (), word, start, end))
|
||||
return TRUE;
|
||||
|
||||
if (!regex_match (re_url_no_scheme (), word, start, end))
|
||||
return FALSE;
|
||||
|
||||
if (*start > 0 && word[*start - 1] == '@')
|
||||
return FALSE;
|
||||
|
||||
return host_has_public_suffix_range (word, *start, *end);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -307,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)
|
||||
{
|
||||
@@ -393,6 +407,114 @@ regex_match (const GRegex *re, const char *word, int *start, int *end)
|
||||
return found;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
host_has_public_suffix_range (const char *word, int start, int end)
|
||||
{
|
||||
char *candidate;
|
||||
const char *host_start;
|
||||
const char *host_end;
|
||||
const char *host_colon;
|
||||
gboolean ok;
|
||||
int host_len;
|
||||
char *host;
|
||||
|
||||
candidate = g_strndup (word + start, end - start);
|
||||
host_start = candidate;
|
||||
host_end = candidate + strlen (candidate);
|
||||
if (*host_start == '[')
|
||||
{
|
||||
g_free (candidate);
|
||||
return FALSE;
|
||||
}
|
||||
host_colon = strchr (host_start, ':');
|
||||
if (host_colon)
|
||||
host_end = host_colon;
|
||||
host_colon = strchr (host_start, '/');
|
||||
if (host_colon && host_colon < host_end)
|
||||
host_end = host_colon;
|
||||
host_len = (int)(host_end - host_start);
|
||||
if (host_len <= 0)
|
||||
{
|
||||
g_free (candidate);
|
||||
return FALSE;
|
||||
}
|
||||
host = g_strndup (host_start, host_len);
|
||||
ok = host_has_public_suffix (host);
|
||||
g_free (host);
|
||||
g_free (candidate);
|
||||
return ok;
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
public_suffix_table (void)
|
||||
{
|
||||
static GHashTable *table = NULL;
|
||||
unsigned int i;
|
||||
|
||||
if (table)
|
||||
return table;
|
||||
|
||||
table = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
for (i = 0; i < public_suffix_rules_len; i++)
|
||||
{
|
||||
g_hash_table_add (table, (gpointer)public_suffix_rules[i]);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
host_has_public_suffix (const char *host)
|
||||
{
|
||||
GHashTable *table;
|
||||
gchar **labels;
|
||||
int i;
|
||||
int n;
|
||||
gboolean matched = FALSE;
|
||||
|
||||
if (!strchr (host, '.'))
|
||||
return FALSE;
|
||||
|
||||
labels = g_strsplit (host, ".", -1);
|
||||
for (n = 0; labels[n]; n++)
|
||||
{
|
||||
if (labels[n][0] == '\0')
|
||||
{
|
||||
g_strfreev (labels);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
table = public_suffix_table ();
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
char *tail = g_strjoinv (".", &labels[i]);
|
||||
if (g_hash_table_contains (table, tail))
|
||||
matched = TRUE;
|
||||
if (i + 1 < n)
|
||||
{
|
||||
char *tail_wild = g_strjoinv (".", &labels[i + 1]);
|
||||
char *wild = g_strconcat ("*.", tail_wild, NULL);
|
||||
if (g_hash_table_contains (table, wild))
|
||||
matched = TRUE;
|
||||
g_free (tail_wild);
|
||||
g_free (wild);
|
||||
}
|
||||
if (i > 0)
|
||||
{
|
||||
char *exc = g_strconcat ("!", tail, NULL);
|
||||
if (g_hash_table_contains (table, exc))
|
||||
matched = TRUE;
|
||||
g_free (exc);
|
||||
}
|
||||
g_free (tail);
|
||||
if (matched)
|
||||
break;
|
||||
}
|
||||
|
||||
g_strfreev (labels);
|
||||
return matched;
|
||||
}
|
||||
|
||||
/* Miscellaneous description --- */
|
||||
#define DOMAIN_LABEL "[\\pL\\pN](?:[-\\pL\\pN]{0,61}[\\pL\\pN])?"
|
||||
#define DOMAIN DOMAIN_LABEL "(\\." DOMAIN_LABEL ")*"
|
||||
@@ -477,6 +599,28 @@ re_url (void)
|
||||
return url_ret;
|
||||
}
|
||||
|
||||
static const GRegex *
|
||||
re_url_no_scheme (void)
|
||||
{
|
||||
static GRegex *url_ret = NULL;
|
||||
GString *grist_gstr;
|
||||
char *grist;
|
||||
|
||||
if (url_ret) return url_ret;
|
||||
|
||||
grist_gstr = g_string_new (NULL);
|
||||
g_string_append (grist_gstr, "(");
|
||||
g_string_append (grist_gstr, HOST_URL_OPT_TLD OPT_PORT);
|
||||
g_string_append_printf (grist_gstr, "(/" PATH ")?");
|
||||
g_string_append (grist_gstr, ")");
|
||||
|
||||
grist = g_string_free (grist_gstr, FALSE);
|
||||
url_ret = make_re (grist);
|
||||
g_free (grist);
|
||||
|
||||
return url_ret;
|
||||
}
|
||||
|
||||
#define EMAIL_LOCAL_ATOM "[\\pL\\pN!#$%&'*+/=?^_`{|}~-]+"
|
||||
#define EMAIL_LOCAL EMAIL_LOCAL_ATOM "(\\." EMAIL_LOCAL_ATOM ")*"
|
||||
#define EMAIL EMAIL_LOCAL "@" DOMAIN TLD
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
* Copyright (C) 1998-2010 Peter Zelezny.
|
||||
* Copyright (C) 2009-2013 Berke Viktor.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
@@ -13,8 +13,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
* along with this program; if not, see
|
||||
* <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* You can distribute this header with your plugins for easy compilation */
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -61,28 +61,19 @@ static tab_scroll_animation *tab_right_animation;
|
||||
*/
|
||||
|
||||
static inline gint
|
||||
cv_tabs_get_viewport_size (GdkWindow *parent_win, gboolean vertical)
|
||||
cv_tabs_get_viewport_size (GtkAdjustment *adj)
|
||||
{
|
||||
gint viewport_size = 0;
|
||||
|
||||
if (vertical)
|
||||
viewport_size = gdk_window_get_height (parent_win);
|
||||
else
|
||||
viewport_size = gdk_window_get_width (parent_win);
|
||||
|
||||
return viewport_size;
|
||||
return (gint) gtk_adjustment_get_page_size (adj);
|
||||
}
|
||||
|
||||
static void
|
||||
cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
|
||||
{
|
||||
GdkWindow *parent_win;
|
||||
GtkAdjustment *adj;
|
||||
GtkWidget *inner;
|
||||
gint viewport_size;
|
||||
|
||||
inner = ((tabview *)cv)->inner;
|
||||
parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
|
||||
|
||||
if (cv->vertical)
|
||||
{
|
||||
@@ -92,16 +83,20 @@ cv_tabs_sizealloc (GtkWidget *widget, GtkAllocation *allocation, chanview *cv)
|
||||
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent (inner)));
|
||||
}
|
||||
|
||||
viewport_size = cv_tabs_get_viewport_size (parent_win, cv->vertical);
|
||||
viewport_size = cv_tabs_get_viewport_size (adj);
|
||||
|
||||
if (gtk_adjustment_get_upper (adj) <= viewport_size)
|
||||
{
|
||||
gtk_widget_hide (((tabview *)cv)->b1);
|
||||
gtk_widget_hide (((tabview *)cv)->b2);
|
||||
if (((tabview *)cv)->b1)
|
||||
gtk_widget_hide (((tabview *)cv)->b1);
|
||||
if (((tabview *)cv)->b2)
|
||||
gtk_widget_hide (((tabview *)cv)->b2);
|
||||
} else
|
||||
{
|
||||
gtk_widget_show (((tabview *)cv)->b1);
|
||||
gtk_widget_show (((tabview *)cv)->b2);
|
||||
if (((tabview *)cv)->b1)
|
||||
gtk_widget_show (((tabview *)cv)->b1);
|
||||
if (((tabview *)cv)->b2)
|
||||
gtk_widget_show (((tabview *)cv)->b2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,10 +236,8 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv)
|
||||
gint viewport_size;
|
||||
gfloat new_value;
|
||||
GtkWidget *inner;
|
||||
GdkWindow *parent_win;
|
||||
|
||||
inner = ((tabview *)cv)->inner;
|
||||
parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
|
||||
|
||||
if (cv->vertical)
|
||||
{
|
||||
@@ -254,7 +247,7 @@ tab_scroll_left_up_clicked (GtkWidget *widget, chanview *cv)
|
||||
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent(inner)));
|
||||
}
|
||||
|
||||
viewport_size = cv_tabs_get_viewport_size (parent_win, cv->vertical);
|
||||
viewport_size = cv_tabs_get_viewport_size (adj);
|
||||
|
||||
new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 0, cv->vertical);
|
||||
|
||||
@@ -279,10 +272,8 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
|
||||
gint viewport_size;
|
||||
gfloat new_value;
|
||||
GtkWidget *inner;
|
||||
GdkWindow *parent_win;
|
||||
|
||||
inner = ((tabview *)cv)->inner;
|
||||
parent_win = gtk_widget_get_window (gtk_widget_get_parent (inner));
|
||||
|
||||
if (cv->vertical)
|
||||
{
|
||||
@@ -292,7 +283,7 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
|
||||
adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (gtk_widget_get_parent(inner)));
|
||||
}
|
||||
|
||||
viewport_size = cv_tabs_get_viewport_size (parent_win, cv->vertical);
|
||||
viewport_size = cv_tabs_get_viewport_size (adj);
|
||||
|
||||
new_value = tab_search_offset (inner, gtk_adjustment_get_value (adj), 1, cv->vertical);
|
||||
|
||||
@@ -313,67 +304,41 @@ tab_scroll_right_down_clicked (GtkWidget *widget, chanview *cv)
|
||||
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 (event->direction == GDK_SCROLL_DOWN)
|
||||
mg_switch_page (1, 1);
|
||||
else if (event->direction == GDK_SCROLL_UP)
|
||||
mg_switch_page (1, -1);
|
||||
if (direction != 0)
|
||||
{
|
||||
for (i = 0; i < cv_scroll_step_count (); i++)
|
||||
mg_switch_page (1, direction);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* mouse wheel scrolling */
|
||||
if (event->direction == GDK_SCROLL_UP)
|
||||
tab_scroll_left_up_clicked (widget, cv);
|
||||
else if (event->direction == GDK_SCROLL_DOWN)
|
||||
tab_scroll_right_down_clicked (widget, cv);
|
||||
if (direction < 0)
|
||||
{
|
||||
for (i = 0; i < cv_scroll_step_count (); i++)
|
||||
tab_scroll_left_up_clicked (widget, cv);
|
||||
return TRUE;
|
||||
}
|
||||
else if (direction > 0)
|
||||
{
|
||||
for (i = 0; i < cv_scroll_step_count (); i++)
|
||||
tab_scroll_right_down_clicked (widget, cv);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* make a Scroll (arrow) button */
|
||||
|
||||
static GtkWidget *
|
||||
make_sbutton (GtkArrowType type, void *click_cb, void *userdata)
|
||||
{
|
||||
GtkWidget *button, *arrow;
|
||||
const char *icon_name = "pan-end-symbolic";
|
||||
|
||||
button = gtk_button_new ();
|
||||
switch (type)
|
||||
{
|
||||
case GTK_ARROW_UP:
|
||||
icon_name = "pan-up-symbolic";
|
||||
break;
|
||||
case GTK_ARROW_DOWN:
|
||||
icon_name = "pan-down-symbolic";
|
||||
break;
|
||||
case GTK_ARROW_LEFT:
|
||||
icon_name = "pan-start-symbolic";
|
||||
break;
|
||||
case GTK_ARROW_RIGHT:
|
||||
default:
|
||||
icon_name = "pan-end-symbolic";
|
||||
break;
|
||||
}
|
||||
|
||||
arrow = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_BUTTON);
|
||||
gtk_container_add (GTK_CONTAINER (button), arrow);
|
||||
gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
|
||||
g_signal_connect (G_OBJECT (button), "clicked",
|
||||
G_CALLBACK (click_cb), userdata);
|
||||
g_signal_connect (G_OBJECT (button), "scroll-event",
|
||||
G_CALLBACK (tab_scroll_cb), userdata);
|
||||
gtk_widget_show (arrow);
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
static void
|
||||
cv_tabs_init (chanview *cv)
|
||||
{
|
||||
GtkWidget *box, *hbox = NULL;
|
||||
GtkWidget *box;
|
||||
GtkWidget *viewport;
|
||||
GtkWidget *outer;
|
||||
|
||||
@@ -390,12 +355,19 @@ cv_tabs_init (chanview *cv)
|
||||
G_CALLBACK (cv_tabs_sizealloc), cv);
|
||||
gtk_widget_show (outer);
|
||||
|
||||
viewport = gtk_viewport_new (0, 0);
|
||||
gtk_viewport_set_shadow_type (GTK_VIEWPORT (viewport), GTK_SHADOW_NONE);
|
||||
viewport = gtk_scrolled_window_new (0, 0);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (viewport), GTK_SHADOW_NONE);
|
||||
if (cv->vertical)
|
||||
gtk_widget_set_size_request (viewport, -1, 1);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (viewport),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
else
|
||||
gtk_widget_set_size_request (viewport, 1, -1);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (viewport),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
|
||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (viewport), 1);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (viewport), 1);
|
||||
gtk_widget_set_hexpand (viewport, TRUE);
|
||||
gtk_widget_set_vexpand (viewport, TRUE);
|
||||
cv_add_scroll_events (viewport);
|
||||
g_signal_connect (G_OBJECT (viewport), "scroll-event",
|
||||
G_CALLBACK (tab_scroll_cb), cv);
|
||||
gtk_box_pack_start (GTK_BOX (outer), viewport, 1, 1, 0);
|
||||
@@ -413,35 +385,6 @@ cv_tabs_init (chanview *cv)
|
||||
gtk_container_add (GTK_CONTAINER (viewport), box);
|
||||
gtk_widget_show (box);
|
||||
|
||||
/* if vertical, the buttons can be side by side */
|
||||
if (cv->vertical)
|
||||
{
|
||||
hbox = gtkutil_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (outer), hbox, 0, 0, 0);
|
||||
gtk_widget_show (hbox);
|
||||
}
|
||||
|
||||
/* make the Scroll buttons */
|
||||
((tabview *)cv)->b2 = make_sbutton (cv->vertical ?
|
||||
GTK_ARROW_UP : GTK_ARROW_LEFT,
|
||||
tab_scroll_left_up_clicked,
|
||||
cv);
|
||||
|
||||
((tabview *)cv)->b1 = make_sbutton (cv->vertical ?
|
||||
GTK_ARROW_DOWN : GTK_ARROW_RIGHT,
|
||||
tab_scroll_right_down_clicked,
|
||||
cv);
|
||||
|
||||
if (hbox)
|
||||
{
|
||||
gtk_container_add (GTK_CONTAINER (hbox), ((tabview *)cv)->b2);
|
||||
gtk_container_add (GTK_CONTAINER (hbox), ((tabview *)cv)->b1);
|
||||
} else
|
||||
{
|
||||
gtk_box_pack_start (GTK_BOX (outer), ((tabview *)cv)->b2, 0, 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (outer), ((tabview *)cv)->b1, 0, 0, 0);
|
||||
}
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (cv->box), outer);
|
||||
}
|
||||
|
||||
@@ -746,9 +689,11 @@ cv_tabs_add (chanview *cv, chan *ch, char *name, GtkTreeIter *parent)
|
||||
gtk_widget_set_name (but, "zoitechat-tab");
|
||||
gtk_widget_set_size_request (but, -1, 14);
|
||||
gtk_widget_add_events (but, GDK_POINTER_MOTION_MASK | GDK_LEAVE_NOTIFY_MASK);
|
||||
cv_add_scroll_events (but);
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
|
||||
label = gtk_label_new (name);
|
||||
close_button = gtk_button_new ();
|
||||
cv_add_scroll_events (close_button);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (close_button), "flat");
|
||||
close_icon = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (close_icon), 8);
|
||||
@@ -764,6 +709,10 @@ cv_tabs_add (chanview *cv, chan *ch, char *name, GtkTreeIter *parent)
|
||||
/* used to trap right-clicks */
|
||||
g_signal_connect (G_OBJECT (but), "button-press-event",
|
||||
G_CALLBACK (tab_click_cb), ch);
|
||||
g_signal_connect (G_OBJECT (but), "scroll-event",
|
||||
G_CALLBACK (tab_scroll_cb), cv);
|
||||
g_signal_connect (G_OBJECT (close_button), "scroll-event",
|
||||
G_CALLBACK (tab_scroll_cb), cv);
|
||||
g_signal_connect (G_OBJECT (but), "motion-notify-event",
|
||||
G_CALLBACK (tab_close_motion_cb), ch);
|
||||
g_signal_connect (G_OBJECT (but), "leave-notify-event",
|
||||
|
||||
@@ -111,12 +111,14 @@ cv_tree_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, gpointer user
|
||||
{
|
||||
if (prefs.hex_gui_tab_scrollchans)
|
||||
{
|
||||
if (event->direction == GDK_SCROLL_DOWN)
|
||||
mg_switch_page (1, 1);
|
||||
else if (event->direction == GDK_SCROLL_UP)
|
||||
mg_switch_page (1, -1);
|
||||
int direction = cv_scroll_direction (event);
|
||||
int i;
|
||||
|
||||
return TRUE;
|
||||
if (direction != 0)
|
||||
for (i = 0; i < cv_scroll_step_count (); i++)
|
||||
mg_switch_page (1, direction);
|
||||
|
||||
return direction != 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@@ -141,6 +143,7 @@ cv_tree_init (chanview *cv)
|
||||
win = gtk_scrolled_window_new (0, 0);
|
||||
gtk_widget_set_hexpand (win, TRUE);
|
||||
gtk_widget_set_vexpand (win, TRUE);
|
||||
cv_add_scroll_events (win);
|
||||
|
||||
/*gtk_container_set_border_width (GTK_CONTAINER (win), 1);*/
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (win),
|
||||
@@ -154,6 +157,7 @@ cv_tree_init (chanview *cv)
|
||||
view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (cv->store));
|
||||
gtk_widget_set_hexpand (view, TRUE);
|
||||
gtk_widget_set_vexpand (view, TRUE);
|
||||
cv_add_scroll_events (view);
|
||||
gtk_widget_set_name (view, "zoitechat-tree");
|
||||
{
|
||||
ThemeWidgetStyleValues style_values;
|
||||
|
||||
@@ -95,6 +95,46 @@ static chan *cv_find_chan_by_number (chanview *cv, int num);
|
||||
static int cv_find_number_of_chan (chanview *cv, chan *find_ch);
|
||||
static void cv_find_neighbors_for_removal (chanview *cv, chan *find_ch, chan **left_ch, chan **first_ch);
|
||||
|
||||
static void
|
||||
cv_add_scroll_events (GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_add_events (widget, GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK);
|
||||
}
|
||||
|
||||
static int
|
||||
cv_scroll_direction (GdkEventScroll *event)
|
||||
{
|
||||
gdouble dx;
|
||||
gdouble dy;
|
||||
|
||||
if (event->direction == GDK_SCROLL_SMOOTH && gdk_event_get_scroll_deltas ((GdkEvent *) event, &dx, &dy))
|
||||
{
|
||||
if (dy > 0)
|
||||
return 1;
|
||||
if (dy < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (event->direction)
|
||||
{
|
||||
case GDK_SCROLL_DOWN:
|
||||
return 1;
|
||||
case GDK_SCROLL_UP:
|
||||
return -1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
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 ======= */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -443,6 +443,27 @@ key_handle_key_press (GtkWidget *wid, GdkEventKey *evt, session *sess)
|
||||
if (!list)
|
||||
return FALSE;
|
||||
current_sess = sess;
|
||||
if ((evt->state & GDK_CONTROL_MASK) &&
|
||||
!(evt->state & (GDK_MOD1_MASK | GDK_META_MASK)))
|
||||
{
|
||||
if (!(evt->state & GDK_SHIFT_MASK) &&
|
||||
(evt->keyval == GDK_KEY_w || evt->keyval == GDK_KEY_W))
|
||||
{
|
||||
if (sess->type == SESS_CHANNEL)
|
||||
{
|
||||
fe_close_window (sess);
|
||||
g_signal_stop_emission_by_name (G_OBJECT (wid), "key-press-event");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if ((evt->state & GDK_SHIFT_MASK) &&
|
||||
(evt->keyval == GDK_KEY_t || evt->keyval == GDK_KEY_T))
|
||||
{
|
||||
mg_reopen_closed_channel_tab ();
|
||||
g_signal_stop_emission_by_name (G_OBJECT (wid), "key-press-event");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin_emit_keypress (sess, evt->state, evt->keyval, gdk_keyval_to_unicode (evt->keyval)))
|
||||
return 1;
|
||||
@@ -1952,8 +1973,37 @@ replace_handle (GtkWidget *t)
|
||||
{
|
||||
ptrdiff_t found_offset = found - text;
|
||||
ptrdiff_t found_end_offset = found_offset + (ptrdiff_t) pop_len;
|
||||
gboolean start_ok;
|
||||
gboolean end_ok;
|
||||
int rank;
|
||||
ptrdiff_t distance;
|
||||
const char *before = found;
|
||||
const char *after = found + pop_len;
|
||||
|
||||
if (before > text)
|
||||
{
|
||||
before = g_utf8_find_prev_char (text, before);
|
||||
start_ok = !before || (!g_unichar_isalnum (g_utf8_get_char (before)) && g_utf8_get_char (before) != '_');
|
||||
}
|
||||
else
|
||||
{
|
||||
start_ok = TRUE;
|
||||
}
|
||||
|
||||
if (*after != '\0')
|
||||
{
|
||||
end_ok = !g_unichar_isalnum (g_utf8_get_char (after)) && g_utf8_get_char (after) != '_';
|
||||
}
|
||||
else
|
||||
{
|
||||
end_ok = TRUE;
|
||||
}
|
||||
|
||||
if (!start_ok || !end_ok)
|
||||
{
|
||||
found++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cursor_byte_offset >= found_offset && cursor_byte_offset <= found_end_offset)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -468,6 +468,14 @@ static session_gui static_mg_gui;
|
||||
static session_gui *mg_gui = NULL; /* the shared irc tab */
|
||||
static int ignore_chanmode = FALSE;
|
||||
static const char chan_flags[] = { 'c', 'n', 't', 'i', 'm', 'l', 'k' };
|
||||
typedef struct
|
||||
{
|
||||
int server_id;
|
||||
char channel[CHANLEN];
|
||||
char key[64];
|
||||
}
|
||||
mg_closed_channel_tab;
|
||||
static GSList *mg_closed_channel_tabs;
|
||||
|
||||
static chan *active_tab = NULL; /* active tab */
|
||||
GtkWidget *parent_window = NULL; /* the master window */
|
||||
@@ -864,6 +872,10 @@ fe_set_title (session *sess)
|
||||
|
||||
static void
|
||||
mg_topicbar_update_height (GtkWidget *topic);
|
||||
static void
|
||||
mg_topicbar_queue_relayout (GtkWidget *topic);
|
||||
static void
|
||||
mg_queue_window_relayout (GtkWidget *window);
|
||||
|
||||
static session *
|
||||
mg_session_from_window (GtkWidget *wid)
|
||||
@@ -883,6 +895,57 @@ mg_session_from_window (GtkWidget *wid)
|
||||
return current_sess;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mg_window_relayout_idle_cb (gpointer userdata)
|
||||
{
|
||||
GtkWidget *window = GTK_WIDGET (userdata);
|
||||
session *sess;
|
||||
|
||||
g_object_set_data (G_OBJECT (window), "mg-window-relayout-source", NULL);
|
||||
|
||||
sess = mg_session_from_window (window);
|
||||
if (sess && sess->gui)
|
||||
{
|
||||
if (GTK_IS_WIDGET (sess->gui->topic_entry))
|
||||
mg_topicbar_queue_relayout (sess->gui->topic_entry);
|
||||
|
||||
if (GTK_IS_XTEXT (sess->gui->xtext))
|
||||
{
|
||||
gtk_xtext_refresh (GTK_XTEXT (sess->gui->xtext));
|
||||
gtk_widget_queue_resize (sess->gui->xtext);
|
||||
gtk_widget_queue_draw (sess->gui->xtext);
|
||||
}
|
||||
|
||||
if (GTK_IS_WIDGET (sess->gui->window))
|
||||
{
|
||||
gtk_widget_queue_resize (sess->gui->window);
|
||||
gtk_widget_queue_draw (sess->gui->window);
|
||||
}
|
||||
}
|
||||
|
||||
g_object_unref (window);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
mg_queue_window_relayout (GtkWidget *window)
|
||||
{
|
||||
guint source_id;
|
||||
|
||||
if (!window || !GTK_IS_WIDGET (window))
|
||||
return;
|
||||
|
||||
if (g_object_get_data (G_OBJECT (window), "mg-window-relayout-source") != NULL)
|
||||
return;
|
||||
|
||||
source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
mg_window_relayout_idle_cb,
|
||||
g_object_ref (window),
|
||||
NULL);
|
||||
g_object_set_data (G_OBJECT (window), "mg-window-relayout-source",
|
||||
GUINT_TO_POINTER (source_id));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata)
|
||||
{
|
||||
@@ -894,7 +957,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);
|
||||
}
|
||||
@@ -926,20 +994,13 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
|
||||
}
|
||||
|
||||
sess = mg_session_from_window (GTK_WIDGET (wid));
|
||||
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->topic_entry))
|
||||
{
|
||||
mg_topicbar_update_height (sess->gui->topic_entry);
|
||||
gtk_widget_queue_draw (sess->gui->topic_entry);
|
||||
}
|
||||
if (sess && sess->gui && GTK_IS_XTEXT (sess->gui->xtext))
|
||||
{
|
||||
gtk_xtext_refresh (GTK_XTEXT (sess->gui->xtext));
|
||||
gtk_widget_queue_draw (sess->gui->xtext);
|
||||
}
|
||||
if (sess && sess->gui && GTK_IS_WIDGET (sess->gui->window))
|
||||
gtk_widget_queue_draw (sess->gui->window);
|
||||
mg_queue_window_relayout (sess->gui->window);
|
||||
else
|
||||
mg_queue_window_relayout (GTK_WIDGET (wid));
|
||||
|
||||
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);
|
||||
@@ -1036,21 +1097,10 @@ mg_configure_cb (GtkWidget *wid, GdkEventConfigure *event, session *sess)
|
||||
}
|
||||
|
||||
target_sess = mg_session_from_window (wid);
|
||||
if (target_sess && target_sess->gui)
|
||||
{
|
||||
if (GTK_IS_WIDGET (target_sess->gui->topic_entry))
|
||||
{
|
||||
mg_topicbar_update_height (target_sess->gui->topic_entry);
|
||||
gtk_widget_queue_draw (target_sess->gui->topic_entry);
|
||||
}
|
||||
if (GTK_IS_XTEXT (target_sess->gui->xtext))
|
||||
{
|
||||
gtk_xtext_refresh (GTK_XTEXT (target_sess->gui->xtext));
|
||||
gtk_widget_queue_draw (target_sess->gui->xtext);
|
||||
}
|
||||
if (GTK_IS_WIDGET (target_sess->gui->window))
|
||||
gtk_widget_queue_draw (target_sess->gui->window);
|
||||
}
|
||||
if (target_sess && target_sess->gui && GTK_IS_WIDGET (target_sess->gui->window))
|
||||
mg_queue_window_relayout (target_sess->gui->window);
|
||||
else
|
||||
mg_queue_window_relayout (wid);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1643,6 +1693,71 @@ mg_tab_close_cb (GtkWidget *dialog, gint arg1, session *sess)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mg_closed_channel_tabs_add (session *sess)
|
||||
{
|
||||
mg_closed_channel_tab *item;
|
||||
GSList *last;
|
||||
|
||||
if (!sess || sess->type != SESS_CHANNEL || !sess->channel[0])
|
||||
return;
|
||||
|
||||
item = g_new0 (mg_closed_channel_tab, 1);
|
||||
item->server_id = sess->server->id;
|
||||
g_strlcpy (item->channel, sess->channel, sizeof (item->channel));
|
||||
g_strlcpy (item->key, sess->channelkey, sizeof (item->key));
|
||||
mg_closed_channel_tabs = g_slist_prepend (mg_closed_channel_tabs, item);
|
||||
if (g_slist_length (mg_closed_channel_tabs) > 20)
|
||||
{
|
||||
last = g_slist_last (mg_closed_channel_tabs);
|
||||
g_free (last->data);
|
||||
mg_closed_channel_tabs = g_slist_delete_link (mg_closed_channel_tabs, last);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mg_reopen_closed_channel_tab (void)
|
||||
{
|
||||
mg_closed_channel_tab *item;
|
||||
GSList *head;
|
||||
GSList *list;
|
||||
server *serv;
|
||||
session *sess;
|
||||
|
||||
if (!mg_closed_channel_tabs)
|
||||
return;
|
||||
|
||||
head = mg_closed_channel_tabs;
|
||||
item = head->data;
|
||||
mg_closed_channel_tabs = g_slist_delete_link (mg_closed_channel_tabs, head);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
serv = NULL;
|
||||
for (list = serv_list; list; list = list->next)
|
||||
{
|
||||
server *candidate = list->data;
|
||||
if (candidate->id == item->server_id)
|
||||
{
|
||||
serv = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (serv && serv->connected && item->channel[0])
|
||||
{
|
||||
sess = find_channel (serv, item->channel);
|
||||
if (sess)
|
||||
fe_ctrl_gui (sess, 2, 0);
|
||||
else
|
||||
{
|
||||
new_ircwindow (serv, item->channel, SESS_CHANNEL, 1);
|
||||
serv->p_join (serv, item->channel, item->key);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (item);
|
||||
}
|
||||
|
||||
void
|
||||
mg_tab_close (session *sess)
|
||||
{
|
||||
@@ -1650,11 +1765,12 @@ mg_tab_close (session *sess)
|
||||
GSList *list;
|
||||
int i;
|
||||
|
||||
if (chan_remove (sess->res->tab, FALSE))
|
||||
{
|
||||
sess->res->tab = NULL;
|
||||
mg_ircdestroy (sess);
|
||||
}
|
||||
if (chan_remove (sess->res->tab, FALSE))
|
||||
{
|
||||
mg_closed_channel_tabs_add (sess);
|
||||
sess->res->tab = NULL;
|
||||
mg_ircdestroy (sess);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0, list = sess_list; list; list = list->next)
|
||||
@@ -2338,9 +2454,9 @@ mg_userlist_button (GtkWidget * box, char *label, char *cmd,
|
||||
g_signal_connect (G_OBJECT (wid), "clicked",
|
||||
G_CALLBACK (userlist_button_cb), cmd);
|
||||
gtk_widget_set_hexpand (wid, TRUE);
|
||||
gtk_widget_set_vexpand (wid, TRUE);
|
||||
gtk_widget_set_vexpand (wid, FALSE);
|
||||
gtk_widget_set_halign (wid, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_FILL);
|
||||
gtk_widget_set_valign (wid, GTK_ALIGN_CENTER);
|
||||
gtk_grid_attach (GTK_GRID (box), wid, a, c, b - a, d - c);
|
||||
show_and_unfocus (wid);
|
||||
}
|
||||
@@ -2497,6 +2613,7 @@ mg_topic_word_is_clickable (const char *word, int word_pos)
|
||||
{
|
||||
int start;
|
||||
int end;
|
||||
int word_type;
|
||||
|
||||
if (!word || word[0] == 0)
|
||||
return FALSE;
|
||||
@@ -2504,7 +2621,8 @@ mg_topic_word_is_clickable (const char *word, int word_pos)
|
||||
if (strcmp (word, "/") == 0)
|
||||
return FALSE;
|
||||
|
||||
if (url_check_word (word) == 0)
|
||||
word_type = url_check_word (word);
|
||||
if (word_type != WORD_URL && word_type != WORD_HOST && word_type != WORD_HOST6)
|
||||
return FALSE;
|
||||
|
||||
url_last (&start, &end);
|
||||
@@ -2553,7 +2671,8 @@ mg_topic_button_release_cb (GtkWidget *entry, GdkEventButton *event, gpointer us
|
||||
if (!word)
|
||||
return FALSE;
|
||||
|
||||
if (mg_topic_word_is_clickable (word, word_pos))
|
||||
if ((event->state & 13) == prefs.hex_gui_url_mod &&
|
||||
mg_topic_word_is_clickable (word, word_pos))
|
||||
{
|
||||
url_last (&start, &end);
|
||||
word[end] = 0;
|
||||
@@ -2622,7 +2741,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;
|
||||
@@ -2644,13 +2762,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
|
||||
@@ -3025,33 +3147,51 @@ mg_create_dialogbuttons (GtkWidget *box)
|
||||
static void
|
||||
mg_topicbar_update_height (GtkWidget *topic)
|
||||
{
|
||||
GtkWidget *scroller;
|
||||
GtkWidget *parent;
|
||||
GtkWidget *grandparent;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start;
|
||||
GtkTextIter end;
|
||||
GtkTextView *view;
|
||||
PangoLayout *layout;
|
||||
char *text;
|
||||
int width;
|
||||
int line_height;
|
||||
int line_count;
|
||||
int target_height;
|
||||
int margin_left;
|
||||
int margin_right;
|
||||
int margin_top;
|
||||
int margin_bottom;
|
||||
int old_height;
|
||||
PangoContext *context;
|
||||
PangoFontMetrics *metrics;
|
||||
|
||||
if (!topic || !GTK_IS_TEXT_VIEW (topic))
|
||||
return;
|
||||
|
||||
scroller = gtk_widget_get_parent (topic);
|
||||
view = GTK_TEXT_VIEW (topic);
|
||||
parent = gtk_widget_get_parent (topic);
|
||||
grandparent = parent ? gtk_widget_get_parent (parent) : NULL;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (topic));
|
||||
margin_left = gtk_text_view_get_left_margin (view);
|
||||
margin_right = gtk_text_view_get_right_margin (view);
|
||||
margin_top = gtk_text_view_get_top_margin (view);
|
||||
margin_bottom = gtk_text_view_get_bottom_margin (view);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (view);
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
||||
layout = gtk_widget_create_pango_layout (topic, text && text[0] ? text : " ");
|
||||
g_free (text);
|
||||
|
||||
width = gtk_widget_get_allocated_width (topic) - 8;
|
||||
if (width > 0)
|
||||
pango_layout_set_width (layout, width * PANGO_SCALE);
|
||||
width = gtk_widget_get_allocated_width (topic);
|
||||
if (width <= 1 && parent)
|
||||
width = gtk_widget_get_allocated_width (parent);
|
||||
width -= margin_left + margin_right;
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
pango_layout_set_width (layout, width * PANGO_SCALE);
|
||||
pango_layout_set_wrap (layout, PANGO_WRAP_WORD_CHAR);
|
||||
|
||||
context = gtk_widget_get_pango_context (topic);
|
||||
@@ -3063,44 +3203,95 @@ mg_topicbar_update_height (GtkWidget *topic)
|
||||
pango_font_metrics_unref (metrics);
|
||||
if (line_height <= 0)
|
||||
line_height = 16;
|
||||
|
||||
line_count = pango_layout_get_line_count (layout);
|
||||
if (line_count <= 0)
|
||||
line_count = 1;
|
||||
target_height = line_height * line_count;
|
||||
if (target_height < line_height)
|
||||
target_height = line_height;
|
||||
|
||||
gtk_widget_set_size_request (topic, -1, target_height);
|
||||
if (scroller && GTK_IS_SCROLLED_WINDOW (scroller))
|
||||
target_height = (line_height * line_count) + margin_top + margin_bottom;
|
||||
if (target_height < line_height + margin_top + margin_bottom)
|
||||
target_height = line_height + margin_top + margin_bottom;
|
||||
|
||||
old_height = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (topic),
|
||||
"mg-topicbar-target-height"));
|
||||
if (old_height != target_height)
|
||||
{
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), -1);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), -1);
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (scroller), target_height);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scroller), target_height);
|
||||
gtk_widget_set_size_request (scroller, -1, target_height);
|
||||
gtk_widget_queue_resize (scroller);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_queue_resize (topic);
|
||||
g_object_set_data (G_OBJECT (topic), "mg-topicbar-target-height",
|
||||
GINT_TO_POINTER (target_height));
|
||||
gtk_widget_set_size_request (topic, -1, target_height);
|
||||
|
||||
if (parent && GTK_IS_SCROLLED_WINDOW (parent))
|
||||
{
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), -1);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), -1);
|
||||
gtk_scrolled_window_set_max_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (parent), target_height);
|
||||
gtk_widget_set_size_request (parent, -1, target_height);
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_queue_resize (topic);
|
||||
if (parent)
|
||||
gtk_widget_queue_resize (parent);
|
||||
if (grandparent)
|
||||
gtk_widget_queue_resize (grandparent);
|
||||
gtk_widget_queue_draw (topic);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
mg_topicbar_relayout_idle_cb (gpointer userdata)
|
||||
{
|
||||
GtkWidget *topic = GTK_WIDGET (userdata);
|
||||
|
||||
g_object_set_data (G_OBJECT (topic), "mg-topicbar-relayout-source", NULL);
|
||||
mg_topicbar_update_height (topic);
|
||||
g_object_unref (topic);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
mg_topicbar_queue_relayout (GtkWidget *topic)
|
||||
{
|
||||
guint source_id;
|
||||
|
||||
if (!topic || !GTK_IS_TEXT_VIEW (topic))
|
||||
return;
|
||||
|
||||
if (g_object_get_data (G_OBJECT (topic), "mg-topicbar-relayout-source") != NULL)
|
||||
return;
|
||||
|
||||
source_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||
mg_topicbar_relayout_idle_cb,
|
||||
g_object_ref (topic),
|
||||
NULL);
|
||||
g_object_set_data (G_OBJECT (topic), "mg-topicbar-relayout-source",
|
||||
GUINT_TO_POINTER (source_id));
|
||||
}
|
||||
|
||||
static void
|
||||
mg_topicbar_buffer_changed_cb (GtkTextBuffer *buffer, gpointer userdata)
|
||||
{
|
||||
(void) buffer;
|
||||
mg_topicbar_update_height (GTK_WIDGET (userdata));
|
||||
mg_topicbar_queue_relayout (GTK_WIDGET (userdata));
|
||||
}
|
||||
|
||||
static void
|
||||
mg_topicbar_size_allocate_cb (GtkWidget *widget, GtkAllocation *allocation, gpointer userdata)
|
||||
{
|
||||
(void) allocation;
|
||||
int old_width;
|
||||
|
||||
(void) userdata;
|
||||
mg_topicbar_update_height (widget);
|
||||
|
||||
old_width = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget),
|
||||
"mg-topicbar-allocated-width"));
|
||||
if (allocation->width == old_width)
|
||||
return;
|
||||
|
||||
g_object_set_data (G_OBJECT (widget), "mg-topicbar-allocated-width",
|
||||
GINT_TO_POINTER (allocation->width));
|
||||
mg_topicbar_queue_relayout (widget);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3336,8 +3527,13 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
||||
inbox = mg_box_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), inbox, TRUE, TRUE, 0);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
frame = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_hexpand (frame, TRUE);
|
||||
gtk_widget_set_vexpand (frame, TRUE);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (frame),
|
||||
GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (frame),
|
||||
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (inbox), frame, TRUE, TRUE, 0);
|
||||
|
||||
theme_get_xtext_colors_for_widget (frame, xtext_palette, XTEXT_COLS);
|
||||
@@ -3354,9 +3550,7 @@ mg_create_textarea (session *sess, GtkWidget *box)
|
||||
g_signal_connect (G_OBJECT (xtext), "word_click",
|
||||
G_CALLBACK (mg_word_clicked), NULL);
|
||||
|
||||
gui->vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL,
|
||||
GTK_XTEXT (xtext)->adj);
|
||||
gtk_box_pack_start (GTK_BOX (inbox), gui->vscrollbar, FALSE, TRUE, 0);
|
||||
gui->vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (frame));
|
||||
|
||||
gtk_drag_dest_set (gui->vscrollbar, 5, dnd_dest_targets, 2,
|
||||
GDK_ACTION_MOVE | GDK_ACTION_COPY | GDK_ACTION_LINK);
|
||||
@@ -3382,7 +3576,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);
|
||||
@@ -3399,11 +3593,11 @@ mg_create_meters (session_gui *gui, GtkWidget *parent_box)
|
||||
GtkWidget *infbox, *wid, *box;
|
||||
|
||||
gui->meter_box = infbox = box = mg_box_new (GTK_ORIENTATION_VERTICAL, FALSE, 1);
|
||||
gtk_box_pack_start (GTK_BOX (parent_box), box, 0, 0, 0);
|
||||
gtk_box_pack_end (GTK_BOX (parent_box), box, 0, 0, 0);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -3489,6 +3683,44 @@ mg_theme_userlist_changed (const ThemeChangedEvent *event, gpointer userdata)
|
||||
mg_theme_apply_userlist_style (gui);
|
||||
}
|
||||
|
||||
static void
|
||||
mg_theme_refresh_menu_widget (GtkWidget *widget)
|
||||
{
|
||||
GtkRequisition minimum;
|
||||
GtkRequisition natural;
|
||||
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
gtk_widget_queue_resize (widget);
|
||||
gtk_widget_get_preferred_size (widget, &minimum, &natural);
|
||||
}
|
||||
|
||||
static void
|
||||
mg_theme_refresh_menu_tree (GtkWidget *menu)
|
||||
{
|
||||
GList *children;
|
||||
GList *node;
|
||||
|
||||
if (!menu || !GTK_IS_MENU_SHELL (menu))
|
||||
return;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (menu));
|
||||
for (node = children; node; node = node->next)
|
||||
{
|
||||
GtkWidget *item = GTK_WIDGET (node->data);
|
||||
GtkWidget *submenu = NULL;
|
||||
|
||||
if (GTK_IS_MENU_ITEM (item))
|
||||
submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (item));
|
||||
if (submenu)
|
||||
mg_theme_refresh_menu_tree (submenu);
|
||||
mg_theme_refresh_menu_widget (item);
|
||||
}
|
||||
g_list_free (children);
|
||||
mg_theme_refresh_menu_widget (menu);
|
||||
}
|
||||
|
||||
static void
|
||||
mg_theme_window_changed (const ThemeChangedEvent *event, gpointer userdata)
|
||||
{
|
||||
@@ -3499,8 +3731,11 @@ mg_theme_window_changed (const ThemeChangedEvent *event, gpointer userdata)
|
||||
!theme_changed_event_has_reason (event, THEME_CHANGED_REASON_WIDGET_STYLE))
|
||||
return;
|
||||
|
||||
if (gui)
|
||||
theme_manager_apply_to_window (gui->window);
|
||||
if (!gui)
|
||||
return;
|
||||
|
||||
theme_manager_apply_to_window (gui->window);
|
||||
mg_theme_refresh_menu_tree (gui->menu);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3543,8 +3778,14 @@ mg_create_userlist (session_gui *gui, GtkWidget *box)
|
||||
gtk_box_pack_start (GTK_BOX (box), vbox, TRUE, TRUE, 0);
|
||||
|
||||
gui->namelistinfo = gtk_label_new (NULL);
|
||||
gtk_label_set_xalign (GTK_LABEL (gui->namelistinfo), 0.0f);
|
||||
gtk_widget_set_halign (gui->namelistinfo, GTK_ALIGN_START);
|
||||
gtk_label_set_xalign (GTK_LABEL (gui->namelistinfo), 0.5f);
|
||||
gtk_label_set_justify (GTK_LABEL (gui->namelistinfo), GTK_JUSTIFY_CENTER);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (gui->namelistinfo), PANGO_ELLIPSIZE_END);
|
||||
gtk_label_set_width_chars (GTK_LABEL (gui->namelistinfo), 1);
|
||||
gtk_widget_set_margin_start (gui->namelistinfo, 0);
|
||||
gtk_widget_set_margin_end (gui->namelistinfo, 0);
|
||||
gtk_widget_set_hexpand (gui->namelistinfo, TRUE);
|
||||
gtk_widget_set_halign (gui->namelistinfo, GTK_ALIGN_FILL);
|
||||
if (prefs.hex_gui_ulist_count)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), gui->namelistinfo, 0, 0, 0);
|
||||
|
||||
@@ -4600,7 +4841,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);
|
||||
@@ -5114,9 +5362,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)
|
||||
{
|
||||
@@ -5194,6 +5447,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);
|
||||
|
||||
@@ -5271,11 +5527,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);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ void mg_apply_setup (void);
|
||||
void mg_apply_session_font_prefs (session_gui *gui);
|
||||
void mg_close_sess (session *);
|
||||
void mg_tab_close (session *sess);
|
||||
void mg_reopen_closed_channel_tab (void);
|
||||
void mg_detach (session *sess, int mode);
|
||||
void mg_progressbar_create (session_gui *gui);
|
||||
void mg_progressbar_destroy (session_gui *gui);
|
||||
|
||||
@@ -2309,7 +2309,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 +2381,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "../common/servlist.h"
|
||||
#include "../common/cfgfiles.h"
|
||||
#include "../common/fe.h"
|
||||
#include "../common/secretstore.h"
|
||||
#include "../common/util.h"
|
||||
|
||||
#include "fe-gtk.h"
|
||||
@@ -85,6 +86,12 @@ static GtkWidget *edit_entry_nick2;
|
||||
static GtkWidget *edit_entry_user;
|
||||
static GtkWidget *edit_entry_real;
|
||||
static GtkWidget *edit_entry_pass;
|
||||
static GtkWidget *edit_check_show_pass;
|
||||
static GtkWidget *edit_check_use_keyring;
|
||||
static GtkWidget *edit_button_encrypt_pass;
|
||||
static GtkWidget *edit_button_import_pass;
|
||||
static int edit_pass_changed;
|
||||
static char *edit_loaded_password;
|
||||
static GtkWidget *edit_label_nick;
|
||||
static GtkWidget *edit_label_nick2;
|
||||
static GtkWidget *edit_label_real;
|
||||
@@ -103,6 +110,168 @@ static session *servlist_sess;
|
||||
|
||||
static void servlist_network_row_cb (GtkTreeSelection *sel, gpointer user_data);
|
||||
static GtkWidget *servlist_open_edit (GtkWidget *parent, ircnet *net);
|
||||
static void servlist_password_changed_cb (GtkEditable *editable, gpointer userdata);
|
||||
|
||||
static void
|
||||
servlist_update_password_tools (ircnet *net)
|
||||
{
|
||||
gboolean has_local;
|
||||
gboolean use_keyring;
|
||||
|
||||
if (!edit_button_encrypt_pass || !edit_button_import_pass)
|
||||
return;
|
||||
|
||||
use_keyring = net && (net->flags & FLAG_USE_KEYRING);
|
||||
has_local = net && net->pass && *net->pass && !use_keyring && !edit_pass_changed;
|
||||
gtk_widget_set_sensitive (edit_button_encrypt_pass, has_local && !servlist_password_is_encrypted (net->pass));
|
||||
gtk_widget_set_sensitive (edit_button_import_pass, has_local);
|
||||
}
|
||||
|
||||
static void
|
||||
servlist_entry_set_text_silent (GtkWidget *entry, const char *text)
|
||||
{
|
||||
g_signal_handlers_block_by_func (G_OBJECT (entry), G_CALLBACK (servlist_password_changed_cb), NULL);
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (entry), G_CALLBACK (servlist_password_changed_cb), NULL);
|
||||
}
|
||||
|
||||
static char *
|
||||
servlist_display_password (ircnet *net)
|
||||
{
|
||||
if (!net)
|
||||
return NULL;
|
||||
if (edit_pass_changed)
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (edit_entry_pass)));
|
||||
if (edit_loaded_password)
|
||||
return g_strdup (edit_loaded_password);
|
||||
if (net->flags & FLAG_USE_KEYRING)
|
||||
return secretstore_get_network_password (net->name);
|
||||
return servlist_password_decrypt_for_storage (net->pass);
|
||||
}
|
||||
|
||||
static void
|
||||
servlist_toggle_show_password_cb (GtkToggleButton *toggle, gpointer userdata)
|
||||
{
|
||||
if (gtk_toggle_button_get_active (toggle))
|
||||
{
|
||||
char *password = servlist_display_password (selected_net);
|
||||
if (password)
|
||||
{
|
||||
if (edit_loaded_password)
|
||||
{
|
||||
memset (edit_loaded_password, 0, strlen (edit_loaded_password));
|
||||
g_free (edit_loaded_password);
|
||||
}
|
||||
edit_loaded_password = g_strdup (password);
|
||||
servlist_entry_set_text_silent (userdata, password);
|
||||
memset (password, 0, strlen (password));
|
||||
g_free (password);
|
||||
}
|
||||
gtk_entry_set_visibility (GTK_ENTRY (userdata), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_entry_set_visibility (GTK_ENTRY (userdata), FALSE);
|
||||
if (edit_loaded_password && !edit_pass_changed)
|
||||
servlist_entry_set_text_silent (userdata, "***");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
servlist_toggle_keyring_cb (GtkToggleButton *toggle, gpointer userdata)
|
||||
{
|
||||
servlist_update_password_tools (selected_net);
|
||||
}
|
||||
|
||||
static void
|
||||
servlist_password_changed_cb (GtkEditable *editable, gpointer userdata)
|
||||
{
|
||||
edit_pass_changed = 1;
|
||||
if (edit_loaded_password && strcmp (gtk_entry_get_text (GTK_ENTRY (editable)), "***"))
|
||||
{
|
||||
memset (edit_loaded_password, 0, strlen (edit_loaded_password));
|
||||
g_free (edit_loaded_password);
|
||||
edit_loaded_password = NULL;
|
||||
}
|
||||
servlist_update_password_tools (selected_net);
|
||||
}
|
||||
|
||||
static void
|
||||
servlist_encrypt_password_cb (GtkWidget *button, gpointer userdata)
|
||||
{
|
||||
ircnet *net = userdata;
|
||||
char *plain;
|
||||
char *enc;
|
||||
|
||||
if (!net || (net->flags & FLAG_USE_KEYRING) || !net->pass || servlist_password_is_encrypted (net->pass))
|
||||
return;
|
||||
|
||||
plain = servlist_password_decrypt_for_storage (net->pass);
|
||||
if (!plain || !*plain)
|
||||
{
|
||||
if (plain)
|
||||
{
|
||||
memset (plain, 0, strlen (plain));
|
||||
g_free (plain);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
enc = servlist_password_encrypt_for_storage (plain);
|
||||
memset (plain, 0, strlen (plain));
|
||||
g_free (plain);
|
||||
if (!enc)
|
||||
{
|
||||
fe_message (_("Could not encrypt this password."), FE_MSG_WARN);
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (net->pass);
|
||||
net->pass = enc;
|
||||
servlist_save ();
|
||||
servlist_update_password_tools (net);
|
||||
}
|
||||
|
||||
static void
|
||||
servlist_import_password_cb (GtkWidget *button, gpointer userdata)
|
||||
{
|
||||
ircnet *net = userdata;
|
||||
char *plain;
|
||||
|
||||
if (!net || !net->name || (net->flags & FLAG_USE_KEYRING) || !net->pass || !*net->pass)
|
||||
return;
|
||||
|
||||
plain = servlist_password_decrypt_for_storage (net->pass);
|
||||
if (!plain || !*plain)
|
||||
{
|
||||
if (plain)
|
||||
{
|
||||
memset (plain, 0, strlen (plain));
|
||||
g_free (plain);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!secretstore_set_network_password (net->name, plain))
|
||||
{
|
||||
memset (plain, 0, strlen (plain));
|
||||
g_free (plain);
|
||||
fe_message (_("Could not move this password into the system keyring."), FE_MSG_WARN);
|
||||
return;
|
||||
}
|
||||
|
||||
memset (plain, 0, strlen (plain));
|
||||
g_free (plain);
|
||||
g_free (net->pass);
|
||||
net->pass = NULL;
|
||||
net->flags |= FLAG_USE_KEYRING;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edit_check_use_keyring), TRUE);
|
||||
servlist_entry_set_text_silent (edit_entry_pass, "***");
|
||||
edit_pass_changed = 0;
|
||||
servlist_save ();
|
||||
servlist_update_password_tools (net);
|
||||
}
|
||||
|
||||
static char *
|
||||
servlist_get_cert_file (ircnet *net)
|
||||
@@ -1078,14 +1247,79 @@ servlist_update_from_entry (char **str, GtkWidget *entry)
|
||||
*str = g_strdup (gtk_entry_get_text (GTK_ENTRY (entry)));
|
||||
}
|
||||
|
||||
static char *
|
||||
servlist_edit_current_password (ircnet *net)
|
||||
{
|
||||
if (!net)
|
||||
return NULL;
|
||||
if (net->flags & FLAG_USE_KEYRING)
|
||||
return secretstore_get_network_password (net->name);
|
||||
return servlist_password_decrypt_for_storage (net->pass);
|
||||
}
|
||||
|
||||
static void
|
||||
servlist_edit_update (ircnet *net)
|
||||
{
|
||||
gboolean use_keyring;
|
||||
gboolean keyring_changed;
|
||||
char *password = NULL;
|
||||
servlist_update_from_entry (&net->nick, edit_entry_nick);
|
||||
servlist_update_from_entry (&net->nick2, edit_entry_nick2);
|
||||
servlist_update_from_entry (&net->user, edit_entry_user);
|
||||
servlist_update_from_entry (&net->real, edit_entry_real);
|
||||
servlist_update_from_entry (&net->pass, edit_entry_pass);
|
||||
if (net && net->name)
|
||||
{
|
||||
use_keyring = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (edit_check_use_keyring));
|
||||
keyring_changed = !!(net->flags & FLAG_USE_KEYRING) != !!use_keyring;
|
||||
if (!edit_pass_changed && !keyring_changed)
|
||||
return;
|
||||
if (edit_pass_changed)
|
||||
password = g_strdup (gtk_entry_get_text (GTK_ENTRY (edit_entry_pass)));
|
||||
else
|
||||
password = servlist_edit_current_password (net);
|
||||
if (use_keyring)
|
||||
{
|
||||
if (password && *password)
|
||||
{
|
||||
if (!secretstore_set_network_password (net->name, password))
|
||||
{
|
||||
fe_message (_("No system keyring is available. ZoiteChat can save this password using local encrypted fallback storage, but it is less protected than your desktop keyring."), FE_MSG_WARN);
|
||||
memset (password, 0, strlen (password));
|
||||
g_free (password);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
secretstore_delete_network_password (net->name);
|
||||
net->flags |= FLAG_USE_KEYRING;
|
||||
g_free (net->pass);
|
||||
net->pass = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *enc = NULL;
|
||||
if (password && *password)
|
||||
{
|
||||
enc = servlist_password_encrypt_for_storage (password);
|
||||
if (!enc)
|
||||
{
|
||||
fe_message (_("Could not encrypt this password."), FE_MSG_WARN);
|
||||
memset (password, 0, strlen (password));
|
||||
g_free (password);
|
||||
return;
|
||||
}
|
||||
}
|
||||
secretstore_delete_network_password (net->name);
|
||||
net->flags &= ~FLAG_USE_KEYRING;
|
||||
g_free (net->pass);
|
||||
net->pass = enc;
|
||||
}
|
||||
if (password)
|
||||
{
|
||||
memset (password, 0, strlen (password));
|
||||
g_free (password);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1093,9 +1327,19 @@ servlist_edit_close_cb (GtkWidget *button, gpointer userdata)
|
||||
{
|
||||
if (selected_net)
|
||||
servlist_edit_update (selected_net);
|
||||
if (edit_loaded_password)
|
||||
{
|
||||
memset (edit_loaded_password, 0, strlen (edit_loaded_password));
|
||||
g_free (edit_loaded_password);
|
||||
edit_loaded_password = NULL;
|
||||
}
|
||||
|
||||
gtk_widget_destroy (edit_win);
|
||||
edit_win = NULL;
|
||||
edit_entry_pass = NULL;
|
||||
edit_check_show_pass = NULL;
|
||||
edit_button_encrypt_pass = NULL;
|
||||
edit_button_import_pass = NULL;
|
||||
}
|
||||
|
||||
static gint
|
||||
@@ -1126,6 +1370,10 @@ servlist_edit_cb (GtkWidget *but, gpointer none)
|
||||
{
|
||||
if (!servlist_has_selection (GTK_TREE_VIEW (networks_tree)))
|
||||
return;
|
||||
if (!selected_net || !selected_net->name)
|
||||
return;
|
||||
if ((selected_net->flags & FLAG_USE_KEYRING) && !secretstore_require_unlock (selected_net->name))
|
||||
return;
|
||||
|
||||
edit_win = servlist_open_edit (serverlist_win, selected_net);
|
||||
gtkutil_set_icon (edit_win);
|
||||
@@ -2317,7 +2565,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
|
||||
|
||||
/* Checkboxes and entries */
|
||||
table3 = gtkutil_grid_new (14, 2, FALSE);
|
||||
table3 = gtkutil_grid_new (17, 2, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox5), table3, FALSE, FALSE, 0);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (table3), 2);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (table3), 8);
|
||||
@@ -2336,38 +2584,97 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
#endif
|
||||
servlist_create_check (1, net->flags & FLAG_USE_GLOBAL, table3, 5, 0, _("Use global user information"));
|
||||
|
||||
edit_entry_nick = servlist_create_entry (table3, _("_Nick name:"), 6, net->nick, &edit_label_nick, 0);
|
||||
edit_entry_nick2 = servlist_create_entry (table3, _("Second choice:"), 7, net->nick2, &edit_label_nick2, 0);
|
||||
edit_entry_real = servlist_create_entry (table3, _("Rea_l name:"), 8, net->real, &edit_label_real, 0);
|
||||
edit_entry_user = servlist_create_entry (table3, _("_User name:"), 9, net->user, &edit_label_user, 0);
|
||||
edit_check_use_keyring = gtk_check_button_new_with_mnemonic (_("Use system keyring"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (edit_check_use_keyring), net->flags & FLAG_USE_KEYRING);
|
||||
servlist_table_attach (table3, edit_check_use_keyring, 0, 2, 6, 7,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
g_signal_connect (G_OBJECT (edit_check_use_keyring), "toggled",
|
||||
G_CALLBACK (servlist_toggle_keyring_cb), NULL);
|
||||
|
||||
edit_entry_nick = servlist_create_entry (table3, _("_Nick name:"), 7, net->nick, &edit_label_nick, 0);
|
||||
edit_entry_nick2 = servlist_create_entry (table3, _("Second choice:"), 8, net->nick2, &edit_label_nick2, 0);
|
||||
edit_entry_real = servlist_create_entry (table3, _("Rea_l name:"), 9, net->real, &edit_label_real, 0);
|
||||
edit_entry_user = servlist_create_entry (table3, _("_User name:"), 10, net->user, &edit_label_user, 0);
|
||||
|
||||
label_logintype = gtk_label_new (_("Login method:"));
|
||||
servlist_table_attach (table3, label_logintype, 0, 1, 10, 11,
|
||||
servlist_table_attach (table3, label_logintype, 0, 1, 11, 12,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
gtk_widget_set_halign (label_logintype, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label_logintype, GTK_ALIGN_CENTER);
|
||||
combobox_logintypes = servlist_create_logintypecombo (notebook);
|
||||
servlist_table_attach (table3, combobox_logintypes, 1, 2, 10, 11,
|
||||
servlist_table_attach (table3, combobox_logintypes, 1, 2, 11, 12,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_FILL, SERVLIST_ALIGN_FILL,
|
||||
4, 2);
|
||||
|
||||
edit_entry_pass = servlist_create_entry (table3, _("Password:"), 11, net->pass, 0, _("Password used for login. If in doubt, leave blank."));
|
||||
edit_entry_pass = servlist_create_entry (table3, _("Password:"), 12, NULL, 0, _("Password used for login. If in doubt, leave blank."));
|
||||
if (edit_loaded_password)
|
||||
{
|
||||
memset (edit_loaded_password, 0, strlen (edit_loaded_password));
|
||||
g_free (edit_loaded_password);
|
||||
edit_loaded_password = NULL;
|
||||
}
|
||||
edit_pass_changed = 0;
|
||||
g_signal_connect (G_OBJECT (edit_entry_pass), "changed",
|
||||
G_CALLBACK (servlist_password_changed_cb), NULL);
|
||||
if (net->flags & FLAG_USE_KEYRING)
|
||||
{
|
||||
char *stored = secretstore_get_network_password (net->name);
|
||||
if (stored && *stored)
|
||||
{
|
||||
edit_loaded_password = g_strdup (stored);
|
||||
servlist_entry_set_text_silent (edit_entry_pass, "***");
|
||||
}
|
||||
if (stored)
|
||||
{
|
||||
memset (stored, 0, strlen (stored));
|
||||
g_free (stored);
|
||||
}
|
||||
}
|
||||
else if (net->pass && *net->pass)
|
||||
{
|
||||
servlist_entry_set_text_silent (edit_entry_pass, "***");
|
||||
}
|
||||
edit_pass_changed = 0;
|
||||
gtk_entry_set_visibility (GTK_ENTRY (edit_entry_pass), FALSE);
|
||||
if (selected_net && selected_net->logintype == LOGIN_SASLEXTERNAL)
|
||||
gtk_widget_set_sensitive (edit_entry_pass, FALSE);
|
||||
edit_check_show_pass = gtk_check_button_new_with_mnemonic (_("Show password"));
|
||||
servlist_table_attach (table3, edit_check_show_pass, 0, 2, 13, 14,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
4, 2);
|
||||
g_signal_connect (G_OBJECT (edit_check_show_pass), "toggled",
|
||||
G_CALLBACK (servlist_toggle_show_password_cb), edit_entry_pass);
|
||||
|
||||
edit_button_encrypt_pass = gtk_button_new_with_mnemonic (_("Encrypt saved password"));
|
||||
servlist_table_attach (table3, edit_button_encrypt_pass, 0, 1, 14, 15,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
g_signal_connect (G_OBJECT (edit_button_encrypt_pass), "clicked",
|
||||
G_CALLBACK (servlist_encrypt_password_cb), net);
|
||||
edit_button_import_pass = gtk_button_new_with_mnemonic (_("Move password to keyring"));
|
||||
servlist_table_attach (table3, edit_button_import_pass, 1, 2, 14, 15,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
4, 2);
|
||||
g_signal_connect (G_OBJECT (edit_button_import_pass), "clicked",
|
||||
G_CALLBACK (servlist_import_password_cb), net);
|
||||
|
||||
label34 = gtk_label_new (_("Character set:"));
|
||||
servlist_table_attach (table3, label34, 0, 1, 12, 13,
|
||||
servlist_table_attach (table3, label34, 0, 1, 15, 16,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
gtk_widget_set_halign (label34, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (label34, GTK_ALIGN_CENTER);
|
||||
comboboxentry_charset = servlist_create_charsetcombo ();
|
||||
servlist_table_attach (table3, comboboxentry_charset, 1, 2, 12, 13,
|
||||
servlist_table_attach (table3, comboboxentry_charset, 1, 2, 15, 16,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_FILL, SERVLIST_ALIGN_FILL,
|
||||
4, 2);
|
||||
@@ -2393,7 +2700,7 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
G_CALLBACK (servlist_delete_client_cert_cb), net);
|
||||
gtk_box_pack_start (GTK_BOX (hbox_cert_buttons), edit_button_cert_delete, FALSE, FALSE, 0);
|
||||
|
||||
servlist_table_attach (table3, hbox_cert_buttons, 0, 2, 13, 14,
|
||||
servlist_table_attach (table3, hbox_cert_buttons, 0, 2, 16, 17,
|
||||
FALSE, FALSE,
|
||||
SERVLIST_ALIGN_START, SERVLIST_ALIGN_CENTER,
|
||||
SERVLIST_X_PADDING, SERVLIST_Y_PADDING);
|
||||
@@ -2417,6 +2724,8 @@ servlist_open_edit (GtkWidget *parent, ircnet *net)
|
||||
{
|
||||
servlist_toggle_global_user (FALSE);
|
||||
}
|
||||
servlist_toggle_keyring_cb (GTK_TOGGLE_BUTTON (edit_check_use_keyring), NULL);
|
||||
servlist_update_password_tools (net);
|
||||
|
||||
gtk_widget_grab_focus (button10);
|
||||
gtk_widget_grab_default (button10);
|
||||
|
||||
@@ -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}
|
||||
};
|
||||
@@ -367,7 +368,7 @@ static const setting filexfer_settings[] =
|
||||
{ST_TOGGLE, N_("Receive window"), P_OFFINTNL(hex_gui_autoopen_recv), 0, 0, 0},
|
||||
{ST_TOGGLE, N_("Chat window"), P_OFFINTNL(hex_gui_autoopen_chat), 0, 0, 0},
|
||||
|
||||
{ST_HEADER, N_("Maximum File Transfer Speeds (Byte per Second)"), 0, 0, 0},
|
||||
{ST_HEADER, N_("Maximum File Transfer Speeds (KiB/s or MiB/s)"), 0, 0, 0},
|
||||
{ST_NUMBER, N_("One upload:"), P_OFFINTNL(hex_dcc_max_send_cps),
|
||||
N_("Maximum speed for one transfer"), 0, 10000000},
|
||||
{ST_NUMBER, N_("One download:"), P_OFFINTNL(hex_dcc_max_get_cps),
|
||||
@@ -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},
|
||||
@@ -873,6 +880,67 @@ setup_create_italic_label (char *text)
|
||||
return label;
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const setting *set;
|
||||
GtkSpinButton *spin;
|
||||
GtkComboBox *unit;
|
||||
} setup_dcc_speed_data;
|
||||
|
||||
static gboolean
|
||||
setup_is_dcc_speed_setting (const setting *set)
|
||||
{
|
||||
return set->offset == P_OFFINTNL (hex_dcc_max_send_cps)
|
||||
|| set->offset == P_OFFINTNL (hex_dcc_max_get_cps)
|
||||
|| set->offset == P_OFFINTNL (hex_dcc_global_max_send_cps)
|
||||
|| set->offset == P_OFFINTNL (hex_dcc_global_max_get_cps);
|
||||
}
|
||||
|
||||
static int
|
||||
setup_dcc_speed_multiplier (GtkComboBox *combo)
|
||||
{
|
||||
return gtk_combo_box_get_active (combo) == 1 ? 1024 * 1024 : 1024;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dcc_speed_spin_range (setup_dcc_speed_data *data)
|
||||
{
|
||||
int max = data->set->extra / setup_dcc_speed_multiplier (data->unit);
|
||||
gtk_spin_button_set_range (data->spin, 0, max > 0 ? max : 0);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dcc_speed_store (setup_dcc_speed_data *data)
|
||||
{
|
||||
int value = gtk_spin_button_get_value_as_int (data->spin);
|
||||
int speed = value * setup_dcc_speed_multiplier (data->unit);
|
||||
if (speed > data->set->extra)
|
||||
speed = data->set->extra;
|
||||
setup_set_int (&setup_prefs, data->set, speed);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dcc_speed_spin_cb (GtkSpinButton *spin, setup_dcc_speed_data *data)
|
||||
{
|
||||
(void)spin;
|
||||
setup_dcc_speed_store (data);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_dcc_speed_unit_cb (GtkComboBox *combo, setup_dcc_speed_data *data)
|
||||
{
|
||||
int speed = setup_get_int (&setup_prefs, data->set);
|
||||
int multiplier;
|
||||
int value;
|
||||
|
||||
(void)combo;
|
||||
setup_dcc_speed_spin_range (data);
|
||||
multiplier = setup_dcc_speed_multiplier (data->unit);
|
||||
value = (speed + (multiplier / 2)) / multiplier;
|
||||
gtk_spin_button_set_value (data->spin, value);
|
||||
setup_dcc_speed_store (data);
|
||||
}
|
||||
|
||||
static void
|
||||
setup_spin_cb (GtkSpinButton *spin, const setting *set)
|
||||
{
|
||||
@@ -902,11 +970,43 @@ setup_create_spin (GtkWidget *table, int row, const setting *set)
|
||||
g_object_set_data (G_OBJECT (wid), "lbl", label);
|
||||
if (set->tooltip)
|
||||
gtk_widget_set_tooltip_text (wid, _(set->tooltip));
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid),
|
||||
if (setup_is_dcc_speed_setting (set))
|
||||
{
|
||||
GtkWidget *unit;
|
||||
setup_dcc_speed_data *data = g_new0 (setup_dcc_speed_data, 1);
|
||||
int speed = setup_get_int (&setup_prefs, set);
|
||||
int use_mib = speed >= (1024 * 1024) && speed % (1024 * 1024) == 0;
|
||||
int multiplier;
|
||||
|
||||
data->set = set;
|
||||
data->spin = GTK_SPIN_BUTTON (wid);
|
||||
|
||||
unit = gtk_combo_box_text_new ();
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (unit), _("KiB/s"));
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (unit), _("MiB/s"));
|
||||
gtk_combo_box_set_wrap_width (GTK_COMBO_BOX (unit), 1);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (unit), use_mib ? 1 : 0);
|
||||
data->unit = GTK_COMBO_BOX (unit);
|
||||
|
||||
setup_dcc_speed_spin_range (data);
|
||||
multiplier = setup_dcc_speed_multiplier (data->unit);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid), (speed + (multiplier / 2)) / multiplier);
|
||||
|
||||
g_signal_connect (G_OBJECT (wid), "value-changed",
|
||||
G_CALLBACK (setup_dcc_speed_spin_cb), data);
|
||||
g_signal_connect (G_OBJECT (unit), "changed",
|
||||
G_CALLBACK (setup_dcc_speed_unit_cb), data);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (rbox), wid, 0, 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (rbox), unit, 0, 0, 6);
|
||||
} else
|
||||
{
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid),
|
||||
setup_get_int (&setup_prefs, set));
|
||||
g_signal_connect (G_OBJECT (wid), "value-changed",
|
||||
g_signal_connect (G_OBJECT (wid), "value-changed",
|
||||
G_CALLBACK (setup_spin_cb), (gpointer)set);
|
||||
gtk_box_pack_start (GTK_BOX (rbox), wid, 0, 0, 0);
|
||||
gtk_box_pack_start (GTK_BOX (rbox), wid, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (set->list)
|
||||
{
|
||||
@@ -1271,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)
|
||||
@@ -2087,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
|
||||
|
||||
@@ -59,6 +59,17 @@ fe_open_url (const char *url)
|
||||
(void)url;
|
||||
}
|
||||
|
||||
char *
|
||||
get_xdir (void)
|
||||
{
|
||||
return (char *)"/tmp";
|
||||
}
|
||||
|
||||
void
|
||||
load_text_events (void)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
theme_get_color (ThemeSemanticToken token, GdkRGBA *color)
|
||||
{
|
||||
@@ -96,12 +107,23 @@ theme_manager_reset_mode_colors (unsigned int mode, gboolean *palette_changed)
|
||||
*palette_changed = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
theme_runtime_clear_gtk_mapped_custom_tokens (void)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
theme_manager_save_preferences (void)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
theme_manager_apply_to_window (GtkWidget *window)
|
||||
{
|
||||
(void)window;
|
||||
}
|
||||
|
||||
void
|
||||
theme_manager_dispatch_changed (ThemeChangedReason reasons)
|
||||
{
|
||||
|
||||
@@ -82,6 +82,36 @@ theme_token_to_rgb16 (ThemeSemanticToken token, guint16 *red, guint16 *green, gu
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GtkStateFlags
|
||||
theme_access_state_with_base (GtkStyleContext *context, GtkStateFlags state)
|
||||
{
|
||||
GtkStateFlags base_state;
|
||||
|
||||
base_state = gtk_style_context_get_state (context);
|
||||
base_state &= (GTK_STATE_FLAG_DIR_LTR | GTK_STATE_FLAG_DIR_RTL | GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_FOCUSED);
|
||||
return base_state | state;
|
||||
}
|
||||
|
||||
static void
|
||||
theme_access_context_get_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *out_color)
|
||||
{
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, theme_access_state_with_base (context, state));
|
||||
gtk_style_context_get_color (context, gtk_style_context_get_state (context), out_color);
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static void
|
||||
theme_access_context_get_background_color (GtkStyleContext *context, GtkStateFlags state, GdkRGBA *out_color)
|
||||
{
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, theme_access_state_with_base (context, state));
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_get_background_color (context, gtk_style_context_get_state (context), out_color);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
theme_access_get_gtk_palette_map (GtkWidget *widget, ThemeGtkPaletteMap *out_map)
|
||||
{
|
||||
@@ -96,13 +126,11 @@ theme_access_get_gtk_palette_map (GtkWidget *widget, ThemeGtkPaletteMap *out_map
|
||||
if (context == NULL)
|
||||
return FALSE;
|
||||
|
||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_foreground);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_background);
|
||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_foreground);
|
||||
gtk_style_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_background);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_get_color (context, GTK_STATE_FLAG_LINK, &accent);
|
||||
theme_access_context_get_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_foreground);
|
||||
theme_access_context_get_background_color (context, GTK_STATE_FLAG_NORMAL, &out_map->text_background);
|
||||
theme_access_context_get_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_foreground);
|
||||
theme_access_context_get_background_color (context, GTK_STATE_FLAG_SELECTED, &out_map->selection_background);
|
||||
theme_access_context_get_color (context, GTK_STATE_FLAG_LINK, &accent);
|
||||
if (accent.alpha <= 0.0)
|
||||
accent = out_map->selection_background;
|
||||
out_map->accent = accent;
|
||||
|
||||
@@ -88,9 +88,15 @@ theme_application_apply_toplevel_theme (gboolean dark)
|
||||
gboolean
|
||||
theme_application_apply_mode (unsigned int mode, gboolean *palette_changed)
|
||||
{
|
||||
static gboolean runtime_loaded = FALSE;
|
||||
gboolean dark;
|
||||
|
||||
theme_runtime_load ();
|
||||
if (!runtime_loaded)
|
||||
{
|
||||
theme_runtime_load ();
|
||||
runtime_loaded = TRUE;
|
||||
}
|
||||
|
||||
dark = theme_runtime_apply_mode (mode, palette_changed);
|
||||
theme_application_apply_toplevel_theme (dark);
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@ static const char *theme_css_selector_light_class = "zoitechat-light";
|
||||
static const char *theme_css_palette_provider_key = "zoitechat-palette-provider";
|
||||
static const guint theme_css_provider_priority = GTK_STYLE_PROVIDER_PRIORITY_USER;
|
||||
static const char *theme_css_palette_scope_selectors =
|
||||
".zoitechat-palette, .zoitechat-palette *, .zoitechat-palette box, .zoitechat-palette grid, .zoitechat-palette stack, .zoitechat-palette frame, .zoitechat-palette paned, .zoitechat-palette paned > separator, .zoitechat-palette separator, .zoitechat-palette viewport, .zoitechat-palette overlay, .zoitechat-palette revealer, .zoitechat-palette notebook, .zoitechat-palette notebook > header, .zoitechat-palette notebook > header > tabs, .zoitechat-palette notebook > header > tabs > tab, .zoitechat-palette scrolledwindow, .zoitechat-palette scrollbar, .zoitechat-palette scrollbar slider, .zoitechat-palette scrollbar trough, .zoitechat-palette treeview, .zoitechat-palette treeview.view, .zoitechat-palette treeview.view text, .zoitechat-palette treeview.view cell, .zoitechat-palette treeview.view row, .zoitechat-palette treeview header, .zoitechat-palette treeview header button, .zoitechat-palette list, .zoitechat-palette list row, .zoitechat-palette row, .zoitechat-palette textview, .zoitechat-palette textview text, .zoitechat-palette text, .zoitechat-palette entry, .zoitechat-palette entry text, .zoitechat-palette button, .zoitechat-palette button label, .zoitechat-palette check, .zoitechat-palette radio, .zoitechat-palette switch, .zoitechat-palette slider, .zoitechat-palette scale, .zoitechat-palette scale trough, .zoitechat-palette scale highlight, .zoitechat-palette spinbutton, .zoitechat-palette combobox, .zoitechat-palette combobox box, .zoitechat-palette progressbar, .zoitechat-palette progressbar trough, .zoitechat-palette levelbar, .zoitechat-palette levelbar trough, .zoitechat-palette menubar, .zoitechat-palette menu, .zoitechat-palette menuitem, .zoitechat-palette menuitem label, .zoitechat-palette toolbar, .zoitechat-palette headerbar, .zoitechat-palette label, .zoitechat-palette link, .zoitechat-palette infobar, .zoitechat-palette statusbar, .zoitechat-palette statusbar frame, .zoitechat-palette tooltip, .zoitechat-palette tooltip label";
|
||||
".zoitechat-palette, .zoitechat-palette *, .zoitechat-palette box, .zoitechat-palette grid, .zoitechat-palette stack, .zoitechat-palette frame, .zoitechat-palette paned, .zoitechat-palette paned > separator, .zoitechat-palette separator, .zoitechat-palette viewport, .zoitechat-palette overlay, .zoitechat-palette revealer, .zoitechat-palette notebook, .zoitechat-palette notebook > header, .zoitechat-palette notebook > header > tabs, .zoitechat-palette notebook > header > tabs > tab, .zoitechat-palette scrolledwindow, .zoitechat-palette scrollbar, .zoitechat-palette scrollbar slider, .zoitechat-palette scrollbar trough, .zoitechat-palette treeview, .zoitechat-palette treeview.view, .zoitechat-palette treeview.view text, .zoitechat-palette treeview.view cell, .zoitechat-palette treeview.view row, .zoitechat-palette treeview header, .zoitechat-palette treeview header button, .zoitechat-palette list, .zoitechat-palette list row, .zoitechat-palette row, .zoitechat-palette textview, .zoitechat-palette textview text, .zoitechat-palette text, .zoitechat-palette entry, .zoitechat-palette entry text, .zoitechat-palette button, .zoitechat-palette button label, .zoitechat-palette check, .zoitechat-palette switch, .zoitechat-palette slider, .zoitechat-palette scale, .zoitechat-palette scale trough, .zoitechat-palette scale highlight, .zoitechat-palette spinbutton, .zoitechat-palette combobox, .zoitechat-palette combobox box, .zoitechat-palette progressbar, .zoitechat-palette progressbar trough, .zoitechat-palette levelbar, .zoitechat-palette levelbar trough, .zoitechat-palette menubar, .zoitechat-palette menu, .zoitechat-palette menuitem, .zoitechat-palette menuitem label, .zoitechat-palette toolbar, .zoitechat-palette headerbar, .zoitechat-palette label, .zoitechat-palette link, .zoitechat-palette infobar, .zoitechat-palette statusbar, .zoitechat-palette statusbar frame, .zoitechat-palette tooltip, .zoitechat-palette tooltip label";
|
||||
static const char *theme_css_palette_selection_selectors =
|
||||
".zoitechat-palette *:selected, .zoitechat-palette *:selected:focus, .zoitechat-palette *:selected:hover, .zoitechat-palette treeview.view:selected, .zoitechat-palette treeview.view:selected:focus, .zoitechat-palette treeview.view:selected:hover, .zoitechat-palette row:selected, .zoitechat-palette row:selected:focus, .zoitechat-palette row:selected:hover, .zoitechat-palette selection, .zoitechat-palette text selection, .zoitechat-palette entry selection, .zoitechat-palette entry text selection, .zoitechat-palette button:selected, .zoitechat-palette button:checked, .zoitechat-palette check:checked, .zoitechat-palette radio:checked, .zoitechat-palette switch:checked, .zoitechat-palette slider:active, .zoitechat-palette menuitem:selected, .zoitechat-palette menuitem:hover, .zoitechat-palette notebook > header > tabs > tab:checked, .zoitechat-palette notebook > header > tabs > tab:hover, .zoitechat-palette treeview header button:hover, .zoitechat-palette treeview header button:active, .zoitechat-palette progressbar progress, .zoitechat-palette levelbar block.filled, .zoitechat-palette:focus selection, .zoitechat-palette:focus text selection";
|
||||
".zoitechat-palette *:selected, .zoitechat-palette *:selected:focus, .zoitechat-palette *:selected:hover, .zoitechat-palette treeview.view:selected, .zoitechat-palette treeview.view:selected:focus, .zoitechat-palette treeview.view:selected:hover, .zoitechat-palette row:selected, .zoitechat-palette row:selected:focus, .zoitechat-palette row:selected:hover, .zoitechat-palette selection, .zoitechat-palette text selection, .zoitechat-palette entry selection, .zoitechat-palette entry text selection, .zoitechat-palette button:selected, .zoitechat-palette button:checked, .zoitechat-palette check:checked, .zoitechat-palette switch:checked, .zoitechat-palette slider:active, .zoitechat-palette menuitem:selected, .zoitechat-palette menuitem:hover, .zoitechat-palette notebook > header > tabs > tab:checked, .zoitechat-palette notebook > header > tabs > tab:hover, .zoitechat-palette treeview header button:hover, .zoitechat-palette treeview header button:active, .zoitechat-palette progressbar progress, .zoitechat-palette levelbar block.filled, .zoitechat-palette:focus selection, .zoitechat-palette:focus text selection";
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "theme-gtk3.h"
|
||||
#include "theme-manager.h"
|
||||
#include "theme-preferences.h"
|
||||
#include "theme-runtime.h"
|
||||
|
||||
extern void load_text_events (void);
|
||||
|
||||
@@ -1417,17 +1418,56 @@ theme_preferences_gtk3_sync_remove_state (theme_preferences_ui *ui)
|
||||
gtk_widget_set_sensitive (ui->gtk3_remove, source == ZOITECHAT_GTK3_THEME_SOURCE_USER);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
theme_preferences_gtk3_apply_and_refresh (GError **error)
|
||||
static void
|
||||
theme_preferences_gtk3_sync_runtime_palette (theme_preferences_ui *ui)
|
||||
{
|
||||
if (!theme_gtk3_apply_current (error))
|
||||
return FALSE;
|
||||
theme_manager_dispatch_changed (THEME_CHANGED_REASON_THEME_PACK |
|
||||
THEME_CHANGED_REASON_PALETTE |
|
||||
THEME_CHANGED_REASON_WIDGET_STYLE |
|
||||
THEME_CHANGED_REASON_USERLIST |
|
||||
THEME_CHANGED_REASON_MODE);
|
||||
return TRUE;
|
||||
ThemeWidgetStyleValues style_values;
|
||||
GtkWidget *style_source = NULL;
|
||||
|
||||
if (ui && ui->parent)
|
||||
style_source = GTK_WIDGET (ui->parent);
|
||||
else if (ui && ui->gtk3_combo)
|
||||
style_source = ui->gtk3_combo;
|
||||
|
||||
theme_runtime_clear_gtk_mapped_custom_tokens ();
|
||||
|
||||
theme_get_widget_style_values_for_widget (style_source, &style_values);
|
||||
|
||||
theme_preferences_staged_set_color (THEME_TOKEN_TEXT_FOREGROUND,
|
||||
&style_values.foreground,
|
||||
NULL,
|
||||
TRUE);
|
||||
theme_preferences_staged_set_color (THEME_TOKEN_TEXT_BACKGROUND,
|
||||
&style_values.background,
|
||||
NULL,
|
||||
TRUE);
|
||||
theme_preferences_staged_set_color (THEME_TOKEN_SELECTION_FOREGROUND,
|
||||
&style_values.selection_foreground,
|
||||
NULL,
|
||||
TRUE);
|
||||
theme_preferences_staged_set_color (THEME_TOKEN_SELECTION_BACKGROUND,
|
||||
&style_values.selection_background,
|
||||
NULL,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
theme_preferences_gtk3_apply_and_refresh (theme_preferences_ui *ui, GError **error)
|
||||
{
|
||||
if (!theme_gtk3_apply_current (error))
|
||||
return FALSE;
|
||||
|
||||
if (ui && ui->parent)
|
||||
theme_manager_apply_to_window (GTK_WIDGET (ui->parent));
|
||||
|
||||
theme_preferences_gtk3_sync_runtime_palette (ui);
|
||||
|
||||
theme_manager_dispatch_changed (THEME_CHANGED_REASON_THEME_PACK |
|
||||
THEME_CHANGED_REASON_PALETTE |
|
||||
THEME_CHANGED_REASON_WIDGET_STYLE |
|
||||
THEME_CHANGED_REASON_USERLIST |
|
||||
THEME_CHANGED_REASON_MODE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1463,7 +1503,7 @@ theme_preferences_gtk3_changed_cb (GtkComboBox *combo, gpointer user_data)
|
||||
ui->setup_prefs->hex_gui_gtk3_variant = prefs.hex_gui_gtk3_variant;
|
||||
}
|
||||
|
||||
if (selection_changed && !theme_preferences_gtk3_apply_and_refresh (&error))
|
||||
if (selection_changed && !theme_preferences_gtk3_apply_and_refresh (ui, &error))
|
||||
{
|
||||
theme_preferences_show_message (ui, GTK_MESSAGE_ERROR,
|
||||
error ? error->message : _("Failed to apply GTK3 theme."));
|
||||
@@ -1552,7 +1592,7 @@ theme_preferences_populate_gtk3 (theme_preferences_ui *ui)
|
||||
g_free (final_id);
|
||||
}
|
||||
|
||||
if (should_apply && !theme_preferences_gtk3_apply_and_refresh (&error))
|
||||
if (should_apply && !theme_preferences_gtk3_apply_and_refresh (ui, &error))
|
||||
{
|
||||
theme_preferences_show_message (ui, GTK_MESSAGE_ERROR,
|
||||
error ? error->message : _("Failed to apply GTK3 theme."));
|
||||
|
||||
@@ -410,6 +410,20 @@ theme_runtime_reset_mode_colors (gboolean dark_mode)
|
||||
dark_mode_active = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
theme_runtime_clear_gtk_mapped_custom_tokens (void)
|
||||
{
|
||||
light_custom_tokens[THEME_TOKEN_TEXT_FOREGROUND] = FALSE;
|
||||
light_custom_tokens[THEME_TOKEN_TEXT_BACKGROUND] = FALSE;
|
||||
light_custom_tokens[THEME_TOKEN_SELECTION_FOREGROUND] = FALSE;
|
||||
light_custom_tokens[THEME_TOKEN_SELECTION_BACKGROUND] = FALSE;
|
||||
|
||||
dark_custom_tokens[THEME_TOKEN_TEXT_FOREGROUND] = FALSE;
|
||||
dark_custom_tokens[THEME_TOKEN_TEXT_BACKGROUND] = FALSE;
|
||||
dark_custom_tokens[THEME_TOKEN_SELECTION_FOREGROUND] = FALSE;
|
||||
dark_custom_tokens[THEME_TOKEN_SELECTION_BACKGROUND] = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
theme_runtime_load (void)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,7 @@ gboolean theme_runtime_apply_dark_mode (gboolean enable);
|
||||
void theme_runtime_user_set_color (ThemeSemanticToken token, const GdkRGBA *col);
|
||||
void theme_runtime_dark_set_color (ThemeSemanticToken token, const GdkRGBA *col);
|
||||
void theme_runtime_reset_mode_colors (gboolean dark_mode);
|
||||
void theme_runtime_clear_gtk_mapped_custom_tokens (void);
|
||||
gboolean theme_runtime_get_color (ThemeSemanticToken token, GdkRGBA *out_rgba);
|
||||
gboolean theme_runtime_mode_has_user_colors (gboolean dark_mode);
|
||||
void theme_runtime_get_widget_style_values (ThemeWidgetStyleValues *out_values);
|
||||
|
||||
@@ -93,23 +93,14 @@ userlist_apply_saved_column_width (GtkTreeViewColumn *column, int width)
|
||||
static void
|
||||
userlist_update_min_width (session *sess)
|
||||
{
|
||||
GtkRequisition minimum;
|
||||
GtkRequisition natural;
|
||||
GtkWidget *scrolled_window;
|
||||
int width;
|
||||
|
||||
if (!sess || !sess->gui || !sess->gui->user_box || !sess->gui->namelistinfo || !sess->gui->user_tree)
|
||||
if (!sess || !sess->gui || !sess->gui->user_tree)
|
||||
return;
|
||||
|
||||
gtk_widget_get_preferred_size (sess->gui->namelistinfo, &minimum, &natural);
|
||||
width = MAX (minimum.width, natural.width);
|
||||
if (width < 1)
|
||||
width = 1;
|
||||
|
||||
scrolled_window = gtk_widget_get_parent (sess->gui->user_tree);
|
||||
if (GTK_IS_SCROLLED_WINDOW (scrolled_window))
|
||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled_window), width);
|
||||
gtk_widget_set_size_request (sess->gui->user_box, width, -1);
|
||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (scrolled_window), 1);
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
@@ -909,17 +900,19 @@ userlist_create (GtkWidget *box)
|
||||
};
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_hexpand (sw, TRUE);
|
||||
gtk_widget_set_vexpand (sw, TRUE);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
prefs.hex_gui_ulist_show_hosts ?
|
||||
GTK_POLICY_AUTOMATIC :
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW (sw), 1);
|
||||
gtk_box_pack_start (GTK_BOX (box), sw, TRUE, TRUE, 0);
|
||||
gtk_widget_show (sw);
|
||||
|
||||
treeview = gtk_tree_view_new ();
|
||||
gtk_widget_set_hexpand (treeview, TRUE);
|
||||
gtk_widget_set_vexpand (treeview, TRUE);
|
||||
gtk_widget_set_name (treeview, "zoitechat-userlist");
|
||||
gtk_widget_set_can_focus (treeview, TRUE);
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
|
||||
|
||||
@@ -110,6 +110,15 @@ enum
|
||||
TARGET_COMPOUND_TEXT
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_HADJUSTMENT,
|
||||
PROP_VADJUSTMENT,
|
||||
PROP_HSCROLL_POLICY,
|
||||
PROP_VSCROLL_POLICY
|
||||
};
|
||||
|
||||
|
||||
/* Selection targets for PRIMARY selection / copy-paste.
|
||||
*
|
||||
@@ -158,7 +167,8 @@ gtk_xtext_install_selection_targets (GtkWidget *widget)
|
||||
|
||||
static guint xtext_signals[LAST_SIGNAL];
|
||||
|
||||
G_DEFINE_TYPE (GtkXText, gtk_xtext, GTK_TYPE_WIDGET)
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkXText, gtk_xtext, GTK_TYPE_WIDGET,
|
||||
G_IMPLEMENT_INTERFACE (GTK_TYPE_SCROLLABLE, NULL))
|
||||
|
||||
char *nocasestrstr (const char *text, const char *tofind); /* util.c */
|
||||
int xtext_get_stamp_str (time_t, char **);
|
||||
@@ -168,9 +178,13 @@ static gboolean gtk_xtext_is_selecting (GtkXText *xtext);
|
||||
static char *gtk_xtext_selection_get_text (GtkXText *xtext, int *len_ret);
|
||||
static textentry *gtk_xtext_nth (GtkXText *xtext, int line, int *subline);
|
||||
static void gtk_xtext_adjustment_changed (GtkAdjustment * adj,
|
||||
GtkXText * xtext);
|
||||
GtkXText * xtext);
|
||||
static void gtk_xtext_scroll_adjustments (GtkXText *xtext, GtkAdjustment *hadj,
|
||||
GtkAdjustment *vadj);
|
||||
static void gtk_xtext_set_property (GObject *object, guint prop_id,
|
||||
const GValue *value, GParamSpec *pspec);
|
||||
static void gtk_xtext_get_property (GObject *object, guint prop_id,
|
||||
GValue *value, GParamSpec *pspec);
|
||||
static int gtk_xtext_render_ents (GtkXText * xtext, textentry *, textentry *);
|
||||
static void gtk_xtext_recalc_widths (xtext_buffer *buf, int);
|
||||
static void gtk_xtext_fix_indent (xtext_buffer *buf);
|
||||
@@ -794,6 +808,9 @@ gtk_xtext_init (GtkXText * xtext)
|
||||
xtext->recycle = FALSE;
|
||||
xtext->dont_render = FALSE;
|
||||
xtext->dont_render2 = FALSE;
|
||||
xtext->hadj = NULL;
|
||||
xtext->hscroll_policy = GTK_SCROLL_MINIMUM;
|
||||
xtext->vscroll_policy = GTK_SCROLL_MINIMUM;
|
||||
gtk_xtext_scroll_adjustments (xtext, NULL, NULL);
|
||||
|
||||
gtk_xtext_install_selection_targets (GTK_WIDGET (xtext));
|
||||
@@ -886,6 +903,66 @@ gtk_xtext_adjustment_changed (GtkAdjustment * adj, GtkXText * xtext)
|
||||
xtext->buffer->old_value = xtext_adj_get_value (adj);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtext_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GtkXText *xtext = GTK_XTEXT (object);
|
||||
GtkAdjustment *adj;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HADJUSTMENT:
|
||||
adj = g_value_get_object (value);
|
||||
if (xtext->hadj == adj)
|
||||
break;
|
||||
if (xtext->hadj)
|
||||
g_object_unref (xtext->hadj);
|
||||
xtext->hadj = adj ? g_object_ref (adj) : NULL;
|
||||
g_object_notify (object, "hadjustment");
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
gtk_xtext_scroll_adjustments (xtext, NULL, g_value_get_object (value));
|
||||
g_object_notify (object, "vadjustment");
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
xtext->hscroll_policy = g_value_get_enum (value);
|
||||
g_object_notify (object, "hscroll-policy");
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
xtext->vscroll_policy = g_value_get_enum (value);
|
||||
g_object_notify (object, "vscroll-policy");
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_xtext_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
||||
{
|
||||
GtkXText *xtext = GTK_XTEXT (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_HADJUSTMENT:
|
||||
g_value_set_object (value, xtext->hadj);
|
||||
break;
|
||||
case PROP_VADJUSTMENT:
|
||||
g_value_set_object (value, xtext->adj);
|
||||
break;
|
||||
case PROP_HSCROLL_POLICY:
|
||||
g_value_set_enum (value, xtext->hscroll_policy);
|
||||
break;
|
||||
case PROP_VSCROLL_POLICY:
|
||||
g_value_set_enum (value, xtext->vscroll_policy);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_xtext_new (const XTextColor *palette, int separator)
|
||||
{
|
||||
@@ -952,6 +1029,11 @@ gtk_xtext_cleanup (GtkXText *xtext)
|
||||
xtext->adj = NULL;
|
||||
}
|
||||
|
||||
if (xtext->hadj)
|
||||
{
|
||||
g_object_unref (G_OBJECT (xtext->hadj));
|
||||
xtext->hadj = NULL;
|
||||
}
|
||||
|
||||
if (xtext->hand_cursor)
|
||||
{
|
||||
@@ -2218,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;
|
||||
}
|
||||
|
||||
@@ -2384,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)
|
||||
@@ -2422,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;
|
||||
@@ -2856,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) -
|
||||
@@ -2876,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
|
||||
@@ -2924,6 +3074,13 @@ gtk_xtext_class_init (GtkXTextClass * class)
|
||||
widget_class = (GtkWidgetClass *) class;
|
||||
xtext_class = (GtkXTextClass *) class;
|
||||
|
||||
object_class->set_property = gtk_xtext_set_property;
|
||||
object_class->get_property = gtk_xtext_get_property;
|
||||
g_object_class_override_property (object_class, PROP_HADJUSTMENT, "hadjustment");
|
||||
g_object_class_override_property (object_class, PROP_VADJUSTMENT, "vadjustment");
|
||||
g_object_class_override_property (object_class, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (object_class, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
xtext_signals[WORD_CLICK] =
|
||||
g_signal_new ("word_click",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
@@ -4830,13 +4987,12 @@ gtk_xtext_check_marker_visibility (GtkXText * xtext)
|
||||
static void
|
||||
gtk_xtext_unstrip_color (gint start, gint end, GSList *slp, GList **gl, gint maxo)
|
||||
{
|
||||
gint off1, off2, curlen;
|
||||
gint off1, off2;
|
||||
GSList *cursl;
|
||||
offsets_t marks;
|
||||
offlen_t *meta;
|
||||
|
||||
off1 = 0;
|
||||
curlen = 0;
|
||||
cursl = slp;
|
||||
while (cursl)
|
||||
{
|
||||
@@ -4846,7 +5002,6 @@ gtk_xtext_unstrip_color (gint start, gint end, GSList *slp, GList **gl, gint max
|
||||
off1 = meta->off + start;
|
||||
break;
|
||||
}
|
||||
curlen += meta->len;
|
||||
start -= meta->len;
|
||||
end -= meta->len;
|
||||
cursl = g_slist_next (cursl);
|
||||
@@ -4861,7 +5016,6 @@ gtk_xtext_unstrip_color (gint start, gint end, GSList *slp, GList **gl, gint max
|
||||
off2 = meta->off + end;
|
||||
break;
|
||||
}
|
||||
curlen += meta->len;
|
||||
end -= meta->len;
|
||||
cursl = g_slist_next (cursl);
|
||||
}
|
||||
|
||||
@@ -134,6 +134,9 @@ struct _GtkXText
|
||||
xtext_buffer *selection_buffer;
|
||||
|
||||
GtkAdjustment *adj;
|
||||
GtkAdjustment *hadj;
|
||||
GtkScrollablePolicy hscroll_policy;
|
||||
GtkScrollablePolicy vscroll_policy;
|
||||
cairo_surface_t *background_surface; /* 0 = use palette[19] */
|
||||
cairo_surface_t *background_clip_surface;
|
||||
GdkWindow *draw_window; /* points to ->window */
|
||||
@@ -187,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 */
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -30,8 +30,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
|
||||
@@ -56,7 +56,6 @@ Name: "plugins\exec"; Description: "Exec"; Types: custom; Flags: disablenouninst
|
||||
Name: "plugins\fishlim"; Description: "FiSHLiM"; Types: custom; Flags: disablenouninstallwarning
|
||||
Name: "plugins\sysinfo"; Description: "SysInfo"; Types: custom; Flags: disablenouninstallwarning
|
||||
Name: "plugins\upd"; Description: "Update Checker"; Types: normal custom; Flags: disablenouninstallwarning
|
||||
Name: "plugins\winamp"; Description: "Winamp"; Types: custom; Flags: disablenouninstallwarning
|
||||
Name: "langs"; Description: "Language Interfaces"; Types: custom; Flags: disablenouninstallwarning
|
||||
Name: "langs\lua"; Description: "Lua (LuaJIT 2.1)"; Types: normal custom; Flags: disablenouninstallwarning
|
||||
Name: "langs\perl"; Description: "Perl (Strawberry Perl 5.42.0.1)"; Types: custom; Flags: disablenouninstallwarning
|
||||
@@ -173,11 +172,9 @@ Source: "plugins\hcexec.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Co
|
||||
Source: "plugins\hcfishlim.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\fishlim
|
||||
Source: "share\gtkpref.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: libs
|
||||
Source: "share\adwaita-icons-attribution.txt"; DestDir: "{app}\share"; Flags: ignoreversion; Components: libs
|
||||
Source: "share\music.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\winamp
|
||||
Source: "share\download.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\upd
|
||||
Source: "plugins\hcupd.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\upd
|
||||
Source: "WinSparkle.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: plugins\upd
|
||||
Source: "plugins\hcwinamp.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\winamp
|
||||
Source: "share\system.png"; DestDir: "{app}\share"; Flags: ignoreversion; Components: plugins\sysinfo
|
||||
Source: "plugins\hcsysinfo.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: plugins\sysinfo
|
||||
Source: "plugins\hcperl.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion; Components: langs\perl
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.18.0~pre6
|
||||
2.18.1
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
|
||||
<ArchiveDefs Condition="'$(ArchiveLib)'=='archive_static.lib' or '$(ArchiveLib)'=='libarchive_static.lib'">LIBARCHIVE_STATIC</ArchiveDefs>
|
||||
|
||||
<DepLibs>$(Gtk3Lib);$(Gdk3Lib);wininet.lib;winmm.lib;ws2_32.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;$(IntlLib);$(IconvLib);$(ZlibLib);$(Xml2Lib);$(JpegLib);$(PngLib);$(ArchiveLib);$(OpenSslLibs)</DepLibs>
|
||||
<DepLibs>$(Gtk3Lib);$(Gdk3Lib);wininet.lib;winmm.lib;ws2_32.lib;advapi32.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;$(IntlLib);$(IconvLib);$(ZlibLib);$(Xml2Lib);$(JpegLib);$(PngLib);$(ArchiveLib);$(OpenSslLibs)</DepLibs>
|
||||
|
||||
<DataDir>$(SolutionDir)..\data\\</DataDir>
|
||||
<ZoiteChatBuild>$(SolutionDir)..\..\zoitechat-build</ZoiteChatBuild>
|
||||
|
||||
@@ -40,11 +40,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upd", "..\plugins\upd\upd.v
|
||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winamp", "..\plugins\winamp\winamp.vcxproj", "{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sysinfo", "..\plugins\sysinfo\sysinfo.vcxproj", "{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{87554B59-006C-4D94-9714-897B27067BA3} = {87554B59-006C-4D94-9714-897B27067BA3}
|
||||
@@ -73,7 +68,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "installer", "installer\inst
|
||||
{E93E1255-95D1-4B08-8FDF-B53CC6A21280} = {E93E1255-95D1-4B08-8FDF-B53CC6A21280}
|
||||
{5EF7F47D-D09C-43C4-BF64-B28B11A0FF91} = {5EF7F47D-D09C-43C4-BF64-B28B11A0FF91}
|
||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {6C0CA980-97C5-427A-BE61-5BCECAFABBDA}
|
||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} = {E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}
|
||||
{E4BDB4C8-2335-415A-ACEE-BA88B19BFE82} = {E4BDB4C8-2335-415A-ACEE-BA88B19BFE82}
|
||||
{C53145CC-D021-40C9-B97C-0249AB9A43C9} = {C53145CC-D021-40C9-B97C-0249AB9A43C9}
|
||||
{D90BC3E3-1341-4849-9354-5F40489D39D1} = {D90BC3E3-1341-4849-9354-5F40489D39D1}
|
||||
@@ -121,8 +115,6 @@ Global
|
||||
{3C4F42FC-292A-420B-B63D-C03DFBDD8E4E}.Release|x64.Build.0 = Release|x64
|
||||
{461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.ActiveCfg = Release|x64
|
||||
{461DC24A-A410-4171-8C02-CCDBF3702C2A}.Release|x64.Build.0 = Release|x64
|
||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}.Release|x64.ActiveCfg = Release|x64
|
||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}.Release|x64.Build.0 = Release|x64
|
||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.ActiveCfg = Release|x64
|
||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA}.Release|x64.Build.0 = Release|x64
|
||||
{B10A2C41-344C-43E0-A32D-B9587C198D8B}.Release|x64.ActiveCfg = Release|x64
|
||||
@@ -153,7 +145,6 @@ Global
|
||||
{17E4BE39-76F7-4A06-AD21-EFD0C5091F76} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||
{3C4F42FC-292A-420B-B63D-C03DFBDD8E4E} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||
{461DC24A-A410-4171-8C02-CCDBF3702C2A} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||
{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||
{6C0CA980-97C5-427A-BE61-5BCECAFABBDA} = {561126F4-FA18-45FC-A2BF-8F858F161D6D}
|
||||
{B10A2C41-344C-43E0-A32D-B9587C198D8B} = {0FD996A7-464F-4981-8380-3DCA3A244A13}
|
||||
{C9B735E4-75BC-45AC-A5E3-39A6D076F912} = {0FD996A7-464F-4981-8380-3DCA3A244A13}
|
||||
|
||||
Reference in New Issue
Block a user