Compare commits

..

1 commit

Author SHA1 Message Date
Jari Matilainen
7f66e4c8ac
Update session.c 2023-04-04 11:11:37 +02:00
146 changed files with 1397 additions and 3586 deletions

View file

@ -3,8 +3,8 @@ name: abicheck
env:
build_options: -Dbuildtype=debug -Denable-true-color=yes -Dwith-proxy=yes -Dc_args=-DPERL_EUPXS_ALWAYS_EXPORT
prefix: /usr/local
apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev libglib2.0-dev
get_pip_build_deps: pip3 install 'setuptools<66'; pip3 install wheel; pip3 install 'meson<0.59.0'
apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev
get_pip_build_deps: pip3 install setuptools; pip3 install wheel; pip3 install 'meson<0.59.0'
getabidef_def: getabidef() { awk '$1=="#define" && $2=="IRSSI_ABI_VERSION" { print $3 }' "$1"/include/irssi/src/common.h; }
jobs:
build-base-ref:
@ -17,7 +17,7 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: prepare required software
run: |
sudo apt update; sudo apt install $apt_build_deps
sudo apt install $apt_build_deps
eval "$get_pip_build_deps"
- name: checkout base ref
uses: actions/checkout@main
@ -37,7 +37,7 @@ jobs:
echo base abi : $base_abi
./base$prefix/bin/irssi --version
echo base_abi=$base_abi >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
name: base.inst
path: base
@ -52,7 +52,7 @@ jobs:
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: prepare required software
run: |
sudo apt update; sudo apt install $apt_build_deps
sudo apt install $apt_build_deps
eval "$get_pip_build_deps"
- name: checkout merge ref
uses: actions/checkout@main
@ -71,7 +71,7 @@ jobs:
echo merge abi : $merge_abi
./merge$prefix/bin/irssi --version
echo merge_abi=$merge_abi >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
name: merge.inst
path: merge
@ -87,14 +87,14 @@ jobs:
steps:
- name: prepare required software
run: |
sudo apt update; sudo apt install abigail-tools
sudo apt install abigail-tools
- name: fetch base build
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: base.inst
path: base
- name: fetch merge build
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
with:
name: merge.inst
path: merge
@ -103,7 +103,7 @@ jobs:
abipkgdiff -l base merge >abipkgdiff.out && diff_ret=0 || diff_ret=$?
echo "diff_ret=$diff_ret" >> $GITHUB_ENV
cat abipkgdiff.out
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
path: abipkgdiff.out
- run: |

View file

@ -5,50 +5,23 @@ on:
pull_request:
name: Check Irssi
env:
apt_build_deps: ninja-build libutf8proc-dev libperl-dev libotr5-dev libglib2.0-dev
apt_build_deps: libutf8proc-dev libperl-dev libotr5-dev
apt_build_deps_meson: ninja-build
get_pip_build_deps_meson: pip3 install setuptools${setuptools_ver}; pip3 install wheel; pip3 install meson${meson_ver}
build_options_meson: -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes -Dwith-otr=yes
prefix: ~/irssi-build
jobs:
dist:
runs-on: ubuntu-latest
env:
meson_ver: <0.63.0
setuptools_ver: <66
steps:
- name: prepare required software
run: |
sudo apt update && sudo apt install $apt_build_deps
eval "$get_pip_build_deps_meson"
patch ~/.local/lib/python3.12/site-packages/pkg_resources/__init__.py <<- PATCH
--- __init__.py 2024-12-16 20:37:46.733230351 +0100
+++ __init__.py 2024-12-16 20:38:42.479554540 +0100
@@ -2188,7 +2188,8 @@ def resolve_egg_link(path):
return next(dist_groups, ())
-register_finder(pkgutil.ImpImporter, find_on_path)
+if hasattr(pkgutil, 'ImpImporter'):
+ register_finder(pkgutil.ImpImporter, find_on_path)
if hasattr(importlib_machinery, 'FileFinder'):
register_finder(importlib_machinery.FileFinder, find_on_path)
@@ -2345,7 +2346,8 @@ def file_ns_handler(importer, path_item,
return subpath
-register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
+if hasattr(pkgutil, 'ImpImporter'):
+ register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
register_namespace_handler(zipimport.zipimporter, file_ns_handler)
if hasattr(importlib_machinery, 'FileFinder'):
PATCH
- uses: actions/checkout@main
- name: make dist
run: |
./utils/make-dist.sh
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
path: irssi-*.tar.gz
retention-days: 1
@ -61,21 +34,24 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-latest]
os: [ubuntu-18.04, ubuntu-latest]
builder: [meson]
compiler: [clang, gcc]
flags: [regular]
setuptools_ver: [<66]
include:
- os: ubuntu-22.04
- os: ubuntu-18.04
builder: meson
meson_ver: ==0.53.2
setuptools_ver: <51
- os: ubuntu-latest
builder: meson
meson_ver: <0.63.0
- os: ubuntu-latest
builder: meson
flags: meson-latest FAILURE-OK
steps:
- name: fetch dist
uses: actions/download-artifact@v4
uses: actions/download-artifact@v3
- name: set PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
@ -84,8 +60,8 @@ jobs:
meson_ver: ${{ matrix.meson_ver }}
setuptools_ver: ${{ matrix.setuptools_ver }}
run: |
sudo apt update && sudo apt install $apt_build_deps
eval "$get_pip_build_deps_meson"
sudo apt update && sudo apt install $apt_build_deps $apt_build_deps_${{ matrix.builder }}
eval "$get_pip_build_deps_${{ matrix.builder }}"
curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl
- name: unpack archive
run: tar xaf artifact/irssi-*.tar.gz
@ -96,12 +72,14 @@ jobs:
meson Build $build_options_meson --prefix=${prefix/\~/~}
ninja -C Build
ninja -C Build install
if: ${{ matrix.builder == 'meson' }}
- name: run tests with Meson
run: |
# ninja test
cd irssi-*/
ninja -C Build test
find -name testlog.txt -exec sed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} +
if: ${{ matrix.builder == 'meson' }}
- name: run launch test
env:
TERM: xterm
@ -115,66 +93,9 @@ jobs:
^set -clear log_day_changed
^set -clear log_open_string
^set log_timestamp *
^window log on
load irc
load dcc
load flood
load notifylist
load perl
load otr
load proxy
^quit' > irssi-test/startup
irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl
cat irc.log.*
annotation-warnings:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
env:
CC: clang
steps:
- name: prepare required software
run: |
sudo apt update && sudo apt install $apt_build_deps
- uses: actions/checkout@main
- name: Setup local annotations
uses: irssi-import/actions-irssi/problem-matchers@master
- name: set PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: prepare required software
env:
meson_ver: ${{ matrix.meson_ver }}
setuptools_ver: ${{ matrix.setuptools_ver }}
run: |
sudo apt update && sudo apt install $apt_build_deps
eval "$get_pip_build_deps_meson"
curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl
- name: build and install with meson
run: |
meson Build $build_options_meson --prefix=${prefix/\~/~}
ninja -C Build
ninja -C Build install >/dev/null
- name: run launch test
env:
TERM: xterm
run: |
# automated irssi launch test
cd
mkdir irssi-test
echo 'echo automated irssi launch test
^set settings_autosave off
^set -clear log_close_string
^set -clear log_day_changed
^set -clear log_open_string
^set log_timestamp *
^window log on
load irc
load dcc
load flood
load notifylist
load perl
load otr
load proxy
^quit' > irssi-test/startup
^window log on' > irssi-test/startup
echo load perl >> irssi-test/startup
echo load proxy >> irssi-test/startup
echo ^quit >> irssi-test/startup
irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl
cat irc.log.*

View file

@ -44,7 +44,7 @@ jobs:
dry-run: false
sanitizer: ${{ matrix.sanitizer }}
- name: Upload Crash
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts

View file

@ -22,8 +22,8 @@ jobs:
|
CLANG_FORMAT=clang-format-14 git-clang-format-14 --diff FETCH_HEAD HEAD | tee git-clang-format.diff
cmp -s <(echo no modified files to format) git-clang-format.diff || cmp -s <(echo -n) git-clang-format.diff
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v1
if: failure()
with:
name: git-clang-format.diff
path: git-clang-format.diff
path: git-clang-format.diff

View file

@ -1,32 +0,0 @@
name: Format meson files
on:
push:
pull_request:
permissions: {}
jobs:
muon-meson-fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
with:
persist-credentials: false
# Build from source because Ubuntu 24.04 apt only has muon 0.2.0.
# Newer muons seem to format differently.
- name: Build muon from source
run: |
git clone --depth 1 --branch 0.5.0 https://github.com/muon-build/muon /tmp/muon
cd /tmp/muon
./bootstrap.sh build
build/muon-bootstrap setup build
build/muon-bootstrap -C build samu
sudo build/muon -C build install
- name: Run muon fmt
run: |
find . -name meson.build -print0 | xargs -0 muon fmt -c .muon_fmt.ini -i
git diff --exit-code

View file

@ -1,104 +0,0 @@
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
name: Check Irssi on Solaris
env:
get_pip_build_deps_meson: pip3 install setuptools${setuptools_ver}; pip3 install wheel
prefix: ~/irssi-build
jobs:
dist:
runs-on: ubuntu-latest
env:
setuptools_ver: <66
steps:
- name: prepare required software
run: |
sudo apt update && sudo apt install $apt_build_deps
eval "$get_pip_build_deps_meson"
patch ~/.local/lib/python3.12/site-packages/pkg_resources/__init__.py <<- PATCH
--- __init__.py 2024-12-16 20:37:46.733230351 +0100
+++ __init__.py 2024-12-16 20:38:42.479554540 +0100
@@ -2188,7 +2188,8 @@ def resolve_egg_link(path):
return next(dist_groups, ())
-register_finder(pkgutil.ImpImporter, find_on_path)
+if hasattr(pkgutil, 'ImpImporter'):
+ register_finder(pkgutil.ImpImporter, find_on_path)
if hasattr(importlib_machinery, 'FileFinder'):
register_finder(importlib_machinery.FileFinder, find_on_path)
@@ -2345,7 +2346,8 @@ def file_ns_handler(importer, path_item,
return subpath
-register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
+if hasattr(pkgutil, 'ImpImporter'):
+ register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
register_namespace_handler(zipimport.zipimporter, file_ns_handler)
if hasattr(importlib_machinery, 'FileFinder'):
PATCH
- uses: actions/checkout@main
- name: make dist
run: |
./utils/make-dist.sh
- uses: actions/upload-artifact@v4
with:
path: irssi-*.tar.gz
retention-days: 1
install:
runs-on: ubuntu-latest
needs: dist
steps:
- name: fetch dist
uses: actions/download-artifact@v4
- name: Test in Solaris
uses: vmactions/solaris-vm@v1
with:
usesh: true
sync: rsync
release: "11.4-gcc"
prepare: |
pkg update --accept || echo 1:$?
pkg install meson || echo 2:$?
pkgutil -y -i curl || echo 3:$?
pkgutil -y -i gtar || echo 4:$?
pkgutil -y -i findutils || echo 5:$?
run: |
set -ex
export PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl
gtar xzf artifact/irssi-*.tar.gz
# ninja install
cd irssi-*/
meson Build -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes --prefix=$HOME/irssi-build
ninja -C Build
ninja -C Build install
# ninja test
ninja -C Build test
gfind -name testlog.txt -exec gsed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} +
export TERM=xterm
# automated irssi launch test
cd
mkdir irssi-test
echo 'echo automated irssi launch test
^set settings_autosave off
^set -clear log_close_string
^set -clear log_day_changed
^set -clear log_open_string
^set log_timestamp *
^window log on
load irc
load dcc
load flood
load notifylist
load perl
load otr
load proxy
^quit' > irssi-test/startup
irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl
cat irc.log.*

View file

@ -73,7 +73,7 @@ jobs:
- name: build irssi package
run: |
sudo ./scripts/run-docker.sh ./build-package.sh -I irssi-an
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v3
with:
name: irssi-termux-pkg
path: output/irssi-an*.deb

View file

@ -17,4 +17,4 @@ jobs:
repo: 'irssi.github.io',
workflow_id: 'pages.yml',
ref: 'main'
})
})

View file

@ -1,75 +0,0 @@
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
name: Check Irssi on Void Linux glibc
jobs:
dist:
runs-on: ubuntu-latest
container: ghcr.io/void-linux/void-glibc:latest
steps:
- name: prepare required software
run: |
xbps-install -Syu xbps || :
xbps-install -Syu
xbps-install -Sy git findutils python3-setuptools tar xz gzip
- uses: actions/checkout@main
- name: make dist
run: |
git config --global --add safe.directory /__w/irssi/irssi
./utils/make-dist.sh
- uses: actions/upload-artifact@v4
with:
path: irssi-*.tar.gz
retention-days: 1
install:
runs-on: ubuntu-latest
container: ghcr.io/void-linux/void-glibc:latest
needs: dist
steps:
- name: prepare required software
run: |
xbps-install -Syu xbps || :
xbps-install -Syu
xbps-install -Sy meson base-devel libglib-devel libutf8proc-devel ncurses-devel ncurses-base openssl-devel libotr-devel libgcrypt-devel tar findutils curl
- name: fetch dist
uses: actions/download-artifact@v4
- name: Setup local annotations
uses: irssi-import/actions-irssi/problem-matchers@master
- name: Test on Void Linux glibc
run: |
set -ex
curl -SLf https://github.com/irssi-import/actions-irssi/raw/master/check-irssi/render.pl -o ~/render.pl && chmod +x ~/render.pl
tar xzf artifact/irssi-*.tar.gz
# ninja install
cd irssi-*/
meson Build -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes --prefix=$HOME/irssi-build --buildtype debugoptimized
ninja -C Build
ninja -C Build install
# ninja test
ninja -C Build test
find -name testlog.txt -exec sed -i -e '/Inherited environment:.* GITHUB/d' {} + -exec cat {} +
export TERM=xterm
# automated irssi launch test
cd
mkdir irssi-test
echo 'echo automated irssi launch test
^set settings_autosave off
^set -clear log_close_string
^set -clear log_day_changed
^set -clear log_open_string
^set log_timestamp *
^window log on
load irc
load dcc
load flood
load notifylist
load perl
load otr
load proxy
^quit' > irssi-test/startup
export LC_CTYPE=C.utf8
irssi-build/bin/irssi --home irssi-test | perl -Mutf8 -C ~/render.pl
cat irc.log.*

View file

@ -1,14 +0,0 @@
# Irssi configuration for muon fmt
max_line_len = 108
indent_style = space
indent_size = 2
#indent_by = ' '
space_array = true
kwargs_force_multiline = true
wide_colon = true
no_single_comma_function = true
insert_final_newline = true
sort_files = false
group_arg_value = true
sticky_parens = true
continuation_indent = true

14
INSTALL
View file

@ -5,14 +5,10 @@
To compile Irssi you need:
- meson-0.53 build system with ninja-1.8 or greater
- pkg-config (or compatible)
- glib-2.32 or greater
- openssl (for ssl support)
- perl-5.8 or greater (for building, and optionally Perl scripts)
(n.b a complete perl is needed, including ExtUtils::Embed and xsubpp)
- perl-5.6 or greater (for Perl support)
- terminfo or ncurses (for text frontend)
- utf8proc (optional, for additional char width calculation)
- libgcrypt (for OTR)
For most people, this should work just fine:
@ -112,11 +108,3 @@ would call:
Getting perl scripting to work needs a few things:
- TODO
Apple MacOS / Darwin
At the time of writing, meson has an open issue with correctly linking
libraries on macos.
See docs/meson-macos-ar.txt for a workaround.

21
NEWS
View file

@ -1,26 +1,5 @@
v1.5-head 202x-xx-xx The Irssi team <staff@irssi.org>
v1.4.5 2023-10-03 The Irssi team <staff@irssi.org>
+ Add workaround for Perl 5.38.0 bug that breaks the Irssi
locale and glyph rendering (scripts.irssi.org#857, #1498)
- Fix Perl scripts broken by Perl 5.38 (scripts.irssi.org#851,
#1474). With input from Leon Timmermans
- Document workaround to fix linker errors when building with
meson on Apple (#1435, #1492)
- Fix meson using wrong filenames on Apple, leading to broken
Perl support (#1483, #1493)
- Fix /upgrade not accepting `~' (#1460, #1462). By Lukas Mai
- Improve compatibility with Perl5-IDEA (#1465, #1467). By
Charlie Daffern
- Fix logic in how own actions are printed for other protocols
(codeberg!5, #1471). By Andrej Kacian
- Fix crash on old PowerPC Mac (#1482, #1484)
- Fix wrong prototype of library function used in terminal
handling (#1495). By Emil Engler
- Minor cleanups (#1488, #1497). Includes work by Emil Engler
- Minor help and documentation fixes (#1458, #1494, #1477,
#1478). Includes work by KindOne
v1.4.4 2023-03-31 The Irssi team <staff@irssi.org>
* Expose location of signals.txt via pkg-config (codeberg!1,
#1439, #1446, #1447). By Andrej Kacian

View file

@ -41,7 +41,7 @@ ninja -C Build && sudo ninja -C Build install
- [glib-2.32](https://wiki.gnome.org/Projects/GLib) or greater
- [openssl](https://www.openssl.org/)
- [perl-5.8](https://www.perl.org/) or greater (for perl support)
- [perl-5.6](https://www.perl.org/) or greater (for perl support)
- terminfo or ncurses (for text frontend)
#### See the [INSTALL](INSTALL) file for details

View file

@ -1,110 +0,0 @@
<base href='https://irssi.org/New-users/'>
<h1>New users guide</h1>
<section id="new-to-irc">
<h2>New to IRC</h2>
<p>Internet Relay Chat was created in 1988 and has hardly changed. It can be used to exchange text messages (one message = single line) with other people, either privately (called query, PM, private message, MSG) or in a room (channel). Pictures are shared by uploading them to a temporary host like <a class="reference external" href="https://pomf.lain.la/">https://pomf.lain.la/</a> and then pasting the HTTP links. Code snippets or longer texts are shared by pasting them to a Pastebin like <a class="reference external" href="https://paste.opensuse.org/">https://paste.opensuse.org/</a> and then sharing the HTTP link.</p>
<p>IRC does not have message history. You can only receive replies while your computer is turned on and connected to the channel you want to follow. Some people run their IRC programs on remote servers for that reason.</p>
<p>IRC is organised into networks. Each network consists of many servers. It (mostly) does not matter which server you connect to as long as it belongs to the network you want to use. Irssi supports connections to many networks at the same time.</p>
<p>Each network contains many channels, rooms that are often dedicated to discussing a specific topic. You can find many channels on <a class="reference external" href="https://netsplit.de/">https://netsplit.de/</a> or using a search engine with the keyword “IRC”. Irssi supports joining many channels at the same time.</p>
<p>There is a rather large IRC network catering to free and open-source software and peer directed projects at <a class="reference external" href="https://libera.chat/">https://libera.chat/</a> and a smaller one at <a class="reference external" href="https://www.oftc.net/">https://www.oftc.net/</a> many free software projects still have support channels on these IRC networks (although some have moved to Matrix or proprietary platforms like Discord).</p>
</section>
<section id="first-start">
<h2>First start</h2>
<p>After (compiling and) installing Irssi, to start it, open a shell (Terminal) and type:</p>
<div class="highlight-default notranslate"><div><pre>irssi
</pre></div>
</div>
<p>You should be greeted by a blinking cursor behind <code class="docutils literal notranslate">[(status)]</code>. You are now in the status window of Irssi. Window is the Irssi name for what you might nowadays call a “Web browser tab”.</p>
<p>If youre confused about what you are seeing on the Irssi screen, you can find an annotated screenshot of it at <a class="reference internal" href="../User-interface/">User interface</a>.</p>
<p>If you want, you can pick a nick name (handle) that will be shown to others reading your messages now, by typing</p>
<div class="highlight-default notranslate"><div><pre>/set nick whatyouwant
</pre></div>
</div>
<p>Each command or message can be sent by pressing Enter. Commands in Irssi start with a <code class="docutils literal notranslate">/</code>. If there is no <code class="docutils literal notranslate">/</code>, then the line that you wrote will be sent as a message to the channel that you have open, for everyone to see.</p>
<section id="leaving">
<h3>Leaving</h3>
<p>Type <code class="docutils literal notranslate">/quit</code> to get out of Irssi.</p>
</section>
</section>
<section id="connecting-to-a-network">
<h2>Connecting to a network</h2>
<p>Irssi comes with some predefined networks. You can see the current list of networks by typing</p>
<div class="highlight-default notranslate"><div><pre>/network
</pre></div>
</div>
<p>(the list will be shown in your status window)</p>
<p>To connect to one of the networks in the list, type <code class="docutils literal notranslate">/connect networkname</code>, for example:</p>
<div class="highlight-default notranslate"><div><pre>/connect liberachat
</pre></div>
</div>
<p>You should see several messages scroll by. After a while, you should be connected to the Libera Chat network.</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Irssi version 1.2 or older may be lacking the liberachat network entry. See <a class="reference external" href="https://github.com/shabble/irssi-docs/wiki/liberachat">https://github.com/shabble/irssi-docs/wiki/liberachat</a> for how to add it.</p>
</div>
<section id="nickname-registration">
<h3>Nickname registration</h3>
<p>Many IRC networks (but not all) offer a way to register a user account. Sometimes (but not on all networks) the account registration also includes reserving a nick for you. <em>How</em> to register also differs by network. Some <em>channels</em> only allow users with registered accounts to join them, so it may be very important for you to register a user account.</p>
<p>User accounts are always specific to a network.</p>
<p>For the Libera Chat network, you can find instructions how to register and set up your account with Irssi on <a class="reference external" href="https://github.com/shabble/irssi-docs/wiki/liberachat#configure-sasl-automated-log-in">https://github.com/shabble/irssi-docs/wiki/liberachat#configure-sasl-automated-log-in</a></p>
</section>
</section>
<section id="joining-a-channel">
<h2>Joining a channel</h2>
<p>Once you are connected to a network, you can join channels by typing <code class="docutils literal notranslate">/join #channelname</code>, for example:</p>
<div class="highlight-default notranslate"><div><pre>/join #irssi
</pre></div>
</div>
<p>Now, a new window will open and you can send messages to the channel.</p>
<section id="changing-windows">
<h3>Changing windows</h3>
<p>You can change between windows using the <code class="docutils literal notranslate">Ctrl</code>+<code class="docutils literal notranslate">n</code> or <code class="docutils literal notranslate">Ctrl</code>+<code class="docutils literal notranslate">p</code> keys, orif your terminal is configured properlyusing <code class="docutils literal notranslate">Alt</code>+<code class="docutils literal notranslate">1</code>, <code class="docutils literal notranslate">Alt</code>+<code class="docutils literal notranslate">2</code>, … See <a class="reference internal" href="../documentation/help/bind_-list/">bind -list</a> for a list of all default key bindings.</p>
</section>
<section id="removing-clutter">
<h3>Removing clutter</h3>
<p>By default, Irssi shows when someone joins or leaves a channel. These messages can waste a lot of lines and obscure the actual chat. To hide them, type</p>
<div class="highlight-default notranslate"><div><pre>/window hidelevel +joins +parts +quits
</pre></div>
</div>
<p>To get them back</p>
<div class="highlight-default notranslate"><div><pre>/window hidelevel -joins -parts -quits
</pre></div>
</div>
<p>If you want to hide them by default, <code class="docutils literal notranslate">/set window_default_hidelevel hidden joins parts quits</code></p>
</section>
</section>
<section id="adding-a-new-network">
<h2>Adding a new network</h2>
<p>If you want to join a network that is not there, you first need to find at least one server of that network. Lets say you have found the room <a class="reference external" href="https://netsplit.de/channels/details.php?room=%23hackint&amp;net=hackint">#hackint</a> on netsplit.de and want to join it. Then you can find that the <a class="reference external" href="https://netsplit.de/servers/?net=hackint">server</a> is irc.hackint.org, port 6697, SSL (TLS) on. To add it to Irssi, use the commands:</p>
<div class="highlight-default notranslate"><div><pre>/network add hackint
/server add -tls -network hackint irc.hackint.org 6697
</pre></div>
</div>
<p>Then, you can connect to the newly added network with</p>
<div class="highlight-default notranslate"><div><pre>/connect hackint
</pre></div>
</div>
<section id="multiple-networks">
<h3>Multiple networks</h3>
<p>If you are connected to multiple networks, you can change which one you are “talking” to (which one to send commands) by using the <code class="docutils literal notranslate">Ctrl</code>+<code class="docutils literal notranslate">x</code> key in the status window.</p>
</section>
</section>
<section id="on-line-help">
<h2>On-line help</h2>
<p>Most /commands have a help page, you can read it with</p>
<div class="highlight-default notranslate"><div><pre>/help commandname
</pre></div>
</div>
<p>or <a class="reference internal" href="../documentation/help/">on-line</a>.</p>
<p>The settings that can be changed with /SET are described on <a class="reference internal" href="../documentation/settings/">Settings Documentation</a> the settingshelp <a class="reference internal" href="#about-scripts">script</a> can be used to read it from within <code class="docutils literal notranslate">/help</code></p>
</section>
<section id="about-scripts">
<h2>About Scripts</h2>
<p>You can enhance your Irssi by installing scripts. Many Perl scripts written by other Irssi users can be found on <a class="reference external" href="https://scripts.irssi.org/">https://scripts.irssi.org/</a></p>
<p>Most of them should be compatible with Irssi 1.4 (but some may not, also see the Full Change log for some incompatible ones)</p>
</section>
<section id="about-themes">
<h2>About Themes</h2>
<p>Irssis look can be thoroughly changed with themes. Many themes created by other Irssi users can be found on <a class="reference external" href="https://themes.irssi.org/">https://themes.irssi.org/</a></p>
<p>If you want to modify the look of Irssi yourself, the <em>default</em> theme which can be found in your <code class="docutils literal notranslate">~/.irssi</code> folder is a good starting point. It also has a few comments explaining what some of the abstracts are used for</p>
</section>

View file

@ -1,193 +0,0 @@
# New users guide #
## New to IRC ##
Internet Relay Chat was created in 1988 and has hardly changed. It can be used
to exchange text messages (one message = single line) with other people, either
privately (called query, PM, private message, MSG) or in a room (channel).
Pictures are shared by uploading them to a temporary host like [1]https://
pomf.lain.la/ and then pasting the HTTP links. Code snippets or longer texts
are shared by pasting them to a Pastebin like [2]https://paste.opensuse.org/
and then sharing the HTTP link.
IRC does not have message history. You can only receive replies while your
computer is turned on and connected to the channel you want to follow. Some
people run their IRC programs on remote servers for that reason.
IRC is organised into networks. Each network consists of many servers. It
(mostly) does not matter which server you connect to as long as it belongs to
the network you want to use. Irssi supports connections to many networks at the
same time.
Each network contains many channels, rooms that are often dedicated to
discussing a specific topic. You can find many channels on [3]https://
netsplit.de/ or using a search engine with the keyword “IRC”. Irssi supports
joining many channels at the same time.
There is a rather large IRC network catering to free and open-source software
and peer directed projects at [4]https://libera.chat/ and a smaller one at [5]
https://www.oftc.net/ many free software projects still have support channels
on these IRC networks (although some have moved to Matrix or proprietary
platforms like Discord).
## First start ##
After (compiling and) installing Irssi, to start it, open a shell (Terminal)
and type:
irssi
You should be greeted by a blinking cursor behind [(status)]. You are now in
the status window of Irssi. Window is the Irssi name for what you might
nowadays call a “Web browser tab”.
If youre confused about what you are seeing on the Irssi screen, you can find
an annotated screenshot of it at [6]User interface.
If you want, you can pick a nick name (handle) that will be shown to others
reading your messages now, by typing
/set nick whatyouwant
Each command or message can be sent by pressing Enter. Commands in Irssi start
with a /. If there is no /, then the line that you wrote will be sent as a
message to the channel that you have open, for everyone to see.
### Leaving ###
Type /quit to get out of Irssi.
## Connecting to a network ##
Irssi comes with some predefined networks. You can see the current list of
networks by typing
/network
(the list will be shown in your status window)
To connect to one of the networks in the list, type /connect networkname, for
example:
/connect liberachat
You should see several messages scroll by. After a while, you should be
connected to the Libera Chat network.
Attention
Irssi version 1.2 or older may be lacking the liberachat network entry. See [7]
https://github.com/shabble/irssi-docs/wiki/liberachat for how to add it.
### Nickname registration ###
Many IRC networks (but not all) offer a way to register a user account.
Sometimes (but not on all networks) the account registration also includes
reserving a nick for you. How to register also differs by network. Some
channels only allow users with registered accounts to join them, so it may be
very important for you to register a user account.
User accounts are always specific to a network.
For the Libera Chat network, you can find instructions how to register and set
up your account with Irssi on [8]https://github.com/shabble/irssi-docs/wiki/
liberachat#configure-sasl-automated-log-in
## Joining a channel ##
Once you are connected to a network, you can join channels by typing /join #
channelname, for example:
/join #irssi
Now, a new window will open and you can send messages to the channel.
### Changing windows ###
You can change between windows using the Ctrl+n or Ctrl+p keys, orif your
terminal is configured properlyusing Alt+1, Alt+2, … See [9]bind -list for a
list of all default key bindings.
### Removing clutter ###
By default, Irssi shows when someone joins or leaves a channel. These messages
can waste a lot of lines and obscure the actual chat. To hide them, type
/window hidelevel +joins +parts +quits
To get them back
/window hidelevel -joins -parts -quits
If you want to hide them by default, /set window_default_hidelevel hidden joins
parts quits
## Adding a new network ##
If you want to join a network that is not there, you first need to find at
least one server of that network. Lets say you have found the room [10]#
hackint on netsplit.de and want to join it. Then you can find that the [11]
server is irc.hackint.org, port 6697, SSL (TLS) on. To add it to Irssi, use the
commands:
/network add hackint
/server add -tls -network hackint irc.hackint.org 6697
Then, you can connect to the newly added network with
/connect hackint
### Multiple networks ###
If you are connected to multiple networks, you can change which one you are
“talking” to (which one to send commands) by using the Ctrl+x key in the status
window.
## On-line help ##
Most /commands have a help page, you can read it with
/help commandname
or [12]on-line.
The settings that can be changed with /SET are described on [13]Settings
Documentation the settingshelp [14]script can be used to read it from within
/help
## About Scripts ##
You can enhance your Irssi by installing scripts. Many Perl scripts written by
other Irssi users can be found on [15]https://scripts.irssi.org/
Most of them should be compatible with Irssi 1.4 (but some may not, also see
the Full Change log for some incompatible ones)
## About Themes ##
Irssis look can be thoroughly changed with themes. Many themes created by
other Irssi users can be found on [16]https://themes.irssi.org/
If you want to modify the look of Irssi yourself, the default theme which can
be found in your ~/.irssi folder is a good starting point. It also has a few
comments explaining what some of the abstracts are used for
References:
[1] https://pomf.lain.la/
[2] https://paste.opensuse.org/
[3] https://netsplit.de/
[4] https://libera.chat/
[5] https://www.oftc.net/
[6] https://irssi.org/User-interface/
[7] https://github.com/shabble/irssi-docs/wiki/liberachat
[8] https://github.com/shabble/irssi-docs/wiki/liberachat#configure-sasl-automated-log-in
[9] https://irssi.org/documentation/help/bind_-list/
[10] https://netsplit.de/channels/details.php?room=%23hackint&net=hackint
[11] https://netsplit.de/servers/?net=hackint
[12] https://irssi.org/documentation/help/
[13] https://irssi.org/documentation/settings/
[14] https://irssi.org/New-users/#about-scripts
[15] https://scripts.irssi.org/
[16] https://themes.irssi.org/

View file

@ -9,13 +9,13 @@ To make Irssi enter capability mode on startup, add
capsicum = "yes";
awaylog_file = "~/irclogs/away.log";
to your ~/.irssi/config in the settings/core section, and restart the
client. Alternatively you can enter it "by hand", using the
"/capsicum enter" command. From the security point of view it's strongly
preferable to use the former method, to avoid establishing connections
without the sandbox protection; the "/capsicum" command is only intended
for experimentation, and in cases where you need to do something that's not
possible in capability mode - run scripts, for example - before continuing.
to your ~/.irssi/config and restart the client. Alternatively you can
enter it "by hand", using the "/capsicum enter" command. From the security
point of view it's strongly preferable to use the former method, to avoid
establishing connections without the sandbox protection; the "/capsicum"
command is only intended for experimentation, and in cases where you need
to do something that's not possible in capability mode - run scripts,
for example - before continuing.
There is no way to leave the capability mode, apart from exiting Irssi.
When running in capability mode, there are certain restrictions - Irssi

View file

@ -162,4 +162,4 @@ server reconnections and irc network splits</li>
<li>placing channels and queries in windows</li>
<li>nick completion</li>
<li>printing infomation of some events</li>
</ul>
</ul>

View file

@ -78,4 +78,4 @@
<h3 id="q-how-to-pronounce-irssi">Q: How to pronounce Irssi?</h3>
<p>A: Check <a href="/assets/irssi.wav">here</a></p>
<p>A: Check <a href="/assets/irssi.wav">here</a></p>

View file

@ -17,15 +17,13 @@ Details:
Adds or removes a binding; the binding itself is case-sensitive and may
contain as many characters as you want.
Key bindings are case sensitive so uppercase letters mean you also have
to use the shift key, except for ctrl which does not support shift but
the keys must always be typed in uppercase.
Uppercase characters usually indicate that you need to keep the shift-key
pressed to use the binding.
%9Examples:%9
/BIND
/BIND meta-c /CLEAR
/BIND meta-C /CYCLE
/BIND meta-q change_window 16
/BIND -delete meta-y
/BIND ^W^C /WINDOW NEW HIDE

View file

@ -5,7 +5,7 @@
%9Parameters:%9
The server to search on and the remote server to search on; if no arguments
The server to search on and the remote sever to search on; if no arguments
are given, the active server will be used.
%9Description:%9

View file

@ -36,8 +36,8 @@
-cmdmax: Specifies the maximum number of commands to perform before
starting the internal flood protection.
-sasl_mechanism Specifies the mechanism to use for the SASL authentication.
Irssi supports: PLAIN, EXTERNAL, SCRAM-SHA-1, SCRAM-SHA-256
and SCRAM-SHA-512
At the moment irssi only supports the 'plain' and the
'external' mechanisms.
Use '' to disable the authentication.
-sasl_username Specifies the username to use during the SASL authentication.
-sasl_password Specifies the password to use during the SASL authentication.

View file

@ -20,10 +20,10 @@
%9Description:%9
Manipulate the text in the window to go to the given line number, or
Manipulate the text in the window to go to a to the given line number, or
clear the buffers.
The timestamp format is '[dd[.mm] | -<days ago>] hh:mi[:ss]'.
The timestamp format is format is '[dd[.mm] | -<days ago>] hh:mi[:ss]'.
%9Examples:%9

View file

@ -16,13 +16,11 @@
-4: Connects using IPv4.
-6: Connects using IPv6.
-tls: Connects using TLS encryption.
-notls: Connect without TLS encrption.
-tls_cert: The TLS client certificate file.
-tls_pkey: The TLS client private key, if not included in the
certificate file.
-tls_pass: The password for the TLS client private key or certificate.
-tls_verify: Verifies the TLS certificate of the server.
-notls_verify: Doesn't verify the TLS certificate of the server.
-tls_verify: Verifies the TLS certificate of the server.
-tls_cafile: The file with the list of CA certificates.
-tls_capath: The directory which contains the CA certificates.
-tls_ciphers: TLS cipher suite preference lists.

View file

@ -15,6 +15,7 @@
%9Examples:%9
/TOGGLE resolve_prefer_ipv6
/TOGGLE channels_rejoin_unavailable ON
%9See also:%9 SET

View file

@ -74,5 +74,5 @@
/WINDOW HIDELEVEL ^JOINS ^PARTS ^QUITS
/WINDOW LOGFILE ~/logs/notices.log
%9See also:%9 JOIN, LEVELS, LOG, QUERY, SET window_default_level, SET window_default_hidelevel
%9See also:%9 JOIN, LEVELS, LOG, QUERY

View file

@ -116,7 +116,6 @@ install_data(
'whowas',
'window',
),
install_dir : helpdir,
)
install_dir : helpdir)
# subdir('in')

View file

@ -373,6 +373,9 @@
After connected to server, Irssi can automatically change your user
mode. You can set it with /SET usermode <mode>, default is +i.
/SET resolve_prefer_ipv6 - If ON, prefer IPv6 for hosts that
have both v4 and v6 addresses.
5.5 Automatic reconnecting
If you get disconnected from server, Irssi will try to reconnect

View file

@ -1,6 +0,0 @@
;; manual workaround for meson bug https://github.com/mesonbuild/meson/issues/11165
;; fixes compilation with meson on apple macos
;; usage: meson --native-file ./docs/meson-macos-ar.txt ...
[binaries]
ar = ['/bin/sh', '-c', 'ar=${AR:-ar}; ranlib=${RANLIB:-ranlib -c -}; case "x$1" in xcsr*) $ar "$@" && $ranlib "$2" || exit $?; ;; *) exec $ar "$@"; ;; esac;', 'ar']

View file

@ -13,7 +13,6 @@ install_data(
'startup-HOWTO.html',
'startup-HOWTO.txt',
),
install_dir : docdir,
)
install_dir : docdir)
subdir('help')

View file

@ -522,8 +522,6 @@ Connect->{}
address - Address where we connected (irc.blah.org)
port - Port where we connected
chatnet - Chat network
chosen_family - IP family chosen to connect to
ipaddr - IP address connected to
password - Password we used in connection.
wanted_nick - Nick which we would prefer to use

View file

@ -1,52 +0,0 @@
<base href='https://irssi.org/documentation/qna/multi/'>
<h1>Right-aligned nicks</h1>
<p>To create a “tabular” effect of the chat view, or to align nick names in a column, you can use Irssis theme/format system. The basic commands are the following:</p>
<div class="highlight-default notranslate"><div><pre>/format own_msg {ownmsgnick $2 {ownnick $[-9]0}}$1
/format own_msg_channel {ownmsgnick $3 {ownnick $[-9]0}{msgchannel $1}}$2
/format pubmsg_me {pubmsgmenick $2 {menick $[-9]0}}$1
/format pubmsg_me_channel {pubmsgmenick $3 {menick $[-9]0}{msgchannel $1}}$2
/format pubmsg_hilight {pubmsghinick $0 $3 $[-9]1}$2
/format pubmsg_hilight_channel {pubmsghinick $0 $4 $[-9]1{msgchannel $2}}$3
/format pubmsg {pubmsgnick $2 {pubnick $[-9]0}}$1
/format pubmsg_channel {pubmsgnick $3 {pubnick $[-9]0}{msgchannel $1}}$2
</pre></div>
</div>
<p>These are copied from the default themes default values, which are responsible for displaying your own messages sent to a channel (<code class="docutils literal notranslate">own_msg</code>) as well as received messages (<code class="docutils literal notranslate">pubmsg</code>) and the two basic highlightings (<code class="docutils literal notranslate">me</code> and <code class="docutils literal notranslate">hilight</code>).</p>
<p>Then, in front of the argument that contains the nick name (<code class="docutils literal notranslate">$0</code> in most cases, but <code class="docutils literal notranslate">$1</code> in <code class="docutils literal notranslate">pubmsg_hilight</code>), an alignment modifier (see <a class="reference internal" href="../../settings/#a-b">Appendix B: Special Variables and Expandos</a>) has been added: <code class="docutils literal notranslate">[-9]</code>. This means that the nicks will be right-aligned and truncated to 9 characters.</p>
<p><strong>Note</strong>: Modifiers <em>only</em> work in the <code class="docutils literal notranslate">/format</code> section of a theme (this may change in the future)</p>
<p>There are also some scripts that try to do the alignment for you, like: <code class="docutils literal notranslate">nm</code>, <code class="docutils literal notranslate">nm2</code>.</p>
<p>There are also some nice themes that extend the alignment to further formats, like: <a class="reference external" href="https://github.com/ronilaukkarinen/weed">weed</a>.</p>
<h1>Automatic log-in to NickServ</h1>
<p>Please check here =&gt; <a class="reference internal" href="../../manual/automation/#automatic-log-in-to-nickserv">Automatic log-in to NickServ</a></p>
<h1>CertFP Log-in</h1>
<p>CertFP, short for Certificate Finger Print, is another method to log you in to NickServ. Instead of a password, it uses a <a class="reference external" href="https://en.wikipedia.org/wiki/Client_certificate">Client Certificate</a>.</p>
<p>In order to use it, you</p>
<ul class="simple">
<li><p>first need a certificate,</p></li>
<li><p>then configure Irssi to use this certificate,</p></li>
<li><p>and finally register the certificate with NickServ.</p></li>
</ul>
<p>Irssi does not have built-in certificate management commands, so you need to use an external tool like <code class="docutils literal notranslate">openssl</code> to create the certificate.</p>
<p>A step-by-step guide for the Libera Chat network can be found here =&gt; <a class="reference external" href="https://github.com/shabble/irssi-docs/wiki/liberachat_certfp">https://github.com/shabble/irssi-docs/wiki/liberachat_certfp</a></p>
<p>It is necessary that the certificate be available as a file; PKCS#11 is not supported.</p>
<h1>Tor (The Onion Router)</h1>
<p><a class="reference external" href="https://www.torproject.org/">Tor</a> is an overlay network for anonymous communication. It operates a local <a class="reference external" href="https://en.wikipedia.org/wiki/SOCKS">SOCKS</a> proxy for applications to use.</p>
<p>Unfortunately, Irssi currently does not support SOCKS proxies natively. As a workaround, you can install the <a class="reference external" href="https://github.com/rofl0r/proxychains-ng">ProxyChains-NG</a> program (note, it must be the NG version).</p>
<p>Afterwards, you can launch Irssi like this:</p>
<div class="highlight-default notranslate"><div><pre>proxychains4 irssi
</pre></div>
</div>
<p>Now your connections will go through the Proxy configured in ProxyChains-NG (Tor by default).</p>
<p>IRC networks may have different requirements to be able to connect via Tor. For the Libera Chat network, you will first need to set up <a class="reference internal" href="../certfp/">CertFP Log-in</a> using a clearnet connection, and then connect to their <a class="reference external" href="https://libera.chat/guides/connect#accessing-liberachat-via-tor">Onion Service</a> <code class="docutils literal notranslate">palladium.libera.chat</code>. More detailed instructions can be found here =&gt; <a class="reference external" href="https://github.com/shabble/irssi-docs/wiki/liberator">https://github.com/shabble/irssi-docs/wiki/liberator</a></p>
<h1>The following signatures were invalid: EXPKEYSIG</h1>
<p>If you see such a message</p>
<div class="highlight-default notranslate"><div><pre>Err:4 home:/ailin_nemui:/irssi-an InRelease
The following signatures were invalid: EXPKEYSIG EDB7AED941EEDB57 home:ailin_nemui OBS Project &lt;home:ailin_nemui@build.opensuse.org&gt;
</pre></div>
</div>
<p>this means that the automatic signing key used by the Open Build Service expired. OBS renews the key periodically, but Debian does not support this.</p>
<section id="fix">
<h2>Fix</h2>
<p>Download the key again, following the regular OBS instructions. If it still does not work, verify if there is a second expired copy of the key in <code class="docutils literal notranslate">/etc/apt/trusted.gpg.d</code> or in <code class="docutils literal notranslate">apt-key list</code> and remove it as well.</p>
</section>

View file

@ -1,111 +0,0 @@
# Right-aligned nicks #
To create a “tabular” effect of the chat view, or to align nick names in a
column, you can use Irssis theme/format system. The basic commands are the
following:
/format own_msg {ownmsgnick $2 {ownnick $[-9]0}}$1
/format own_msg_channel {ownmsgnick $3 {ownnick $[-9]0}{msgchannel $1}}$2
/format pubmsg_me {pubmsgmenick $2 {menick $[-9]0}}$1
/format pubmsg_me_channel {pubmsgmenick $3 {menick $[-9]0}{msgchannel $1}}$2
/format pubmsg_hilight {pubmsghinick $0 $3 $[-9]1}$2
/format pubmsg_hilight_channel {pubmsghinick $0 $4 $[-9]1{msgchannel $2}}$3
/format pubmsg {pubmsgnick $2 {pubnick $[-9]0}}$1
/format pubmsg_channel {pubmsgnick $3 {pubnick $[-9]0}{msgchannel $1}}$2
These are copied from the default themes default values, which are responsible
for displaying your own messages sent to a channel (own_msg) as well as
received messages (pubmsg) and the two basic highlightings (me and hilight).
Then, in front of the argument that contains the nick name ($0 in most cases,
but $1 in pubmsg_hilight), an alignment modifier (see [1]Appendix B: Special
Variables and Expandos) has been added: [-9]. This means that the nicks will be
right-aligned and truncated to 9 characters.
Note: Modifiers only work in the /format section of a theme (this may change in
the future)
There are also some scripts that try to do the alignment for you, like: nm,
nm2.
There are also some nice themes that extend the alignment to further formats,
like: [2]weed.
# Automatic log-in to NickServ #
Please check here => [3]Automatic log-in to NickServ
# CertFP Log-in #
CertFP, short for Certificate Finger Print, is another method to log you in to
NickServ. Instead of a password, it uses a [4]Client Certificate.
In order to use it, you
• first need a certificate,
• then configure Irssi to use this certificate,
• and finally register the certificate with NickServ.
Irssi does not have built-in certificate management commands, so you need to
use an external tool like openssl to create the certificate.
A step-by-step guide for the Libera Chat network can be found here => [5]https:
//github.com/shabble/irssi-docs/wiki/liberachat_certfp
It is necessary that the certificate be available as a file; PKCS#11 is not
supported.
# Tor (The Onion Router) #
[6]Tor is an overlay network for anonymous communication. It operates a local
[7]SOCKS proxy for applications to use.
Unfortunately, Irssi currently does not support SOCKS proxies natively. As a
workaround, you can install the [8]ProxyChains-NG program (note, it must be the
NG version).
Afterwards, you can launch Irssi like this:
proxychains4 irssi
Now your connections will go through the Proxy configured in ProxyChains-NG
(Tor by default).
IRC networks may have different requirements to be able to connect via Tor. For
the Libera Chat network, you will first need to set up [9]CertFP Log-in using a
clearnet connection, and then connect to their [10]Onion Service
palladium.libera.chat. More detailed instructions can be found here => [11]
https://github.com/shabble/irssi-docs/wiki/liberator
# The following signatures were invalid: EXPKEYSIG #
If you see such a message
Err:4 home:/ailin_nemui:/irssi-an InRelease
The following signatures were invalid: EXPKEYSIG EDB7AED941EEDB57 home:ailin_nemui OBS Project <home:ailin_nemui@build.opensuse.org>
this means that the automatic signing key used by the Open Build Service
expired. OBS renews the key periodically, but Debian does not support this.
## Fix ##
Download the key again, following the regular OBS instructions. If it still
does not work, verify if there is a second expired copy of the key in /etc/apt/
trusted.gpg.d or in apt-key list and remove it as well.
References:
[1] https://irssi.org/documentation/settings/#a-b
[2] https://github.com/ronilaukkarinen/weed
[3] https://irssi.org/documentation/manual/automation/#automatic-log-in-to-nickserv
[4] https://en.wikipedia.org/wiki/Client_certificate
[5] https://github.com/shabble/irssi-docs/wiki/liberachat_certfp
[6] https://www.torproject.org/
[7] https://en.wikipedia.org/wiki/SOCKS
[8] https://github.com/rofl0r/proxychains-ng
[9] https://irssi.org/documentation/qna/certfp/
[10] https://libera.chat/guides/connect#accessing-liberachat-via-tor
[11] https://github.com/shabble/irssi-docs/wiki/liberator

View file

@ -1,67 +1,58 @@
project(
'irssi',
'c',
project('irssi', 'c',
version : '1.5-head',
meson_version : '>=0.53',
default_options : [ 'warning_level=1' ],
)
default_options : ['warning_level=1'])
############################
############################
glib_internal_version = 'glib-2.74.7' # keep this in sync with subprojects/glib.wrap
glib_internal_version = 'glib-2.74.3' # keep this in sync with subprojects/glib.wrap
glib_pcre2_internal_version = 'pcre2-10.40'
glib_libffi_internal_version = 'libffi'
cc = meson.get_compiler('c')
rootinc = include_directories('.')
dep = [ ]
textui_dep = [ ]
dep = []
textui_dep = []
need_dl_cross_link = false
need_dl_cross_link_main = false
dl_cross_irssi_main = [ ]
# The Android environment requires that all modules are linked to each other.
# See https://github.com/android/ndk/issues/201
if host_machine.system() == 'android'
need_dl_cross_link = true
elif host_machine.system() == 'cygwin'
need_dl_cross_link = true
need_dl_cross_link_main = true
endif
includedir = get_option('includedir')
incdir = 'irssi'
moduledir = get_option('libdir') / incdir / 'modules'
helpdir = get_option('datadir') / incdir / 'help'
themedir = get_option('datadir') / incdir / 'themes'
scriptdir = get_option('datadir') / incdir / 'scripts'
docdir = get_option('docdir') != '' ? get_option('docdir') : (get_option('datadir') / 'doc' / incdir)
includedir = get_option('includedir')
incdir = 'irssi'
moduledir = get_option('libdir') / incdir / 'modules'
helpdir = get_option('datadir') / incdir / 'help'
themedir = get_option('datadir') / incdir / 'themes'
scriptdir = get_option('datadir') / incdir / 'scripts'
docdir = get_option('docdir') != '' ? get_option('docdir') : (get_option('datadir') / 'doc' / incdir)
want_textui = get_option('without-textui') != 'yes'
want_bot = get_option('with-bot') == 'yes'
want_fuzzer = get_option('with-fuzzer') == 'yes'
fuzzer_lib = get_option('with-fuzzer-lib')
want_textui = get_option('without-textui') != 'yes'
want_bot = get_option('with-bot') == 'yes'
want_fuzzer = get_option('with-fuzzer') == 'yes'
fuzzer_lib = get_option('with-fuzzer-lib')
fuzzer_link_language = get_option('fuzzer-link-language')
want_proxy = get_option('with-proxy') == 'yes'
want_proxy = get_option('with-proxy') == 'yes'
require_capsicum = get_option('with-capsicum') == 'yes'
want_capsicum = get_option('with-capsicum') != 'no'
require_capsicum = get_option('with-capsicum') == 'yes'
want_capsicum = get_option('with-capsicum') != 'no'
require_libutf8proc = get_option('disable-utf8proc') == 'no'
want_libutf8proc = get_option('disable-utf8proc') != 'yes'
want_libutf8proc = get_option('disable-utf8proc') != 'yes'
require_perl = get_option('with-perl') == 'yes'
want_perl = get_option('with-perl') != 'no'
with_perl_lib = get_option('with-perl-lib')
require_perl = get_option('with-perl') == 'yes'
want_perl = get_option('with-perl') != 'no'
with_perl_lib = get_option('with-perl-lib')
require_otr = get_option('with-otr') == 'yes'
want_otr = get_option('with-otr') != 'no'
require_otr = get_option('with-otr') == 'yes'
want_otr = get_option('with-otr') != 'no'
want_glib_internal = get_option('install-glib') != 'no'
want_glib_internal = get_option('install-glib') != 'no'
require_glib_internal = get_option('install-glib') == 'force'
want_static_dependency = get_option('static-dependency') == 'yes'
package_version = get_option('PACKAGE_VERSION') != '' ? get_option('PACKAGE_VERSION') : meson.project_version()
package_version = get_option('PACKAGE_VERSION') != '' ? get_option('PACKAGE_VERSION') : meson.project_version()
fs = import('fs')
if fs.exists('config.status') or fs.exists('irssi-version.h') or fs.exists('default-config.h') or fs.exists('default-theme.h') or fs.exists('src/perl/irssi-core.pl.h') or fs.exists('src/perl/perl-signals-list.h') or fs.exists('irssi-config.h')
@ -69,69 +60,34 @@ if fs.exists('config.status') or fs.exists('irssi-version.h') or fs.exists('defa
endif
UNSET = '=INVALID='
UNSET_ARR = [ UNSET ]
UNSET_ARR = [UNSET]
chat_modules = [ 'irc' ]
chat_modules = ['irc']
run_command(
'mkdir',
meson.current_build_dir() / incdir,
check : false,
)
run_command(
'ln',
'-s', meson.current_source_dir() / 'src',
meson.current_build_dir() / incdir,
check : false,
)
run_command(
'ln',
'-s', meson.current_build_dir() / 'irssi-config.h',
meson.current_build_dir() / incdir,
check : false,
)
run_command(
'ln',
'-s', meson.current_build_dir() / 'irssi-version.h',
meson.current_build_dir() / incdir,
check : false,
)
run_command('mkdir', meson.current_build_dir() / incdir, check : false)
run_command('ln', '-s', meson.current_source_dir() / 'src', meson.current_build_dir() / incdir, check : false)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-config.h', meson.current_build_dir() / incdir, check : false)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-version.h', meson.current_build_dir() / incdir, check : false)
def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"'
def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"'
def_sysconfdir = '-D' + 'SYSCONFDIR' + '="' + (get_option('prefix') / get_option('sysconfdir')) + '"'
def_helpdir = '-D' + 'HELPDIR' + '="' + (get_option('prefix') / helpdir) + '"'
def_themesdir = '-D' + 'THEMESDIR' + '="' + (get_option('prefix') / themedir) + '"'
def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) + '"'
def_helpdir = '-D' + 'HELPDIR' + '="' + (get_option('prefix') / helpdir) + '"'
def_themesdir = '-D' + 'THEMESDIR' + '="' + (get_option('prefix') / themedir) + '"'
def_scriptdir = '-D' + 'SCRIPTDIR' + '="' + (get_option('prefix') / scriptdir) + '"'
def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK'
module_suffix = [ ]
perl_module_suffix = [ ]
# Meson uses the wrong module extensions on Mac.
# https://gitlab.gnome.org/GNOME/glib/issues/520
if [ 'darwin', 'ios' ].contains(host_machine.system())
module_suffix = 'so'
perl_module_suffix = 'bundle'
endif
##############
# Help files #
##############
build_perl = find_program(
'perl',
native : true,
)
build_perl = find_program('perl', native : true)
if meson.is_cross_build()
cross_perl = find_program('perl')
else
cross_perl = build_perl
endif
run_command(
build_perl,
files('utils/syntax.pl'),
check : true,
)
run_command(build_perl, files('utils/syntax.pl'), check : true)
###################
# irssi-version.h #
@ -139,12 +95,12 @@ run_command(
env = find_program('env')
irssi_version_sh = find_program('utils/irssi-version.sh')
irssi_version_h = custom_target(
'irssi-version.h',
irssi_version_h = custom_target('irssi-version.h',
build_by_default : true,
build_always_stale : true,
capture : true,
command : [ env, 'VERSION=' + meson.project_version(), irssi_version_sh, meson.current_source_dir() ],
command : [env, 'VERSION=' + meson.project_version(),
irssi_version_sh, meson.current_source_dir()],
output : 'irssi-version.h',
install : true,
install_dir : includedir / incdir,
@ -155,24 +111,22 @@ irssi_version_h = custom_target(
####################
file2header = find_program('utils/file2header.sh')
default_config_h = custom_target(
'default-config.h',
default_config_h = custom_target('default-config.h',
input : files('irssi.conf'),
output : 'default-config.h',
capture : true,
command : [ file2header, '@INPUT@', 'default_config' ],
command : [file2header, '@INPUT@', 'default_config'],
)
###################
# default-theme.h #
###################
default_theme_h = custom_target(
'default-theme.h',
default_theme_h = custom_target('default-theme.h',
input : files('themes/default.theme'),
output : 'default-theme.h',
capture : true,
command : [ file2header, '@INPUT@', 'default_theme' ],
command : [file2header, '@INPUT@', 'default_theme'],
)
################
@ -181,18 +135,12 @@ default_theme_h = custom_target(
#### inet_addr ####
inet_addr_found = false
foreach inet_addr_provider : [ '', 'nsl' ]
prov_lib = [ ]
foreach inet_addr_provider : ['', 'nsl']
prov_lib = []
if inet_addr_provider != ''
prov_lib += cc.find_library(
inet_addr_provider,
required : false,
)
prov_lib += cc.find_library(inet_addr_provider, required : false)
endif
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function(
'inet_addr',
dependencies : prov_lib,
)
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function('inet_addr', dependencies : prov_lib)
dep += prov_lib
inet_addr_found = true
break
@ -204,18 +152,12 @@ endif
#### socket ####
socket_found = false
foreach socket_provider : [ '', 'socket', 'network' ]
prov_lib = [ ]
foreach socket_provider : ['', 'socket', 'network']
prov_lib = []
if socket_provider != ''
prov_lib += cc.find_library(
socket_provider,
required : false,
)
prov_lib += cc.find_library(socket_provider, required : false)
endif
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function(
'socket',
dependencies : prov_lib,
)
if (prov_lib.length() == 0 or prov_lib[0].found()) and cc.has_function('socket', dependencies : prov_lib)
dep += prov_lib
socket_found = true
break
@ -225,7 +167,7 @@ if not socket_found
error('socket not found')
endif
built_src = [ ]
built_src = []
glib_internal = false
message('*** If you don\'t have GLib, you can run meson ... -Dinstall-glib=yes')
message('*** to download and build it automatically')
@ -233,82 +175,59 @@ message('*** Or alternatively install your distribution\'s package')
message('*** On Debian: sudo apt-get install libglib2.0-dev')
message('*** On Redhat: dnf install glib2-devel')
if not require_glib_internal
glib_dep = dependency(
'glib-2.0',
version : '>=2.32',
required : not want_glib_internal,
static : want_static_dependency,
include_type : 'system',
)
glib_dep = dependency('glib-2.0', version : '>=2.32', required : not want_glib_internal, static : want_static_dependency, include_type : 'system')
else
glib_dep = dependency(
'',
required : false,
)
glib_dep = dependency('', required : false)
endif
if not glib_dep.found()
glib_internal = true
meson_cmd = find_program('meson')
ninja = find_program('ninja')
glib_internal_download_t = custom_target(
'glib-internal-download',
glib_internal_download_t = custom_target('glib-internal-download',
command : [ meson_cmd, 'subprojects', 'download', 'glib', '--sourcedir', meson.current_source_dir() ],
console : true,
output : [ 'glib-internal-download' ],
output : ['glib-internal-download'],
)
glib_internal_dependencies = [
dependency('threads'),
]
glib_internal_configure_args = [ ]
glib_internal_configure_args = []
glib_internal_usr_local = false
if not cc.has_function('iconv_open')
prov_lib = cc.find_library(
'iconv',
required : false,
)
prov_lib = cc.find_library('iconv', required : false)
if not prov_lib.found()
prov_lib = cc.find_library(
'iconv',
dirs : '/usr/local/lib',
)
prov_lib = cc.find_library('iconv', dirs : '/usr/local/lib')
glib_internal_usr_local = true
endif
if cc.has_function('libiconv_open', dependencies : prov_lib)
glib_internal_configure_args += '-Diconv=gnu'
else
glib_internal_configure_args += '-Diconv=native'
endif
glib_internal_dependencies += prov_lib
endif
if not cc.has_function('ngettext')
prov_lib = cc.find_library(
'intl',
required : false,
)
prov_lib = cc.find_library('intl', required : false)
if not prov_lib.found()
prov_lib = cc.find_library(
'intl',
dirs : '/usr/local/lib',
)
prov_lib = cc.find_library('intl', dirs : '/usr/local/lib')
glib_internal_usr_local = true
endif
glib_internal_dependencies += prov_lib
endif
if glib_internal_usr_local
glib_internal_configure_args += [ '-Dc_args=-I/usr/local/include', '-Dc_link_args=-L/usr/local/lib' ]
glib_internal_configure_args += ['-Dc_args=-I/usr/local/include', '-Dc_link_args=-L/usr/local/lib']
endif
if not cc.has_function('getxattr') or not cc.has_header('sys/xattr.h')
if cc.has_header_symbol('attr/xattr.h', 'getxattr')
prov_lib = cc.find_library(
'xattr',
required : false,
)
prov_lib = cc.find_library('xattr', required : false)
else
prov_lib = dependency(
'',
required : false,
)
prov_lib = dependency('', required : false)
endif
if prov_lib.found()
glib_internal_dependencies += prov_lib
@ -317,41 +236,24 @@ if not glib_dep.found()
endif
endif
glib_internal_configure_t = custom_target(
'glib-internal-configure',
command : [
meson_cmd,
'setup',
'--prefix=/irssi-glib-internal',
glib_internal_configure_t = custom_target('glib-internal-configure',
command : [ meson_cmd, 'setup', '--prefix=/irssi-glib-internal',
'--buildtype=' + get_option('buildtype'),
'-Dlibmount=disabled',
'-Dselinux=disabled',
'-Ddefault_library=static',
'-Dforce_fallback_for=pcre2,libffi',
'-Dlibmount=disabled', '-Dselinux=disabled', '-Ddefault_library=static', '-Dforce_fallback_for=pcre2',
glib_internal_configure_args,
(meson.current_build_dir() / 'build-subprojects' / 'glib'),
(meson.current_source_dir() / 'subprojects' / glib_internal_version),
],
(meson.current_source_dir() / 'subprojects' / glib_internal_version) ],
console : true,
output : [ 'glib-internal-configure' ],
depends : glib_internal_download_t,
)
glib_internal_build_t = custom_target(
'glib-internal-build',
command : [
ninja,
'-C', meson.current_build_dir() / 'build-subprojects' / 'glib',
'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a',
output : ['glib-internal-configure'],
depends : glib_internal_download_t,)
glib_internal_build_t = custom_target('glib-internal-build',
command : [ ninja, '-C', meson.current_build_dir() / 'build-subprojects' / 'glib',
'subprojects' / glib_pcre2_internal_version / 'libpcre2-8.a',
'glib' / 'libglib-2.0.a',
'gmodule' / 'libgmodule-2.0.a',
'gobject' / 'libgobject-2.0.a',
'gio' / 'libgio-2.0.a',
],
'gmodule' / 'libgmodule-2.0.a'],
console : true,
output : [ 'glib-internal-build' ],
depends : glib_internal_configure_t,
)
output : ['glib-internal-build'],
depends : glib_internal_configure_t,)
glib_dep = declare_dependency(
dependencies : glib_internal_dependencies,
sources : glib_internal_build_t,
@ -366,78 +268,29 @@ if not glib_dep.found()
],
)
built_src += glib_internal_build_t
libdl_dep = [ ]
prov_lib = cc.find_library(
'dl',
required : false,
)
if prov_lib.found() and cc.has_function(
'dlopen',
dependencies : prov_lib,
)
libdl_dep = []
prov_lib = cc.find_library('dl', required : false)
if prov_lib.found() and cc.has_function('dlopen', dependencies : prov_lib)
libdl_dep += prov_lib
endif
gmodule_dep = declare_dependency(
sources : glib_internal_build_t,
gmodule_dep = declare_dependency(sources : glib_internal_build_t,
dependencies : libdl_dep,
compile_args : [
'-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gmodule'),
],
link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gmodule' / 'libgmodule-2.0.a' ],
)
gobject_dep = declare_dependency(
sources : glib_internal_build_t,
compile_args : [
'-isystem' + (meson.current_build_dir() / 'build-subprojects' / 'glib'),
],
link_args : [
meson.current_build_dir() / 'build-subprojects' / 'glib' / 'subprojects' / glib_libffi_internal_version / 'src' / 'libffi.a',
meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gobject' / 'libgobject-2.0.a',
],
)
gio_dep = declare_dependency(
sources : glib_internal_build_t,
dependencies : cc.find_library('z'),
compile_args : [
'-isystem' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'gio'),
'-isystem' + (meson.current_build_dir() / 'build-subprojects' / 'glib'),
],
link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'gio' / 'libgio-2.0.a' ],
)
else
gmodule_dep = dependency(
'gmodule-2.0',
static : want_static_dependency,
include_type : 'system',
)
gobject_dep = dependency(
'gobject-2.0',
static : want_static_dependency,
include_type : 'system',
)
gio_dep = dependency(
'gio-2.0',
static : want_static_dependency,
include_type : 'system',
)
gmodule_dep = dependency('gmodule-2.0', static : want_static_dependency, include_type : 'system')
endif
dep += glib_dep
dep += gmodule_dep
dep += gobject_dep
dep += gio_dep
if glib_internal and want_static_dependency and want_fuzzer
openssl_proj = subproject(
'openssl',
default_options : [ 'default_library=static', 'asm=disabled' ],
)
openssl_proj = subproject('openssl', default_options : ['default_library=static', 'asm=disabled'])
openssl_dep = openssl_proj.get_variable('openssl_dep')
else
openssl_dep = dependency(
'openssl',
static : want_static_dependency,
include_type : 'system',
)
openssl_dep = dependency('openssl', static : want_static_dependency, include_type : 'system')
endif
dep += openssl_dep
@ -446,16 +299,10 @@ dep += openssl_dep
############
have_libutf8proc = false
libutf8proc = [ ]
libutf8proc = []
if want_libutf8proc
libutf8proc = cc.find_library(
'utf8proc',
required : require_libutf8proc,
)
have_libutf8proc = cc.has_function(
'utf8proc_version',
dependencies : libutf8proc,
)
libutf8proc = cc.find_library('utf8proc', required : require_libutf8proc)
have_libutf8proc = cc.has_function('utf8proc_version', dependencies : libutf8proc)
if have_libutf8proc
dep += libutf8proc
endif
@ -470,15 +317,9 @@ endif
if want_textui
setupterm_found = false
foreach setupterm_provider : [ 'tinfo', 'ncursesw', 'ncurses', 'terminfo' ]
prov_lib = cc.find_library(
setupterm_provider,
required : false,
)
if prov_lib.found() and cc.has_function(
'setupterm',
dependencies : prov_lib,
)
foreach setupterm_provider : ['tinfo', 'ncursesw', 'ncurses', 'terminfo']
prov_lib = cc.find_library(setupterm_provider, required : false)
if prov_lib.found() and cc.has_function('setupterm', dependencies : prov_lib)
textui_dep += prov_lib
setupterm_found = true
break
@ -495,20 +336,15 @@ endif
have_perl = false
if want_perl
perl_cflags = [ ]
perl_ldflags = [ ]
perl_rpath_flags = [ ]
perl_cflags = []
perl_ldflags = []
perl_rpath_flags = []
perl_rpath = ''
#### ccopts ####
perl_ccopts = meson.get_cross_property('perl_ccopts', UNSET_ARR)
if perl_ccopts == UNSET_ARR
res = run_command(
cross_perl,
'-MExtUtils::Embed',
'-e', 'ccopts',
check : true,
)
res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ccopts', check : true)
perl_ccopts = res.stdout().strip().split()
endif
foreach fl : perl_ccopts
@ -525,15 +361,10 @@ if want_perl
#### ldopts ####
perl_ldopts = meson.get_cross_property('perl_ldopts', UNSET_ARR)
if perl_ldopts == UNSET_ARR
res = run_command(
cross_perl,
'-MExtUtils::Embed',
'-e', 'ldopts',
check : true,
)
res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ldopts', check : true)
perl_ldopts = res.stdout().strip().split()
endif
skip_libs = [ '-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic' ]
skip_libs = ['-ldb', '-ldbm', '-lndbm', '-lgdbm', '-lc', '-lposix', '-rdynamic']
foreach fl : perl_ldopts
if not fl.startswith('-A') and not skip_libs.contains(fl)
if fl.startswith('-Wl,-rpath,')
@ -547,26 +378,13 @@ if want_perl
perl_version = meson.get_cross_property('perl_version', UNSET)
if perl_version == UNSET
perl_version = run_command(
cross_perl,
'-V::version:',
check : true,
).stdout().split('\'')[1]
perl_version = run_command(cross_perl, '-V::version:', check : true).stdout().split('\'')[1]
endif
# disable clang warning
if perl_version.version_compare('<5.35.2')
perl_cflags += cc.get_supported_arguments('-Wno-compound-token-split-by-macro')
endif
perl_dep = declare_dependency(
compile_args : perl_cflags,
link_args : perl_ldflags,
version : perl_version,
)
perl_dep = declare_dependency(compile_args : perl_cflags, link_args : perl_ldflags,
version : perl_version)
####
if not cc.links(
'''
if not cc.links('''
#include <EXTERN.h>
#include <perl.h>
int main()
@ -574,10 +392,8 @@ int main()
perl_alloc();
return 0;
}
''',
args : perl_cflags + perl_ldflags + perl_rpath_flags,
name : 'working Perl support',
)
''', args : perl_cflags + perl_ldflags + perl_rpath_flags,
name : 'working Perl support')
if require_perl
error('error linking with perl libraries')
else
@ -586,15 +402,9 @@ int main()
else
xsubpp_file_c = meson.get_cross_property('perl_xsubpp', UNSET)
if xsubpp_file_c == UNSET
xsubpp_file_c = run_command(
build_perl,
'-MExtUtils::ParseXS',
'-e($r = $INC{"ExtUtils/ParseXS.pm"}) =~ s{ParseXS\\.pm$}{xsubpp}; print $r',
check : true,
).stdout()
xsubpp_file_c = run_command(build_perl, '-MExtUtils::ParseXS', '-Eprint $INC{"ExtUtils/ParseXS.pm"} =~ s{ParseXS\\.pm$}{xsubpp}r', check : true).stdout()
endif
xsubpp = generator(
build_perl,
xsubpp = generator(build_perl,
output : '@BASENAME@.c',
capture : true,
arguments : [ xsubpp_file_c, '@EXTRA_ARGS@', '@INPUT@' ],
@ -602,44 +412,31 @@ int main()
xsubpp_file = files(xsubpp_file_c)
if with_perl_lib == 'module'
perl_install_base = run_command(
build_perl,
'-MText::ParseWords=shellwords',
'-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}',
check : true,
).stdout()
perl_install_base = run_command(build_perl, '-MText::ParseWords=shellwords', '-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}', check : true).stdout()
if perl_install_base == ''
with_perl_lib = ''
endif
endif
if with_perl_lib == ''
if get_option('prefix') in [ '/usr/local', 'C:/' ]
if get_option('prefix') in ['/usr/local', 'C:/']
with_perl_lib = 'site'
elif get_option('prefix') in [ '/usr' ]
elif get_option('prefix') in ['/usr']
with_perl_lib = 'vendor'
endif
endif
perlmoddir = ''
if with_perl_lib in [ 'site', 'vendor', 'module' ]
if with_perl_lib in ['site', 'vendor', 'module']
set_perl_use_lib = false
perl_library_dir = with_perl_lib + ' default'
if with_perl_lib in [ 'site', 'vendor' ]
if with_perl_lib in ['site', 'vendor']
perlmoddir = meson.get_cross_property('perl_install' + with_perl_lib + 'arch', UNSET)
if perlmoddir == UNSET
perlmoddir = run_command(
cross_perl,
'-V::install' + with_perl_lib + 'arch:',
check : true,
).stdout().split('\'')[1]
perlmoddir = run_command(cross_perl, '-V::install' + with_perl_lib + 'arch:', check : true).stdout().split('\'')[1]
endif
elif with_perl_lib == 'module'
perl_archname = meson.get_cross_property('perl_archname', UNSET)
if perl_archname == UNSET
perl_archname = run_command(
cross_perl,
'-V::archname:',
check : true,
).stdout().split('\'')[1]
perl_archname = run_command(cross_perl, '-V::archname:', check : true).stdout().split('\'')[1]
endif
perlmoddir = perl_install_base / 'lib' / 'perl5' / perl_archname
endif
@ -660,12 +457,7 @@ int main()
if set_perl_use_lib
perl_inc = meson.get_cross_property('perl_inc', UNSET_ARR)
if perl_inc == UNSET_ARR
set_perl_use_lib = run_command(
cross_perl,
'-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC',
perl_use_lib,
check : false,
).returncode() != 0
set_perl_use_lib = run_command(cross_perl, '-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC', perl_use_lib, check : false).returncode() != 0
else
set_perl_use_lib = not perl_inc.contains(perl_use_lib)
endif
@ -691,20 +483,8 @@ endif
have_otr = false
if want_otr
libgcrypt = dependency(
'libgcrypt',
version : '>=1.2.0',
required : require_otr,
static : want_static_dependency,
include_type : 'system',
)
libotr = dependency(
'libotr',
version : '>=4.1.0',
required : require_otr,
static : want_static_dependency,
include_type : 'system',
)
libgcrypt = dependency('libgcrypt', version : '>=1.2.0', required : require_otr, static : want_static_dependency, include_type : 'system')
libotr = dependency('libotr', version : '>=4.1.0', required : require_otr, static : want_static_dependency, include_type : 'system')
if libgcrypt.found() and libotr.found()
dep += libgcrypt
dep += libotr
@ -718,19 +498,9 @@ endif
have_capsicum = false
if want_capsicum
if cc.has_function(
'cap_enter',
dependencies : cc.find_library('c'),
)
libnv = cc.find_library(
'nv',
required : require_capsicum,
)
nvlist_create_found = libnv.found() and cc.has_function(
'nvlist_create',
dependencies : libnv,
prefix : '#include <sys/nv.h>',
)
if cc.has_function('cap_enter', dependencies : cc.find_library('c'))
libnv = cc.find_library('nv', required : require_capsicum)
nvlist_create_found = libnv.found() and cc.has_function('nvlist_create', dependencies : libnv, prefix : '#include <sys/nv.h>')
if nvlist_create_found
dep += libnv
have_capsicum = true
@ -747,14 +517,11 @@ if want_capsicum
endif
# dependency helper sets
dep_cflagsonly = [ ]
dep_cflagsonly = []
foreach d : dep
dep_cflagsonly += d.partial_dependency(
includes : true,
compile_args : true,
)
dep_cflagsonly += d.partial_dependency(includes : true, compile_args : true)
endforeach
dl_cross_dep = [ ]
dl_cross_dep = []
if need_dl_cross_link
dl_cross_dep = dep
endif
@ -765,19 +532,11 @@ endif
conf = configuration_data()
conf.set(
'HAVE_CAPSICUM',
have_capsicum,
description : 'Build with Capsicum support',
)
conf.set('HAVE_CAPSICUM', have_capsicum, description : 'Build with Capsicum support')
conf.set('HAVE_GMODULE', true)
conf.set('TERM_TRUECOLOR', true)
conf.set('USE_GREGEX', true)
conf.set10(
'_DARWIN_USE_64_BIT_INODE',
true,
description : 'Enable large inode numbers on Mac OS X 10.5.',
)
conf.set10('_DARWIN_USE_64_BIT_INODE', true, description : 'Enable large inode numbers on Mac OS X 10.5.')
conf.set_quoted('FHS_PREFIX', get_option('fhs-prefix'))
headers = [
@ -791,110 +550,29 @@ headers = [
]
foreach h : headers
if cc.has_header(h)
conf.set(
'HAVE_' + h.underscorify().to_upper(),
1,
description : 'Define to 1 if you have the <' + h + '> header file.',
)
conf.set('HAVE_' + h.underscorify().to_upper(), 1, description : 'Define to 1 if you have the <' + h + '> header file.')
endif
endforeach
if want_textui and conf.get('HAVE_TERM_H', 0) == 1
if cc.links(
'''
#include <stdio.h>
#include <term.h>
int main (void) {
return tputs("x", 1, putchar);
}
''',
args : '-pedantic-errors',
dependencies : textui_dep,
name : 'Curses working',
)
# ok
else
has_curses_h = cc.has_header('curses.h')
if has_curses_h and cc.links(
'''
#include <curses.h>
#include <term.h>
int main (void) {
return tputs("x", 1, putchar);
}
''',
args : '-pedantic-errors',
dependencies : textui_dep,
name : 'Curses working with curses.h',
)
conf.set(
'NEED_CURSES_H',
1,
description : 'tputs needs curses.h',
)
else
if has_curses_h and cc.links(
'''
#include <curses.h>
#include <term.h>
int char_putchar (char c) {
return putchar(c);
}
int main (void) {
return tputs("x", 1, char_putchar);
}
''',
args : '-pedantic-errors',
dependencies : textui_dep,
name : 'Curses with tputs third argument arg char',
)
conf.set(
'NEED_CURSES_H',
1,
description : 'tputs needs curses.h',
)
conf.set(
'TPUTS_SVR4',
1,
description : 'third argument of tputs has the type int (*)(char)',
)
else
error('could not link terminfo')
endif
endif
endif
endif
conf.set('HAVE_LIBUTF8PROC', have_libutf8proc)
conf.set_quoted('PACKAGE_VERSION', package_version)
conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
configure_file(
output : 'irssi-config.h',
configure_file(output : 'irssi-config.h',
configuration : conf,
install_dir : includedir / incdir,
)
install_dir : includedir / incdir)
##########
# CFLAGS #
##########
#### warnings ####
add_project_arguments(
cc.get_supported_arguments('-Werror=declaration-after-statement'),
language : 'c',
)
add_project_arguments(cc.get_supported_arguments('-Werror=declaration-after-statement'), language : 'c')
#### personality ####
add_project_arguments(
cc.get_supported_arguments('-fno-strict-aliasing'),
language : 'c',
)
add_project_arguments(cc.get_supported_arguments('-fno-strict-aliasing'), language : 'c')
if get_option('buildtype').contains('debug')
add_project_arguments(
cc.get_supported_arguments('-fno-omit-frame-pointer'),
language : 'c',
)
add_project_arguments(cc.get_supported_arguments('-fno-omit-frame-pointer'), language : 'c')
endif
if want_fuzzer
@ -902,10 +580,7 @@ if want_fuzzer
if not cc.has_argument('-fsanitize=fuzzer-no-link')
error('compiler does not support -fsanitize=fuzzer-no-link, try clang?')
endif
add_project_arguments(
'-fsanitize=fuzzer-no-link',
language : 'c',
)
add_project_arguments('-fsanitize=fuzzer-no-link', language : 'c')
endif
if fuzzer_link_language != 'c'
add_languages(fuzzer_link_language)
@ -917,7 +592,7 @@ endif
##############
pc = import('pkgconfig')
pc_requires = [ ]
pc_requires = []
if not glib_internal
pc_requires += glib_dep
endif
@ -932,14 +607,15 @@ if signalsfile.startswith('/')
else
signalsfile = '${prefix}' / signalsfile
endif
pc.generate(
filebase : 'irssi-1',
pc.generate(filebase : 'irssi-1',
name : 'Irssi',
description : 'Irssi chat client',
version : package_version,
requires : pc_requires,
variables : [ 'irssimoduledir=${libdir}' / incdir / 'modules', 'signalsfile=' + signalsfile ],
)
variables : [
'irssimoduledir=${libdir}' / incdir / 'modules',
'signalsfile=' + signalsfile
])
###########
# irssi.1 #

View file

@ -5,7 +5,7 @@ use Irssi;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "1.11";
$VERSION = "1.10";
%IRSSI = (
authors => 'Timo Sirainen & Jostein Kjønigsen',
name => 'autoop',
@ -98,11 +98,10 @@ sub load_autoops {
%opnicks = ();
open(CONF, "<", "$file") or return;
while (my $line = <CONF>) {
chomp($line);
if ($line !~ /^\s*$/) {
cmd_autoop($line);
$count++;
}
if ($line !=~ /^\s*$/) {
cmd_autoop($line);
$count++;
}
}
close(CONF);

View file

@ -1,6 +1,6 @@
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "2.93";
$VERSION = "2.92";
%IRSSI = (
authors => "Timo Sirainen, Matti Hiljanen, Joost Vunderink, Bart Matthaei",
contact => "tss\@iki.fi, matti\@hiljanen.com, joost\@carnique.nl, bart\@dreamflow.nl",
@ -63,8 +63,8 @@ sub cmd_print_help {
"/MAILBOX SHOW\n".
" - Shows a list of the defined mailboxes.\n\n".
"Use the following commands to change the behaviour:\n\n".
"/SET MAILDIR_MODE on|off\n".
" - If maildir_mode is on, the mailboxes in the list are assumed to be ".
"/SET MAILDIRMODE on|off\n".
" - If maildirmode is on, the mailboxes in the list are assumed to be ".
"directories. Otherwise they are assumed to be spool files.\n".
" Default: off.\n".
"/SET MAIL_OLDNOTNEW on|off\n".

View file

@ -11,5 +11,4 @@ install_data(
'scriptassist.pl',
'usercount.pl',
),
install_dir : scriptdir,
)
install_dir : scriptdir)

View file

@ -5,7 +5,7 @@
use strict;
our $VERSION = '2023111700';
our $VERSION = '2022053100';
our %IRSSI = (
authors => 'Stefan \'tommie\' Tomanek',
contact => 'stefan@pico.ruhr.de',
@ -22,8 +22,6 @@ our ($forked, %remote_db, $have_gpg, @complist);
use Irssi 20020324;
use CPAN::Meta::YAML;
use LWP::UserAgent;
use Hash::Util qw(lock_ref_keys);
use JSON::PP;
use POSIX;
use version;
@ -45,7 +43,7 @@ sub show_help {
/scriptassist info <scripts>
Display information about <scripts>
/scriptassist ratings <scripts|all>
Retrieve the average ratings of the scripts
Retrieve the average ratings of the the scripts
/scriptassist top <num>
Retrieve the first <num> top rated scripts
/scriptassist new <num>
@ -201,163 +199,87 @@ sub get_unknown {
}
sub get_names {
my ($sname, $db, $votes) = @_;
my ($sname, $db) = shift;
$sname =~ s/\s+$//;
my $ext = 'pl'; # default extension
if ($sname =~ s/\.(\w{2,3})$//) {
$ext = $1;
}
my $plname = "$sname.$ext";
$sname =~ s/\.pl$//;
my $plname = "$sname.pl";
$sname =~ s/^.*\///;
my $xname = $sname;
$xname =~ s/\W/_/g;
my $pname = "${xname}::";
if ($xname ne $sname || $sname =~ /_/) {
my $dir = Irssi::get_irssi_dir()."/scripts/";
if ($db && exists $db->{$plname}) {
if ($db && exists $db->{"$sname.pl"}) {
# $found = 1;
} elsif (-e $dir.$plname || -e $dir."autorun/".$plname) {
} elsif (-e $dir.$plname || -e $dir."$sname.pl" || -e $dir."autorun/$sname.pl") {
# $found = 1;
} else {
# not found
my $pat = $xname; $pat =~ y/_/?/;
my $re = "\Q$xname"; $re =~ s/\Q_/./g;
if ($db) {
my ($cand) = grep /^$re\.\Q$ext\E$/, sort keys %$db;
my ($cand) = grep /^$re\.pl$/, sort keys %$db;
if ($cand) {
return get_names($cand, $db, $votes);
return get_names($cand, $db);
}
}
my ($cand) = glob "'$dir$pat.$ext' '${dir}autorun/$pat.$ext'";
my ($cand) = glob "'$dir$pat.pl' '${dir}autorun/$pat.pl'";
if ($cand) {
$cand =~ s/^.*\///;
return get_names($cand, $db, $votes);
return get_names($cand, $db);
}
}
}
my ($script_stash, $script_irssi, $script_db, $local_version);
$script_db = $db->{$plname} if $db && exists $db->{$plname};
if (lc $ext eq 'pl') {
$script_stash = $Irssi::Script::{$pname};
}
elsif (lc $ext eq 'py' && is_python_loaded()) {
my $filename;
capture_print_text_command(
'py list',
sub {
for my $line (@_[ 1 .. $#_ ]) {
my ($script, $fn) = split ' ', $line, 2;
if ($script eq $sname) {
$filename = $fn;
}
}
});
if (defined $filename) {
my $filename_quoted = $filename;
$filename_quoted =~ s/[\\']/\\$&/g;
capture_print_text_command(
# make sure the command line stays short
'py exec ' .
(join ';', split /\n/, <<PYTHON
import ast as A, types as _, json
i = 'IRSSI'
v = '__version__'
T = isinstance
f = '$filename_quoted'
a = lambda _: T(_, A.Assign)
n = lambda _: T(_, A.Name)
y = lambda _: _.id
t = lambda _: list(map(y, filter(n, _.targets)))
C = lambda e: lambda _: a(_) and t(_) == [e]
O = _.SimpleNamespace(value=A.Constant(None))
P = A.parse(open(f).read(), filename=f)
f = lambda e: A.literal_eval(next(filter(C(e), P.body), O).value)
print(json.dumps({ i: f(i), v: f(v) }))
PYTHON
),
sub {
eval {
my $doc = decode_json("@_");
$script_stash = { IRSSI => $doc->{IRSSI}, VERSION => \($doc->{__version__}) };
};
}
);
}
}
if (defined $script_stash) {
$script_irssi = $script_stash->{IRSSI};
$local_version = ${$script_stash->{VERSION}}
if $script_stash->{VERSION};
}
lock_ref_keys({
sname => $ext eq 'pl' ? $sname : $plname,
plname => $plname,
pname => $pname,
xname => $xname,
stash => $script_stash,
irssi => $script_irssi,
db => $script_db,
db_version => ($script_db ? $script_db->{version} : undef),
local_version => $local_version,
($votes ? (votes => $votes->{$plname}) : ()),
})
($sname, $plname, $pname, $xname)
}
sub script_info {
my ($scripts) = @_;
my %result;
my $xml = get_scripts();
my $py = is_python_loaded();
foreach (@{$scripts}) {
my %r;
my $n = get_names($_, $xml);
next unless (defined $n->{db} || defined $n->{irssi});
$r{version} = $n->{db_version};
my ($sname, $plname, $pname) = get_names($_, $xml);
next unless (defined $xml->{$plname} || ( exists $Irssi::Script::{$pname} && exists $Irssi::Script::{$pname}{IRSSI} ));
$result{$sname}{version} = get_remote_version($sname, $xml);
my @headers = ('authors', 'contact', 'description', 'license', 'source');
foreach my $entry (@headers) {
$r{$entry} = $n->{irssi}{$entry};
if ($n->{db} && defined $n->{db}{$entry}) {
$r{$entry} = $n->{db}{$entry};
$result{$sname}{$entry} = $Irssi::Script::{$pname}{IRSSI}{$entry};
if (defined $xml->{$plname}{$entry}) {
$result{$sname}{$entry} = $xml->{$plname}{$entry};
}
}
if ($n->{db} && $n->{db}{signature_available}) {
$r{signature_available} = 1;
if ($xml->{$plname}{signature_available}) {
$result{$sname}{signature_available} = 1;
}
if ($n->{db} && defined $n->{db}{modules}) {
my $modules = $n->{db}{modules};
if (defined $xml->{$plname}{modules}) {
my $modules = $xml->{$plname}{modules};
foreach my $mod (split(/ /, $modules)) {
my $opt = ($mod =~ /\((.*)\)/)? 1 : 0;
$mod = $1 if $1;
$r{modules}{$mod}{optional} = $opt;
$r{modules}{$mod}{installed} = module_exist($mod);
$result{$sname}{modules}{$mod}{optional} = $opt;
$result{$sname}{modules}{$mod}{installed} = module_exist($mod);
}
} elsif ($n->{irssi} && defined $n->{irssi}{modules}) {
my $modules = $n->{irssi}{modules};
} elsif (defined $Irssi::Script::{$pname}{IRSSI}{modules}) {
my $modules = $Irssi::Script::{$pname}{IRSSI}{modules};
foreach my $mod (split(/ /, $modules)) {
my $opt = ($mod =~ /\((.*)\)/)? 1 : 0;
$mod = $1 if $1;
$r{modules}{$mod}{optional} = $opt;
$r{modules}{$mod}{installed} = module_exist($mod);
$result{$sname}{modules}{$mod}{optional} = $opt;
$result{$sname}{modules}{$mod}{installed} = module_exist($mod);
}
}
if (!$py && $n->{db} && $n->{db}{language} eq 'Python') { # py
$r{modules}{'irssi-python module'}{installed} = 0;
}
# if (defined $n->{db}{depends}) {
# my $depends = $n->{db}{depends};
# if (defined $xml->{$plname}{depends}) {
# my $depends = $xml->{$plname}{depends};
# foreach my $dep (split(/ /, $depends)) {
# $r{depends}{$dep}{installed} = 1; #(defined ${ 'Irssi::Script::'.$dep });
# $result{$sname}{depends}{$dep}{installed} = 1; #(defined ${ 'Irssi::Script::'.$dep });
# }
# }
$result{$n->{sname}} = \%r;
}
return \%result;
}
sub get_rate_url {
my ($src) = @_;
if (ref $src) { ($src) = grep { $_ } map { $_->{source} } values %$src; }
die("No script source address found\n") unless $src;
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.$VERSION);
my $request = HTTP::Request->new('GET', $src);
@ -366,9 +288,6 @@ sub get_rate_url {
my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
die("Fetching ratings location failed: $error");
}
if (my $error = $response->header('X-Died')) {
die("$error\n");
}
my $votes_url;
for my $tag ($response->content() =~ /<script([^>]*)>/g) {
my $attr = " $tag ";
@ -380,7 +299,7 @@ sub get_rate_url {
}
$request = HTTP::Request->new('GET', $votes_url);
$response = $ua->request($request);
if (!$response->is_success || $response->header('X-Died')) {
if (!$response->is_success) {
my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
die("Fetching ratings failed: $error");
}
@ -392,16 +311,16 @@ sub get_rate_url {
sub rate_script {
my ($script, $stars) = @_;
my $xml = get_scripts();
my $votes = get_rate_url($xml);
my $n = get_names($script, $xml, $votes);
die "Script $script not found\n" unless $n->{votes};
return $n->{votes}{u}
my $votes = get_rate_url(map { $_->{source} } values %$xml);
my ($sname, $plname, $pname) = get_names($script, $xml);
die "Script $script not found\n" unless $votes->{$plname};
return $votes->{$plname}{u}
}
sub get_ratings {
my ($scripts, $limit) = @_;
my $xml = get_scripts();
my $votes = get_rate_url($xml);
my $votes = get_rate_url(map { $_->{source} } values %$xml);
foreach (keys %{$votes}) {
if ($xml->{$_}) {
$xml->{$_}{votes} = $votes->{$_}{v};
@ -410,9 +329,9 @@ sub get_ratings {
my %result;
if (@{$scripts}) {
foreach (@{$scripts}) {
my $n = get_names($_, $xml);
next unless ($n->{db} || $n->{irssi});
$result{$n->{plname}} = [$n->{db}{votes}];
my ($sname, $plname, $pname) = get_names($_, $xml);
next unless (defined $xml->{$plname} || ( exists $Irssi::Script::{$pname} && exists $Irssi::Script::{$pname}{IRSSI} ));
$result{$plname} = [$xml->{$plname}{votes}];
}
} else {
my @keys = sort { $xml->{$b}{votes} <=> $xml->{$a}{votes}
@ -452,22 +371,16 @@ sub debug_scripts {
my ($scripts) = @_;
my %result;
my $xml = get_scripts();
my $py = is_python_loaded();
foreach (@{$scripts}) {
my %r;
my $n = get_names($_, $xml);
if ($n->{db} && defined $n->{db}{modules}) {
my $modules = $n->{db}{modules};
my ($sname, $plname) = get_names($_, $xml);
if (defined $xml->{$plname}{modules}) {
my $modules = $xml->{$plname}{modules};
foreach my $mod (split(/ /, $modules)) {
my $opt = ($mod =~ /\((.*)\)/)? 1 : 0;
$mod = $1 if $1;
$r{$mod}{optional} = $opt;
$r{$mod}{installed} = module_exist($mod);
$result{$sname}{$mod}{optional} = $opt;
$result{$sname}{$mod}{installed} = module_exist($mod);
}
$result{$n->{sname}} = \%r;
}
if (!$py && $n->{db} && $n->{db}{language} eq 'Python') { # py
$result{$n->{sname}}{'irssi-python module'}{installed} = 0;
}
}
return(\%result);
@ -478,11 +391,11 @@ sub install_scripts {
my %success;
my $dir = Irssi::get_irssi_dir()."/scripts/";
foreach (@{$scripts}) {
my $n = get_names($_, $xml);
if ($n->{stash} && (-e $dir.$n->{plname})) {
$success{$n->{sname}}{installed} = -2;
my ($sname, $plname, $pname) = get_names($_, $xml);
if (get_local_version($sname) && (-e $dir.$plname)) {
$success{$sname}{installed} = -2;
} else {
$success{$n->{sname}} = download_script($n->{sname}, $xml);
$success{$sname} = download_script($sname, $xml);
}
}
return \%success;
@ -493,24 +406,24 @@ sub update_scripts {
$list = loaded_scripts() if ($list->[0] eq "all" || scalar(@$list) == 0);
my %status;
foreach (@{$list}) {
my $n = get_names($_, $database);
my $local = $n->{local_version};
my $remote = $n->{db_version};
my ($sname) = get_names($_, $database);
my $local = get_local_version($sname);
my $remote = get_remote_version($sname, $database);
next if $local eq '' || $remote eq '';
if (compare_versions($local, $remote) eq "older") {
$status{$n->{sname}} = download_script($n->{sname}, $database);
$status{$sname} = download_script($sname, $database);
} else {
$status{$n->{sname}}{installed} = -2;
$status{$sname}{installed} = -2;
}
$status{$n->{sname}}{remote} = $remote;
$status{$n->{sname}}{local} = $local;
$status{$sname}{remote} = $remote;
$status{$sname}{local} = $local;
}
return \%status;
}
sub search_scripts {
my ($query, $database) = @_;
$query =~ s/\.pl\Z//; # pl
$query =~ s/\.pl\Z//;
my %result;
foreach (sort keys %{$database}) {
my %entry = %{$database->{$_}};
@ -519,7 +432,7 @@ sub search_scripts {
$string .= $entry{description} if defined $entry{description};
if ($string =~ /$query/i) {
my $name = $_;
$name =~ s/\.pl$//; # pl
$name =~ s/\.pl$//;
if (defined $entry{description}) {
$result{$name}{desc} = $entry{description};
} else {
@ -530,7 +443,7 @@ sub search_scripts {
} else {
$result{$name}{authors} = "";
}
if (get_names($name, $database)->{stash}) {
if (get_local_version($name)) {
$result{$name}{installed} = 1;
} else {
$result{$name}{installed} = 0;
@ -618,8 +531,8 @@ sub print_unknown {
my $text .= "The command '/".$cmd."' is provided by the script '".$data->{$cmd}{$_}{name}."'.\n";
$text .= "This script is currently not installed on your system.\n";
$text .= "If you want to install the script, enter\n";
my $n = get_names($_);
$text .= " %U/script install ".$n->{sname}."%U ";
my ($name) = get_names($_);
$text .= " %U/script install ".$name."%U ";
my $output = draw_box("ScriptAssist", $text, "'".$_."' missing", 1);
print CLIENTCRAP $output;
}
@ -628,10 +541,10 @@ sub print_unknown {
sub check_autorun {
my ($script) = @_;
my $n = get_names($script);
my (undef, $plname) = get_names($script);
my $dir = Irssi::get_irssi_dir()."/scripts/";
if (-e $dir."/autorun/".$n->{plname}) {
if (readlink($dir."/autorun/".$n->{plname}) eq "../".$n->{plname}) {
if (-e $dir."/autorun/".$plname) {
if (readlink($dir."/autorun/".$plname) eq "../".$plname) {
return 1;
}
}
@ -669,15 +582,14 @@ sub print_info {
my $line;
foreach my $script (sort keys(%data)) {
my ($local, $autorun);
my $n = get_names($script);
if ($n->{stash}) {
if (get_local_version($script)) {
$line .= "%go%n ";
$local = $n->{local_version};
$local = get_local_version($script);
} else {
$line .= "%ro%n ";
$local = undef;
}
if ($n->{stash} || check_autorun($script)) {
if (defined $local || check_autorun($script)) {
$autorun = "no";
$autorun = "yes" if check_autorun($script);
} else {
@ -731,7 +643,7 @@ sub print_ratings {
my @table;
foreach my $script (sort {$data{$b}{rating}<=>$data{$a}{rating}} keys(%data)) {
my @line;
if (get_names($script)->{stash}) {
if (get_local_version($script)) {
push @line, "%go%n";
} else {
push @line, "%yo%n";
@ -748,13 +660,13 @@ sub print_new {
my @table;
foreach (sort {$list->{$b}{modified} cmp $list->{$a}{modified}} keys %$list) {
my @line;
my $n = get_names($_);
if ($n->{stash}) {
my ($name) = get_names($_);
if (get_local_version($name)) {
push @line, "%go%n";
} else {
push @line, "%yo%n";
}
push @line, "%9".$n->{sname}."%9";
push @line, "%9".$name."%9";
push @line, $list->{$_}{modified};
push @table, \@line;
}
@ -766,23 +678,14 @@ sub print_debug {
my $line;
foreach my $script (sort keys %data) {
$line .= "%ro%n %9".$script."%9 failed to load\n";
my $py = $data{$script}{'irssi-python module'};
if ($py) { # py
$line .= " You are attempting to load a Python script!\n";
} else {
$line .= " Make sure you have the following perl modules installed:\n";
}
$line .= " Make sure you have the following perl modules installed:\n";
foreach (sort keys %{$data{$script}}) {
if ( $data{$script}{$_}{installed} == 1 ) {
$line .= " %g->%n ".$_." (found)";
} else {
$line .= " %r->%n ".$_." (not found)\n";
$line .= " [This module is optional]\n" if $data{$script}{$_}{optional};
if ($py) { # py
$line .= " [If you have it installed, try: /load python]";
} else {
$line .= " [Try /scriptassist cpan ".$_."]";
}
$line .= " [Try /scriptassist cpan ".$_."]";
}
$line .= "\n";
}
@ -792,13 +695,7 @@ sub print_debug {
sub load_script {
my ($script) = @_;
if ($script =~ s/\.py$//i) { # py
if (is_python_loaded()) {
Irssi::command('py load '.$script);
}
} else {
Irssi::command('script load '.$script); # pl
}
Irssi::command('script load '.$script);
}
sub print_install {
@ -818,7 +715,7 @@ sub print_install {
} else {
load_script($script) unless (lc($script) eq lc($IRSSI{name}));
}
if (get_names($script)->{stash} && not lc($script) eq lc($IRSSI{name})) {
if (get_local_version($script) && not lc($script) eq lc($IRSSI{name})) {
$line .= "%go%n %9".$script."%9 installed\n";
push @installed, $script;
} elsif (lc($script) eq lc($IRSSI{name})) {
@ -854,14 +751,16 @@ sub list_sbitems {
my ($scripts) = @_;
my $text;
foreach (@$scripts) {
my $n = get_names($_);
next unless $n->{irssi}{sbitems};
next unless exists $Irssi::Script::{"${_}::"};
next unless exists $Irssi::Script::{"${_}::"}{IRSSI};
my $header = $Irssi::Script::{"${_}::"}{IRSSI};
next unless $header->{sbitems};
$text .= '%9"'.$_.'"%9 provides the following statusbar item(s):'."\n";
$text .= ' ->'.$_."\n" foreach (split / /, $n->{irssi}{sbitems});
$text .= ' ->'.$_."\n" foreach (split / /, $header->{sbitems});
}
return unless $text;
$text .= "\n";
$text .= "Enter '/statusbar additem <item> window' to add an item.";
$text .= "Enter '/statusbar window add <item>' to add an item.";
print CLIENTCRAP draw_box('ScriptAssist', $text, 'sbitems', 1);
}
@ -939,12 +838,14 @@ sub print_update {
sub contact_author {
my ($script) = @_;
my $n = get_names($script);
if ($n->{irssi} && defined $n->{irssi}{contact}) {
my @ads = split(/ |,/, $n->{irssi}{contact});
my ($sname, $plname, $pname) = get_names($script);
return unless exists $Irssi::Script::{$pname};
my $header = $Irssi::Script::{$pname}{IRSSI};
if ($header && defined $header->{contact}) {
my @ads = split(/ |,/, $header->{contact});
my $address = $ads[0];
$address .= '?subject='.$script;
$address .= '_'.$n->{local_version} if $n->{local_version};
$address .= '_'.get_local_version($script) if defined get_local_version($script);
call_openurl($address) if $address =~ /[\@:]/;
}
}
@ -973,10 +874,6 @@ sub get_scripts {
$error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
next;
}
if (my $died = $response->header('X-Died')) {
$error = $died;
next;
}
$fetched = 1;
my $data = $response->content();
my $src = $site;
@ -1032,6 +929,20 @@ sub get_scripts {
return $remote_db{db};
}
sub get_remote_version {
my ($script, $database) = @_;
my $plname = (get_names($script, $database))[1];
return $database->{$plname}{version};
}
sub get_local_version {
my ($script) = @_;
my $pname = (get_names($script))[2];
return unless exists $Irssi::Script::{$pname};
my $vref = $Irssi::Script::{$pname}{VERSION};
return $vref ? $$vref : undef;
}
sub compare_versions {
my ($ver1, $ver2) = @_;
for ($ver1, $ver2) {
@ -1048,42 +959,11 @@ sub compare_versions {
return 'equal';
}
sub is_python_loaded {
!! grep { $_->{cmd} eq 'py' } Irssi::commands
}
my @print_text_capture;
sub capture_print_text {
my ($dest, $text, $plain) = @_;
push @print_text_capture, $plain;
Irssi::signal_stop;
}
sub capture_print_text_command {
my ($command, $sub) = @_;
Irssi::signal_add_first('print text', 'capture_print_text');
@print_text_capture = ();
Irssi::command($command);
my @capture = @print_text_capture;
Irssi::signal_remove('print text', 'capture_print_text');
@print_text_capture = ();
$sub->(@capture);
}
sub loaded_scripts {
my @modules;
foreach (sort grep(s/::$//, keys %Irssi::Script::)) { # pl
foreach (sort grep(s/::$//, keys %Irssi::Script::)) {
push @modules, $_;
}
if (is_python_loaded()) {
capture_print_text_command(
'py list', sub {
for my $line (@_[ 1 .. $#_ ]) {
my ($script, $file) = split ' ', $line, 2;
push @modules, "$script.py";
}
});
}
return \@modules;
}
@ -1091,9 +971,9 @@ sub check_scripts {
my ($data) = @_;
my %versions;
foreach (@{loaded_scripts()}) {
my $n = get_names($_, $data);
my $remote = $n->{db_version};
my $local = $n->{local_version};
my ($sname) = get_names($_, $data);
my $remote = get_remote_version($sname, $data);
my $local = get_local_version($sname);
my $state;
if ($local && $remote) {
$state = compare_versions($local, $remote);
@ -1106,9 +986,9 @@ sub check_scripts {
$remote = '/';
}
if ($state) {
$versions{$n->{sname}}{state} = $state;
$versions{$n->{sname}}{remote} = $remote;
$versions{$n->{sname}}{local} = $local;
$versions{$sname}{state} = $state;
$versions{$sname}{remote} = $remote;
$versions{$sname}{local} = $local;
}
}
return \%versions;
@ -1116,40 +996,40 @@ sub check_scripts {
sub download_script {
my ($script, $xml) = @_;
my $n = get_names($script, $xml);
my $site = $n->{db}{source};
my ($sname, $plname) = get_names($script, $xml);
my %result;
my $site = $xml->{$plname}{source};
$result{installed} = 0;
$result{signed} = 0;
my $dir = Irssi::get_irssi_dir();
my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout => 30);
my $ua = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1,timeout => 30);
$ua->agent('ScriptAssist/'.2003020803);
my $request = HTTP::Request->new('GET', $site.'/scripts/'.$n->{plname});
my $request = HTTP::Request->new('GET', $site.'/scripts/'.$script.'.pl');
my $response = $ua->request($request);
if ($response->is_success() && !$response->header('X-Died')) {
if ($response->is_success()) {
my $file = $response->content();
mkdir $dir.'/scripts/' unless (-e $dir.'/scripts/');
open(my $f, '>', $dir.'/scripts/'.$n->{plname}.'.new');
print $f $file;
close($f);
open(my $F, '>', $dir.'/scripts/'.$plname.'.new');
print $F $file;
close($F);
if ($have_gpg && Irssi::settings_get_bool('scriptassist_use_gpg')) {
my $ua2 = LWP::UserAgent->new(env_proxy => 1,keep_alive => 1,timeout => 30);
$ua->agent('ScriptAssist/'.2003020803);
my $request2 = HTTP::Request->new('GET', $site.'/signatures/'.$n->{plname}.'.asc');
my $request2 = HTTP::Request->new('GET', $site.'/signatures/'.$plname.'.asc');
my $response2 = $ua->request($request2);
if ($response2->is_success() && !$response->header('X-Died')) {
if ($response2->is_success()) {
my $sig_dir = $dir.'/scripts/signatures/';
mkdir $sig_dir unless (-e $sig_dir);
open(my $s, '>', $sig_dir.$n->{plname}.'.asc');
open(my $S, '>', $sig_dir.$plname.'.asc');
my $file2 = $response2->content();
print $s $file2;
close($s);
print $S $file2;
close($S);
my $sig;
foreach (1..2) {
# FIXME gpg needs two rounds to load the key
my $gpg = new GnuPG();
eval {
$sig = $gpg->verify( file => $dir.'/scripts/'.$n->{plname}.'.new', signature => $sig_dir.$n->{plname}.'.asc' );
$sig = $gpg->verify( file => $dir.'/scripts/'.$plname.'.new', signature => $sig_dir.$plname.'.asc' );
};
}
if (defined $sig->{user}) {
@ -1175,8 +1055,8 @@ sub download_script {
if ($result{installed}) {
my $old_dir = "$dir/scripts/old/";
mkdir $old_dir unless (-e $old_dir);
rename "$dir/scripts/".$n->{plname}, "$old_dir/".$n->{plname}.".old" if -e "$dir/scripts/".$n->{plname};
rename "$dir/scripts/".$n->{plname}.".new", "$dir/scripts/".$n->{plname};
rename "$dir/scripts/$plname", "$old_dir/$plname.old" if -e "$dir/scripts/$plname";
rename "$dir/scripts/$plname.new", "$dir/scripts/$plname";
}
return \%result;
}
@ -1203,23 +1083,23 @@ sub print_check {
sub toggle_autorun {
my ($script) = @_;
my $n = get_names($script);
my ($sname, $plname) = get_names($script);
my $dir = Irssi::get_irssi_dir()."/scripts/";
mkdir $dir."autorun/" unless (-e $dir."autorun/");
return unless (-e $dir.$n->{plname});
if (-e $dir."/autorun/".$n->{plname}) {
if (readlink($dir."/autorun/".$n->{plname}) eq "../".$n->{plname}) {
if (unlink($dir."/autorun/".$n->{plname})) {
print CLIENTCRAP "%R>>%n Autorun of ".$n->{sname}." disabled";
return unless (-e $dir.$plname);
if (-e $dir."/autorun/".$plname) {
if (readlink($dir."/autorun/".$plname) eq "../".$plname) {
if (unlink($dir."/autorun/".$plname)) {
print CLIENTCRAP "%R>>%n Autorun of ".$sname." disabled";
} else {
print CLIENTCRAP "%R>>%n Unable to delete link";
}
} else {
print CLIENTCRAP "%R>>%n ".$dir."/autorun/".$n->{plname}." is not a correct link";
print CLIENTCRAP "%R>>%n ".$dir."/autorun/".$plname." is not a correct link";
}
} else {
if (symlink("../".$n->{plname}, $dir."/autorun/".$n->{plname})) {
print CLIENTCRAP "%R>>%n Autorun of ".$n->{sname}." enabled";
if (symlink("../".$plname, $dir."/autorun/".$plname)) {
print CLIENTCRAP "%R>>%n Autorun of ".$sname." enabled";
} else {
print CLIENTCRAP "%R>>%n Unable to create autorun link";
}
@ -1298,9 +1178,9 @@ sub cmd_help {
sub sig_command_script_load {
my ($script, $server, $witem) = @_;
my $n = get_names($script);
if ( $n->{stash} ) {
if (my $code = ("Irssi::Script::".$n->{pname})->can('pre_unload')) {
my ($sname, $plname, $pname, $xname) = get_names($script);
if ( exists $Irssi::Script::{$pname} ) {
if (my $code = "Irssi::Script::${pname}"->can('pre_unload')) {
print CLIENTCRAP "%R>>%n Triggering pre_unload function of $script...";
$code->();
}

View file

@ -6,7 +6,7 @@
#define IRSSI_GLOBAL_CONFIG "irssi.conf" /* config file name in /etc/ */
#define IRSSI_HOME_CONFIG "config" /* config file name in ~/.irssi/ */
#define IRSSI_ABI_VERSION 58
#define IRSSI_ABI_VERSION 51
#define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
@ -38,7 +38,6 @@
#include <glib.h>
#include <gmodule.h>
#include <gio/gio.h>
typedef guint64 uoff_t;
#define PRIuUOFF_T G_GUINT64_FORMAT

View file

@ -30,7 +30,6 @@
#include <irssi/src/core/servers-setup.h>
#include <irssi/src/core/servers-reconnect.h>
#include <irssi/src/core/channels.h>
#include <irssi/src/core/chatnets.h>
#include <irssi/src/core/queries.h>
#include <irssi/src/core/window-item-def.h>
#include <irssi/src/core/rawlog.h>
@ -92,7 +91,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
return NULL;
}
if (strchr(addr, '/') != NULL && chatnet_find(addr) == NULL)
if (strchr(addr, '/') != NULL)
conn->unix_socket = TRUE;
/* TLS options are handled in server_create_conn_opt ... -> server_setup_fill_optlist */
@ -101,11 +100,10 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
host = g_hash_table_lookup(optlist, "host");
if (host != NULL && *host != '\0') {
IPADDR ip4 = { 0 };
IPADDR ip6 = { 0 };
if (net_gethostbyname_first_ips(host, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT, &ip4,
&ip6) == 0)
server_connect_own_ip_save(conn, &ip4, &ip6);
IPADDR ip4, ip6;
if (net_gethostbyname(host, &ip4, &ip6) == 0)
server_connect_own_ip_save(conn, &ip4, &ip6);
}
cmd_params_free(free_arg);
@ -213,8 +211,8 @@ static void cmd_server(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
command_runsub("server", data, server, item);
}
/* SYNTAX: SERVER CONNECT [-4 | -6] [-tls | -notls] [-tls_cert <cert>] [-tls_pkey <pkey>]
[-tls_pass <password>] [-tls_verify | -notls_verify] [-tls_cafile <cafile>]
/* SYNTAX: SERVER CONNECT [-4 | -6] [-tls] [-tls_cert <cert>] [-tls_pkey <pkey>]
[-tls_pass <password>] [-tls_verify] [-tls_cafile <cafile>]
[-tls_capath <capath>] [-tls_ciphers <list>]
[-tls_pinned_cert <fingerprint>] [-tls_pinned_pubkey <fingerprint>]
[-!] [-noautosendcmd] [-nocap]

View file

@ -19,7 +19,6 @@
*/
#include "module.h"
#include <irssi/src/core/misc.h>
#include <irssi/src/core/levels.h>
/* the order of these levels must match the bits in levels.h */
@ -170,7 +169,8 @@ char *bits2level(int bits)
if (str->len > 0)
g_string_truncate(str, str->len-1);
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}

View file

@ -3,11 +3,10 @@
if have_capsicum
core_capsicum_source = files('capsicum.c')
else
core_capsicum_source = [ ]
core_capsicum_source = []
endif
libcore_a = static_library(
'core',
libcore_a = static_library('core',
files(
'args.c',
'channels-setup.c',
@ -64,8 +63,7 @@ libcore_a = static_library(
def_moduledir,
def_sysconfdir,
],
dependencies : dep,
)
dependencies : dep)
install_headers(
files(
@ -124,5 +122,4 @@ install_headers(
'window-item-def.h',
'write-buffer.h',
),
subdir : incdir / 'src' / 'core',
)
subdir : incdir / 'src' / 'core')

View file

@ -135,15 +135,6 @@ GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *defaul
}
#endif
#if GLIB_CHECK_VERSION(2, 76, 0)
/* nothing */
#else
gchar *g_string_free_and_steal(GString *string)
{
return g_string_free(string, FALSE);
}
#endif
int find_substr(const char *list, const char *item)
{
const char *ptr;
@ -270,7 +261,8 @@ char *gslistptr_to_string(GSList *list, int offset, const char *delimiter)
list = list->next;
}
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
@ -288,7 +280,8 @@ char *i_slist_to_string(GSList *list, const char *delimiter)
list = list->next;
}
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}

View file

@ -26,12 +26,6 @@ long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATE
GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz);
#endif
#if GLIB_CHECK_VERSION(2, 76, 0)
/* nothing */
#else
gchar *g_string_free_and_steal(GString *string);
#endif
GSList *i_slist_find_string(GSList *list, const char *key);
GSList *i_slist_find_icase_string(GSList *list, const char *key);
GList *i_list_find_string(GList *list, const char *key);

View file

@ -42,7 +42,7 @@ static char *module_get_name(const char *path, int *start, int *end)
if (name == NULL)
name = path;
if (strncmp(name, "lib", 3) == 0 || strncmp(name, "cyg", 3) == 0)
if (strncmp(name, "lib", 3) == 0)
name += 3;
module_name = g_strdup(name);
@ -102,41 +102,10 @@ static char *module_get_sub(const char *name, const char *root)
return g_strdup(name);
}
static GModule *module_open(const char *name)
static GModule *module_open(const char *name, int *found)
{
GModule *module;
#if GLIB_CHECK_VERSION(2, 75, 0)
/* in this version of glib, g_module_open knows how to construct system-dependent module
file names, and g_module_build_path is deprecated. */
char *path;
if (g_path_is_absolute(name) || *name == '~' ||
(*name == '.' && name[1] == G_DIR_SEPARATOR))
path = g_strdup(name);
else {
/* first try from home dir */
path = g_strdup_printf("%s/modules/%s", get_irssi_dir(), name);
module = g_module_open(path, (GModuleFlags) 0);
g_free(path);
if (module != NULL) {
return module;
}
/* module not found from home dir, try global module dir */
path = g_strdup_printf("%s/%s", MODULEDIR, name);
}
module = g_module_open(path, (GModuleFlags) 0);
g_free(path);
return module;
#else /* GLib < 2.75.0 */
/* in this version of glib, we build the module path with g_module_build_path.
unfortunately, this is broken on Darwin when compiled with meson. */
struct stat statbuf;
GModule *module;
char *path, *str;
if (g_path_is_absolute(name) || *name == '~' ||
@ -151,6 +120,7 @@ static GModule *module_open(const char *name)
if (stat(path, &statbuf) == 0) {
module = g_module_open(path, (GModuleFlags) 0);
g_free(path);
*found = TRUE;
return module;
}
@ -159,11 +129,10 @@ static GModule *module_open(const char *name)
path = g_module_build_path(MODULEDIR, name);
}
*found = stat(path, &statbuf) == 0;
module = g_module_open(path, (GModuleFlags) 0);
g_free(path);
return module;
#endif
}
static char *module_get_func(const char *rootmodule, const char *submodule,
@ -182,7 +151,8 @@ static char *module_get_func(const char *rootmodule, const char *submodule,
signal_emit("module error", 4, GINT_TO_POINTER(error), text, \
rootmodule, submodule)
/* Returns 1 if ok, 0 if not */
/* Returns 1 if ok, 0 if error in module and
-1 if module wasn't found */
static int module_load_name(const char *path, const char *rootmodule,
const char *submodule, int silent)
{
@ -196,15 +166,15 @@ static int module_load_name(const char *path, const char *rootmodule,
gpointer value1, value2 = NULL;
char *versionfunc, *initfunc, *deinitfunc;
int module_abi_version = 0;
int valid;
int found;
gmodule = module_open(path);
gmodule = module_open(path, &found);
if (gmodule == NULL) {
if (!silent) {
if (!silent || found) {
module_error(MODULE_ERROR_LOAD, g_module_error(),
rootmodule, submodule);
}
return 0;
return found ? 0 : -1;
}
/* get the module's irssi abi version and bail out on mismatch */
@ -231,12 +201,12 @@ static int module_load_name(const char *path, const char *rootmodule,
/* get the module's init() and deinit() functions */
initfunc = module_get_func(rootmodule, submodule, "init");
deinitfunc = module_get_func(rootmodule, submodule, "deinit");
valid = g_module_symbol(gmodule, initfunc, &value1) &&
g_module_symbol(gmodule, deinitfunc, &value2);
found = g_module_symbol(gmodule, initfunc, &value1) &&
g_module_symbol(gmodule, deinitfunc, &value2);
g_free(initfunc);
g_free(deinitfunc);
if (!valid) {
if (!found) {
module_error(MODULE_ERROR_INVALID, NULL,
rootmodule, submodule);
g_module_close(gmodule);
@ -340,7 +310,7 @@ static int module_load_full(const char *path, const char *rootmodule,
/* check if the given module exists.. */
try_prefixes = g_strcmp0(rootmodule, submodule) == 0;
status = module_load_name(path, rootmodule, submodule, try_prefixes);
if (status <= 0 && try_prefixes) {
if (status == -1 && try_prefixes) {
/* nope, try loading the module_core,
fe_module, etc. */
status = module_load_prefixes(path, rootmodule,

View file

@ -21,8 +21,6 @@
#include "module.h"
#include <irssi/src/core/network.h>
#include <sys/select.h>
/* when quitting, wait for max. 5 seconds before forcing to close the socket */
#define MAX_QUIT_CLOSE_WAIT 5

View file

@ -22,94 +22,86 @@
#include <signal.h>
#include <irssi/src/core/network.h>
#include <irssi/src/core/pidwait.h>
#include <irssi/src/core/net-nonblock.h>
typedef struct {
GResolverNameLookupFlags flags;
NetGethostbynameContinuationFunc cont;
void *cont_data;
} NET_GETHOSTBYNAME_CALLBACK_DATA;
static void net_gethostbyname_callback(GResolver *resolver, GAsyncResult *result,
NET_GETHOSTBYNAME_CALLBACK_DATA *data)
/* nonblocking gethostbyname(), ip (IPADDR) + error (int, 0 = not error) is
written to pipe when found PID of the resolver child is returned */
int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_lookup)
{
/* GList<GInetAddress> */
GList *ailist;
GError *error;
RESOLVED_IP_REC *iprec;
RESOLVED_IP_REC rec;
const char *errorstr;
int pid;
error = NULL;
#if GLIB_CHECK_VERSION(2, 59, 0)
ailist = g_resolver_lookup_by_name_with_flags_finish(resolver, result, &error);
#else
/* compatibility code for old GLib */
ailist = g_resolver_lookup_by_name_finish(resolver, result, &error);
if (error == NULL && data->flags) {
GList *ll, *lll;
for (ll = ailist; ll != NULL; ll = lll) {
GInetAddress *address;
GSocketFamily family;
address = G_INET_ADDRESS(ll->data);
family = g_inet_address_get_family(address);
lll = ll->next;
if ((data->flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY &&
family == G_SOCKET_FAMILY_IPV6) ||
(data->flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY &&
family == G_SOCKET_FAMILY_IPV4)) {
g_object_unref(address);
ailist = g_list_delete_link(ailist, ll);
}
}
if (ailist == NULL) {
g_set_error(&error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
data->flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY ?
"IPv4 address not found for host" :
"IPv6 address not found for host");
}
}
#endif
iprec = g_new0(RESOLVED_IP_REC, 1);
if (error != NULL) {
iprec->error = error;
} else {
iprec->ailist = ailist;
}
g_object_unref(resolver);
resolved_ip_ref(iprec);
data->cont(iprec, data->cont_data);
g_free(data);
}
/* nonblocking gethostbyname() */
GCancellable *net_gethostbyname_nonblock(const char *addr, GResolverNameLookupFlags flags,
NetGethostbynameContinuationFunc cont, void *cont_data)
{
GResolver *resolver;
GCancellable *cancellable;
NET_GETHOSTBYNAME_CALLBACK_DATA *data;
(void) reverse_lookup; /* Kept for API backward compatibility */
g_return_val_if_fail(addr != NULL, FALSE);
resolver = g_resolver_get_default();
cancellable = g_cancellable_new();
data = g_new0(NET_GETHOSTBYNAME_CALLBACK_DATA, 1);
data->flags = flags;
data->cont = cont;
data->cont_data = cont_data;
#if GLIB_CHECK_VERSION(2, 59, 0)
g_resolver_lookup_by_name_with_flags_async(resolver, addr, flags, cancellable,
(GAsyncReadyCallback) net_gethostbyname_callback,
data);
#else
/* compatibility code for old GLib */
g_resolver_lookup_by_name_async(resolver, addr, cancellable,
(GAsyncReadyCallback) net_gethostbyname_callback, data);
#endif
return cancellable;
pid = fork();
if (pid > 0) {
/* parent */
pidwait_add(pid);
return pid;
}
if (pid != 0) {
/* failed! */
g_warning("net_connect_thread(): fork() failed! "
"Using blocking resolving");
}
/* child */
srand(time(NULL));
memset(&rec, 0, sizeof(rec));
rec.error = net_gethostbyname(addr, &rec.ip4, &rec.ip6);
if (rec.error == 0) {
errorstr = NULL;
} else {
errorstr = net_gethosterror(rec.error);
rec.errlen = errorstr == NULL ? 0 : strlen(errorstr)+1;
}
i_io_channel_write_block(pipe, &rec, sizeof(rec));
if (rec.errlen != 0)
i_io_channel_write_block(pipe, (void *) errorstr, rec.errlen);
if (pid == 0)
_exit(99);
/* we used blocking lookup */
return 0;
}
/* get the resolved IP address */
int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec)
{
rec->error = -1;
rec->errorstr = NULL;
fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK);
/* get ip+error */
if (i_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1) {
rec->errorstr = g_strdup_printf("Host name lookup: %s",
g_strerror(errno));
return -1;
}
if (rec->error) {
/* read error string, if we can't read everything for some
reason, just ignore it. */
rec->errorstr = g_malloc0(rec->errlen+1);
i_io_channel_read_block(pipe, rec->errorstr, rec->errlen);
}
return 0;
}
/* Kill the resolver child */
void net_disconnect_nonblock(int pid)
{
g_return_if_fail(pid > 0);
kill(pid, SIGKILL);
}

View file

@ -3,10 +3,20 @@
#include <irssi/src/core/network.h>
typedef void (*NetGethostbynameContinuationFunc)(RESOLVED_IP_REC *, void *);
typedef struct {
IPADDR ip4, ip6; /* resolved ip addresses */
int error; /* error, 0 = no error, -1 = error: */
int errlen; /* error text length */
char *errorstr; /* error string - dynamically allocated, you'll
need to free() it yourself unless it's NULL */
} RESOLVED_IP_REC;
/* nonblocking gethostbyname(), Cancellable of the resolver child is returned. */
GCancellable *net_gethostbyname_nonblock(const char *addr, GResolverNameLookupFlags flags,
NetGethostbynameContinuationFunc cont, void *cont_data);
/* nonblocking gethostbyname(), PID of the resolver child is returned. */
int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_lookup);
/* get the resolved IP address. returns -1 if some error occurred with read() */
int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec);
/* Kill the resolver child */
void net_disconnect_nonblock(int pid);
#endif

View file

@ -28,7 +28,6 @@
#include <irssi/src/core/tls.h>
#include <openssl/crypto.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/pem.h>
@ -752,49 +751,44 @@ static void set_server_temporary_key_info(TLS_REC *tls, SSL *ssl)
#ifdef SSL_get_server_tmp_key
/* Show ephemeral key information. */
EVP_PKEY *ephemeral_key = NULL;
/* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */
#ifndef OPENSSL_NO_EC
EC_KEY *ec_key = NULL;
#endif
char *ephemeral_key_algorithm = NULL;
char *cname = NULL;
int nid;
g_return_if_fail(tls != NULL);
g_return_if_fail(ssl != NULL);
if (SSL_get_server_tmp_key(ssl, &ephemeral_key)) {
int keytype = EVP_PKEY_id(ephemeral_key);
switch (keytype) {
case EVP_PKEY_DH:
tls_rec_set_ephemeral_key_algorithm(tls, "DH");
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
break;
switch (EVP_PKEY_id(ephemeral_key)) {
case EVP_PKEY_DH:
tls_rec_set_ephemeral_key_algorithm(tls, "DH");
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
break;
/* OPENSSL_NO_EC is for solaris 11.3 (2016), github ticket #598 */
#ifndef OPENSSL_NO_EC
case EVP_PKEY_EC: {
#if (OPENSSL_VERSION_NUMBER >= 0x30000000L)
char cname[50];
EVP_PKEY_get_group_name(ephemeral_key, cname, sizeof(cname), NULL);
#else
EC_KEY *ec_key = NULL;
char *cname = NULL;
int nid;
case EVP_PKEY_EC:
ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key);
nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key));
EC_KEY_free(ec_key);
cname = (char *)OBJ_nid2sn(nid);
ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname);
ec_key = EVP_PKEY_get1_EC_KEY(ephemeral_key);
nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec_key));
EC_KEY_free(ec_key);
cname = (char *) OBJ_nid2sn(nid);
#endif
ephemeral_key_algorithm = g_strdup_printf("ECDH: %s", cname);
tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm);
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
tls_rec_set_ephemeral_key_algorithm(tls, ephemeral_key_algorithm);
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
g_free_and_null(ephemeral_key_algorithm);
break;
}
g_free_and_null(ephemeral_key_algorithm);
break;
#endif
default:
tls_rec_set_ephemeral_key_algorithm(tls, OBJ_nid2ln(keytype));
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
break;
default:
tls_rec_set_ephemeral_key_algorithm(tls, "Unknown");
tls_rec_set_ephemeral_key_size(tls, EVP_PKEY_bits(ephemeral_key));
break;
}
EVP_PKEY_free(ephemeral_key);

View file

@ -81,14 +81,27 @@ int i_io_channel_read_block(GIOChannel *channel, void *data, int len)
return received < len ? -1 : 0;
}
IPADDR ip4_any = { AF_INET,
IPADDR ip4_any = {
AF_INET,
#if defined(IN6ADDR_ANY_INIT)
IN6ADDR_ANY_INIT
IN6ADDR_ANY_INIT
#else
{ INADDR_ANY }
{ INADDR_ANY }
#endif
};
int net_ip_compare(IPADDR *ip1, IPADDR *ip2)
{
if (ip1->family != ip2->family)
return 0;
if (ip1->family == AF_INET6)
return memcmp(&ip1->ip, &ip2->ip, sizeof(ip1->ip)) == 0;
return memcmp(&ip1->ip, &ip2->ip, 4) == 0;
}
static void sin_set_ip(union sockaddr_union *so, const IPADDR *ip)
{
if (ip == NULL) {
@ -379,119 +392,95 @@ int net_getsockname(GIOChannel *handle, IPADDR *addr, int *port)
return 0;
}
void resolved_ip_ref(RESOLVED_IP_REC *iprec)
/* Get IP addresses for host, both IPv4 and IPv6 if possible.
If ip->family is 0, the address wasn't found.
Returns 0 = ok, others = error code for net_gethosterror() */
int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6)
{
iprec->refcount++;
}
int resolved_ip_unref(RESOLVED_IP_REC *iprec)
{
if (--iprec->refcount > 0) {
return TRUE;
}
g_resolver_free_addresses(iprec->ailist);
if (iprec->error != NULL) {
g_error_free(iprec->error);
}
g_free(iprec);
return FALSE;
}
/* Get IP addresses for host, both IPv4 and IPv6 if possible. */
static RESOLVED_IP_REC *net_gethostbyname(const char *addr, GResolverNameLookupFlags flags)
{
/* GList<GInetAddress> */
GList *ailist;
GError *error;
GResolver *resolver;
RESOLVED_IP_REC *iprec;
g_return_val_if_fail(addr != NULL, NULL);
error = NULL;
resolver = g_resolver_get_default();
#if GLIB_CHECK_VERSION(2, 59, 0)
ailist = g_resolver_lookup_by_name_with_flags(resolver, addr, flags, NULL, &error);
#else
/* compatibility code for old GLib */
ailist = g_resolver_lookup_by_name(resolver, addr, NULL, &error);
if (error == NULL && flags) {
GList *ll, *lll;
for (ll = ailist; ll != NULL; ll = lll) {
GInetAddress *address;
GSocketFamily family;
address = G_INET_ADDRESS(ll->data);
family = g_inet_address_get_family(address);
lll = ll->next;
if ((flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY &&
family == G_SOCKET_FAMILY_IPV6) ||
(flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY &&
family == G_SOCKET_FAMILY_IPV4)) {
g_object_unref(address);
ailist = g_list_delete_link(ailist, ll);
}
}
if (ailist == NULL) {
g_set_error(&error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
flags == G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY ?
"IPv4 address not found for host" :
"IPv6 address not found for host");
}
}
#endif
iprec = g_new0(RESOLVED_IP_REC, 1);
if (error != NULL) {
iprec->error = error;
} else {
iprec->ailist = ailist;
}
g_object_unref(resolver);
resolved_ip_ref(iprec);
return iprec;
}
int net_gethostbyname_first_ips(const char *addr, GResolverNameLookupFlags flags, IPADDR *ip4,
IPADDR *ip6)
{
RESOLVED_IP_REC *iprec;
union sockaddr_union *so;
struct addrinfo hints, *ai, *ailist;
int ret, count_v4, count_v6, use_v4, use_v6;
#ifdef HAVE_CAPSICUM
if (capsicum_enabled())
return (capsicum_net_gethostbyname(addr, ip4, ip6));
#endif
iprec = net_gethostbyname(addr, flags);
if (iprec->error == NULL) {
GList *curr;
g_return_val_if_fail(addr != NULL, -1);
for (curr = iprec->ailist; curr; curr = curr->next) {
unsigned short family;
GInetAddress *addr;
memset(ip4, 0, sizeof(IPADDR));
memset(ip6, 0, sizeof(IPADDR));
addr = curr->data;
family = g_inet_address_get_family(addr);
if (ip4->family == 0 && family == AF_INET) {
ip4->family = AF_INET;
memcpy(&ip4->ip, g_inet_address_to_bytes(addr), sizeof(ip4->ip));
} else if (ip6->family == 0 && family == AF_INET6) {
ip6->family = AF_INET6;
memcpy(&ip6->ip, g_inet_address_to_bytes(addr), sizeof(ip6->ip));
}
}
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
resolved_ip_unref(iprec);
return 0;
} else {
resolved_ip_unref(iprec);
return -1;
/* save error to host_error for later use */
ret = getaddrinfo(addr, NULL, &hints, &ailist);
if (ret != 0)
return ret;
/* count IPs */
count_v4 = count_v6 = 0;
for (ai = ailist; ai != NULL; ai = ai->ai_next) {
if (ai->ai_family == AF_INET)
count_v4++;
else if (ai->ai_family == AF_INET6)
count_v6++;
}
if (count_v4 == 0 && count_v6 == 0)
return HOST_NOT_FOUND; /* shouldn't happen? */
/* if there are multiple addresses, return random one */
use_v4 = count_v4 <= 1 ? 0 : rand() % count_v4;
use_v6 = count_v6 <= 1 ? 0 : rand() % count_v6;
count_v4 = count_v6 = 0;
for (ai = ailist; ai != NULL; ai = ai->ai_next) {
so = (union sockaddr_union *) ai->ai_addr;
if (ai->ai_family == AF_INET) {
if (use_v4 == count_v4)
sin_get_ip(so, ip4);
count_v4++;
} else if (ai->ai_family == AF_INET6) {
if (use_v6 == count_v6)
sin_get_ip(so, ip6);
count_v6++;
}
}
freeaddrinfo(ailist);
return 0;
}
/* Get name for host, *name should be g_free()'d unless it's NULL.
Return values are the same as with net_gethostbyname() */
int net_gethostbyaddr(IPADDR *ip, char **name)
{
union sockaddr_union so;
int host_error;
char hostname[NI_MAXHOST];
g_return_val_if_fail(ip != NULL, -1);
g_return_val_if_fail(name != NULL, -1);
*name = NULL;
memset(&so, 0, sizeof(so));
sin_set_ip(&so, ip);
/* save error to host_error for later use */
host_error = getnameinfo((struct sockaddr *)&so, sizeof(so),
hostname, sizeof(hostname),
NULL, 0,
NI_NAMEREQD);
if (host_error != 0)
return host_error;
*name = g_strdup(hostname);
return 0;
}
int net_ip2host(IPADDR *ip, char *host)
@ -502,6 +491,8 @@ int net_ip2host(IPADDR *ip, char *host)
int net_host2ip(const char *host, IPADDR *ip)
{
unsigned long addr;
if (strchr(host, ':') != NULL) {
/* IPv6 */
ip->family = AF_INET6;
@ -510,8 +501,16 @@ int net_host2ip(const char *host, IPADDR *ip)
} else {
/* IPv4 */
ip->family = AF_INET;
if (inet_pton(AF_INET, host, &ip->ip) == 0)
#ifdef HAVE_INET_ATON
if (inet_aton(host, &ip->ip.s_addr) == 0)
return -1;
#else
addr = inet_addr(host);
if (addr == INADDR_NONE)
return -1;
memcpy(&ip->ip, &addr, 4);
#endif
}
return 0;
@ -530,6 +529,29 @@ int net_geterror(GIOChannel *handle)
return data;
}
/* get error of net_gethostname() */
const char *net_gethosterror(int error)
{
g_return_val_if_fail(error != 0, NULL);
if (error == EAI_SYSTEM) {
return strerror(errno);
} else {
return gai_strerror(error);
}
}
/* return TRUE if host lookup failed because it didn't exist (ie. not
some error with name server) */
int net_hosterror_notfound(int error)
{
#ifdef EAI_NODATA /* NODATA is deprecated */
return error != 1 && (error == EAI_NONAME || error == EAI_NODATA);
#else
return error != 1 && (error == EAI_NONAME);
#endif
}
/* Get name of TCP service */
char *net_getservbyport(int port)
{

View file

@ -6,7 +6,6 @@
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <irssi/src/common.h>
#ifndef AF_INET6
# ifdef PF_INET6
@ -16,31 +15,11 @@
# endif
#endif
#if GLIB_CHECK_VERSION(2, 59, 0)
/* nothing */
#else
/* compatibility code for old GLib */
typedef enum {
G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT = 0,
G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY = 1 << 0,
G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY = 1 << 1,
} GResolverNameLookupFlags;
#endif
struct _IPADDR {
unsigned short family;
struct in6_addr ip;
};
typedef struct {
int refcount;
/* GList<GInetAddress> */
GList *ailist; /* needs to be freed */
GError *error; /* needs to be freed */
} RESOLVED_IP_REC;
/* maxmimum string length of IP address */
#define MAX_IP_LEN INET6_ADDRSTRLEN
@ -50,7 +29,9 @@ extern IPADDR ip4_any;
GIOChannel *i_io_channel_new(int handle);
/* OTR */
/* Returns 1 if IPADDRs are the same. */
/* Deprecated since it is unused. It will be deleted in a later release. */
int net_ip_compare(IPADDR *ip1, IPADDR *ip2) G_GNUC_DEPRECATED;
int i_io_channel_write_block(GIOChannel *channel, void *data, int len);
int i_io_channel_read_block(GIOChannel *channel, void *data, int len);
@ -79,9 +60,18 @@ int net_receive(GIOChannel *handle, char *buf, int len);
/* Transmit data, return number of bytes sent, -1 = error */
int net_transmit(GIOChannel *handle, const char *data, int len);
/* Get the first IP address for host, both IPv4 and IPv6 if possible. */
int net_gethostbyname_first_ips(const char *addr, GResolverNameLookupFlags flags, IPADDR *ip4,
IPADDR *ip6);
/* Get IP addresses for host, both IPv4 and IPv6 if possible.
If ip->family is 0, the address wasn't found.
Returns 0 = ok, others = error code for net_gethosterror() */
int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6);
/* Get name for host, *name should be g_free()'d unless it's NULL.
Return values are the same as with net_gethostbyname() */
int net_gethostbyaddr(IPADDR *ip, char **name);
/* get error of net_gethostname() */
const char *net_gethosterror(int error);
/* return TRUE if host lookup failed because it didn't exist (ie. not
some error with name server) */
int net_hosterror_notfound(int error);
/* Get socket address/port */
int net_getsockname(GIOChannel *handle, IPADDR *addr, int *port);
@ -100,7 +90,4 @@ char *net_getservbyport(int port);
int is_ipv4_address(const char *host);
int is_ipv6_address(const char *host);
void resolved_ip_ref(RESOLVED_IP_REC *iprec);
int resolved_ip_unref(RESOLVED_IP_REC *iprec);
#endif

View file

@ -12,7 +12,6 @@ char *proxy_string, *proxy_string_after, *proxy_password;
unsigned short family; /* 0 = don't care, AF_INET or AF_INET6 */
unsigned short chosen_family; /* family actually chosen during name resolution */
char *ipaddr;
char *tag; /* try to keep this tag when connected to server */
char *address;
int port;
@ -45,8 +44,6 @@ unsigned int unix_socket:1; /* Connect using named unix socket */
unsigned int use_tls:1; /* this connection uses TLS */
unsigned int tls_verify:1;
unsigned int no_connect:1; /* don't connect() at all, it's done by plugin */
int last_connected;
int last_failed;
RESOLVED_IP_REC *resolved_host;
unsigned short last_failed_family; /* #641: if we failed to connect to ipv6, try ipv4 and vice versa */
char *channels;
char *away_reason;

View file

@ -21,8 +21,10 @@ unsigned int no_reconnect:1; /* Don't reconnect to server */
NET_SENDBUF_REC *handle;
int readtag; /* input tag */
GCancellable *connect_cancellable;
/* for net_gethostbyname_return() */
GIOChannel *connect_pipe[2];
int connect_tag;
int connect_pid;
RAWLOG_REC *rawlog;
GHashTable *module_data;

View file

@ -120,10 +120,6 @@ static int server_reconnect_timeout(void)
if (server->connect_tag != -1) {
g_source_remove(server->connect_tag);
server->connect_tag = -1;
} else if (server->connect_cancellable != NULL) {
g_cancellable_cancel(server->connect_cancellable);
g_object_unref(server->connect_cancellable);
server->connect_cancellable = NULL;
}
server->connection_lost = TRUE;
server_connect_failed(server, "Timeout");
@ -172,8 +168,7 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
server_connect_ref(dest);
dest->type = module_get_uniq_id("SERVER CONNECT", 0);
dest->reconnection = src->reconnection;
dest->last_connected = src->last_connected;
dest->last_failed = src->last_failed;
dest->last_failed_family = src->last_failed_family;
dest->proxy = g_strdup(src->proxy);
dest->proxy_port = src->proxy_port;
dest->proxy_string = g_strdup(src->proxy_string);
@ -212,10 +207,6 @@ server_connect_copy_skeleton(SERVER_CONNECT_REC *src, int connect_info)
dest->own_ip6 = g_new(IPADDR, 1);
memcpy(dest->own_ip6, src->own_ip6, sizeof(IPADDR));
}
dest->resolved_host = src->resolved_host;
if (dest->resolved_host != NULL) {
resolved_ip_ref(dest->resolved_host);
}
dest->channels = g_strdup(src->channels);
dest->away_reason = g_strdup(src->away_reason);

View file

@ -58,8 +58,7 @@ static void save_ips(IPADDR *ip4, IPADDR *ip6,
static void get_source_host_ip(void)
{
const char *hostname;
IPADDR ip4 = { 0 };
IPADDR ip6 = { 0 };
IPADDR ip4, ip6;
if (source_host_ok)
return;
@ -67,28 +66,25 @@ static void get_source_host_ip(void)
/* FIXME: This will block! */
hostname = settings_get_str("hostname");
source_host_ok = *hostname != '\0' &&
net_gethostbyname_first_ips(hostname, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT,
&ip4, &ip6) == 0;
net_gethostbyname(hostname, &ip4, &ip6) == 0;
if (source_host_ok) {
if (source_host_ok)
save_ips(&ip4, &ip6, &source_host_ip4, &source_host_ip6);
} else {
g_free_and_null(source_host_ip4);
g_free_and_null(source_host_ip6);
else {
g_free_and_null(source_host_ip4);
g_free_and_null(source_host_ip6);
}
}
static void conn_set_ip(SERVER_CONNECT_REC *conn, const char *own_host,
IPADDR **own_ip4, IPADDR **own_ip6)
{
IPADDR ip4 = { 0 };
IPADDR ip6 = { 0 };
IPADDR ip4, ip6;
if (*own_ip4 == NULL && *own_ip6 == NULL) {
/* resolve the IP */
if (net_gethostbyname_first_ips(own_host, G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT,
&ip4, &ip6) == 0)
save_ips(&ip4, &ip6, own_ip4, own_ip6);
if (net_gethostbyname(own_host, &ip4, &ip6) == 0)
save_ips(&ip4, &ip6, own_ip4, own_ip6);
}
server_connect_own_ip_save(conn, *own_ip4, *own_ip6);

View file

@ -51,16 +51,20 @@ void server_connect_failed(SERVER_REC *server, const char *msg)
g_source_remove(server->connect_tag);
server->connect_tag = -1;
}
if (server->connect_cancellable != NULL) {
g_cancellable_cancel(server->connect_cancellable);
g_object_unref(server->connect_cancellable);
server->connect_cancellable = NULL;
}
if (server->handle != NULL) {
net_sendbuffer_destroy(server->handle, TRUE);
server->handle = NULL;
}
if (server->connect_pipe[0] != NULL) {
g_io_channel_shutdown(server->connect_pipe[0], TRUE, NULL);
g_io_channel_unref(server->connect_pipe[0]);
g_io_channel_shutdown(server->connect_pipe[1], TRUE, NULL);
g_io_channel_unref(server->connect_pipe[1]);
server->connect_pipe[0] = NULL;
server->connect_pipe[1] = NULL;
}
server_unref(server);
}
@ -130,7 +134,8 @@ static char *server_create_tag(SERVER_CONNECT_REC *conn)
}
g_free(tag);
tag = g_string_free(str, FALSE);
tag = str->str;
g_string_free(str, FALSE);
return tag;
}
@ -152,7 +157,7 @@ static void server_connect_callback_init(SERVER_REC *server, GIOChannel *handle)
error = net_geterror(handle);
if (error != 0) {
server->connection_lost = TRUE;
server->connrec->last_failed = server->connrec->last_connected;
server->connrec->last_failed_family = server->connrec->chosen_family;
server_connect_failed(server, g_strerror(error));
return;
}
@ -173,7 +178,7 @@ static void server_connect_callback_init_ssl(SERVER_REC *server, GIOChannel *han
error = irssi_ssl_handshake(handle);
if (error == -1) {
server->connection_lost = TRUE;
server->connrec->last_failed = server->connrec->last_connected;
server->connrec->last_failed_family = server->connrec->chosen_family;
server_connect_failed(server, NULL);
return;
}
@ -207,18 +212,13 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip,
g_return_if_fail(ip != NULL || unix_socket != NULL);
if (ip != NULL) {
server->connrec->chosen_family = ip->family;
net_ip2host(ip, ipaddr);
server->connrec->ipaddr = g_strdup(ipaddr);
}
signal_emit("server connecting", 2, server, ip);
if (server->connrec->no_connect)
return;
if (ip != NULL) {
server->connrec->chosen_family = ip->family;
own_ip = IPADDR_IS_V6(ip) ? server->connrec->own_ip6 : server->connrec->own_ip4;
port = server->connrec->proxy != NULL ?
server->connrec->proxy_port : server->connrec->port;
@ -255,12 +255,12 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip,
server->connection_lost = TRUE;
if (ip != NULL) {
server->connrec->last_failed = server->connrec->last_connected;
server->connrec->last_failed_family = ip->family;
}
server_connect_failed(server, errmsg2 ? errmsg2 : errmsg);
g_free(errmsg2);
} else {
server->connrec->last_failed = 0;
server->connrec->last_failed_family = 0;
if (!server->connrec->use_tls)
server->handle = net_sendbuffer_create(handle, 0);
if (server->connrec->use_tls)
@ -272,47 +272,48 @@ static void server_real_connect(SERVER_REC *server, IPADDR *ip,
}
}
static int server_start_connect_resolve(SERVER_REC *server);
static void server_connect_use_resolved(SERVER_REC *server)
static void server_connect_callback_readpipe(SERVER_REC *server)
{
IPADDR *ip;
RESOLVED_IP_REC iprec;
IPADDR *ip;
const char *errormsg;
RESOLVED_IP_REC *iprec = server->connrec->resolved_host;
if (iprec->error != NULL) {
/* error */
g_source_remove(server->connect_tag);
server->connect_tag = -1;
net_gethostbyname_return(server->connect_pipe[0], &iprec);
g_io_channel_shutdown(server->connect_pipe[0], TRUE, NULL);
g_io_channel_unref(server->connect_pipe[0]);
g_io_channel_shutdown(server->connect_pipe[1], TRUE, NULL);
g_io_channel_unref(server->connect_pipe[1]);
server->connect_pipe[0] = NULL;
server->connect_pipe[1] = NULL;
/* figure out if we should use IPv4 or v6 address */
if (iprec.error != 0) {
/* error */
ip = NULL;
} else if (server->connrec->family == AF_INET) {
/* force IPv4 connection */
ip = iprec.ip4.family == 0 ? NULL : &iprec.ip4;
} else if (server->connrec->family == AF_INET6) {
/* force IPv6 connection */
ip = iprec.ip6.family == 0 ? NULL : &iprec.ip6;
} else {
GList *curr;
int i;
curr = iprec->ailist;
i = 0;
while (i < server->connrec->last_failed) {
if (curr != NULL) {
curr = curr->next;
i++;
}
/* curr is different now */
if (curr == NULL) {
resolved_ip_unref(server->connrec->resolved_host);
server->connrec->resolved_host = NULL;
server->connrec->last_failed = 0;
/* retry resolve */
server_start_connect_resolve(server);
return;
}
}
if (curr != NULL) {
GInetAddress *addr;
addr = curr->data;
server->connrec->last_connected = i + 1;
ip = g_new0(IPADDR, 1);
ip->family = g_inet_address_get_family(addr);
memcpy(&ip->ip, g_inet_address_to_bytes(addr), sizeof(ip->ip));
/* pick the one that was found. if both were found:
1. disprefer the last one that failed
2. prefer ipv4 over ipv6 unless resolve_prefer_ipv6 is set
*/
if (iprec.ip4.family == 0 ||
(iprec.ip6.family != 0 &&
(server->connrec->last_failed_family == AF_INET ||
(settings_get_bool("resolve_prefer_ipv6") &&
server->connrec->last_failed_family != AF_INET6)))) {
ip = &iprec.ip6;
} else {
ip = NULL;
ip = &iprec.ip4;
}
}
@ -321,69 +322,28 @@ static void server_connect_use_resolved(SERVER_REC *server)
server_real_connect(server, ip, NULL);
errormsg = NULL;
} else {
if (iprec->error->code == G_RESOLVER_ERROR_NOT_FOUND) {
if (iprec.error == 0 || net_hosterror_notfound(iprec.error)) {
/* IP wasn't found for the host, don't try to
reconnect back to this server */
server->dns_error = TRUE;
}
errormsg = iprec->error->message;
if (errormsg == NULL)
errormsg = "Host lookup failed";
if (iprec.error == 0) {
/* forced IPv4 or IPv6 address but it wasn't found */
errormsg = server->connrec->family == AF_INET ?
"IPv4 address not found for host" :
"IPv6 address not found for host";
} else {
/* gethostbyname() failed */
errormsg = iprec.errorstr != NULL ? iprec.errorstr :
"Host lookup failed";
}
server->connection_lost = TRUE;
/* clear the error in resolved_host */
server->connrec->resolved_host = NULL;
server_connect_failed(server, errormsg);
resolved_ip_unref(iprec);
}
g_free(ip);
}
static void server_connect_callback_resolved(RESOLVED_IP_REC *iprec, SERVER_REC *server)
{
if (server->connect_cancellable != NULL) {
g_object_unref(server->connect_cancellable);
server->connect_cancellable = NULL;
}
if (server->connrec->resolved_host != NULL) {
resolved_ip_unref(server->connrec->resolved_host);
}
server->connrec->resolved_host = iprec;
if (iprec->error == NULL && iprec->ailist == NULL) {
server->connection_lost = TRUE;
server->dns_error = TRUE;
server_connect_failed(server, "Host lookup failed");
} else {
server_connect_use_resolved(server);
}
}
static int server_start_connect_resolve(SERVER_REC *server)
{
const char *connect_address;
GResolverNameLookupFlags net_gethostbyname_flags;
connect_address =
server->connrec->proxy != NULL ? server->connrec->proxy : server->connrec->address;
net_gethostbyname_flags = G_RESOLVER_NAME_LOOKUP_FLAGS_DEFAULT;
if (server->connrec->family == AF_INET) {
net_gethostbyname_flags = G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY;
} else if (server->connrec->family == AF_INET6) {
net_gethostbyname_flags = G_RESOLVER_NAME_LOOKUP_FLAGS_IPV6_ONLY;
}
if (server->connrec->resolved_host == NULL) {
server->connect_cancellable = net_gethostbyname_nonblock(
connect_address, net_gethostbyname_flags,
(NetGethostbynameContinuationFunc) server_connect_callback_resolved, server);
return FALSE;
} else {
return TRUE;
}
g_free(iprec.errorstr);
}
SERVER_REC *server_connect(SERVER_CONNECT_REC *conn)
@ -435,6 +395,9 @@ void server_connect_init(SERVER_REC *server)
/* starts connecting to server */
int server_start_connect(SERVER_REC *server)
{
const char *connect_address;
int fd[2];
g_return_val_if_fail(server != NULL, FALSE);
if (!server->connrec->unix_socket && server->connrec->port <= 0)
return FALSE;
@ -452,17 +415,30 @@ int server_start_connect(SERVER_REC *server)
/* connect with unix socket */
server_real_connect(server, NULL, server->connrec->address);
} else {
int already_resolved;
/* resolve host name */
already_resolved = server_start_connect_resolve(server);
if (pipe(fd) != 0) {
g_warning("server_connect(): pipe() failed.");
g_free(server->tag);
g_free(server->nick);
return FALSE;
}
server->connect_pipe[0] = i_io_channel_new(fd[0]);
server->connect_pipe[1] = i_io_channel_new(fd[1]);
connect_address = server->connrec->proxy != NULL ?
server->connrec->proxy : server->connrec->address;
server->connect_pid =
net_gethostbyname_nonblock(connect_address,
server->connect_pipe[1], 0);
server->connect_tag =
i_input_add(server->connect_pipe[0], I_INPUT_READ,
(GInputFunction) server_connect_callback_readpipe, server);
server->connect_time = time(NULL);
lookup_servers = g_slist_append(lookup_servers, server);
signal_emit("server looking", 1, server);
if (already_resolved) {
server_connect_use_resolved(server);
}
}
return TRUE;
}
@ -501,9 +477,8 @@ void server_disconnect(SERVER_REC *server)
if (server->connect_tag != -1) {
/* still connecting to server.. */
server_connect_failed(server, NULL);
return;
} else if (server->connect_cancellable != NULL) {
if (server->connect_pid != -1)
net_disconnect_nonblock(server->connect_pid);
server_connect_failed(server, NULL);
return;
}
@ -662,7 +637,6 @@ void server_connect_unref(SERVER_CONNECT_REC *conn)
g_free_not_null(conn->proxy_string_after);
g_free_not_null(conn->proxy_password);
g_free_not_null(conn->ipaddr);
g_free_not_null(conn->tag);
g_free_not_null(conn->address);
g_free_not_null(conn->chatnet);
@ -670,10 +644,6 @@ void server_connect_unref(SERVER_CONNECT_REC *conn)
g_free_not_null(conn->own_ip4);
g_free_not_null(conn->own_ip6);
if (conn->resolved_host != NULL) {
resolved_ip_unref(conn->resolved_host);
}
g_free_not_null(conn->password);
g_free_not_null(conn->nick);
g_free_not_null(conn->username);
@ -794,6 +764,7 @@ static void sig_chat_protocol_deinit(CHAT_PROTOCOL_REC *proto)
void servers_init(void)
{
settings_add_bool("server", "resolve_prefer_ipv6", TRUE);
lookup_servers = servers = NULL;
signal_add("chat protocol deinit", (SIGNAL_FUNC) sig_chat_protocol_deinit);

View file

@ -2,7 +2,6 @@
#define IRSSI_CORE_SERVERS_H
#include <irssi/src/core/modules.h>
#include <irssi/src/core/network.h>
/* Returns SERVER_REC if it's server, NULL if it isn't. */
#define SERVER(server) \

View file

@ -26,7 +26,6 @@
#include <irssi/src/core/net-sendbuffer.h>
#include <irssi/src/core/pidwait.h>
#include <irssi/src/lib-config/iconfig.h>
#include <irssi/src/core/misc.h>
#include <irssi/src/core/chat-protocols.h>
#include <irssi/src/core/servers.h>
@ -34,6 +33,8 @@
#include <irssi/src/core/channels.h>
#include <irssi/src/core/nicklist.h>
#include <irssi/src/core/misc.h>
static char *session_file;
char *irssi_binary = NULL;
@ -60,19 +61,14 @@ void session_upgrade(void)
static void cmd_upgrade(const char *data)
{
CONFIG_REC *session;
char *session_file, *str, *name;
char *session_file, *str;
char *binary;
if (*data == '\0')
name = irssi_binary;
else
name = convert_home(data);
data = irssi_binary;
binary = g_find_program_in_path(name);
if (name != irssi_binary)
g_free(name);
if (binary == NULL)
data = convert_home(data);
if ((binary = g_find_program_in_path(data)) == NULL)
cmd_return_error(CMDERR_PROGRAM_NOT_FOUND);
/* save the session */

View file

@ -88,7 +88,8 @@ static char *get_argument(char **cmd, char **arglist)
}
if (str->len > 0) g_string_truncate(str, str->len-1);
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
@ -411,7 +412,8 @@ char *get_alignment(const char *text, int align, int flags, char pad)
}
}
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
@ -602,7 +604,8 @@ char *parse_special_string(const char *cmd, SERVER_REC *server, void *item,
}
g_strfreev(arglist);
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}

View file

@ -261,12 +261,7 @@ static const char *command_history_prev_int(WINDOW_REC *window, const char *text
if (*text != '\0' &&
(pos == NULL || g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) != 0)) {
/* save the old entry to history */
if (pos != NULL && settings_get_bool("command_history_editable")) {
history_entry_destroy(pos->data);
pos->data = history_entry_new(history, text);
} else {
command_history_add(history, text);
}
command_history_add(history, text);
}
return history->pos == NULL ? text : ((HISTORY_ENTRY_REC *)history->pos->data)->text;
@ -297,12 +292,7 @@ static const char *command_history_next_int(WINDOW_REC *window, const char *text
if (*text != '\0' &&
(pos == NULL || g_strcmp0(((HISTORY_ENTRY_REC *)pos->data)->text, text) != 0)) {
/* save the old entry to history */
if (pos != NULL && settings_get_bool("command_history_editable")) {
history_entry_destroy(pos->data);
pos->data = history_entry_new(history, text);
} else {
command_history_add(history, text);
}
command_history_add(history, text);
}
return history->pos == NULL ? "" : ((HISTORY_ENTRY_REC *)history->pos->data)->text;
}
@ -477,7 +467,6 @@ void command_history_init(void)
{
settings_add_int("history", "max_command_history", 100);
settings_add_bool("history", "window_history", FALSE);
settings_add_bool("history", "command_history_editable", FALSE);
special_history_func_set(special_history_func);

View file

@ -111,7 +111,8 @@ char *auto_word_complete(const char *line, int *pos)
*pos = startpos+strlen(replace);
g_string_insert(result, startpos, replace);
ret = g_string_free_and_steal(result);
ret = result->str;
g_string_free(result, FALSE);
}
g_free(word);
@ -289,7 +290,8 @@ char *word_complete(WINDOW_REC *window, const char *line, int *pos, int erase, i
g_free_not_null(last_line);
last_line = g_strdup(result->str);
ret = g_string_free_and_steal(result);
ret = result->str;
g_string_free(result, FALSE);
/* free the data */
g_free(data);

View file

@ -166,7 +166,7 @@ void fe_common_core_init(void)
settings_add_bool("lookandfeel", "use_msgs_window", FALSE);
g_get_charset(&str);
settings_add_str("lookandfeel", "term_charset", str);
settings_add_str("lookandfeel", "glib_log_domains", "all -glib-gio:debug");
settings_add_str("lookandfeel", "glib_log_domains", "all");
themes_init();
theme_register(fecommon_core_formats);
@ -258,19 +258,13 @@ void fe_common_core_deinit(void)
g_log_set_default_handler(logger_old, NULL);
}
static gboolean glib_domain_wanted(const char *domain, const char *level)
static gboolean glib_domain_wanted(const char *domain)
{
const char *domains;
char *c, *cur;
int len = 0;
int print_it = 0; /* -1 for exclude, 0 for undecided, 1 for include */
int incl;
char *domainlevel, *alllevel, *starlevel, *domainstar;
domainlevel = g_strdup_printf("%s:%s", domain, level);
alllevel = g_strdup_printf("all:%s", level);
starlevel = g_strdup_printf("*:%s", level);
domainstar = g_strdup_printf("%s:*", domain);
/* Go through each item in glib_log_domains setting to determine whether
* or not we want to print message from this domain */
@ -293,10 +287,8 @@ static gboolean glib_domain_wanted(const char *domain, const char *level)
}
/* If we got a valid item, process it */
if (len > 0 && (!strncasecmp(domain, c, len) || !strncasecmp("all", c, len) ||
!strncmp("*", c, len) || !strncasecmp(domainstar, c, len) ||
!strncasecmp(domainlevel, c, len) ||
!strncasecmp(alllevel, c, len) || !strncasecmp(starlevel, c, len)))
if (len > 0 && (!strncmp(domain, c, len) || !strncasecmp("all", c, len) ||
!strncmp("*", c, len)))
print_it = incl;
/* Go past any spaces towards the next item */
@ -308,11 +300,6 @@ static gboolean glib_domain_wanted(const char *domain, const char *level)
len = 0;
} while (*c != '\0' && print_it != -1);
g_free(domainlevel);
g_free(alllevel);
g_free(starlevel);
g_free(domainstar);
return (print_it == 1);
}
@ -346,7 +333,7 @@ static void i_log_func(const char *log_domain, GLogLevelFlags log_level, const c
domain = (log_domain ? log_domain : "default");
/* Only print the message if we decided to */
if (!glib_domain_wanted(domain, reason))
if (!glib_domain_wanted(domain))
return;
if (windows == NULL)

View file

@ -214,7 +214,8 @@ static char *log_items_get_list(LOG_REC *log)
if(rec->servertag != NULL)
g_string_append_printf(str, " (%s)", rec->servertag);
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}

View file

@ -133,7 +133,8 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text)
}
}
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
@ -729,8 +730,9 @@ static void sig_nicklist_new(CHANNEL_REC *channel, NICK_REC *nick)
n++;
} while (printnick_exists(firstnick, nick, newnick->str));
g_hash_table_insert(printnicks, nick, g_string_free_and_steal(newnick));
g_free(nickhost);
g_hash_table_insert(printnicks, nick, newnick->str);
g_string_free(newnick, FALSE);
g_free(nickhost);
}
static void sig_nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick)

View file

@ -101,14 +101,8 @@ static SERVER_SETUP_REC *create_server_setup(GHashTable *optlist)
}
}
if (rec == NULL) {
/* no protocols loaded, bail out */
signal_emit("chat protocol unknown", 1, "(none)");
return NULL;
}
server = rec->create_server_setup();
server->chat_type = rec->id;
server = rec->create_server_setup();
server->chat_type = rec->id;
server->tls_verify = TRUE;
return server;
}

View file

@ -616,7 +616,8 @@ char *format_string_expand(const char *text, int *flags)
text++;
}
ret = g_string_free_and_steal(out);
ret = out->str;
g_string_free(out, FALSE);
return ret;
}
@ -791,7 +792,8 @@ static char *format_get_text_args(TEXT_DEST_REC *dest,
text++;
}
ret = g_string_free_and_steal(out);
ret = out->str;
g_string_free(out, FALSE);
return ret;
}
@ -886,7 +888,8 @@ char *format_add_linestart(const char *text, const char *linestart)
text++;
}
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
@ -910,7 +913,8 @@ char *format_add_lineend(const char *text, const char *linestart)
}
g_string_append(str, linestart);
ret = g_string_free_and_steal(str);
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
@ -1546,13 +1550,9 @@ void format_send_as_gui_flags(TEXT_DEST_REC *dest, const char *text, SIGNAL_FUNC
break;
case 15:
/* remove all styling */
if (!hide_text_style) {
if (!hide_colors) {
fgcolor = theme->default_color;
bgcolor = -1;
}
flags &= GUI_PRINT_FLAG_INDENT | GUI_PRINT_FLAG_MONOSPACE;
}
fgcolor = theme->default_color;
bgcolor = -1;
flags &= GUI_PRINT_FLAG_INDENT|GUI_PRINT_FLAG_MONOSPACE;
break;
case 17:
if (!hide_text_style)

View file

@ -469,7 +469,8 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text,
}
g_string_append(str, text + pos);
newstr = g_string_free_and_steal(str);
newstr = str->str;
g_string_free(str, FALSE);
format_dest_meta_stash(dest, "hilight-start",
tmp = g_strdup_printf("%d", hilight_start));
@ -625,7 +626,7 @@ static void cmd_hilight_show(void)
}
/* SYNTAX: HILIGHT [-nick | -word | -line] [-mask | -full | -matchcase | -regexp]
[-color <color>] [-actcolor <color>] [-level <level>] [-priority <number>]
[-color <color>] [-actcolor <color>] [-level <level>]
[-network <network>] [-channels <channels>] <text> */
static void cmd_hilight(const char *data)
{

View file

@ -3,7 +3,7 @@
if have_capsicum
fe_common_core_capsicum_source = files('fe-capsicum.c')
else
fe_common_core_capsicum_source = [ ]
fe_common_core_capsicum_source = []
endif
fe_common_core_sources = [
@ -43,11 +43,10 @@ fe_common_core_sources = [
+ [
default_theme_h,
irssi_version_h,
],
]
]
libfe_common_core_a = static_library(
'fe_common_core',
libfe_common_core_a = static_library('fe_common_core',
fe_common_core_sources,
include_directories : rootinc,
implicit_include_directories : false,
@ -55,12 +54,10 @@ libfe_common_core_a = static_library(
def_helpdir,
def_themesdir,
],
dependencies : dep,
)
dependencies : dep)
if want_fuzzer
libfuzzer_fe_common_core_a = static_library(
'fuzzer_fe_common_core',
libfuzzer_fe_common_core_a = static_library('fuzzer_fe_common_core',
fe_common_core_sources,
include_directories : rootinc,
implicit_include_directories : false,
@ -69,8 +66,7 @@ if want_fuzzer
def_themesdir,
def_suppress_printf_fallback,
],
dependencies : dep,
)
dependencies : dep)
endif
install_headers(
@ -100,5 +96,4 @@ install_headers(
'window-items.h',
'windows-layout.h',
),
subdir : incdir / 'src' / 'fe-common' / 'core',
)
subdir : incdir / 'src' / 'fe-common' / 'core')

View file

@ -24,7 +24,6 @@
#include <irssi/src/core/signals.h>
#include <irssi/src/core/commands.h>
#include <irssi/src/core/settings.h>
#include <irssi/src/core/misc.h>
#include <irssi/src/core/levels.h>
#include <irssi/src/core/servers.h>
@ -241,7 +240,8 @@ static char *printtext_get_args(TEXT_DEST_REC *dest, const char *str,
}
}
ret = g_string_free_and_steal(out);
ret = out->str;
g_string_free(out, FALSE);
return ret;
}
@ -270,7 +270,8 @@ static char *printtext_expand_formats(const char *str, int *flags)
}
}
ret = g_string_free_and_steal(out);
ret = out->str;
g_string_free(out, FALSE);
return ret;
}

View file

@ -395,8 +395,9 @@ char *theme_format_expand_get(THEME_REC *theme, const char **format)
(*format)++;
}
ret = g_string_free_and_steal(str);
return ret;
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
static char *theme_format_expand_data_rec(THEME_REC *theme, const char **format,
@ -495,7 +496,8 @@ static char *theme_format_expand_abstract(THEME_REC *theme, const char **formatp
p++;
}
g_free(ret);
abstract = g_string_free_and_steal(str);
abstract = str->str;
g_string_free(str, FALSE);
/* abstract may itself contain abstracts or replaces */
p = abstract;
@ -566,14 +568,15 @@ static char *theme_format_expand_data_rec(THEME_REC *theme, const char **format,
}
}
/* save the last color */
if (save_last_fg != NULL)
*save_last_fg = last_fg;
if (save_last_bg != NULL)
*save_last_bg = last_bg;
/* save the last color */
if (save_last_fg != NULL)
*save_last_fg = last_fg;
if (save_last_bg != NULL)
*save_last_bg = last_bg;
ret = g_string_free_and_steal(str);
return ret;
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
/* expand the data part in {abstract data} */
@ -642,8 +645,9 @@ static char *theme_format_compress_colors(THEME_REC *theme, const char *format)
}
}
ret = g_string_free_and_steal(str);
return ret;
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
char *theme_format_expand(THEME_REC *theme, const char *format)

View file

@ -1,7 +1,6 @@
# this file is part of irssi
libfe_irc_dcc_a = static_library(
'fe_irc_dcc',
libfe_irc_dcc_a = static_library('fe_irc_dcc',
files(
'fe-dcc-chat-messages.c',
'fe-dcc-chat.c',
@ -17,17 +16,12 @@ libfe_irc_dcc_a = static_library(
def_helpdir,
def_sysconfdir,
],
dependencies : dep,
)
shared_library(
'fe_irc_dcc',
name_suffix : module_suffix,
dependencies : dep)
shared_module('fe_irc_dcc',
install : true,
install_dir : moduledir,
link_with : dl_cross_irc_dcc + dl_cross_irc_core + dl_cross_irssi_main,
link_whole : libfe_irc_dcc_a,
override_options : [ 'b_lundef=false' ],
)
link_with : dl_cross_irc_dcc,
link_whole : libfe_irc_dcc_a)
install_headers(
files(
@ -35,5 +29,4 @@ install_headers(
'module-formats.h',
'module.h',
),
subdir : incdir / 'src' / 'fe-common' / 'irc' / 'dcc',
)
subdir : incdir / 'src' / 'fe-common' / 'irc' / 'dcc')

View file

@ -119,10 +119,11 @@ static void ctcp_default_reply(IRC_SERVER_REC *server, const char *data,
g_free(ctcp);
}
static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, const char *nick,
const char *addr, const char *target)
static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr,
const char *target)
{
gint64 tv, tv2 = 0;
gint64 tv, tv2;
long usecs;
g_return_if_fail(data != NULL);
@ -140,9 +141,8 @@ static void ctcp_ping_reply(IRC_SERVER_REC *server, const char *data, const char
tv2 += tv * G_TIME_SPAN_SECOND;
tv = g_get_real_time();
usecs = tv - tv2;
printformat(server, server_ischannel(SERVER(server), target) ? target : nick,
MSGLEVEL_CTCPS, IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND,
usecs % G_TIME_SPAN_SECOND);
printformat(server, server_ischannel(SERVER(server), target) ? target : nick, MSGLEVEL_CTCPS,
IRCTXT_CTCP_PING_REPLY, nick, usecs / G_TIME_SPAN_SECOND, usecs % G_TIME_SPAN_SECOND);
}
void fe_ctcp_init(void)

View file

@ -35,7 +35,6 @@
#include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/fe-common/core/fe-channels.h>
#include <irssi/src/fe-common/irc/fe-irc-server.h>
#include <irssi/src/fe-common/irc/fe-irc-channels.h>
static void print_event_received(IRC_SERVER_REC *server, const char *data,
const char *nick, int target_param);
@ -144,74 +143,45 @@ static void event_ban_list(IRC_SERVER_REC *server, const char *data)
IRC_CHANNEL_REC *chanrec;
BAN_REC *banrec;
const char *channel;
char *params, *ban, *setby, *tims, *timestr, *ago;
char *params, *ban, *setby, *tims;
long secs;
g_return_if_fail(data != NULL);
params = event_get_params(data, 5, NULL, &channel,
&ban, &setby, &tims);
timestr = my_asctime((time_t) atoll(tims));
ago = time_ago((time_t) atoll(tims));
secs = *tims == '\0' ? 0 :
(long) (time(NULL) - atol(tims));
chanrec = irc_channel_find(server, channel);
banrec = chanrec == NULL ? NULL : banlist_find(chanrec->banlist, ban);
channel = get_visible_target(server, channel);
printformat(server, channel, MSGLEVEL_CRAP,
*setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec) + 1, channel, ban,
setby, ago, timestr);
*setby == '\0' ? IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
banrec == NULL ? 0 : g_slist_index(chanrec->banlist, banrec)+1,
channel, ban, setby, secs);
g_free(timestr);
g_free(params);
}
static void event_eban_list(IRC_SERVER_REC *server, const char *data)
{
const char *channel;
char *params, *ban, *setby, *tims, *timestr, *ago;
char *params, *ban, *setby, *tims;
long secs;
g_return_if_fail(data != NULL);
params = event_get_params(data, 5, NULL, &channel,
&ban, &setby, &tims);
timestr = my_asctime((time_t) atoll(tims));
ago = time_ago((time_t) atoll(tims));
secs = *tims == '\0' ? 0 :
(long) (time(NULL) - atol(tims));
channel = get_visible_target(server, channel);
printformat(server, channel, MSGLEVEL_CRAP,
*setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG, channel, ban, setby,
timestr, ago);
g_free(timestr);
g_free(params);
}
static void do_quiet_list(IRC_SERVER_REC *server, const char *channel, char *ban, char *setby,
char *tims)
{
char *timestr, *ago;
timestr = my_asctime((time_t) atoll(tims));
ago = time_ago((time_t) atoll(tims));
channel = get_visible_target(server, channel);
printformat(server, channel, MSGLEVEL_CRAP,
*setby == '\0' ? IRCTXT_QUIETLIST : IRCTXT_QUIETLIST_LONG, channel, ban, setby,
ago, timestr);
g_free(timestr);
}
static void event_quiet_list(IRC_SERVER_REC *server, const char *data)
{
const char *channel;
char *params, *ban, *setby, *tims;
g_return_if_fail(data != NULL);
params = event_get_params(data, 6, NULL, &channel, NULL, &ban, &setby, &tims);
do_quiet_list(server, channel, ban, setby, tims);
*setby == '\0' ? IRCTXT_EBANLIST : IRCTXT_EBANLIST_LONG,
channel, ban, setby, secs);
g_free(params);
}
@ -244,21 +214,20 @@ static void event_accept_list(IRC_SERVER_REC *server, const char *data)
static void event_invite_list(IRC_SERVER_REC *server, const char *data)
{
const char *channel;
char *params, *invite, *setby, *tims, *timestr, *ago;
char *params, *invite, *setby, *tims;
long secs;
g_return_if_fail(data != NULL);
params = event_get_params(data, 5, NULL, &channel, &invite,
&setby, &tims);
timestr = my_asctime((time_t) atoll(tims));
ago = time_ago((time_t) atoll(tims));
secs = *tims == '\0' ? 0 :
(long) (time(NULL) - atol(tims));
channel = get_visible_target(server, channel);
printformat(server, channel, MSGLEVEL_CRAP,
*setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG, channel, invite,
setby, timestr, ago);
g_free(timestr);
*setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG,
channel, invite, setby, secs);
g_free(params);
}
@ -726,26 +695,6 @@ static void event_target_received(IRC_SERVER_REC *server, const char *data,
print_event_received(server, data, nick, TRUE);
}
static void event_hybrid_quiet_list(IRC_SERVER_REC *server, const char *data)
{
const char *channel;
char *params, *ban, *setby, *tims;
g_return_if_fail(data != NULL);
params = event_get_params(data, 5, NULL, &channel, &ban, &setby, &tims);
if (*tims == '\0') {
/* probably not a quiet list */
event_target_received(server, data, NULL);
return;
}
do_quiet_list(server, channel, ban, setby, tims);
g_free(params);
}
static void event_motd(IRC_SERVER_REC *server, const char *data,
const char *nick, const char *addr)
{
@ -778,8 +727,6 @@ void fe_events_numeric_init(void)
signal_add("event 281", (SIGNAL_FUNC) event_accept_list);
signal_add("event 367", (SIGNAL_FUNC) event_ban_list);
signal_add("event 348", (SIGNAL_FUNC) event_eban_list);
signal_add("event 728", (SIGNAL_FUNC) event_quiet_list);
signal_add("event 344", (SIGNAL_FUNC) event_hybrid_quiet_list); /* used by ircd-hybrid */
signal_add("event 346", (SIGNAL_FUNC) event_invite_list);
signal_add("event 433", (SIGNAL_FUNC) event_nick_in_use);
signal_add("event 332", (SIGNAL_FUNC) event_topic_get);
@ -838,7 +785,8 @@ void fe_events_numeric_init(void)
signal_add("event 470", (SIGNAL_FUNC) event_received);
signal_add("event 479", (SIGNAL_FUNC) event_received);
signal_add("event 345", (SIGNAL_FUNC) event_target_received); /* end of reop list/hybrid quiet list */
signal_add("event 344", (SIGNAL_FUNC) event_target_received); /* reop list */
signal_add("event 345", (SIGNAL_FUNC) event_target_received); /* end of reop list */
signal_add("event 347", (SIGNAL_FUNC) event_target_received); /* end of invite exception list */
signal_add("event 349", (SIGNAL_FUNC) event_target_received); /* end of ban exception list */
signal_add("event 368", (SIGNAL_FUNC) event_target_received); /* end of ban list */
@ -856,6 +804,7 @@ void fe_events_numeric_init(void)
signal_add("event 506", (SIGNAL_FUNC) event_target_received); /* cannot send (+R) */
signal_add("event 716", (SIGNAL_FUNC) event_target_received); /* cannot /msg (+g) */
signal_add("event 717", (SIGNAL_FUNC) event_target_received); /* +g notified */
signal_add("event 728", (SIGNAL_FUNC) event_target_received); /* quiet (or other) list */
signal_add("event 729", (SIGNAL_FUNC) event_target_received); /* end of quiet (or other) list */
/* clang-format on */
}
@ -876,8 +825,6 @@ void fe_events_numeric_deinit(void)
signal_remove("event 281", (SIGNAL_FUNC) event_accept_list);
signal_remove("event 367", (SIGNAL_FUNC) event_ban_list);
signal_remove("event 348", (SIGNAL_FUNC) event_eban_list);
signal_remove("event 728", (SIGNAL_FUNC) event_quiet_list);
signal_remove("event 344", (SIGNAL_FUNC) event_hybrid_quiet_list);
signal_remove("event 346", (SIGNAL_FUNC) event_invite_list);
signal_remove("event 433", (SIGNAL_FUNC) event_nick_in_use);
signal_remove("event 332", (SIGNAL_FUNC) event_topic_get);
@ -932,6 +879,7 @@ void fe_events_numeric_deinit(void)
signal_remove("event 470", (SIGNAL_FUNC) event_received);
signal_remove("event 479", (SIGNAL_FUNC) event_received);
signal_remove("event 344", (SIGNAL_FUNC) event_target_received);
signal_remove("event 345", (SIGNAL_FUNC) event_target_received);
signal_remove("event 347", (SIGNAL_FUNC) event_target_received);
signal_remove("event 349", (SIGNAL_FUNC) event_target_received);
@ -950,5 +898,6 @@ void fe_events_numeric_deinit(void)
signal_remove("event 506", (SIGNAL_FUNC) event_target_received);
signal_remove("event 716", (SIGNAL_FUNC) event_target_received);
signal_remove("event 717", (SIGNAL_FUNC) event_target_received);
signal_remove("event 728", (SIGNAL_FUNC) event_target_received);
signal_remove("event 729", (SIGNAL_FUNC) event_target_received);
}

View file

@ -73,38 +73,6 @@ const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target)
return target;
}
/* Get time elapsed since an event */
char *time_ago(time_t seconds)
{
static char ret[128];
long unsigned years, weeks, days, hours, minutes;
seconds = time(NULL) - seconds;
years = seconds / (86400 * 365);
seconds %= (86400 * 365);
weeks = seconds / 604800;
days = (seconds / 86400) % 7;
hours = (seconds / 3600) % 24;
minutes = (seconds / 60) % 60;
seconds %= 60;
if (years)
snprintf(ret, sizeof(ret), "%luy %luw %lud", years, weeks, days);
else if (weeks)
snprintf(ret, sizeof(ret), "%luw %lud %luh", weeks, days, hours);
else if (days)
snprintf(ret, sizeof(ret), "%lud %luh %lum", days, hours, minutes);
else if (hours)
snprintf(ret, sizeof(ret), "%luh %lum", hours, minutes);
else if (minutes)
snprintf(ret, sizeof(ret), "%lum %lus", minutes, (long unsigned) seconds);
else
snprintf(ret, sizeof(ret), "%lus", (long unsigned) seconds);
return ret;
}
static void sig_channel_rejoin(SERVER_REC *server, REJOIN_REC *rec)
{
g_return_if_fail(rec != NULL);

View file

@ -3,7 +3,6 @@
int fe_channel_is_opchannel(IRC_SERVER_REC *server, const char *target);
const char *fe_channel_skip_prefix(IRC_SERVER_REC *server, const char *target);
char *time_ago(time_t seconds);
void fe_irc_channels_init(void);
void fe_irc_channels_deinit(void);

View file

@ -39,7 +39,6 @@
#include <irssi/src/fe-common/core/window-items.h>
#include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/fe-common/core/keyboard.h>
#include <irssi/src/fe-common/irc/fe-irc-channels.h>
/* SYNTAX: ME <message> */
static void cmd_me(const char *data, IRC_SERVER_REC *server, WI_ITEM_REC *item)
@ -225,16 +224,15 @@ static void bans_show_channel(IRC_CHANNEL_REC *channel, IRC_SERVER_REC *server)
/* show bans.. */
counter = 1;
for (tmp = channel->banlist; tmp != NULL; tmp = tmp->next) {
char *timestr, *ago;
BAN_REC *rec = tmp->data;
timestr = my_asctime(rec->time);
ago = time_ago(rec->time);
printformat(server, channel->visible_name, MSGLEVEL_CRAP,
(rec->setby == NULL || *rec->setby == '\0') ? IRCTXT_BANLIST :
IRCTXT_BANLIST_LONG,
counter, channel->visible_name, rec->ban, rec->setby, ago, timestr);
counter++;
(rec->setby == NULL || *rec->setby == '\0') ?
IRCTXT_BANLIST : IRCTXT_BANLIST_LONG,
counter, channel->visible_name,
rec->ban, rec->setby,
(int) (time(NULL)-rec->time));
counter++;
}
}

View file

@ -173,7 +173,7 @@ static void sig_message_own_action(IRC_SERVER_REC *server, const char *msg,
oldtarget = target;
target = fe_channel_skip_prefix(IRC_SERVER(server), target);
if (server_ischannel(SERVER(server), target))
item = channel_find(SERVER(server), target);
item = irc_channel_find(server, target);
else
item = irc_query_find(server, target);

View file

@ -137,7 +137,7 @@ static void get_server_splits(void *key, NETSPLIT_REC *split,
g_string_append_printf(chanrec->nicks, "%s, ", split->nick);
if (chanrec->nick_count == netsplit_max_nicks)
chanrec->maxnickpos = chanrec->nicks->len - 2;
chanrec->maxnickpos = chanrec->nicks->len;
}
}
}

View file

@ -1,7 +1,6 @@
# this file is part of irssi
libfe_common_irc_a = static_library(
'fe_common_irc',
libfe_common_irc_a = static_library('fe_common_irc',
files(
'fe-cap.c',
'fe-common-irc.c',
@ -28,17 +27,12 @@ libfe_common_irc_a = static_library(
def_helpdir,
def_themesdir,
],
dependencies : dep,
)
shared_library(
'fe_common_irc',
name_suffix : module_suffix,
dependencies : dep)
shared_module('fe_common_irc',
install : true,
install_dir : moduledir,
link_with : dl_cross_irc_core + dl_cross_irssi_main,
link_whole : libfe_common_irc_a,
override_options : [ 'b_lundef=false' ],
)
link_with : dl_cross_irc_core,
link_whole : libfe_common_irc_a)
install_headers(
files(
@ -47,8 +41,7 @@ install_headers(
'module-formats.h',
'module.h',
),
subdir : incdir / 'src' / 'fe-common' / 'irc',
)
subdir : incdir / 'src' / 'fe-common' / 'irc')
subdir('dcc')
subdir('notifylist')

View file

@ -81,14 +81,12 @@ FORMAT_REC fecommon_irc_formats[] = {
{ "bantype", "Ban type changed to {channel $0}", 1, { 0 } },
{ "no_bans", "No bans in channel {channel $0}", 1, { 0 } },
{ "banlist", "$0 - {channel $1}: ban {ban $2}", 3, { 1, 0, 0 } },
{ "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, on $5 ($4 ago)}", 6, { 1, 0, 0, 0, 0, 0 } },
{ "quietlist", "{channel $0}: quiet {ban $1}", 2, { 0, 0 } },
{ "quietlist_long", "{channel $0}: quiet {ban $1} {comment by {nick $2}, on $4 ($3 ago)}", 5, { 0, 0, 0, 0, 0 } },
{ "banlist_long", "$0 - {channel $1}: ban {ban $2} {comment by {nick $3}, $4 secs ago}", 5, { 1, 0, 0, 0, 1 } },
{ "ebanlist", "{channel $0}: ban exception {ban $1}", 2, { 0, 0 } },
{ "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, on $4 ($3 ago)}", 5, { 0, 0, 0, 0, 0 } },
{ "ebanlist_long", "{channel $0}: ban exception {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
{ "no_invitelist", "Invite list is empty in channel {channel $0}", 1, { 0 } },
{ "invitelist", "{channel $0}: invite {ban $1}", 2, { 0, 0 } },
{ "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, on $3 ($4 ago)}", 5, { 0, 0, 0, 0, 0 } },
{ "invitelist_long", "{channel $0}: invite {ban $1} {comment by {nick $2}, $3 secs ago}", 4, { 0, 0, 0, 1 } },
{ "no_such_channel", "{channel $0}: No such channel", 1, { 0 } },
{ "channel_synced", "Join to {channel $0} was synced in {hilight $1} secs", 2, { 0, 2 } },
{ "server_help_start", "$1", 2, { 0, 0 } },

View file

@ -59,8 +59,6 @@ enum {
IRCTXT_NO_BANS,
IRCTXT_BANLIST,
IRCTXT_BANLIST_LONG,
IRCTXT_QUIETLIST,
IRCTXT_QUIETLIST_LONG,
IRCTXT_EBANLIST,
IRCTXT_EBANLIST_LONG,
IRCTXT_NO_INVITELIST,

View file

@ -1,7 +1,6 @@
# this file is part of irssi
libfe_irc_notifylist_a = static_library(
'fe_irc_notifylist',
libfe_irc_notifylist_a = static_library('fe_irc_notifylist',
files(
'fe-notifylist.c',
'module-formats.c',
@ -12,22 +11,16 @@ libfe_irc_notifylist_a = static_library(
def_helpdir,
def_sysconfdir,
],
dependencies : dep,
)
shared_library(
'fe_irc_notifylist',
name_suffix : module_suffix,
dependencies : dep)
shared_module('fe_irc_notifylist',
install : true,
install_dir : moduledir,
link_with : dl_cross_irc_notifylist + dl_cross_irssi_main,
link_whole : libfe_irc_notifylist_a,
override_options : [ 'b_lundef=false' ],
)
link_with : dl_cross_irc_notifylist,
link_whole : libfe_irc_notifylist_a)
install_headers(
files(
'module-formats.h',
'module.h',
),
subdir : incdir / 'src' / 'fe-common' / 'irc' / 'notifylist',
)
subdir : incdir / 'src' / 'fe-common' / 'irc' / 'notifylist')

View file

@ -1,4 +1,6 @@
# this file is part of irssi
# intentionally empty
subdir('core')
foreach s : chat_modules
subdir(s)
endforeach

View file

@ -1,6 +1,5 @@
# this file is part of irssi
executable(
'theme-load-fuzz',
executable('theme-load-fuzz',
files(
'../../null-logger.c',
'theme-load.c',
@ -11,12 +10,12 @@ executable(
libcore_a,
libfuzzer_fe_common_core_a,
],
link_args : [ fuzzer_lib ],
link_args : [fuzzer_lib],
link_language : fuzzer_link_language,
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep,
dependencies : dep
)
# noinst_headers = files(

View file

@ -1,7 +1,6 @@
# this file is part of irssi
executable(
'event-get-params-fuzz',
executable('event-get-params-fuzz',
files(
'../../null-logger.c',
'event-get-params.c',
@ -13,12 +12,12 @@ executable(
libirc_core_a,
libfuzzer_fe_common_core_a,
],
link_args : [ fuzzer_lib ],
link_args : [fuzzer_lib],
link_language : fuzzer_link_language,
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep,
dependencies : dep
)
# noinst_headers = files(

View file

@ -3,8 +3,7 @@
subdir('irc')
subdir('fe-common')
executable(
'irssi-fuzz',
executable('irssi-fuzz',
files(
'null-logger.c',
'irssi.c',
@ -15,16 +14,15 @@ executable(
libcore_a,
libfuzzer_fe_common_core_a,
],
link_args : [ fuzzer_lib ],
link_args : [fuzzer_lib],
link_language : fuzzer_link_language,
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep,
dependencies : dep
)
executable(
'server-fuzz',
executable('server-fuzz',
files(
'null-logger.c',
'server.c',
@ -39,12 +37,12 @@ executable(
libfe_irc_dcc_a,
libfe_irc_notifylist_a,
],
link_args : [ fuzzer_lib ],
link_args : [fuzzer_lib],
link_language : fuzzer_link_language,
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep,
dependencies : dep
)
# noinst_headers = files(

View file

@ -30,7 +30,6 @@
#include <irssi/src/core/misc.h>
#include <irssi/src/core/servers-setup.h>
#include <irssi/src/core/rawlog.h>
#include <irssi/src/core/network-openssl.h>
#include <irssi/src/core/net-sendbuffer.h>
#include <stddef.h>

View file

@ -1,24 +1,19 @@
# this file is part of irssi
fe_none_irssi = executable(
'botti',
executable('botti',
files(
'irssi.c',
),
include_directories : rootinc,
implicit_include_directories : false,
export_dynamic : true,
implib : true,
link_with : [
libconfig_a,
libcore_a,
],
install : true,
dependencies : dep,
dependencies : dep
)
if need_dl_cross_link_main
dl_cross_irssi_main = [ fe_none_irssi ]
endif
# noinst_headers = files(
# 'module.h',

View file

@ -405,7 +405,7 @@ void gui_printtext_init(void)
indent_functions = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
settings_add_int("history", "scrollback_lines", 5000);
settings_add_int("history", "scrollback_lines", 500);
settings_add_time("history", "scrollback_time", "1day");
settings_add_time("history", "scrollback_max_age", "0");
settings_add_int("history", "scrollback_burst_remove", 10);

View file

@ -233,10 +233,8 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
if (MAIN_WINDOW_TEXT_HEIGHT(parent) <
WINDOW_MIN_SIZE+NEW_WINDOW_SIZE)
parent = find_window_with_room();
if (parent == NULL) {
g_free(rec);
if (parent == NULL)
return NULL; /* not enough space */
}
space = parent->height / 2;
rec->first_line = parent->first_line;
@ -257,10 +255,8 @@ MAIN_WINDOW_REC *mainwindow_create(int right)
if (MAIN_WINDOW_TEXT_WIDTH(parent) < 2 * NEW_WINDOW_WIDTH) {
parent = find_window_with_room_right();
}
if (parent == NULL) {
g_free(rec);
if (parent == NULL)
return NULL; /* not enough space */
}
space = parent->width / 2;
rec->first_line = parent->first_line;

View file

@ -1,7 +1,6 @@
# this file is part of irssi
fe_text_irssi = executable(
'irssi',
executable('irssi',
files(
#### terminfo_sources ####
'term-terminfo.c',
@ -36,18 +35,15 @@ fe_text_irssi = executable(
include_directories : rootinc,
implicit_include_directories : false,
export_dynamic : true,
implib : true,
link_with : [
libconfig_a,
libcore_a,
libfe_common_core_a,
],
],
install : true,
dependencies : dep + textui_dep,
dependencies : dep
+ textui_dep
)
if need_dl_cross_link_main
dl_cross_irssi_main = [ fe_text_irssi ]
endif
install_headers(
files(
@ -61,8 +57,7 @@ install_headers(
'textbuffer-view.h',
'textbuffer.h',
),
subdir : incdir / 'src' / 'fe-text',
)
subdir : incdir / 'src' / 'fe-text')
# noinst_headers = files(
# 'gui-entry.h',

View file

@ -30,26 +30,17 @@
#include <termios.h>
#include <stdio.h>
#ifdef HAVE_TERM_H
#ifdef NEED_CURSES_H
#include <curses.h>
#endif
#include <term.h>
#else
/* TODO: This needs arguments, starting with C2X. */
int tputs();
#endif
/* returns number of characters in the beginning of the buffer being a
a single character, or -1 if more input is needed. The character will be
saved in result */
typedef int (*TERM_INPUT_FUNC)(const unsigned char *buffer, int size, unichar *result);
typedef int (*TERM_INPUT_FUNC)(const unsigned char *buffer, int size,
unichar *result);
struct _TERM_WINDOW {
/* Terminal to use for window */
/* Terminal to use for window */
TERM_REC *term;
/* Area for window in terminal */
/* Area for window in terminal */
int x, y;
int width, height;
};
@ -318,16 +309,14 @@ void term_window_scroll(TERM_WINDOW *window, int count)
term_lines_empty[window->y+y] = FALSE;
}
#ifdef TPUTS_SVR4
#define putc_arg_t char
#else
#define putc_arg_t int
#endif
inline static int term_putchar(putc_arg_t c)
inline static int term_putchar(int c)
{
return fputc(c, current_term->out);
}
/* copied from terminfo-core.c */
int tputs();
static int termctl_set_color_24bit(int bg, unsigned int lc)
{
static char buf[20];
@ -374,8 +363,8 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne
if (!term_use_colors && bg > 0)
col |= ATTR_REVERSE;
set_normal = ((col & ATTR_RESETFG) && last_fg != COLOR_RESET) ||
((col & ATTR_RESETBG) && last_bg != COLOR_RESET);
set_normal = ((col & ATTR_RESETFG) && last_fg != COLOR_RESET) ||
((col & ATTR_RESETBG) && last_bg != COLOR_RESET);
if (((last_attrs & ATTR_BOLD) && (col & ATTR_BOLD) == 0) ||
((last_attrs & ATTR_REVERSE) && (col & ATTR_REVERSE) == 0) ||
((last_attrs & ATTR_BLINK) && (col & ATTR_BLINK) == 0)) {
@ -386,17 +375,19 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne
if (set_normal) {
last_fg = last_bg = COLOR_RESET;
last_attrs = 0;
last_attrs = 0;
terminfo_set_normal();
}
/* set foreground color */
if (fg != last_fg && (fg != 0 || (col & ATTR_RESETFG) == 0)) {
if (term_use_colors) {
if (fg != last_fg &&
(fg != 0 || (col & ATTR_RESETFG) == 0)) {
if (term_use_colors) {
last_fg = fg;
if (fg >> 8)
termctl_set_color_24bit(0, last_fg == COLOR_BLACK24 ? 0 :
last_fg >> 8);
termctl_set_color_24bit(0,
last_fg == COLOR_BLACK24 ? 0
: last_fg >> 8);
else
terminfo_set_fg(last_fg);
}
@ -404,17 +395,19 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne
/* set background color */
if (window && window->term->TI_colors &&
(term_color256map[bg & 0xff] & 8) == window->term->TI_colors)
(term_color256map[bg&0xff]&8) == window->term->TI_colors)
col |= ATTR_BLINK;
if (col & ATTR_BLINK)
current_term->tr_set_blink(current_term);
current_term->set_blink(current_term);
if (bg != last_bg && (bg != 0 || (col & ATTR_RESETBG) == 0)) {
if (term_use_colors) {
if (bg != last_bg &&
(bg != 0 || (col & ATTR_RESETBG) == 0)) {
if (term_use_colors) {
last_bg = bg;
if (bg >> 8)
termctl_set_color_24bit(1, last_bg == COLOR_BLACK24 ? 0 :
last_bg >> 8);
termctl_set_color_24bit(1,
last_bg == COLOR_BLACK24 ? 0
: last_bg >> 8);
else
terminfo_set_bg(last_bg);
}
@ -426,7 +419,7 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne
/* bold */
if (window && window->term->TI_colors &&
(term_color256map[fg & 0xff] & 8) == window->term->TI_colors)
(term_color256map[fg&0xff]&8) == window->term->TI_colors)
col |= ATTR_BOLD;
if (col & ATTR_BOLD)
terminfo_set_bold();
@ -446,7 +439,7 @@ void term_set_color2(TERM_WINDOW *window, int col, unsigned int fgcol24, unsigne
terminfo_set_italic(FALSE);
/* update the new attribute settings whilst ignoring color values. */
last_attrs = col & ~(BG_MASK | FG_MASK);
last_attrs = col & ~( BG_MASK | FG_MASK );
}
void term_move(TERM_WINDOW *window, int x, int y)

View file

@ -1,27 +1,18 @@
#include "module.h"
#include <irssi/src/core/signals.h>
#include <irssi/src/core/misc.h>
#include <irssi/src/fe-text/terminfo-core.h>
#ifndef _POSIX_VDISABLE
# define _POSIX_VDISABLE 0
#endif
#ifdef TPUTS_SVR4
#define putc_arg_t char
#else
#define putc_arg_t int
#endif
#define tput(s) tputs(s, 0, term_putchar)
inline static int term_putchar(putc_arg_t c)
inline static int term_putchar(int c)
{
return fputc(c, current_term->out);
}
#ifdef HAVE_TERM_H
#ifdef NEED_CURSES_H
#include <curses.h>
#endif
#include <term.h>
#else
/* Don't bother including curses.h because of these -
@ -44,8 +35,8 @@ int tigetflag();
#define CAP_TYPE_STR 2
typedef struct {
char *ti_name; /* terminfo name */
char *tc_name; /* termcap name */
const char *ti_name; /* terminfo name */
const char *tc_name; /* termcap name */
int type;
unsigned int offset;
} TERMINFO_REC;
@ -178,20 +169,20 @@ static void _set_cursor_visible(TERM_REC *term, int set)
/* Scroll (change_scroll_region+parm_rindex+parm_index / csr+rin+indn) */
static void _scroll_region(TERM_REC *term, int y1, int y2, int count)
{
/* setup the scrolling region to wanted area */
scroll_region_setup(term, y1, y2);
/* setup the scrolling region to wanted area */
scroll_region_setup(term, y1, y2);
term->tr_move(term, 0, y1);
term->move(term, 0, y1);
if (count > 0) {
term->tr_move(term, 0, y2);
term->move(term, 0, y2);
tput(tparm(term->TI_indn, count, count, 0, 0, 0, 0, 0, 0, 0));
} else if (count < 0) {
term->tr_move(term, 0, y1);
term->move(term, 0, y1);
tput(tparm(term->TI_rin, -count, -count, 0, 0, 0, 0, 0, 0, 0));
}
/* reset the scrolling region to full screen */
scroll_region_setup(term, 0, term->height - 1);
/* reset the scrolling region to full screen */
scroll_region_setup(term, 0, term->height-1);
}
/* Scroll (change_scroll_region+scroll_reverse+scroll_forward / csr+ri+ind) */
@ -199,21 +190,21 @@ static void _scroll_region_1(TERM_REC *term, int y1, int y2, int count)
{
int i;
/* setup the scrolling region to wanted area */
scroll_region_setup(term, y1, y2);
/* setup the scrolling region to wanted area */
scroll_region_setup(term, y1, y2);
if (count > 0) {
term->tr_move(term, 0, y2);
term->move(term, 0, y2);
for (i = 0; i < count; i++)
tput(tparm(term->TI_ind, 0, 0, 0, 0, 0, 0, 0, 0, 0));
} else if (count < 0) {
term->tr_move(term, 0, y1);
term->move(term, 0, y1);
for (i = count; i < 0; i++)
tput(tparm(term->TI_ri, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}
/* reset the scrolling region to full screen */
scroll_region_setup(term, 0, term->height - 1);
/* reset the scrolling region to full screen */
scroll_region_setup(term, 0, term->height-1);
}
/* Scroll (parm_insert_line+parm_delete_line / il+dl) */
@ -222,22 +213,22 @@ static void _scroll_line(TERM_REC *term, int y1, int y2, int count)
/* setup the scrolling region to wanted area -
this might not necessarily work with il/dl, but at least it
looks better if it does */
scroll_region_setup(term, y1, y2);
scroll_region_setup(term, y1, y2);
if (count > 0) {
term->tr_move(term, 0, y1);
term->move(term, 0, y1);
tput(tparm(term->TI_dl, count, count, 0, 0, 0, 0, 0, 0, 0));
term->tr_move(term, 0, y2 - count + 1);
term->move(term, 0, y2-count+1);
tput(tparm(term->TI_il, count, count, 0, 0, 0, 0, 0, 0, 0));
} else if (count < 0) {
term->tr_move(term, 0, y2 + count + 1);
term->move(term, 0, y2+count+1);
tput(tparm(term->TI_dl, -count, -count, 0, 0, 0, 0, 0, 0, 0));
term->tr_move(term, 0, y1);
term->move(term, 0, y1);
tput(tparm(term->TI_il, -count, -count, 0, 0, 0, 0, 0, 0, 0));
}
/* reset the scrolling region to full screen */
scroll_region_setup(term, 0, term->height - 1);
/* reset the scrolling region to full screen */
scroll_region_setup(term, 0, term->height-1);
}
/* Scroll (insert_line+delete_line / il1+dl1) */
@ -246,17 +237,17 @@ static void _scroll_line_1(TERM_REC *term, int y1, int y2, int count)
int i;
if (count > 0) {
term->tr_move(term, 0, y1);
for (i = 0; i < count; i++)
term->move(term, 0, y1);
for (i = 0; i < count; i++)
tput(tparm(term->TI_dl1, 0, 0, 0, 0, 0, 0, 0, 0, 0));
term->tr_move(term, 0, y2 - count + 1);
for (i = 0; i < count; i++)
term->move(term, 0, y2-count+1);
for (i = 0; i < count; i++)
tput(tparm(term->TI_il1, 0, 0, 0, 0, 0, 0, 0, 0, 0));
} else if (count < 0) {
term->tr_move(term, 0, y2 + count + 1);
term->move(term, 0, y2+count+1);
for (i = count; i < 0; i++)
tput(tparm(term->TI_dl1, 0, 0, 0, 0, 0, 0, 0, 0, 0));
term->tr_move(term, 0, y1);
term->move(term, 0, y1);
for (i = count; i < 0; i++)
tput(tparm(term->TI_il1, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}
@ -271,14 +262,14 @@ static void _clear_screen(TERM_REC *term)
/* Clear screen (clr_eos / ed) */
static void _clear_eos(TERM_REC *term)
{
term->tr_move(term, 0, 0);
term->move(term, 0, 0);
tput(tparm(term->TI_ed, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}
/* Clear screen (parm_delete_line / dl) */
static void _clear_del(TERM_REC *term)
{
term->tr_move(term, 0, 0);
term->move(term, 0, 0);
tput(tparm(term->TI_dl, term->height, term->height, 0, 0, 0, 0, 0, 0, 0));
}
@ -287,8 +278,8 @@ static void _clear_del_1(TERM_REC *term)
{
int i;
term->tr_move(term, 0, 0);
for (i = 0; i < term->height; i++)
term->move(term, 0, 0);
for (i = 0; i < term->height; i++)
tput(tparm(term->TI_dl1, 0, 0, 0, 0, 0, 0, 0, 0, 0));
}
@ -461,7 +452,10 @@ static void terminfo_colors_deinit(TERM_REC *term)
terminal capabilities don't contain color codes */
void terminfo_setup_colors(TERM_REC *term, int force)
{
static const char ansitab[16] = { 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11, 15 };
static const char ansitab[16] = {
0, 4, 2, 6, 1, 5, 3, 7,
8, 12, 10, 14, 9, 13, 11, 15
};
unsigned int i, color;
terminfo_colors_deinit(term);
@ -469,15 +463,16 @@ void terminfo_setup_colors(TERM_REC *term, int force)
if (force && term->TI_setf == NULL && term->TI_setaf == NULL)
term->TI_colors = 8;
if ((term->TI_setf || term->TI_setaf || force) && term->TI_colors > 0) {
if ((term->TI_setf || term->TI_setaf || force) &&
term->TI_colors > 0) {
term->TI_fg = g_new0(char *, term->TI_colors);
term->TI_bg = g_new0(char *, term->TI_colors);
term->tr_set_fg = _set_fg;
term->tr_set_bg = _set_bg;
term->set_fg = _set_fg;
term->set_bg = _set_bg;
} else {
/* no colors */
term->TI_colors = 0;
term->tr_set_fg = term->tr_set_bg = _ignore_parm;
term->set_fg = term->set_bg = _ignore_parm;
}
if (term->TI_setaf) {
@ -491,7 +486,7 @@ void terminfo_setup_colors(TERM_REC *term, int force)
term->TI_fg[i] = g_strdup(tparm(term->TI_setf, i, 0, 0, 0, 0, 0, 0, 0, 0));
} else if (force) {
for (i = 0; i < 8; i++)
term->TI_fg[i] = g_strdup_printf("\033[%dm", 30 + ansitab[i]);
term->TI_fg[i] = g_strdup_printf("\033[%dm", 30+ansitab[i]);
}
if (term->TI_setab) {
@ -505,7 +500,7 @@ void terminfo_setup_colors(TERM_REC *term, int force)
term->TI_bg[i] = g_strdup(tparm(term->TI_setb, i, 0, 0, 0, 0, 0, 0, 0, 0));
} else if (force) {
for (i = 0; i < 8; i++)
term->TI_bg[i] = g_strdup_printf("\033[%dm", 40 + ansitab[i]);
term->TI_bg[i] = g_strdup_printf("\033[%dm", 40+ansitab[i]);
}
}
@ -583,12 +578,12 @@ static int term_setup(TERM_REC *term)
{
GString *str;
int err;
char *term_env;
char *term_env;
term_env = getenv("TERM");
if (term_env == NULL) {
fprintf(stderr, "TERM environment not set\n");
return 0;
return 0;
}
if (setupterm(term_env, 1, &err) != 0) {
@ -596,98 +591,98 @@ static int term_setup(TERM_REC *term)
return 0;
}
term_fill_capabilities(term);
term_fill_capabilities(term);
/* Cursor movement */
if (term->TI_cup)
term->tr_move = _move_cup;
term->move = _move_cup;
else if (term->TI_hpa && term->TI_vpa)
term->tr_move = _move_pa;
term->move = _move_pa;
else {
fprintf(stderr, "Terminal doesn't support cursor movement\n");
fprintf(stderr, "Terminal doesn't support cursor movement\n");
return 0;
}
term->tr_move_relative = _move_relative;
term->tr_set_cursor_visible =
term->TI_civis && term->TI_cnorm ? _set_cursor_visible : _ignore_parm;
term->move_relative = _move_relative;
term->set_cursor_visible = term->TI_civis && term->TI_cnorm ?
_set_cursor_visible : _ignore_parm;
/* Scrolling */
/* Scrolling */
if ((term->TI_csr || term->TI_wind) && term->TI_rin && term->TI_indn)
term->tr_scroll = _scroll_region;
term->scroll = _scroll_region;
else if (term->TI_il && term->TI_dl)
term->tr_scroll = _scroll_line;
term->scroll = _scroll_line;
else if ((term->TI_csr || term->TI_wind) && term->TI_ri && term->TI_ind)
term->tr_scroll = _scroll_region_1;
else if (term->tr_scroll == NULL && (term->TI_il1 && term->TI_dl1))
term->tr_scroll = _scroll_line_1;
else if (term->tr_scroll == NULL) {
fprintf(stderr, "Terminal doesn't support scrolling\n");
term->scroll = _scroll_region_1;
else if (term->scroll == NULL && (term->TI_il1 && term->TI_dl1))
term->scroll = _scroll_line_1;
else if (term->scroll == NULL) {
fprintf(stderr, "Terminal doesn't support scrolling\n");
return 0;
}
/* Clearing screen */
if (term->TI_clear)
term->tr_clear = _clear_screen;
term->clear = _clear_screen;
else if (term->TI_ed)
term->tr_clear = _clear_eos;
term->clear = _clear_eos;
else if (term->TI_dl)
term->tr_clear = _clear_del;
term->clear = _clear_del;
else if (term->TI_dl1)
term->tr_clear = _clear_del_1;
term->clear = _clear_del_1;
else {
/* we could do this by line inserts as well, but don't
bother - if some terminal has insert line it most probably
has delete line as well, if not a regular clear screen */
fprintf(stderr, "Terminal doesn't support clearing screen\n");
fprintf(stderr, "Terminal doesn't support clearing screen\n");
return 0;
}
/* Clearing to end of line */
if (term->TI_el)
term->tr_clrtoeol = _clrtoeol;
term->clrtoeol = _clrtoeol;
else {
fprintf(stderr, "Terminal doesn't support clearing to end of line\n");
fprintf(stderr, "Terminal doesn't support clearing to end of line\n");
return 0;
}
/* Repeating character */
if (term->TI_rep)
term->tr_repeat = _repeat;
term->repeat = _repeat;
else
term->tr_repeat = _repeat_manual;
term->repeat = _repeat_manual;
/* Bold, underline, standout, reverse, italics */
term->tr_set_blink = term->TI_blink ? _set_blink : _ignore;
term->tr_set_bold = term->TI_bold ? _set_bold : _ignore;
term->tr_set_reverse = term->TI_rev ? _set_reverse :
term->TI_smso ? _set_standout_on :
_ignore;
term->tr_set_uline = term->TI_smul && term->TI_rmul ? _set_uline : _ignore_parm;
term->tr_set_standout = term->TI_smso && term->TI_rmso ? _set_standout : _ignore_parm;
term->tr_set_italic = term->TI_sitm && term->TI_ritm ? _set_italic : _ignore_parm;
term->set_blink = term->TI_blink ? _set_blink : _ignore;
term->set_bold = term->TI_bold ? _set_bold : _ignore;
term->set_reverse = term->TI_rev ? _set_reverse :
term->TI_smso ? _set_standout_on : _ignore;
term->set_uline = term->TI_smul && term->TI_rmul ?
_set_uline : _ignore_parm;
term->set_standout = term->TI_smso && term->TI_rmso ?
_set_standout : _ignore_parm;
term->set_italic = term->TI_sitm && term->TI_ritm ?
_set_italic : _ignore_parm;
/* Create a string to set all attributes off */
str = g_string_new(NULL);
/* Create a string to set all attributes off */
str = g_string_new(NULL);
if (term->TI_sgr0)
g_string_append(str, term->TI_sgr0);
if (term->TI_rmul &&
(term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmul, term->TI_sgr0) != 0))
if (term->TI_rmul && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmul, term->TI_sgr0) != 0))
g_string_append(str, term->TI_rmul);
if (term->TI_rmso &&
(term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmso, term->TI_sgr0) != 0))
if (term->TI_rmso && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_rmso, term->TI_sgr0) != 0))
g_string_append(str, term->TI_rmso);
if (term->TI_ritm &&
(term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0))
if (term->TI_ritm && (term->TI_sgr0 == NULL || g_strcmp0(term->TI_ritm, term->TI_sgr0) != 0))
g_string_append(str, term->TI_ritm);
term->TI_normal = g_string_free_and_steal(str);
term->tr_set_normal = _set_normal;
term->TI_normal = str->str;
g_string_free(str, FALSE);
term->set_normal = _set_normal;
term->tr_beep = term->TI_bel ? _beep : _ignore;
term->beep = term->TI_bel ? _beep : _ignore;
terminfo_setup_colors(term, FALSE);
terminfo_input_init0(term);
terminfo_cont(term);
return 1;
terminfo_cont(term);
return 1;
}
void term_set_appkey_mode(int enable)
@ -732,14 +727,14 @@ void terminfo_core_deinit(TERM_REC *term)
TERM_REC *old_term;
old_term = current_term;
current_term = term;
term->tr_set_normal(term);
current_term = old_term;
current_term = term;
term->set_normal(term);
current_term = old_term;
terminfo_stop(term);
terminfo_stop(term);
g_free(term->TI_normal);
terminfo_colors_deinit(term);
g_free(term);
g_free(term);
}

View file

@ -3,49 +3,48 @@
#include <termios.h>
#define terminfo_move(x, y) current_term->tr_move(current_term, x, y)
#define terminfo_move_relative(oldx, oldy, x, y) \
current_term->tr_move_relative(current_term, oldx, oldy, x, y)
#define terminfo_set_cursor_visible(set) current_term->tr_set_cursor_visible(current_term, set)
#define terminfo_scroll(y1, y2, count) current_term->tr_scroll(current_term, y1, y2, count)
#define terminfo_clear() current_term->tr_clear(current_term)
#define terminfo_clrtoeol() current_term->tr_clrtoeol(current_term)
#define terminfo_repeat(chr, count) current_term->tr_repeat(current_term, chr, count)
#define terminfo_set_fg(color) current_term->tr_set_fg(current_term, color)
#define terminfo_set_bg(color) current_term->tr_set_bg(current_term, color)
#define terminfo_set_normal() current_term->tr_set_normal(current_term)
#define terminfo_set_bold() current_term->tr_set_bold(current_term)
#define terminfo_set_uline(set) current_term->tr_set_uline(current_term, set)
#define terminfo_set_standout(set) current_term->tr_set_standout(current_term, set)
#define terminfo_set_reverse() current_term->tr_set_reverse(current_term)
#define terminfo_set_italic(set) current_term->tr_set_italic(current_term, set)
#define terminfo_move(x, y) current_term->move(current_term, x, y)
#define terminfo_move_relative(oldx, oldy, x, y) current_term->move_relative(current_term, oldx, oldy, x, y)
#define terminfo_set_cursor_visible(set) current_term->set_cursor_visible(current_term, set)
#define terminfo_scroll(y1, y2, count) current_term->scroll(current_term, y1, y2, count)
#define terminfo_clear() current_term->clear(current_term)
#define terminfo_clrtoeol() current_term->clrtoeol(current_term)
#define terminfo_repeat(chr, count) current_term->repeat(current_term, chr, count)
#define terminfo_set_fg(color) current_term->set_fg(current_term, color)
#define terminfo_set_bg(color) current_term->set_bg(current_term, color)
#define terminfo_set_normal() current_term->set_normal(current_term)
#define terminfo_set_bold() current_term->set_bold(current_term)
#define terminfo_set_uline(set) current_term->set_uline(current_term, set)
#define terminfo_set_standout(set) current_term->set_standout(current_term, set)
#define terminfo_set_reverse() current_term->set_reverse(current_term)
#define terminfo_set_italic(set) current_term->set_italic(current_term, set)
#define terminfo_is_colors_set(term) (term->TI_fg != NULL)
#define terminfo_beep(term) current_term->tr_beep(current_term)
#define terminfo_beep(term) current_term->beep(current_term)
typedef struct _TERM_REC TERM_REC;
struct _TERM_REC {
/* Functions */
void (*tr_move)(TERM_REC *term, int x, int y);
void (*tr_move_relative)(TERM_REC *term, int oldx, int oldy, int x, int y);
void (*tr_set_cursor_visible)(TERM_REC *term, int set);
void (*tr_scroll)(TERM_REC *term, int y1, int y2, int count);
/* Functions */
void (*move)(TERM_REC *term, int x, int y);
void (*move_relative)(TERM_REC *term, int oldx, int oldy, int x, int y);
void (*set_cursor_visible)(TERM_REC *term, int set);
void (*scroll)(TERM_REC *term, int y1, int y2, int count);
void (*tr_clear)(TERM_REC *term);
void (*tr_clrtoeol)(TERM_REC *term);
void (*tr_repeat)(TERM_REC *term, char chr, int count);
void (*clear)(TERM_REC *term);
void (*clrtoeol)(TERM_REC *term);
void (*repeat)(TERM_REC *term, char chr, int count);
void (*tr_set_fg)(TERM_REC *term, int color);
void (*tr_set_bg)(TERM_REC *term, int color);
void (*tr_set_normal)(TERM_REC *term);
void (*tr_set_blink)(TERM_REC *term);
void (*tr_set_bold)(TERM_REC *term);
void (*tr_set_reverse)(TERM_REC *term);
void (*tr_set_uline)(TERM_REC *term, int set);
void (*tr_set_standout)(TERM_REC *term, int set);
void (*tr_set_italic)(TERM_REC *term, int set);
void (*set_fg)(TERM_REC *term, int color);
void (*set_bg)(TERM_REC *term, int color);
void (*set_normal)(TERM_REC *term);
void (*set_blink)(TERM_REC *term);
void (*set_bold)(TERM_REC *term);
void (*set_reverse)(TERM_REC *term);
void (*set_uline)(TERM_REC *term, int set);
void (*set_standout)(TERM_REC *term, int set);
void (*set_italic)(TERM_REC *term, int set);
void (*tr_beep)(TERM_REC *term);
void (*beep)(TERM_REC *term);
#ifndef HAVE_TERMINFO
char buffer1[1024], buffer2[1024];
@ -53,46 +52,46 @@ struct _TERM_REC {
FILE *in, *out;
struct termios tio, old_tio;
/* Terminal size */
int width, height;
/* Terminal size */
int width, height;
/* Cursor movement */
char *TI_smcup, *TI_rmcup, *TI_cup;
char *TI_hpa, *TI_vpa, *TI_cub1, *TI_cuf1;
char *TI_civis, *TI_cnorm;
/* Cursor movement */
const char *TI_smcup, *TI_rmcup, *TI_cup;
const char *TI_hpa, *TI_vpa, *TI_cub1, *TI_cuf1;
const char *TI_civis, *TI_cnorm;
/* Scrolling */
char *TI_csr, *TI_wind;
char *TI_ri, *TI_rin, *TI_ind, *TI_indn;
char *TI_il, *TI_il1, *TI_dl, *TI_dl1;
const char *TI_csr, *TI_wind;
const char *TI_ri, *TI_rin, *TI_ind, *TI_indn;
const char *TI_il, *TI_il1, *TI_dl, *TI_dl1;
/* Clearing screen */
char *TI_clear, *TI_ed; /* + *TI_dl, *TI_dl1; */
const char *TI_clear, *TI_ed; /* + *TI_dl, *TI_dl1; */
/* Clearing to end of line */
char *TI_el;
/* Clearing to end of line */
const char *TI_el;
/* Repeating character */
char *TI_rep;
const char *TI_rep;
/* Colors */
int TI_colors; /* numbers of colors in TI_fg[] and TI_bg[] */
char *TI_sgr0; /* turn off all attributes */
char *TI_smul, *TI_rmul; /* underline on/off */
char *TI_smso, *TI_rmso; /* standout on/off */
char *TI_sitm, *TI_ritm; /* italic on/off */
char *TI_bold, *TI_blink, *TI_rev;
char *TI_setaf, *TI_setab, *TI_setf, *TI_setb;
int TI_colors; /* numbers of colors in TI_fg[] and TI_bg[] */
const char *TI_sgr0; /* turn off all attributes */
const char *TI_smul, *TI_rmul; /* underline on/off */
const char *TI_smso, *TI_rmso; /* standout on/off */
const char *TI_sitm, *TI_ritm; /* italic on/off */
const char *TI_bold, *TI_blink, *TI_rev;
const char *TI_setaf, *TI_setab, *TI_setf, *TI_setb;
/* Colors - generated and dynamically allocated */
/* Colors - generated and dynamically allocated */
char **TI_fg, **TI_bg, *TI_normal;
/* Beep */
char *TI_bel;
char *TI_bel;
/* Keyboard-transmit mode */
char *TI_smkx;
char *TI_rmkx;
const char *TI_smkx;
const char *TI_rmkx;
/* Terminal mode states */
int appkey_enabled;

View file

@ -106,8 +106,9 @@ char *ban_get_masks(IRC_CHANNEL_REC *channel, const char *nicks, int ban_type)
if (str->len > 0)
g_string_truncate(str, str->len-1);
ret = g_string_free_and_steal(str);
return ret;
ret = str->str;
g_string_free(str, FALSE);
return ret;
}
void ban_set(IRC_CHANNEL_REC *channel, const char *bans, int ban_type)

View file

@ -234,7 +234,7 @@ static void event_cap (IRC_SERVER_REC *server, char *args, char *nick, char *add
}
}
else if (!g_ascii_strcasecmp(evt, "ACK")) {
int got_sasl = (i_slist_find_string(server->cap_active, "sasl") != NULL);
int got_sasl = FALSE;
/* Emit a signal for every ack'd cap */
for (i = 0; i < caps_length; i++) {

View file

@ -77,10 +77,6 @@ static void destroy_server_connect(SERVER_CONNECT_REC *conn)
g_free_not_null(ircconn->alternate_nick);
g_free_not_null(ircconn->sasl_username);
g_free_not_null(ircconn->sasl_password);
if (ircconn->scram_session != NULL) {
scram_session_free(ircconn->scram_session);
}
}
void irc_core_init(void)

View file

@ -128,31 +128,12 @@ static void sig_server_setup_fill_chatnet(IRC_SERVER_CONNECT_REC *conn,
conn->sasl_password = g_strdup(ircnet->sasl_password);
} else
g_warning("The fields sasl_username and sasl_password are either missing or empty");
} else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-1") ||
!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-256") ||
!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-512")) {
/* The SCRAM-SHA-* methods need both the username and the password */
if (ircnet->sasl_username != NULL && *ircnet->sasl_username &&
ircnet->sasl_password != NULL && *ircnet->sasl_password) {
if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-1"))
conn->sasl_mechanism = SASL_MECHANISM_SCRAM_SHA_1;
if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-256"))
conn->sasl_mechanism = SASL_MECHANISM_SCRAM_SHA_256;
if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "SCRAM-SHA-512"))
conn->sasl_mechanism = SASL_MECHANISM_SCRAM_SHA_512;
conn->sasl_username = g_strdup(ircnet->sasl_username);
conn->sasl_password = g_strdup(ircnet->sasl_password);
} else
g_warning("The fields sasl_username and sasl_password are either "
"missing or empty");
} else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) {
conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL;
} else {
g_warning("Unsupported SASL mechanism \"%s\" selected",
ircnet->sasl_mechanism);
conn->sasl_mechanism = SASL_MECHANISM_MAX;
}
else if (!g_ascii_strcasecmp(ircnet->sasl_mechanism, "external")) {
conn->sasl_mechanism = SASL_MECHANISM_EXTERNAL;
}
else
g_warning("Unsupported SASL mechanism \"%s\" selected", ircnet->sasl_mechanism);
}
}

View file

@ -25,7 +25,7 @@ typedef struct {
int cmd_queue_speed;
int max_query_chans;
int starttls;
unsigned int no_cap : 1;
int no_cap : 1;
} IRC_SERVER_SETUP_REC;
void irc_servers_setup_init(void);

View file

@ -475,7 +475,6 @@ SERVER_REC *irc_server_init_connect(SERVER_CONNECT_REC *conn)
server->send_message = send_message;
server->query_find_func = (QUERY_REC * (*) (SERVER_REC *, const char *) ) irc_query_find;
server->nick_comp_func = irc_nickcmp_rfc1459;
server->sasl_success = FALSE;
server_connect_init((SERVER_REC *) server);
return (SERVER_REC *) server;
@ -874,7 +873,8 @@ char *irc_server_get_channels(IRC_SERVER_REC *server, int rejoin_channels_mode)
if (use_keys) g_string_append_printf(chans, " %s", keys->str);
}
ret = g_string_free_and_steal(chans);
ret = chans->str;
g_string_free(chans, FALSE);
g_string_free(keys, TRUE);
return ret;

View file

@ -4,7 +4,6 @@
#include <irssi/src/core/chat-protocols.h>
#include <irssi/src/core/servers.h>
#include <irssi/src/irc/core/modes.h>
#include <irssi/src/irc/core/scram.h>
/*
* 63 is the maximum hostname length defined by the protocol. 10 is a common
@ -43,6 +42,7 @@
#define IS_IRC_SERVER_CONNECT(conn) \
(IRC_SERVER_CONNECT(conn) ? TRUE : FALSE)
/* clang-format off */
/* all strings should be either NULL or dynamically allocated */
/* address and nick are mandatory, rest are optional */
struct _IRC_SERVER_CONNECT_REC {
@ -54,17 +54,17 @@ struct _IRC_SERVER_CONNECT_REC {
int sasl_mechanism;
char *sasl_username;
char *sasl_password;
SCRAM_SESSION_REC *scram_session;
int max_cmds_at_once;
int cmd_queue_speed;
int max_query_chans;
int max_kicks, max_msgs, max_modes, max_whois;
unsigned int disallow_starttls : 1;
unsigned int starttls : 1;
unsigned int no_cap : 1;
int disallow_starttls:1;
int starttls:1;
int no_cap:1;
};
/* clang-format on */
#define STRUCT_SERVER_CONNECT_REC IRC_SERVER_CONNECT_REC
struct _IRC_SERVER_REC {

Some files were not shown because too many files have changed in this diff Show more