Compare commits

..

2 Commits

Author SHA1 Message Date
ailin-nemui
fadf0bac18 wip 2019-10-15 16:17:39 +02:00
ailin-nemui
a67775db88 [wip] fix lastlog -clear not resetting /clear 2019-10-15 16:17:39 +02:00
317 changed files with 6848 additions and 6957 deletions

View File

@ -27,7 +27,7 @@ Language: Cpp
Cpp11BracedListStyle: false
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
SortIncludes: false
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements

43
.github/actions.yml vendored Normal file
View File

@ -0,0 +1,43 @@
before_install:
- ./autogen.sh --with-proxy=module --with-bot --with-perl=module --with-otr=module
- make dist
- CO_DIR=$(pwd)
- mkdir -p $HOME/src
- cd $HOME/src
- tar xaf $CO_DIR/irssi-*.tar.*
install:
- cd $HOME/src/irssi-*
- ./configure --with-proxy=module --with-bot --with-perl=module --with-otr=module --prefix=$HOME/irssi-build --enable-always-build-tests
- make CFLAGS="-Wall -Werror -Werror=declaration-after-statement"
- make install
unit_tests:
- cd $HOME/src/irssi-*
- make -C tests -sk check
after_unit_tests:
- cd $HOME/src/irssi-*
- find -name test-suite.log -exec cat {} +
before_script:
- cd $HOME
- 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' > irssi-test/startup
- echo load perl >> irssi-test/startup
- echo load proxy >> irssi-test/startup
- echo ^quit >> irssi-test/startup
script:
- cd $HOME
- irssi-build/bin/irssi --home irssi-test | /tools/render.pl
after_script:
- cat $HOME/irc.log.*

View File

@ -1,127 +0,0 @@
on: [pull_request]
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
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:
runs-on: ubuntu-latest
outputs:
base_abi: ${{ steps.out.outputs.base_abi }}
steps:
- name: set PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: prepare required software
run: |
sudo apt install $apt_build_deps
eval "$get_pip_build_deps"
- name: checkout base ref
uses: actions/checkout@main
with:
path: base.src
ref: ${{ github.base_ref }}
- name: build base ref
run: |
meson Build.base base.src $build_options
ninja -C Build.base
DESTDIR=$PWD/base ninja -C Build.base install
- id: out
run: |
# print versions and abi versions
eval "$getabidef_def"
base_abi=$(getabidef base$prefix)
echo base abi : $base_abi
./base$prefix/bin/irssi --version
echo "::set-output name=base_abi::$base_abi"
- uses: actions/upload-artifact@v2
with:
name: base.inst
path: base
retention-days: 1
build-merge-ref:
runs-on: ubuntu-latest
outputs:
merge_abi: ${{ steps.out.outputs.merge_abi }}
steps:
- name: set PATH
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: prepare required software
run: |
sudo apt install $apt_build_deps
eval "$get_pip_build_deps"
- name: checkout merge ref
uses: actions/checkout@main
with:
path: merge.src
- name: build merge ref
run: |
meson Build.merge merge.src $build_options
ninja -C Build.merge
DESTDIR=$PWD/merge ninja -C Build.merge install
- id: out
run: |
# print versions and abi versions
eval "$getabidef_def"
merge_abi=$(getabidef merge$prefix)
echo merge abi : $merge_abi
./merge$prefix/bin/irssi --version
echo "::set-output name=merge_abi::$merge_abi"
- uses: actions/upload-artifact@v2
with:
name: merge.inst
path: merge
retention-days: 1
check-abi-diff:
runs-on: ubuntu-latest
needs:
- build-merge-ref
- build-base-ref
env:
base_abi: ${{ needs.build-base-ref.outputs.base_abi }}
merge_abi: ${{ needs.build-merge-ref.outputs.merge_abi }}
steps:
- name: prepare required software
run: |
sudo apt install abigail-tools
- name: fetch base build
uses: actions/download-artifact@v2
with:
name: base.inst
path: base
- name: fetch merge build
uses: actions/download-artifact@v2
with:
name: merge.inst
path: merge
- run: |
# abipkgdiff
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@v2
with:
path: abipkgdiff.out
- run: |
# Check if no changes are needed
if [ "$diff_ret" -ne 0 ]; then
if [ "$base_abi" -lt "$merge_abi" ]; then
echo "::warning ::abigail found changes and ABI changed from $base_abi to $merge_abi"
exit 0
else
echo "::error ::Looks like the ABI changed but the IRSSI_ABI_VERSION did not"
exit $diff_ret
fi
else
if [ "$base_abi" -ne "$merge_abi" ]; then
echo "::error ::abigail found no changes yet the IRSSI_ABI_VERSION changed. Is this correct?"
exit 1
else
: "No changes detected and IRSSI_ABI_VERSION untouched"
exit 0
fi
fi

View File

@ -1,101 +0,0 @@
on:
push:
branches:
- master
pull_request:
name: Check Irssi
env:
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
steps:
- name: prepare required software
run: |
sudo apt update && sudo apt install $apt_build_deps
- uses: actions/checkout@main
- name: make dist
run: |
./utils/make-dist.sh
- uses: actions/upload-artifact@v2
with:
path: irssi-*.tar.gz
retention-days: 1
install:
runs-on: ${{ matrix.os }}
env:
CC: ${{ matrix.compiler }}
needs: dist
continue-on-error: ${{ contains(matrix.flags, 'FAILURE-OK') }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-latest]
builder: [meson]
compiler: [clang, gcc]
flags: [regular]
include:
- 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@v2
- 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 $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
- name: build and install with meson
run: |
# ninja install
cd irssi-*/
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
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' > 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

@ -1,51 +0,0 @@
name: CIFuzz
on:
pull_request:
paths:
- 'src/core/**/*.c'
- 'src/fe-common/core/**/*.c'
- 'src/fe-text/gui-*.c'
- 'src/irc/**/*.c'
- 'src/fe-common/irc/**/*.c'
- 'src/lib-config/**/*.c'
- 'src/fe-fuzz/**/*.c'
- 'tests/**/*.c'
- '.github/workflows/cifuzz.yml'
jobs:
Fuzzing:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address, undefined, memory]
steps:
- uses: actions/checkout@main
with:
path: irssi
- name: Docker build build_fuzzers container
run: |
# google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
docker build -t build_fuzzers:actions -f "/home/runner/work/_actions/google/oss-fuzz/master/infra/build_fuzzers.Dockerfile" "/home/runner/work/_actions/google/oss-fuzz/master/infra"
- name: Build Fuzzers (${{ matrix.sanitizer }})
id: build
env:
OSS_FUZZ_PROJECT_NAME: 'irssi'
DRY_RUN: false
SANITIZER: ${{ matrix.sanitizer }}
PROJECT_SRC_PATH: /github/workspace/irssi
REPOSITORY: 'irssi'
run: |
docker run --workdir /github/workspace --rm -e OSS_FUZZ_PROJECT_NAME -e DRY_RUN -e SANITIZER -e PROJECT_SRC_PATH -e REPOSITORY -e WORKSPACE=/github/workspace -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "$GITHUB_WORKSPACE":"/github/workspace" build_fuzzers:actions
- name: Run Fuzzers (${{ matrix.sanitizer }})
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'irssi'
fuzz-seconds: 600
dry-run: false
sanitizer: ${{ matrix.sanitizer }}
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts

View File

@ -1,29 +0,0 @@
on: [pull_request]
name: clang-format
jobs:
check-clang-format:
runs-on: ubuntu-20.04
steps:
- name: install clang-format
run: sudo apt install clang-format-11
- uses: actions/checkout@main
- name: fetch target ref
run:
|
refs=($(git log -1 --format=%s))
git fetch --depth=1 origin "${refs[3]}"
- name: configure clang-format
run:
|
git config clangformat.binary $PWD/utils/clang-format-xs/clang-format-xs
git config clangformat.extensions c,h,xs
- name: run git-clang-format and Check if no changes are needed
run:
|
CLANG_FORMAT=clang-format-11 git-clang-format-11 --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@v1
if: failure()
with:
name: git-clang-format.diff
path: git-clang-format.diff

21
.github/workflows/push.yml vendored Normal file
View File

@ -0,0 +1,21 @@
on: [push]
name: Check Irssi
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: install
uses: irssi-import/actions-irssi/check-irssi@master
with:
args: before_install install
- name: unit_tests
uses: irssi-import/actions-irssi/check-irssi@master
with:
args: unit_tests after_unit_tests
- name: script
uses: irssi-import/actions-irssi/check-irssi@master
env:
TERM: xterm
with:
args: before_script script after_script

View File

@ -1,82 +0,0 @@
on:
push:
branches:
- master
pull_request:
name: Build Irssi Termux package
jobs:
termux-package:
runs-on: ubuntu-latest
steps:
- name: checkout termux-packages
uses: actions/checkout@main
with:
repository: termux/termux-packages
- name: checkout irssi
uses: actions/checkout@main
with:
path: src.irssi.git
- name: download termux docker container
uses: docker://termux/package-builder:latest
- name: build perl package
run: |
./scripts/run-docker.sh ./build-package.sh -i perl
- name: create irssi build receipe
run: |
mkdir packages/irssi-an
cat << 'BUILD_SH' > packages/irssi-an/build.sh
TERMUX_PKG_HOMEPAGE=https://ailin-nemui.github.io/irssi/
TERMUX_PKG_DESCRIPTION="Terminal based IRC client"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@ailin-nemui"
TERMUX_PKG_VERSION=@VERSION@
TERMUX_PKG_REVISION=@REVISION@
TERMUX_PKG_SRCURL=file:///home/builder/termux-packages/src.irssi.git
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_DEPENDS="glib, libandroid-glob, libiconv, libotr, ncurses, openssl, perl, utf8proc"
TERMUX_PKG_BREAKS="irssi"
TERMUX_PKG_REPLACES="irssi"
TERMUX_MESON_PERL_CROSS_FILE=$TERMUX_PKG_TMPDIR/meson-miniperl-cross-$TERMUX_ARCH.txt
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-Dfhs-prefix=$TERMUX_PREFIX
--cross-file $TERMUX_MESON_PERL_CROSS_FILE
"
termux_step_post_configure() {
# Make build log less noisy.
sed -i "s:-I$TERMUX_PREFIX/:-isystem$TERMUX_PREFIX/:g" $TERMUX_PKG_BUILDDIR/build.ninja
}
termux_step_pre_configure() {
LDFLAGS+=" -landroid-glob"
# Make build log less noisy.
CFLAGS+=" -Wno-compound-token-split-by-macro"
# Make sure that perl stuff is reinstalled.
rm -rf $TERMUX_PREFIX/lib/irssi/perl
local perl_version=$(. $TERMUX_SCRIPTDIR/packages/perl/build.sh; echo $TERMUX_PKG_VERSION)
local perl_srcdir=$TERMUX_TOPDIR/perl/src
cat <<MESON_PERL_CROSS >$TERMUX_MESON_PERL_CROSS_FILE
[binaries]
perl = ['$perl_srcdir/miniperl', '-I$TERMUX_PREFIX/lib/perl5/$perl_version/${TERMUX_ARCH}-android', '-I$TERMUX_PREFIX/lib/perl5/$perl_version']
MESON_PERL_CROSS
}
BUILD_SH
version=$(awk '/^v/ { $0=$1; gsub(/^v/,""); gsub(/-head/,"dev"); gsub(/-/,""); print; exit }' src.irssi.git/NEWS)
version=$version+g$(git -C src.irssi.git rev-parse --short HEAD)
sed -i \
-e "s:@VERSION@:$version:" \
-e "s:@REVISION@:$GITHUB_RUN_NUMBER:" \
packages/irssi-an/build.sh
git -C src.irssi.git tag v$version
- name: build irssi package
run: |
./scripts/run-docker.sh ./build-package.sh -I irssi-an
- uses: actions/upload-artifact@v2
with:
name: irssi-termux-pkg
path: output/irssi-an*.deb

5
.gitignore vendored
View File

@ -50,8 +50,6 @@ src/fe-fuzz/crash-*
src/fe-fuzz/oom-*
/core
/irssi-1.pc
/irssi/
/tests/fe-common/core/test-formats
/tests/fe-common/core/test-formats.log
/tests/fe-common/core/test-formats.trs
@ -86,6 +84,3 @@ src/fe-fuzz/oom-*
Build
subprojects/*
!subprojects/*.wrap
Irssi-Dist
setup.cfg
*.egg-info

65
.travis.yml Normal file
View File

@ -0,0 +1,65 @@
sudo: false
dist: xenial
language: perl
perl:
# ~stretch
- "5.24-shrplib"
- "system-perl"
env:
- CC=clang UNITTESTS=false
- CC=gcc UNITTESTS=false
- CC=clang UNITTESTS=true
matrix:
exclude:
- env: CC=clang UNITTESTS=true
perl: "system-perl"
allow_failures:
- env: CC=clang UNITTESTS=true
addons:
apt:
packages:
- libperl-dev
- elinks
- libgcrypt11-dev
- libotr5-dev
before_install:
- perl -V
- pushd ~
- curl -sSLf https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-linux.zip | funzip > bin/ninja
- chmod +x bin/ninja
- curl -sSLf https://github.com/mesonbuild/meson/releases/download/0.51.1/meson-0.51.1.tar.gz | tar xz
- ( cd bin ; ln -s ../meson-*/meson.py meson )
- curl -sSLf https://github.com/irssi-import/glib-travis-build/releases/download/2.58.3/travis-xenial-glib-2.58.3.tar.xz | tar xJ
- export PKG_CONFIG_PATH=$HOME/glib-build/lib/x86_64-linux-gnu/pkgconfig
- export LD_LIBRARY_PATH=$HOME/glib-build/lib/x86_64-linux-gnu
- popd
install:
- meson Build -Dwith-proxy=yes -Dwith-bot=yes -Dwith-perl=yes -Dwith-otr=yes --prefix=$HOME/irssi-build
- ninja -C Build
- ninja -C Build install
before_script:
- pushd ~
- mkdir irssi-test
- echo echo automated irssi launch test > irssi-test/startup;
echo ^set settings_autosave off >> irssi-test/startup;
echo ^set -clear log_close_string >> irssi-test/startup;
echo ^set -clear log_day_changed >> irssi-test/startup;
echo ^set -clear log_open_string >> irssi-test/startup;
echo ^set log_timestamp '* ' >> irssi-test/startup;
echo ^window log on >> irssi-test/startup
- echo load perl >> irssi-test/startup
- echo load proxy >> irssi-test/startup
- echo ^quit >> irssi-test/startup
script:
- irssi-build/bin/irssi --home irssi-test
- popd
- if $UNITTESTS; then ninja -C Build test; fi
after_script:
- cat ~/irc.log.*
- find -name testlog.txt -exec sed -i -e '/Inherited environment:.* TRAVIS/d' {} + -exec cat {} +

94
INSTALL
View File

@ -2,12 +2,12 @@
Irssi installation instructions
-------------------------------
To compile Irssi you need:
To compile irssi you need:
- meson-0.53 build system with ninja-1.8 or greater
- glib-2.32 or greater
- meson-0.49 build system with ninja-1.5 or greater
- glib-2.28 or greater
- openssl (for ssl support)
- perl-5.6 or greater (for Perl support)
- perl-5.6 or greater (for perl support)
- terminfo or ncurses (for text frontend)
For most people, this should work just fine:
@ -17,48 +17,62 @@ For most people, this should work just fine:
su
ninja -C Build install
meson options
For the moment, autotools is also supported:
These options can be given to meson.
./autogen.sh (for people who just cloned the repository)
./configure (if this script already exists, skip ./autogen.sh)
make
su
make install (not _really_ required except for perl support)
configure options
These options can be given to meson or ./configure.
The first syntax is for meson, the 2nd for ./configure
For a complete list of options, run
meson configure
meson configure / ./configure --help
--prefix
Specifies the path where Irssi will be installed.
YES, you can install Irssi WITHOUT ROOT permissions
Specifies the path where irssi will be installed.
YES, you can install irssi WITHOUT ROOT permissions
by using --prefix=/home/dir
-Dwith-proxy=yes
-Dwith-proxy=yes / --with-proxy
Build the Irssi proxy (see startup-HOWTO).
Build the irssi proxy (see startup-HOWTO).
-Dwith-perl=[yes|no]
-Dwith-perl=[yes|no] / --with-perl=[yes|no|module]
Enable Perl support
yes enable builtin (default)
no disable
module enable as module
-Dwith-perl-lib=[site|vendor|DIR]
-Dwith-perl-lib=[site|vendor|DIR] / --with-perl-lib=[site|vendor|DIR]
Specify installation dir for Perl libraries
site install in dir for site-specific modules (default)
vendor install in dir for vendor-specific modules
DIR install in DIR
-Dwith-bot=yes
[N/A] / --with-socks
Build with socks library
-Dwith-bot=yes / --with-bot
Build irssi-bot
-Dwithout-textui=yes
-Dwithout-textui=yes / --without-textui
Build without text frontend
If anything is in non-standard path, you can just give the paths in
the -Dc_args and -Dc_link_args options variable, eg.:
CPPFLAGS and LIBS environment variable, eg.:
meson Build -Dc_args='-I/opt/openssl/include' -Dc_link_args='-L/opt/openssl/lib'
CPPFLAGS=-I/opt/openssl/include LDFLAGS=-L/opt/openssl/lib ./configure
@ -68,43 +82,47 @@ the -Dc_args and -Dc_link_args options variable, eg.:
Perl support generates most of the problems. There's quite a many
things that can go wrong:
- Compiling fails if you compile irssi with GCC in a system that has
perl compiled with some other C compiler. Very common problem with
non-Linux/BSD systems. You'll need to edit src/perl/*/Makefile files
and remove the parameters that gcc doesn't like. Mostly you'll just
need to keep the -I and -D parameters and add -fPIC.
- If there's any weird crashing at startup, you might have older irssi's
perl libraries installed somewhere, and you should remove those.
- If meson complains that it doesn't find some perl stuff, you're
- Dynamic libraries don't want to work with some systems, so if your
system complains about some missing symbol in Irssi.so file, configure
irssi with --with-perl-staticlib option (NOT same as --with-perl=static).
- If configure complains that it doesn't find some perl stuff, you're
probably missing libperl.so or libperl.a. In debian, you'll need to do
apt-get install libperl-dev
- For unprivileged home directory installations, you probably do not want
to specify --with-perl-lib=(site|vendor). Instead, you can use the
default perl installation target (below the irssi prefix). If you are
using local::lib you can also choose to install there by specifying
--with-perl-lib=$PERL_LOCAL_LIB_ROOT/lib/perl5
You can verify that the perl module is loaded and working with "/LOAD"
command. It should print something like:
Module Type Submodules
...
perl dynamic fe core
perl static core fe
System specific notes
---------------------
Android
When cross compiling Irssi for Android, you can specify the path of
the cross-perl in the cross file.
You may not have a cross-perl available. In that case, you will have
to manually supply the required Perl arguments in the cross file. See
the commented properties in the example cross file.
An example cross file can be found in the docs folder. To use it, you
would call:
meson Build --cross-file cross-android-aarch64.txt \
--prefix /data/data/com.termux/files/usr \
--libdir lib \
-Dfhs-prefix=/data/data/com.termux/files/usr \
Cygwin
Getting perl scripting to work needs a few things:
- TODO
- configure with --with-perl-staticlib
- libperl.dll is required in linking and running irssi, it's normally
located somewhere around /usr/lib/perl5/5.6.1/cygwin/CORE/libperl5_6_1.dll
copy it to eg. /usr/bin/libperl.dll
- -DUSEIMPORTLIB is needed to be defined while compiling src/perl directory.
It doesn't hurt to be defined everywhere, so configure irssi with:
CFLAGS='-DUSEIMPORTLIB' ./configure --with-perl-staticlib

View File

@ -1,35 +0,0 @@
global-include meson.build
recursive-include src *.c *.h meson.build
recursive-include src/perl *.c *.h *.xs *.pm *.pl typemap meson.build
recursive-include src/fe-fuzz *.c *.h *.txt meson.build
recursive-include tests *.c meson.build
include meson_options.txt
include subprojects/*.wrap
# prune subprojects/*
include utils/*.pl utils/*.sh
exclude utils/make-dist.sh
include irssi.conf
include themes/*.theme
include docs/*.1 docs/*.txt docs/*.html
include docs/help/in/[a-z]*.in
include scripts/*.pl scripts/examples/*.pl
include irssi-icon.png
include NEWS
include INSTALL
include TODO
include ChangeLog
include .clang-format
# prune Build
# prune dist
prune *.egg-info
# ignore fuzz-support/fuzz.diff
# ignore utils/clang-format-xs/*

33
Makefile.am Normal file
View File

@ -0,0 +1,33 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
# create default-config.h
BUILT_SOURCES = default-config.h default-theme.h irssi-version.h
CLEANFILES = default-config.h default-theme.h
@MAINTAINER_MODE_TRUE@.PHONY: irssi-version.h
default-config.h: $(srcdir)/irssi.conf
$(srcdir)/utils/file2header.sh $(srcdir)/irssi.conf default_config > default-config.h
default-theme.h: $(srcdir)/themes/default.theme
$(srcdir)/utils/file2header.sh $(srcdir)/themes/default.theme default_theme > default-theme.h
irssi-version.h:
VERSION="$(VERSION)" $(srcdir)/utils/irssi-version.sh $(srcdir) | \
cmp -s - $@ || VERSION="$(VERSION)" $(srcdir)/utils/irssi-version.sh $(srcdir) >$@
SUBDIRS = src tests docs scripts themes utils
confdir = $(sysconfdir)
conf_DATA = irssi.conf
pkgconfig_DATA = irssi-1.pc
pkginclude_HEADERS = irssi-config.h irssi-version.h
EXTRA_DIST = \
ChangeLog \
autogen.sh \
README.md \
$(conf_DATA) \
irssi-icon.png

332
NEWS
View File

@ -1,336 +1,8 @@
v1.4-head-an 2022-xx-xx Ailin Nemui <Nei>
v1.3.2-an 2022-01-14 Ailin Nemui <Nei>
- CHANTYPES take precedence over (missing) STATUSMSG in /join
(#1358, an#54)
- Fix crash in Perl's $view->set_bookmark (freebsd#254237,
an#56)
v1.3.1-an 2021-12-17 Ailin Nemui <Nei>
- Minor help fixes (an#51, an#52)
- Fix regression where own channel status was forgotten after
/UPGRADE (#1357, an#53)
v1.3.0-an 2021-11-11 Ailin Nemui <Nei>
* /SET resolve_reverse_lookup setting was removed (#1034,
#1135)
* Irssi will try to connect on IPv4 if IPv6 connection failed
(#1146). By Shivaram Lingamneni
* The display system now renders formats on the fly (#1079,
#1188, #1191, #1192, #1204, #1205, #1209, #1349, #1355,
an#13, an#14, an#28, an#29, an#36, an#37, an#49)
This major change will break scripts that try to modify
printed text during "print text" signal (#1189). They need
to be ported to modify the text during "print format"
instead. It also breaks the usage of using /FORMAT to add
different colours to a line. Such usage needs to be ported
to using $expando variables instead. Affected scripts
include format_identify.pl, friends_peder.pl, nickcolor.pl,
nm.pl, people.pl
The "gui print text finished" and "gui print text after
finished" signals gained a TEXT_DEST_REC *parameter in the
process.
A new "gui render line text" signal is available to change
the rendering of a line
* made the $Z expando (time) dynamic (#1087, #1207, #1208)
This change breaks the usage of /SET timestamp_format to
supply a custom displayed time stamp. Affected scripts
include binary_time.pl
* /HILIGHT -priority now affects which hilight rule gets
applied (#1228, #1232)
* The NAMES list is now hidden by default if there are more
than 18 users on the channel (an#7)
To revert to the previous behaviour
/SET show_names_on_join_limit -1
* -tls_verify is now enabled by default (#1170, an#18, #1309,
an#23, #1343, #1351)
This may cause an ugly display of notls_verify in the output
of /SERVER LIST, even on plain-text connection, on old
configs. Kindly remove the "tls_verify = "no";" entries from
your config file manually.
* Irssi will now attempt STARTTLS if advertised (#1170, #1312,
an#19)
Use -disallow_starttls if you absolutely do not want this
In order to check for a STARTTLS advertisement, Irssi will
now wait for a response (even an error) to CAP LS 302. If
your bouncer/server does not want to communicate before
receiving USER/PASS at all, use -nocap to disable the CAP
check.
* Channel sync requests (WHO, MODE) are now sent "later" than
user commands. This should improve responsiveness to user
commands in the autojoin phase (an#26, an#32, an#33)
* Irssi is now using full paths in #include directives and
consequently does not add all directories to the include
path anymore (#1040)
* The Build System was ported to Meson (#1064, #1065, #1068,
#1071, #1072, #1073, #1074, #1075, #1084, #1085, #1118, #1166,
#1223, #1224, #1245, #1313, #1314, an#31)
* Scriptassist was changed to use a YAML database (#1163)
It will tell you when you need to update your setting
* /BIND shows all partial matches (#1155)
* Cleanup of unused functions (#1017, #1132, #1145, #1182,
#1246, #1264)
Functions removed:
NET_CALLBACK
NET_HOST_CALLBACK
RESOLVED_NAME_REC
net_gethostbyaddr_nonblock
net_connect_nonblock
[ SIMPLE_THREAD_REC, simple_init, simple_readpipe ]
hash_save_key
Functions deprecated:
dec2octal
g_timeval_cmp
get_timeval_diff
Function names corrected:
g_input -> i_input
g_istr -> i_istr
g_io_channel -> i_io_channel
g_hash_free_value -> i_hash_free_value
remove g_free_true
gslist -> i_slist
glog_func -> i_log_func
glist -> i_list
If multi-version compatibility is desired, module authors
can find an example of backwards compatible code in
cdidier/irssi-xmpp#55
+ Add MSGLEVEL_HIDDEN to Perl (#1044)
+ Add $view->set_hidden_level and $view->remove_lines_by_level
to Perl (#1026)
+ Add a /SET scrollback_max_age setting (#1022). By Heikki
Orsila
+ Add /SET actlist_prefer_window_name (#1025)
+ Add -window option to /CAT (#1023, #1159)
+ Add an option to list specific sections with
/SET -section lookandfeel
(#1048)
+ Add support for IRCv3 CAP LS 302 (#1091)
+ Add a new "print noformat" signal that goes together with
"print format" (#1088, #1192)
+ Add support for IRCv3 extended-join. /SET show_extended_join
to enable (#1097, #1107, #1124)
There are two new /FORMATs, join_extended and
join_extended_account, that theme writers need to take into
account if desired.
+ Add support for IRCv3 setname (#1093, #1104, #1254, GL#33)
+ Add support for IRCv3 account-notify (#1100, #1098, GL#33,
#1105, #1131). Credit to oss-fuzz
/SET show_account_notify to enable
+ Add support for IRCv3 invite-notify (#1094)
+ Add support for receiving IRCv3 message-tags (#576, #1090)
+ Add support for sending IRCv3 message-tags (#1092, an#34)
+ Enable the znc.in/self-message CAP by default (#1123)
+ Add support for IRCv3 away-notify. /SET away_notify_public
to enable (#1099, GL#33, #1105)
+ Add support for IRCv3 chghost (#1096, GL#33, #1105)
For servers with broken chghost implementation that fill the
status window with host changed messages, one may add "quote
cap req -chghost" to the -autosendcmd or, if the host change
messages are entirely undesired, "/format -delete
host_changed"
+ Add support for IRCv3 server-time. /SET show_server_time to
enable (#1108)
+ Add support for logging IRCv3 server-time.
/SET log_server_time to disable (#1318, an#16)
+ Add IRCv3 features to signals.txt (#1111)
In particular, "message join" now takes 2 additional
arguments, script and module authors must beware of this
change.
+ Show the unignore time in /IGNORE output (#1158, #1161)
+ Add /SET quit_on_hup to make the behaviour of SIGHUP
configurable (#828, #1169). By Pinguin1234
+ Support numeric 489 as ERR_SECUREONLYCHAN (#1193, #1196). By
Michael Hansen
+ Improve support for building Irssi in Termux-Android with
Meson (#1199)
+ Add usermode key to Irssi::Irc::Chatnet in Perl (#1288). By
Jessica Sophie Porter
+ Add format_string_expand and format_string_unexpand
functions to Perl (#1286)
+ Add ...->format_create_dest(...)->printformat("format",
args...) and ...->printformat_module("module", "format",
args...) methods to Perl (#1284)
You can avoid any CORE::GLOBAL::caller hacks using the
printformat_module method, especially sind that hack was not
safe during signal emissions
+ Add tracking of user accounts in the channel nicklist using
WHOX on join (#1250)
+ Add auto-loading of the Perl and otr module from /SET
autoload_modules (#1295)
+ Add /IGNORE ... NOHILIGHT to ignore some hilights (#1260)
+ Do not beep on hidden lines with /SET beep_msg_level
... -HIDDEN (#1259)
+ Added /CS, /MS, /NS, and /OS aliases to the default config
(#1316). By Mathis Beer
+ Allow -tls_ca{file,path} '' to unset an argument (#730,
#1060, an#30)
+ Add a "server outgoing modify" signal to intercept outgoing
messages (#1148, #1151, an#15, an#43). Original by
JustAnotherArchivist
- remove some hard-coded 510 byte assumptions (#1086)
- Several fixes for error checks in SSL (#944, #1037, #943,
#1036). Reported by Chi Li
- Wrong variable tested in mask_match (#902, #1035)
- Fix bug where irssi-proxy with `?'-port would not reconnect
(#1041)
- Allow shrinking of /SET rawlog_lines (#957, #1020). By
Marcus "Teschi" Prinz
- Fix /WINDOW BALANCE warning (#1054)
- fix overflow when first command history entry expires
(#1070)
- begin modularising IRC module (#1067, #1112, #1113)
- fix some memory leaks in /DCC RESUME and settings_add
(#1077). By Zero King
- fix cut-off text with theme_indent module and /SET
indent_always OFF (#1078)
- fix the cap_queue order (#1095)
- add reference counted strings (#1089)
- Fix irc_op_public messages not triggering hilights (#354,
#891, #1129). By Dan Collins
- Fix /IGNORE not setting the right level in irc_op_public
messages (#1280). Credit to oss-fuzz
- Fix GTimeVal deprecation (#1141, #1144, #1145, #1350, an#44)
If multi-version compatibility is desired, module authors
can find an example of backwards compatible code in
cdidier/irssi-xmpp#53
- Fix /IGNORE ... MODES NO_ACT not working (#1164)
- Deprecated -ssl* options are hidden from tab completion
(#1171)
- Make /SET actlist_sort a choice type (#1198)
- Fix crash from self-unloading script (#1206). By Thomas
Stagner
- Fix crash during Perl signal emission (#1233, #1234)
- Fix a case where empty lines or comments inside channels or
servers in the config would confuse Irssi (#1062, #1242,
#1243)
- Fix reported freezing in DCC GET on slow disks (#159, #1271)
- Fix message-tags parsing (#1274, #1275). Credit to oss-fuzz
- Fail redirects when receiving numeric 263 (RPL_TRYAGAIN) in
response to /WHO (#1283)
- Some updates to .gitignore (#1302). By Rene Kita
- Fix build on operating systems with X/Open Curses, version 2
(#1305, #1308). By Nia Alarie (Regression introduced with
#1290, alternative fix for Irssi 1.2.3 no-term.h.patch)
- Fix otr module not using g_strndup, e.g. on Solaris 10
(#1315). By Claes Nästén
- Fix cursor getting stuck for auto completions that changes
case (#1176, #1322, an#8). By ffrogman
- Restore operation of tag/* in /SET activity_hide_targets
(#1337, an#11) nb. the ::all syntax was working in Irssi 1.1
and 1.2 (and continues to work)
- Fix /SERVER ADD -matrix -network my_matrix_network
(an#12). By Andrej Kacian
- Fix /SERVER ADD creating duplicated entries in the config
file (#1317, an#22, an#41)
- Fix critical when SASL user is set and SASL password is
empty (#1325, an#21)
- Misc fixes (#1106, #1141, #1272, #1297, an#35)
- Fuzz fixes (#1116, #1117, #1119, #1125, #1126, an#20)
- Build system fixes (#1101, #1102, #1069, #1140, #1181, #1253)
- Sync docs and scripts (an#39)
- Text and Help updates
- add -tls_* options to manual (#1029, #1030). By Jacob
V. Rasmussen
- missing targets in /MSG (#1032)
- wrong parameter in /ECHO (#1024)
- Spelling in OTR (#1047). By David Gall
- Clarify statusbar priority (#1049). By Marius Gedminas
- Document get_irssi_dir in Perl (#1051, #1052). By Alex
Shafer
- typo in /HILIGHT help (#1081). By DFrostByte
- improved clarity of your_nick_owned (#1138). By Mike Quin
- Update some URLs to https (#1163)
- Add documentation for escaping some characters (#1329,
#1330, an#9). By Guntbert Reiter
- Fix some typos (#1336, an#10). By Francis Mteo
- Document $abiversion and parse_special (an#38). By bw1
- Infrastructure updates:
- Support for Github Actions (#1039, #1103, #1160, #1212,
#1231, #1252, #1261, an#40)
- Run clang-format on pull requests (#1172, #1173, #1184,
#1230, #1247, #1287)
- Run abidiff on pull requests (#1179, #1195)
- Test CI-Fuzz (#1279, #1304, an#17)
v1.2.3 2021-04-11 The Irssi team <staff@irssi.org>
- Fix the compilation of utf8proc (#1021)
- Fix wrong call to free. By Zero King (#1076)
- Fix a colour reset in true colour themes when encountering
mIRC colours (#1059)
- Fix memory leak on malformed CAP requests (#1120)
- Fix an erroneous free of SASL data. Credit to Oss-Fuzz (#1128,
#1130)
- Re-set the TLS flag when reconnecting (#1027, #1134)
- Fix the scrollback getting stuck after /clear (#1115, #1136)
- Fix the input of Ctrl+C as the first character (#1153, #1154)
- Fix crash on quit during unloading of modules on certain
platforms (#1167)
- Fix Irssi freezing input after Ctrl+Space on GLib >2.62 (#1180,
#1183)
- Fix layout of IDCHANs. By Lauri Tirkkonen (#1197)
- Fix crash when server got reconnected before it was properly
connected (#1210, #1211)
- Fix multiple identical active caps (#1249)
- Minor help corrections (#1156, #1213, #1214, #1255)
- Remove erroneous colour in the colorless theme. Reported and
fixed by Nutchanon Wetchasit (#1220, #1221)
- Fix invalid bounds calculation when editing the text
entry. Found and fixed by Sergey Valentey (#1269)
- Fix passing of negative size in buffer writes. Found and
fixed by Sergey Valentey (#1270)
- Fix Irssi freezing on slow hardware and fast DCC transfers (#159,
#1271)
- Fix compilation on Solaris (#1291)
- Fix null pointer dereference when receiving broken JOIN
record. Credit to Oss-Fuzz (#1292)
- Fix crash on /connect to some sockets (#1239, #1298)
- Fix Irssi rendering on Apple ARM. By Misty De Méo (#1267,
#1268, #1290)
- Fix crash on /lastlog with broken lines (#1281, #1299)
- Fix memory leak when receiving bogus SASL authentication
data. Found and fixed by Sergey Valentey (#1293)
v1.3-head 2019-xx-xx The Irssi team <staff@irssi.org>
v1.2.2 2019-08-29 The Irssi team <staff@irssi.org>
- Fix a use after free issue when receiving IRCv3 CAP
information from the server (GL#34, GL!35)
information from the server (GL#34)
- Fix a crash during startup when windows weren't fully
initialised yet (#1114, bdo#935813)

View File

@ -1,26 +1,27 @@
# Neırssi
# [Irssi](https://irssi.org/)
![Build Status](https://github.com/ailin-nemui/irssi/workflows/Check%20Irssi/badge.svg?branch=master)
[![Build Status](https://travis-ci.org/irssi/irssi.svg?branch=master)](https://travis-ci.org/irssi/irssi)
Neırssi is a modular text mode chat client mostly compatible with
[Irssi](https://irssi.org). It comes with IRC support built in, and
there are third party [ICB](https://github.com/jperkin/irssi-icb),
Irssi is a modular chat client that is most commonly known for its
text mode user interface, but 80% of the code isn't text mode
specific. Irssi comes with IRC support built in, and there are
third party [ICB](https://github.com/jperkin/irssi-icb),
[SILC](http://www.silcnet.org/),
[XMPP](http://cybione.org/~irssi-xmpp/) (Jabber),
[PSYC](http://about.psyc.eu/Irssyc) and
[Quassel](https://github.com/phhusson/quassel-irssi) protocol modules
available.
![irssi](https://user-images.githubusercontent.com/5665186/154820868-50c35841-04f4-4f4c-8df9-dd5aa4bbcde8.png)
![irssi](https://user-images.githubusercontent.com/5665186/32180643-cf127f60-bd92-11e7-8aa2-882313ce1d8e.png)
## [Download information](https://ailin-nemui.github.io/irssi/Getting.html)
## [Download information](https://irssi.org/download/)
#### Development source installation
[Ninja](https://ninja-build.org/) 1.8 and [Meson](https://mesonbuild.com/) 0.53
[Ninja](https://ninja-build.org/) 1.5 and [Meson](https://mesonbuild.com/) 0.49
```
git clone https://github.com/ailin-nemui/irssi
git clone https://github.com/irssi/irssi
cd irssi
meson Build
ninja -C Build && sudo ninja -C Build install
@ -28,41 +29,41 @@ ninja -C Build && sudo ninja -C Build install
#### Release source installation
* Download [release](https://github.com/ailin-nemui/irssi/releases)
* Verify signature
* Download [release](https://github.com/irssi/irssi/releases)
* [Verify](https://irssi.org/download/#release-sources) signature
```
tar xJf irssi-*.tar.xz
cd irssi-*
meson Build
ninja -C Build && sudo ninja -C Build install
./configure
make && sudo make install
```
### Requirements
- [glib-2.32](https://wiki.gnome.org/Projects/GLib) or greater
- [glib-2.28](https://wiki.gnome.org/Projects/GLib) or greater
- [openssl](https://www.openssl.org/)
- [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
## Documentation
## [Documentation](https://irssi.org/documentation/)
* [New users guide](https://ailin-nemui.github.io/irssi/New-users.html)
* [Frequently Asked Questions](https://irssi.org/documentation/faq)
* [Startup How-To](https://irssi.org/documentation/startup)
* Check the built-in `/HELP`, it has all the details on command syntax
* Other random Irssi documentation on https://irssi.org/documentation/
## [Themes](https://irssi-import.github.io/themes/)
## [Scripts](https://scripts.irssi.org/)
## [Modules](https://ailin-nemui.github.io/irssi/Modules.html)
## [Modules](https://irssi.org/modules/)
## [Security information](https://irssi.org/security/)
Please report security issues to staff@irssi.org. Thanks!
## [Bugs](https://github.com/irssi/irssi/issues) / Suggestions / Contributing
## [Bugs](https://github.com/irssi/irssi/issues) / Suggestions / [Contributing](https://irssi.org/development/)
Check the GitHub issues if it is already listed in there; if not, open
an issue on GitHub or send a mail to [staff@irssi.org](mailto:staff@irssi.org).
@ -71,4 +72,4 @@ Irssi is always looking for developers. Feel free to submit patches through
GitHub pull requests.
You can also contact the Irssi developers in
[#irssi](https://irssi.org/support/irc/) on irc.libera.chat.
[#irssi](https://irssi.org/support/irc/) on freenode.

67
autogen.sh Executable file
View File

@ -0,0 +1,67 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
PKG_NAME="Irssi"
srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.
mydir=`pwd`
if test ! -f "$srcdir"/configure.ac; then
echo -n "**Error**: Directory \`$srcdir' does not look like the"
echo " top-level $PKG_NAME directory"
exit 1
fi
cd "$srcdir"
# create help files
echo "Creating help files..."
perl utils/syntax.pl
echo "Creating ChangeLog..."
git log > ChangeLog
if test "$?" -ne 0; then
echo "**Error**: ${PKG_NAME} Autogen must be run in a git clone, cannot proceed."
exit 1
fi
files=`echo docs/help/in/*.in|sed -e 's,docs/help/in/Makefile.in ,,' -e 's,docs/help/in/,!,g' -e 's/\.in /.in ?/g'`
cat docs/help/in/Makefile.am.gen|sed "s/@HELPFILES@/$files/g"|sed 's/?/\\?/g'|tr '!?' '\t\n' > docs/help/in/Makefile.am
files=`echo $files|sed 's/\.in//g'`
cat docs/help/Makefile.am.gen|sed "s/@HELPFILES@/$files/g"|sed 's/?/\\?/g'|tr '!?' '\t\n' > docs/help/Makefile.am
if test x$NOCONFIGURE = x && test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
rm -f aclocal.m4
echo "Running autoreconf ..."
autoreconf -i || exit $?
# make sure perl hashes have correct length
find src/perl -name '*.c' -o -name '*.xs' -exec grep -n hv_store {} + | perl -l -ne 'if (/"(\w+)",\s*(\d+)/ && $2 != length $1) { $X=1; print "Incorrect key length in $_" } END { exit $X }'
cd "$mydir"
conf_flags="--enable-maintainer-mode"
if test x$NOCONFIGURE = x; then
echo Running "$srcdir"/configure $conf_flags "$@" ...
"$srcdir"/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
else
echo Skipping configure process.
fi
if grep -q '==\|\[\[' "$srcdir"/build-aux/test-driver; then
echo
echo "************************************************************************"
echo "**Warning**: your build is not portable, please do not make dist"
echo " see https://bugzilla.opensuse.org/show_bug.cgi?id=1076146"
echo "************************************************************************"
fi

816
configure.ac Normal file
View File

@ -0,0 +1,816 @@
AC_INIT(irssi, 1.3-head)
AC_CONFIG_SRCDIR([src])
AC_CONFIG_AUX_DIR(build-aux)
AC_PREREQ(2.50)
AC_CONFIG_HEADERS([irssi-config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 no-define foreign subdir-objects])
AM_SILENT_RULES([yes])
AM_MAINTAINER_MODE
AC_PROG_CC
AC_PROG_CPP
AM_PROG_LIBTOOL
AC_PATH_PROG(sedpath, sed)
AC_PATH_PROG(perlpath, perl)
PKG_INSTALLDIR
AC_CHECK_HEADERS(unistd.h dirent.h sys/ioctl.h sys/resource.h)
# check posix headers..
AC_CHECK_HEADERS(sys/socket.h sys/time.h sys/utsname.h)
AC_SYS_LARGEFILE
AC_ARG_WITH(socks,
[ --with-socks Build with socks support],
if test x$withval = xno; then
want_socks=no
else
want_socks=yes
fi,
want_socks=no)
AC_ARG_WITH(textui,
[ --without-textui Build without text frontend],
if test x$withval = xno; then
want_textui=no
else
want_textui=yes
fi,
want_textui=yes)
AC_ARG_WITH(bot,
[ --with-bot Build irssi-bot],
if test x$withval = xno; then
want_irssibot=no
else
want_irssibot=yes
fi,
want_irssibot=no)
AC_ARG_WITH(fuzzer,
[ --with-fuzzer Build irssi-fuzzer],
if test x$withval = xno; then
want_irssifuzzer=no
else
want_irssifuzzer=yes
fi,
want_irssifuzzer=no)
AC_ARG_WITH(fuzzer-lib,
[ --with-fuzzer-lib Specify path to fuzzer library],
fuzzerlibpath="$withval")
AC_ARG_WITH(proxy,
[ --with-proxy Build irssi-proxy],
if test x$withval = xno; then
want_irssiproxy=no
else
want_irssiproxy=yes
fi,
want_irssiproxy=no)
AC_ARG_WITH(modules,
[ --with-modules Specify what modules to build in binary],
if test x$withval != xyes -a x$withval != xno; then
build_modules="$withval"
fi)
if test "x$prefix" != "xNONE"; then
prefix=`eval echo $prefix`
PERL_MM_PARAMS="INSTALLDIRS=perl INSTALL_BASE=$prefix"
perl_set_use_lib=yes
perl_prefix_note=yes
fi
AC_ARG_WITH(perl-staticlib,
[ --with-perl-staticlib Specify that we want to link perl libraries
statically in irssi, default is no],
if test x$withval = xno; then
want_staticperllib=no
else
want_staticperllib=yes
fi,
want_staticperllib=no)
AC_ARG_WITH(perl-lib,
[ --with-perl-lib=[perl|site|vendor|DIR] Specify where to install the
Perl libraries for irssi, default is site],
if test "x$withval" = xyes; then
want_perl=yes
elif test "x$withval" = xno; then
want_perl=no
elif test "x$withval" = xperl; then
want_perl=yes
perl_prefix_note=no
PERL_MM_PARAMS="INSTALLDIRS=perl"
perl_set_use_lib=no
elif test "x$withval" = xsite; then
want_perl=yes
perl_prefix_note=no
PERL_MM_PARAMS=""
perl_set_use_lib=no
elif test "x$withval" = xvendor; then
want_perl=yes
perl_prefix_note=no
if test -z "`$perlpath -v|grep '5\.0'`"; then
PERL_MM_PARAMS="INSTALLDIRS=vendor"
else
PERL_MM_PARAMS="INSTALLDIRS=perl PREFIX=`$perlpath -e 'use Config; print $Config{prefix}'`"
fi
perl_set_use_lib=no
else
want_perl=yes
perl_prefix_note=no
PERL_MM_PARAMS="INSTALLDIRS=perl LIB=$withval"
perl_set_use_lib=yes
fi,
want_perl=yes)
AC_ARG_WITH(perl,
[ --with-perl[=yes|no|module] Build with Perl support - also specifies
if it should be built into main irssi binary
(static, default) or as module],
if test x$withval = xyes; then
want_perl=static
elif test x$withval = xstatic; then
want_perl=static
elif test x$withval = xmodule; then
want_perl=module
else
want_perl=no
fi,
want_perl=static)
AC_ARG_WITH(otr,
[ --with-otr[=yes|no|static] Build with OTR support - also specifies
if it should be built into the main irssi
binary (static) or as a module (default)],
if test x$withval = xyes; then
want_otr=module
elif test x$withval = xstatic; then
want_otr=static
elif test x$withval = xmodule; then
want_otr=module
else
want_otr=no
fi,
want_otr=no)
AC_ARG_ENABLE(true-color,
[ --enable-true-color Build with true color support in terminal],
if test x$enableval = xno ; then
want_truecolor=no
else
want_truecolor=yes
fi,
want_truecolor=no)
AC_ARG_ENABLE(gregex,
[ --disable-gregex Build without GRegex (fall back to regex.h)],
if test x$enableval = xno ; then
want_gregex=no
else
want_gregex=yes
fi,
want_gregex=yes)
AC_ARG_ENABLE(utf8proc,
[ --disable-utf8proc Build without Julia's utf8proc],
if test x$enableval = xno ; then
want_utf8proc=no
else
want_utf8proc=yes
fi,
want_utf8proc=yes)
AC_ARG_WITH(capsicum,
[ --with-capsicum Build with Capsicum support],
if test x$withval = xno; then
want_capsicum=no
else
want_capsicum=yes
fi,
want_capsicum=yes)
dnl **
dnl ** just some generic stuff...
dnl **
dnl * OS specific options
case "$host_os" in
hpux*)
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
;;
*)
;;
esac
AC_SEARCH_LIBS([socket], [network socket])
AC_SEARCH_LIBS([inet_addr], [nsl])
dnl * gcc specific options
if test "x$ac_cv_prog_gcc" = "xyes"; then
CFLAGS="$CFLAGS -Wall"
fi
AC_CHECK_TYPE(socklen_t, ,
[AC_DEFINE([socklen_t], [int], [Define to 'int' if <sys/socket.h> doesn't define.])], [
AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
#endif
])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(off_t)
if test $ac_cv_sizeof_off_t = 8; then
offt_64bit=yes
else
offt_64bit=no
fi
dnl **
dnl ** check for socks
dnl **
if test "x$want_socks" = "xyes"; then
AC_CHECK_LIB(socks, connect, [
AC_DEFINE(HAVE_SOCKS,, Build with socks support)
LIBS="$LIBS -lsocks"
AC_CHECK_HEADER(socks.h, [
AC_DEFINE(HAVE_SOCKS_H)
CFLAGS="$CFLAGS -DSOCKS"
AC_MSG_RESULT(["socks5 library found, building with it"])
], [
AC_MSG_RESULT(["socks4 library found, building with it"])
CFLAGS="$CFLAGS -Dconnect=Rconnect -Dgetsockname=Rgetsockname -Dgetpeername=Rgetpeername -Dbind=Rbind -Daccept=Raccept -Dlisten=Rlisten -Dselect=Rselect"
])
])
fi
dnl **
dnl ** fe-text checks
dnl **
for try in 1 2; do
if test $try = 1; then
glib_modules=gmodule
else
echo "*** trying without -lgmodule"
glib_modules=
fi
AM_PATH_GLIB_2_0(2.28.0,,, $glib_modules)
if test "$GLIB_LIBS"; then
if test $glib_modules = gmodule; then
AC_DEFINE(HAVE_GMODULE)
have_gmodule=yes
fi
break
fi
done
if test -z "$GLIB_LIBS"; then
echo
echo "*** If you don't have GLIB, you can get it from ftp://ftp.gtk.org/pub/glib/"
echo "*** We recommend you get the latest stable GLIB 2 version."
echo "*** Compile and install it, and make sure pkg-config finds it,"
echo "*** by adding the path where the .pc file is located to PKG_CONFIG_PATH"
echo -n "*** Or alternatively install your distribution's package"
if test -f /etc/debian_version; then
echo :
echo "*** sudo apt-get install libglib2.0-dev"
elif test -f /etc/redhat-release; then
echo " (glib2-devel)"
else
echo .
fi
echo
AC_ERROR([GLIB is required to build irssi.])
fi
LIBS="$LIBS $GLIB_LIBS"
GLIB_TESTS
dnl **
dnl ** OpenSSL checks
dnl **
PKG_CHECK_MODULES([OPENSSL], [openssl], [
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
LIBS="$LIBS $OPENSSL_LIBS"
], [
AC_CHECK_LIB([ssl], [SSL_library_init], [
LIBS="$LIBS -lssl -lcrypto"
], [
AC_MSG_ERROR([The OpenSSL library was not found])
])
])
dnl **
dnl ** utf8proc
dnl **
if test "x$want_utf8proc" != "xno"; then
AC_CHECK_HEADER([utf8proc.h], [
AC_CHECK_LIB([utf8proc], [utf8proc_version], [
want_utf8proc=yes
AC_DEFINE(HAVE_LIBUTF8PROC,, [Define to 1 if you have the `utf8proc' library (-lutf8proc).])
LIBS="$LIBS -lutf8proc"
], [
want_utf8proc="no, library not found"
])
], [
want_utf8proc="no, library header not found"
])
fi
dnl **
dnl ** curses checks
dnl **
if test "x$want_textui" != "xno"; then
TEXTUI_NO_LIBS="$LIBS"
LIBS=
AC_SEARCH_LIBS([setupterm], [tinfo ncursesw ncurses terminfo], [want_textui=yes], [
AC_ERROR(Terminfo not found - install libncurses-dev or ncurses-devel package)
want_textui="no, Terminfo not found"
])
TEXTUI_LIBS="$LIBS"
AC_SUBST(TEXTUI_LIBS)
LIBS="$TEXTUI_NO_LIBS"
fi
dnl **
dnl ** irssifuzzer checks
dnl **
if test "$want_irssifuzzer" != "no"; then
dnl * we need to build with -fsanitize-coverage=trace-pc-guard
dnl * otherwise fuzzer won't be very successful at finding bugs :)
if test -z "$SANFLAGS"; then
SANFLAGS="-g -fsanitize=address -fsanitize-coverage=trace-pc-guard"
fi
CFLAGS="$CFLAGS $SANFLAGS"
CXXFLAGS="$CXXFLAGS $SANFLAGS"
AC_MSG_CHECKING(for fuzzer library)
if test -z "$fuzzerlibpath"; then
AC_MSG_RESULT([not found, building without fuzzer front end])
want_irssifuzzer=no
else
FUZZER_LIBS="$fuzzerlibpath"
AC_SUBST(FUZZER_LIBS)
fi
fi
dnl **
dnl ** perl checks
dnl **
if test "$want_perl" != "no"; then
AC_MSG_CHECKING(for working Perl support)
if test -z "$perlpath"; then
perl_check_error="perl binary not found"
else
PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
fi
if test "x$ac_cv_prog_gcc" = "xyes" -a -z "`echo $host_os|grep 'bsd\|linux'`"; then
dnl * several systems have Perl compiled with native compiler
dnl * but irssi is being compiled with GCC. Here we try to
dnl * fix those command line options a bit so GCC won't
dnl * complain about them. Normally there's only few options
dnl * that we want to keep:
dnl * -Ddefine -Uundef -I/path -fopt -mopt -iwithsysroot
PERL_CFLAGS=`echo $PERL_CFLAGS | $perlpath -pe 's/^(.* )?-@<:@^DUIifm@:>@@<:@^ @:>@+/\1/g; s/^(.* )?\+@<:@^ @:>@+/\1/g'`
PERL_EXTRA_OPTS="CCCDLFLAGS=\"-fPIC\""
AC_SUBST(PERL_EXTRA_OPTS)
fi
if test -z "$PERL_CFLAGS"; then
if test -n "$perl_check_error"; then
perl_check_error="Error getting perl CFLAGS"
fi
AC_MSG_RESULT([not found, building without Perl])
want_perl=no
else
PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts 2>/dev/null`
dnl * remove all database stuffs
dnl * nsl is already in ldflags
dnl * libc is of course linked without needing -lc
dnl * -rdynamic must not be in LIBADD line
for word in -ldb -ldbm -lndbm -lgdbm -lc -rdynamic; do
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e "s/$word //" -e "s/$word$//"`
done
case "$host_os" in
linux*)
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-lposix //' -e 's/-lposix$//'`
;;
hpux*)
if test "x$ac_cv_prog_gcc" = "xyes"; then
PERL_CFLAGS=`echo $PERL_CFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
PERL_LDFLAGS=`echo $PERL_LDFLAGS | $sedpath -e 's/-Ae //' -e 's/-Ae$//'`
fi
;;
*)
;;
esac
dnl * check that perl's ldflags actually work
echo "#include <EXTERN.h>" > conftest.c
echo "#include <perl.h>" >> conftest.c
echo "int main(){perl_alloc(); return 0;}" >> conftest.c
$CC $CFLAGS $PERL_CFLAGS conftest.c -o conftest $LDFLAGS $PERL_LDFLAGS 2> perl.error.tmp > /dev/null
if test ! -s conftest -a "x$ignore_perl_errors" = "x"; then
perl_check_error="Error linking with perl libraries: $PERL_LDFLAGS: `cat perl.error.tmp`"
AC_MSG_RESULT([error linking with perl libraries, building without Perl])
want_perl=no
fi
rm -f perl.error.tmp
fi
if test "x$want_perl" != "xno"; then
AC_MSG_RESULT(ok)
if test "x$want_perl" = "xstatic"; then
dnl * building with static perl support
dnl * all PERL_LDFLAGS linking is done in fe-text
PERL_LINK_FLAGS="$PERL_LDFLAGS"
PERL_LINK_LIBS="../perl/libperl_core_static.la"
PERL_FE_LINK_LIBS="../perl/libfe_perl_static.la"
PERL_LDFLAGS=
AC_DEFINE(HAVE_STATIC_PERL)
dnl * build only static library of perl module
perl_module_lib=
perl_module_fe_lib=
perl_static_lib=libperl_core_static.la
perl_static_fe_lib=libfe_perl_static.la
else
dnl * build dynamic library of perl module
perl_module_lib=libperl_core.la
perl_module_fe_lib=libfe_perl.la
perl_static_lib=
perl_static_fe_lib=
fi
if test "x$want_staticperllib" = "xyes"; then
PERL_MM_PARAMS="$PERL_MM_PARAMS LINKTYPE=static"
PERL_LINK_LIBS="$PERL_LINK_LIBS ../perl/common/blib/arch/auto/Irssi/Irssi.a ../perl/irc/blib/arch/auto/Irssi/Irc/Irc.a ../perl/ui/blib/arch/auto/Irssi/UI/UI.a ../perl/textui/blib/arch/auto/Irssi/TextUI/TextUI.a"
PERL_STATIC_LIBS=1
else
PERL_STATIC_LIBS=0
fi
# remove any prefix from PERL_MM_OPT
PERL_MM_OPT=`perl -MText::ParseWords -e 'sub qu{$_=shift;s{^(.*?)=(.*)$}{($a,$b)=($1,$2);$b=~s/"/\\\\"/g;qq{$a="$b"}}ge if /@<:@\s"@:>@/;$_} local $,=" "; print map qu($_), grep !/^(INSTALL_BASE|PREFIX)=/, shellwords(@ARGV)' "$PERL_MM_OPT"`
# figure out the correct @INC path - we'll need to do this
# through MakeMaker since it's difficult to get it right
# otherwise.
$perlpath -MExtUtils::MakeMaker -e 'WriteMakefile(NAME => "test", MAKEFILE => "Makefile.test", FIRST_MAKEFILE => "/dev/null", NO_META => 1, NO_MYMETA => 1);' $PERL_MM_PARAMS >/dev/null
echo 'show-INSTALLDIRS:' >> Makefile.test
echo ' @echo $(INSTALLDIRS)' >> Makefile.test
perl_INSTALLDIRS=`$am_make -s -f Makefile.test show-INSTALLDIRS`
if test "x$perl_INSTALLDIRS" = "xsite"; then
perl_library_dir="site default"
perl_INSTALL_VAR=INSTALLSITEARCH
elif test "x$perl_INSTALLDIRS" = "xvendor"; then
perl_library_dir="vendor default"
perl_INSTALL_VAR=INSTALLVENDORARCH
else
perl_library_dir="module default"
perl_INSTALL_VAR=INSTALLARCHLIB
fi
echo 'show-ARCHLIB:' >> Makefile.test
echo ' @echo $('"$perl_INSTALL_VAR"')' >> Makefile.test
perl_use_lib=`$am_make -s -f Makefile.test show-ARCHLIB`
rm -f Makefile.test
if test "x$perl_set_use_lib" = "xyes"; then
if $perlpath -e 'exit ! grep $_ eq $ARGV@<:@0@:>@, grep /^\//, @INC' "$perl_use_lib"; then
perl_library_dir="other path in @INC"
perl_set_use_lib=no
else
perl_library_dir="prepends to @INC with /set perl_use_lib"
PERL_USE_LIB="$perl_use_lib"
fi
fi
AC_SUBST(perl_module_lib)
AC_SUBST(perl_static_lib)
AC_SUBST(perl_module_fe_lib)
AC_SUBST(perl_static_fe_lib)
AC_SUBST(PERL_LINK_FLAGS)
AC_SUBST(PERL_LINK_LIBS)
AC_SUBST(PERL_FE_LINK_LIBS)
AC_SUBST(PERL_LDFLAGS)
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_USE_LIB)
AC_SUBST(PERL_MM_OPT)
AC_SUBST(PERL_MM_PARAMS)
AC_SUBST(PERL_STATIC_LIBS)
fi
fi
dnl **
dnl ** check for capsicum
dnl **
if test "x$want_capsicum" = "xyes"; then
AC_CHECK_LIB(c, cap_enter, [
AC_CHECK_LIB(nv, nvlist_create, [
AC_DEFINE(HAVE_CAPSICUM,, Build with Capsicum support)
LIBS="$LIBS -lnv"
], [
want_capsicum="no, nvlist_create not found"
])
], [
want_capsicum="no, cap_enter not found"
])
fi
dnl **
dnl ** OTR checks
dnl **
have_otr=no
if test "x$want_otr" != "xno"; then
AM_PATH_LIBGCRYPT(1:1.2.0, [], [AC_ERROR(libgcrypt 1.2.0 or newer is required.)])
AM_PATH_LIBOTR(4.1.0, [], [AC_ERROR([libotr 4.1.0 or newer is required.])])
OTR_CFLAGS="$LIBOTR_CFLAGS $LIBGCRYPT_CFLAGS"
OTR_LDFLAGS="$LIBOTR_LIBS $LIBGCRYPT_LIBS"
AC_SUBST(otr_module_lib)
AC_SUBST(otr_static_lib)
if test "x$want_otr" != "xno"; then
if test "x$want_otr" = "xstatic"; then
otr_module_lib=
otr_static_lib=libotr_core_static.la
OTR_LINK_LIBS="../otr/libotr_core_static.la"
OTR_LINK_FLAGS="$OTR_LDFLAGS"
AC_DEFINE(HAVE_STATIC_OTR)
else
otr_module_lib=libotr_core.la
otr_static_lib=
fi
fi
AC_SUBST(otr_module_lib)
AC_SUBST(otr_static_lib)
AC_SUBST(OTR_CFLAGS)
AC_SUBST(OTR_LDFLAGS)
AC_SUBST(OTR_LINK_LIBS)
AC_SUBST(OTR_LINK_FLAGS)
have_otr=yes
fi
dnl ** check what we want to build
AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
AM_CONDITIONAL(BUILD_IRSSIFUZZER, test "$want_irssifuzzer" = "yes")
AM_CONDITIONAL(BUILD_IRSSIPROXY, test "$want_irssiproxy" = "yes")
AM_CONDITIONAL(HAVE_PERL, test "$want_perl" != "no")
AM_CONDITIONAL(HAVE_CAPSICUM, test "x$want_capsicum" = "xyes")
AM_CONDITIONAL(USE_GREGEX, test "x$want_gregex" = "xyes")
AM_CONDITIONAL(HAVE_OTR, test "x$have_otr" != "xno")
# move LIBS to PROG_LIBS so they're not tried to be used when linking eg. perl libraries
PROG_LIBS=$LIBS
LIBS=
AC_SUBST(PROG_LIBS)
dnl **
dnl ** Keep all the libraries here so each frontend doesn't need to
dnl ** keep track of them all
dnl **
dnl ** (these could be made configurable)
CHAT_MODULES="irc"
irc_MODULES="dcc flood notifylist"
if test -n "$build_modules"; then
irc_MODULES="$irc_MODULES $build_modules"
fi
dnl ****************************************
AC_SUBST(CHAT_MODULES)
AC_SUBST(irc_MODULES)
CORE_LIBS="../core/libcore.a ../lib-config/libirssi_config.a"
FE_COMMON_LIBS=""
CHAT_LIBS=""
for c in $CHAT_MODULES; do
CHAT_LIBS="$CHAT_LIBS ../$c/lib$c.a ../$c/core/lib${c}_core.a"
if test -f $srcdir/src/fe-common/$c/module.h; then
FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/libfe_common_$c.a "
fi
for s in `eval echo \\$${c}_MODULES`; do
CHAT_LIBS="$CHAT_LIBS ../$c/$s/lib${c}_$s.a"
if test -f $srcdir/src/fe-common/$c/$s/module.h; then
FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/$c/$s/libfe_${c}_$s.a "
fi
done
done
FE_COMMON_LIBS="$FE_COMMON_LIBS../fe-common/core/libfe_common_core.a"
dnl ** common libraries needed by frontends
COMMON_NOUI_LIBS="$CHAT_LIBS $CORE_LIBS"
COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
AC_SUBST(COMMON_NOUI_LIBS)
AC_SUBST(COMMON_LIBS)
if test "x$want_truecolor" = "xyes"; then
AC_DEFINE([TERM_TRUECOLOR], [], [true color support in terminal])
else
want_truecolor=no
fi
if test "x$want_gregex" = "xyes"; then
AC_DEFINE([USE_GREGEX], [], [use GRegex for regular expressions])
else
want_gregex=no
fi
AH_TEMPLATE(HAVE_GMODULE)
AH_TEMPLATE(HAVE_SOCKS_H, [misc..])
AH_TEMPLATE(HAVE_STATIC_PERL)
AH_TEMPLATE(HAVE_STATIC_OTR)
AH_TEMPLATE(PRIuUOFF_T, [printf()-format for uoff_t, eg. "u" or "lu" or "llu"])
AH_TEMPLATE(UOFF_T_INT, [What type should be used for uoff_t])
AH_TEMPLATE(UOFF_T_LONG)
AH_TEMPLATE(UOFF_T_LONG_LONG)
AC_CONFIG_FILES([
Makefile
src/Makefile
src/core/Makefile
src/irc/Makefile
src/irc/core/Makefile
src/irc/dcc/Makefile
src/irc/notifylist/Makefile
src/irc/proxy/Makefile
src/irc/flood/Makefile
src/fe-common/Makefile
src/fe-common/core/Makefile
src/fe-common/irc/Makefile
src/fe-common/irc/dcc/Makefile
src/fe-common/irc/notifylist/Makefile
src/fe-fuzz/Makefile
src/fe-fuzz/irc/Makefile
src/fe-fuzz/irc/core/Makefile
src/fe-fuzz/fe-common/Makefile
src/fe-fuzz/fe-common/core/Makefile
src/fe-none/Makefile
src/fe-text/Makefile
src/lib-config/Makefile
src/perl/Makefile
src/perl/common/Makefile.PL
src/perl/irc/Makefile.PL
src/perl/ui/Makefile.PL
src/perl/textui/Makefile.PL
src/otr/Makefile
scripts/Makefile
scripts/examples/Makefile
tests/Makefile
tests/fe-common/Makefile
tests/fe-common/core/Makefile
tests/fe-text/Makefile
tests/irc/Makefile
tests/irc/core/Makefile
tests/irc/flood/Makefile
docs/Makefile
docs/help/Makefile
docs/help/in/Makefile
utils/Makefile
themes/Makefile
irssi-1.pc
])
dnl ** make the paths like include headers later
AC_CONFIG_LINKS([irssi/irssi-config.h:irssi-config.h])
AC_LINK_FILES([$srcdir/src],[irssi/src])
AC_OUTPUT
$LN_S ../irssi-version.h irssi/irssi-version.h
dnl ** for building from objdir
old_dir=`pwd` && cd $srcdir && whole_dir=`pwd` && cd $old_dir
if test "x$old_dir" != "x$whole_dir"; then
$LN_S $srcdir/irssi-version.h irssi-version.h
if test "x$want_perl" != "xno"; then
subdirfiles=""
for i in $whole_dir/src/perl/common $whole_dir/src/perl/irc $whole_dir/src/perl/ui $whole_dir/src/perl/textui; do
subdirfiles=`echo $subdirfiles $i/typemap $i/module.h $i/*.pm $i/*.xs`
done
for file in $whole_dir/src/perl/module.h $subdirfiles; do
link=`echo $file|$sedpath "s?$whole_dir/??"`
rm -f $link
$LN_S $file $link
done
fi
fi
echo
echo "Building text frontend ........... : $want_textui"
echo "Building irssi bot ............... : $want_irssibot"
echo "Building irssi proxy ............. : $want_irssiproxy"
if test "x$have_gmodule" = "xyes"; then
echo "Building with module support ..... : yes"
else
echo "Building with module support : NO!! /LOAD will not work!"
echo " - You're missing gmodule (comes with glib) for some reason,"
echo " or it doesn't work in your system."
fi
if test "x$want_perl" = "xstatic"; then
echo "Building with Perl support ....... : static (in irssi binary)"
elif test "x$want_perl" = "xmodule"; then
echo "Building with Perl support ....... : module"
else
if test -z "$perl_check_error"; then
echo "Building with Perl support ....... : no"
else
echo "Building with Perl support ....... : NO!"
echo " - $perl_check_error"
if test -f /etc/debian_version; then
echo " - Try: sudo apt-get install libperl-dev"
elif test -f /etc/redhat-release; then
echo " - Try installing perl-devel"
fi
fi
fi
if test "x$want_perl" != "xno" -a "x$perl_mod_error" != "x"; then
echo " - NOTE: Perl support will be compiled statically to irssi, not as"
echo " a module as requested. Reason:"
echo " $perl_mod_error"
if test -f /etc/debian_version; then
echo " - Try: sudo apt-get install libperl-dev"
fi
fi
if test "x$want_perl" != "xno"; then
echo "Perl library directory ........... : ($perl_library_dir - $perl_use_lib)"
if test "x$perl_prefix_note" = "xyes"; then
echo " - NOTE: This was automatically set to the same directory you gave with"
echo " --prefix. If you want the perl libraries to install to their 'correct'"
echo " path, you'll need to give --with-perl-lib=site option to configure."
echo " Anyway, installing perl to this directory should work just as well."
fi
fi
echo "Install prefix ................... : $prefix"
echo
echo "Building with 64bit DCC support .. : $offt_64bit"
echo "Building with true color support.. : $want_truecolor"
echo "Building with GRegex ............. : $want_gregex"
echo "Building with Capsicum ........... : $want_capsicum"
echo "Building with utf8proc ........... : $want_utf8proc"
if test "x$want_otr" = "xstatic"; then
echo "Building with OTR support ........ : static (in irssi binary)"
elif test "x$want_otr" = "xmodule"; then
echo "Building with OTR support ........ : module"
else
echo "Building with OTR support ........ : no"
fi
echo
echo "If there are any problems, read the INSTALL file."

20
docs/Makefile.am Normal file
View File

@ -0,0 +1,20 @@
man_MANS = \
irssi.1
doc_DATA = \
capsicum.txt \
design.html \
design.txt \
formats.txt \
manual.txt \
faq.html \
faq.txt \
perl.txt \
signals.txt \
special_vars.txt \
startup-HOWTO.html \
startup-HOWTO.txt
EXTRA_DIST = $(doc_DATA) $(man_MANS)
SUBDIRS = help

View File

@ -1,6 +1,7 @@
<base href='https://irssi.org/documentation/design/'>
<h1>Design</h1>
<p>Irssis hierarchy is something like this:</p>
<p>Irssis hierarchy is something like this:</p>
<pre class="repl" id="fig1"><code class="language-ascidia">
sub1 sub2

View File

@ -1,47 +0,0 @@
[binaries]
ar = 'aarch64-linux-android-ar'
c = 'aarch64-linux-android-clang'
cpp = 'aarch64-linux-android-clang++'
ld = 'aarch64-linux-android-ld'
pkgconfig = '/home/builder/.termux-build/_cache/android-r20-api-24-v3/bin/aarch64-linux-android-pkg-config'
strip = 'aarch64-linux-android-strip'
;; you have to substitute 5.30.2 with the Perl version, that can be
;; obtained by running ` miniperl -e 'print substr $^V, 1' `
perl = ['/home/builder/.termux-build/perl/src/miniperl', '-I/data/data/com.termux/files/usr/lib/perl5/5.30.2/aarch64-android', '-I/data/data/com.termux/files/usr/lib/perl5/5.30.2']
[properties]
needs_exe_wrapper = true
c_args = ['-fstack-protector-strong', '-Oz', '-I/data/data/com.termux/files/usr/include']
cpp_args = ['-fstack-protector-strong', '-Oz', '-I/data/data/com.termux/files/usr/include']
c_link_args = ['-L/data/data/com.termux/files/usr/lib', '-Wl,-rpath=/data/data/com.termux/files/usr/lib', '-Wl,--enable-new-dtags', '-Wl,--as-needed', '-Wl,-z,relro,-z,now', '-landroid-glob']
cpp_link_args = ['-L/data/data/com.termux/files/usr/lib', '-Wl,-rpath=/data/data/com.termux/files/usr/lib', '-Wl,--enable-new-dtags', '-Wl,--as-needed', '-Wl,-z,relro,-z,now', '-landroid-glob']
;; if you do not have a cross-perl like miniperl available, you have
;; to specify the required options by uncommenting the following
;; properties
;; you can get the proper values by running the commands on your
;; Android device:
;; ` perl -V::version: `
; perl_version = '5.30.2'
;; ` perl -MExtUtils::Embed -o ccopts `
; perl_ccopts = ['-I/data/data/com.termux/files/usr/include', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-I/data/data/com.termux/files/usr/lib/perl5/5.30.2/aarch64-android/CORE']
;; ` perl -MExtUtils::Embed -o ldopts `
; perl_ldopts = ['-Wl,-E', '-I/data/data/com.termux/files/usr/include', '-L/data/data/com.termux/files/usr/lib/perl5/5.30.2/aarch64-android/CORE', '-lperl', '-lm', '-ldl']
;; ` perl -V::archname: `
; perl_archname = 'aarch64-android'
;; ` perl -V::installsitearch: `
; perl_installsitearch = '/data/data/com.termux/files/usr/lib/perl5/site_perl/5.30.2/aarch64-android'
;; ` perl -V::installvendorarch: `
; perl_installvendorarch = ''
;; ` perl -E 'say for @INC' `
; perl_inc = ['/data/data/com.termux/files/usr/lib/perl5/site_perl/5.30.2/aarch64-android', '/data/data/com.termux/files/usr/lib/perl5/site_perl/5.30.2', '/data/data/com.termux/files/usr/lib/perl5/5.30.2/aarch64-android', '/data/data/com.termux/files/usr/lib/perl5/5.30.2']
[host_machine]
cpu_family = 'arm'
cpu = 'aarch64'
endian = 'little'
system = 'android'

View File

@ -1,8 +1,9 @@
<base href='https://irssi.org/documentation/faq/'>
<h1>Frequently Asked Questions</h1>
<h3 id="q-why-doesnt-irssi-display-colors-even-when-ircii-etc-displays-them">Q: Why doesnt irssi display colors even when ircii etc. displays them?</h3>
<p>A: They force ANSI colors even if terminal doesnt support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like xterm-256color or color_xterm (eg. <code>TERM=xterm-256color irssi</code>). If this doesnt help, then use the evil way of <code>/SET term_force_colors ON</code>.</p>
<h3 id="q-why-doesnt-irssi-display-colors-even-when-ircii-etc-displays-them">Q: Why doesnt irssi display colors even when ircii etc. displays them?</h3>
<p>A: They force ANSI colors even if terminal doesnt support them. By default, irssi uses colors only if terminfo/termcap so says. The correct way to fix this would be to change your TERM environment to a value where colors work, like xterm-color or color_xterm (eg. <code>TERM=xterm-color irssi</code>). If this doesnt help, then use the evil way of <code>/SET term_force_colors ON</code>.</p>
<h3 id="q-how-do-i-easily-write-text-to-channel-that-starts-with--character">Q: How do I easily write text to channel that starts with / character?</h3>
@ -54,7 +55,7 @@
<h3 id="q-will-there-be-detach-like-feature">Q: Will there be /DETACH-like feature?</h3>
<p>A: <a href="https://tmux.github.io/">tmux</a>, <a href="https://www.gnu.org/software/screen/screen.html">screen</a> and <a href="https://sourceforge.net/projects/dtach/">dtach</a> can be used to do it just fine.</p>
<p>A: <a href="http://tmux.github.io/">tmux</a>, <a href="http://www.gnu.org/software/screen/screen.html">screen</a> and <a href="http://dtach.sf.net/">dtach</a> can be used to do it just fine.</p>
<h3 id="q-how-do-i-run-scripts-automatically-at-startup">Q: How do I run scripts automatically at startup?</h3>
@ -70,7 +71,7 @@
<h3 id="q-how-can-i-have-whois-replies-to-active-window">Q: How can I have /WHOIS replies to active window?</h3>
<p>A: You can disable the status window, or do <code>/WINDOW LEVEL -CRAP</code> in it which would also make several other messages show up in active window. You can also use a <a href="https://dgl.cx/irssi/hack-whois-in-current-window.pl">script</a>.</p>
<p>A: You can disable the status window, or do <code>/WINDOW LEVEL -CRAP</code> in it which would also make several other messages show up in active window. You can also use a <a href="http://dgl.cx/irssi/hack-whois-in-current-window.pl">script</a>.</p>
<h3 id="q-how-do-i-add-the-active-network-to-the-statusbar">Q: How do I add the active network to the statusbar</h3>

View File

@ -4,8 +4,8 @@ Q: Why doesnt irssi display colors even when ircii etc. displays them?
A: They force ANSI colors even if terminal doesnt support them. By default,
irssi uses colors only if terminfo/termcap so says. The correct way to fix this
would be to change your TERM environment to a value where colors work, like
xterm-256color or color_xterm (eg. TERM=xterm-256color irssi). If this doesnt
help, then use the evil way of /SET term_force_colors ON.
xterm-color or color_xterm (eg. TERM=xterm-color irssi). If this doesnt help,
then use the evil way of /SET term_force_colors ON.
Q: How do I easily write text to channel that starts with / character?
A: / /text
@ -117,8 +117,8 @@ A: Check [6]here
References:
[1] https://github.com/irssi-import/xirssi
[2] https://tmux.github.io/
[3] https://www.gnu.org/software/screen/screen.html
[4] https://sourceforge.net/projects/dtach/
[5] https://dgl.cx/irssi/hack-whois-in-current-window.pl
[2] http://tmux.github.io/
[3] http://www.gnu.org/software/screen/screen.html
[4] http://dtach.sf.net/
[5] http://dgl.cx/irssi/hack-whois-in-current-window.pl
[6] https://irssi.org/assets/irssi.wav

12
docs/help/Makefile.am.gen Normal file
View File

@ -0,0 +1,12 @@
# Makefile.am is autogenerated by autogen.sh from Makefile.am.gen
helpdir = $(datadir)/irssi/help
help_DATA = \
@HELPFILES@
EXTRA_DIST = \
Makefile.am.gen \
$(help_DATA)
SUBDIRS = in

View File

@ -0,0 +1,5 @@
# Makefile.am is autogenerated by autogen.sh from Makefile.am.gen
EXTRA_DIST = \
Makefile.am.gen \
@HELPFILES@

View File

@ -15,7 +15,7 @@
%9Examples:%9
/ADMIN
/ADMIN irc.libera.chat
/ADMIN orwell.freenode.net
/ADMIN mike
%9See also:%9 INFO

View File

@ -33,12 +33,12 @@
/CHANNEL
/CHANNEL LIST
/CHANNEL ADD -auto #irssi liberachat
/CHANNEL ADD -auto #irssi Freenode
/CHANNEL ADD -auto #basementcat Quakenet secret_lair
/CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout liberachat
/CHANNEL ADD -auto -bots '*!@*.irssi.org *!bot@irssi.org' -botcmd 'msg $0 op WzerTrzq' #hideout Freenode
/CHANNEL ADD -auto -bots 'Q!TheQBot@CServe.quakenet.org' -botcmd '^MSG Q op #irssi' #irssi Quakenet
/CHANNEL MODIFY -noauto #irssi liberachat
/CHANNEL REMOVE #hideout liberachat
/CHANNEL MODIFY -noauto #irssi Freenode
/CHANNEL REMOVE #hideout Freenode
%9Special Example:%9

View File

@ -34,9 +34,9 @@
%9Examples:%9
/CONNECT liberachat
/CONNECT -6 liberachat
/CONNECT -4 -! -host staff.irssi.org -network liberachat irc.libera.chat
/CONNECT Freenode
/CONNECT -6 Freenode
/CONNECT -4 -! -host staff.irssi.org -network Freenode orwell.freenode.net
/CONNECT irc.irssi.org 6667 WzerT8zq mike
%9See also:%9 DISCONNECT, RMRECONNS, SERVER

View File

@ -18,7 +18,7 @@
%9Examples:%9
/DISCONNECT liberachat I'm off for today, take care!
/DISCONNECT Freenode I'm off for today, take care!
/DISCONNECT * Vacation time :D
/DISCONNECT

View File

@ -11,17 +11,11 @@
Evaluates the given commands and executes them; you can use internal
variables and separate multiple commands by using the ';' character.
If the command contains a string with '$', '\' or ';' those characters
need to be escaped:
'$' -> '$$'
'\' -> '\\' (or even '\\\\', depending on where they are used)
';' -> '\;'
%9Examples:%9
/EVAL echo I am connected to ${S} on ${chatnet} as ${N}
/EVAL echo My user privileges are +${usermode}; echo Let's party!
to print '1;2$3\4': /EVAL echo 1\;2$$3\\4
%9References:%9

View File

@ -14,8 +14,6 @@
-network: Ignores only on a specific network.
-channels: Ignores only on specific channels.
-time: The timeout to automatically remove the ignore.
Accepts units specified in days, hours, minutes, seconds,
milliseconds, or no unit for seconds.
The mask, channels and levels to ignore; if no argument is provided, the
list of ignores will be displayed.
@ -27,8 +25,6 @@
The special level 'NO_ACT' can be used to ignore activity in the statusbar
without actually ignoring the message; this behavior is somewhat special
because it is allowed in addition to other ignores for the same target.
The special level 'HIDDEN' can be used to hide matching messages that can
later be revealed using /WINDOW HIDELEVEL -HIDDEN
%9Examples:%9
@ -39,15 +35,12 @@
/IGNORE #irssi ALL -PUBLIC -ACTIONS
/IGNORE -replies *!*@*.irssi.org ALL
/IGNORE -regexp -pattern (away|gone|back|playing|returned) * ACTIONS
/IGNORE -regexp -pattern (away|gone|back|playing|returned) #channel ACTIONS
/IGNORE *zzz* NICKS
/IGNORE *afk* NICKS
/IGNORE *away* NICKS
/IGNORE #irssi NO_ACT JOINS PARTS QUITS
/IGNORE mike NO_ACT -MSGS
/IGNORE mike HIDDEN PUBLIC JOINS PARTS QUITS
/IGNORE -time 5days christmas PUBLICS
/IGNORE -time 300 mike PUBLICS
/IGNORE -regexp -pattern
%9See also:%9 ACCEPT, SILENCE, UNIGNORE

View File

@ -15,7 +15,7 @@
%9Examples:%9
/INFO
/INFO irc.libera.chat
/INFO orwell.freenode.net
%9See also:%9 ADMIN

View File

@ -20,7 +20,7 @@
/JOIN #irssi
/JOIN #basementcat secret_lair
/JOIN -invite
/JOIN -liberachat #github,#libera,#irssi
/JOIN -freenode #github,#freenode,#irssi
%9See also:%9 KICK, PART

View File

@ -23,7 +23,7 @@
%9Examples:%9
/KNOCK #irssi
/KNOCK #libera
/KNOCK #freenode
/KNOCK #github
%9See also:%9 INVITE, JOIN

View File

@ -20,10 +20,9 @@
MODES A channel mode is modified.
MSGS Private messages.
NICKS A nickname changes to another nickname.
NOTICES Private notices.
NOTICES Notices sent from a nickname.
PARTS A nickname leaves a channel.
PUBLIC Public messages in a channel.
PUBNOTICES Public notices in a channel.
QUITS A nickname disconnects from IRC.
SNOTES Notices sent from a server.
TOPICS A channel topic is modified.
@ -33,7 +32,6 @@
HILIGHT The text is highlighted.
NEVER Never ignores or logs the message.
HIDDEN Hides the message when window HIDELEVEL includes HIDDEN.
NO_ACT Doesn't trigger any activity in the statusbar.
NOHILIGHT The text is not highlighted.

View File

@ -33,10 +33,10 @@
%9Examples:%9
/LOG OPEN -targets mike ~/irclogs/mike.log MSGS
/LOG OPEN -targets #irssi ~/irclogs/liberachat/irssi-%%Y-%%m-%%d
/LOG CLOSE ~/irclogs/liberachat/irssi-%%Y-%%m-%%d
/LOG STOP ~/irclogs/liberachat/irssi-%%Y-%%m-%%d
/LOG START ~/irclogs/liberachat/irssi-%%Y-%%m-%%d
/LOG OPEN -targets #irssi-freenode ~/irclogs/freenode/irssi-%%Y-%%m-%%d
/LOG CLOSE ~/irclogs/freenode/irssi-%%Y-%%m-%%d
/LOG STOP ~/irclogs/freenode/irssi-%%Y-%%m-%%d
/LOG START ~/irclogs/freenode/irssi-%%Y-%%m-%%d
/SET autolog ON

View File

@ -15,7 +15,7 @@
%9Examples:%9
/MOTD
/MOTD irc.libera.chat
/MOTD orwel.freenode.org
/MOTD bob
%9See also:%9 ADMIN, INFO, LINKS, MAP

View File

@ -21,7 +21,7 @@
%9Examples:%9
/NAMES -ops
/NAMES -voices #irssi,#libera
/NAMES -voices #irssi,#freenode
%9See also:%9 JOIN, PART, WHO, WHOIS

View File

@ -15,7 +15,7 @@
%9Examples:%9
/NCTCP #irssi VERSION King of the Jungle v1.0
/NCTCP bob,#libera USERINFO I am bob :p
/NCTCP bob,#freenode USERINFO I am bob :p
%9See also:%9 CTCP

View File

@ -18,8 +18,7 @@
-usermode: Specifies the user modes to set on yourself.
-autosendcmd: Specifies the commands, separated by the ';' character,
and enclosed within two "'" characters, to perform after
connecting.
(Some characters need to be escaped - see /help eval)
connecting.
-querychans: Specifies the maximum number of channels to put in one MODE
or WHO command when synchronizing.
-whois: Specifies the maximum number of nicknames in one WHOIS
@ -60,11 +59,11 @@
%9Examples:%9
/NETWORK ADD -usermode +giw EFnet
/NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org liberachat
/NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' liberachat
/NETWORK ADD -usermode +iw -nick mike -realname 'The one and only mike!' -host staff.irssi.org Freenode
/NETWORK ADD -autosendcmd '^MSG NickServ identify WzerT8zq' Freenode
/NETWORK ADD -autosendcmd '^MSG Q@CServe.quakenet.org AUTH mike WzerT8zq; WAIT 2000; OPER mike WzerT8zq; WAIT 2000; MODE mike +kXP' Quakenet
/NETWORK MODIFY -usermode +gi EFnet
/NETWORK REMOVE liberachat
/NETWORK REMOVE Freenode
%9See also:%9 CHANNEL, CONNECT, SERVER

View File

@ -51,7 +51,7 @@ GENKEY <name>
This process is done in a background worker and can take an arbitrary
amount of time. The completion is checked when another irssi event is
caught.
catched.
HELP
Print this help.

View File

@ -14,7 +14,7 @@
%9Examples:%9
/PART #irssi
/PART #libera,#irssi
/PART #freenode,#irssi
%9See also:%9 JOIN, KICK

View File

@ -17,8 +17,8 @@
%9Examples:%9
/QUERY mike
/QUERY -liberachat bob
/QUERY -liberachat -window sarah
/QUERY -freenode bob
/QUERY -freenode -window sarah
%9See also:%9 MSG, UNQUERY, WINDOW

View File

@ -22,7 +22,7 @@
%9Examples:%9
/RECODE
/RECODE ADD liberachat/mike utf-8
/RECODE ADD Freenode/mike utf-8
/RECODE ADD #korea euc-kr
/RECODE REMOVE #korea

View File

@ -15,7 +15,7 @@
%9Examples:%9
/RECONNECT
/RECONNECT liberachat
/RECONNECT Freenode
/RECONNECT EFnet BRB :)
%9See also:%9 CONNECT, DISCONNECT, NETWORK, RMRECONNS, SERVER

View File

@ -5,7 +5,7 @@
%9Parameters:%9
LIST: Displays the list of servers you have configured.
LIST: Displays the list of servers you are connected to.
CONNECT: Connects to the given server.
ADD: Adds a server to your configuration.
MODIFY: Modifies a server in your configuration.
@ -51,24 +51,22 @@
When using the ADD parameter on a server that already exists, the
configuration will be merged with each other.
When using the CONNECT parameter, it will connect to the specified
server; the server in the active window will be disconnected
unless you prepend the server with the '+' character.
Specify '-' as password to remove a server password
When using the command without any of the given parameters, it will
connect to the specified server; the server in the active window will be
disconnected unless you prepend the server with the '+' character; the same
method is applicable to the CONNECT parameter.
%9Examples:%9
/SERVER
/SERVER CONNECT irc.libera.chat
/SERVER CONNECT +irc.libera.chat
/SERVER ADD -network liberachat -noautosendcmd irc.libera.chat
/SERVER ADD -! -auto -host staff.irssi.org -4 -network liberachat -noproxy irc.libera.chat 6667
/SERVER MODIFY -network liberachat -noauto irc.libera.chat
/SERVER MODIFY -network liberachat irc.libera.chat 6697 -
/SERVER REMOVE irc.libera.chat 6667 liberachat
/SERVER CONNECT chat.freenode.net
/SERVER CONNECT +chat.freenode.net
/SERVER ADD -network Freenode -noautosendcmd orwell.freenode.net
/SERVER ADD -! -auto -host staff.irssi.org -4 -network Freenode -noproxy orwell.freenode.net 6667
/SERVER MODIFY -network Freenode -noauto orwell.freenode.net
/SERVER REMOVE orwell.freenode.net 6667 Freenode
/SERVER PURGE
/SERVER PURGE irc.libera.chat
/SERVER PURGE orwell.freenode.net
%9See also:%9 CHANNEL, CONNECT, DISCONNECT, NETWORK, RECONNECT, RMRECONNS

View File

@ -33,12 +33,12 @@
THEME: %|Applies or removes a per-window theme.
GROW: %|Increase the size of the active split window by the specified number of lines.
SHRINK: %|Decrease the size of the active split window by the specified number of lines.
SIZE: %|Set the current split window size to the specified number of lines.
SIZE: %|Set the current split window size to the specified numer of lines.
BALANCE: %|Balance the heights of all split windows.
HIDE: %|Hides the current split window, or the split window specified by number or item name.
SHOW: %|Show the window specified by number or item name as a new split windows. It is made sticky when autostick_split_windows is turned on.
UP: %|Set the split window left or above the current one active. At the top, wraps to the bottom.
DOWN: %|Set the split window right or below the current one active. At the bottom, wraps left.
DOWN: %|Set the split window right or below the current one active. At the bottom, wraps teft.
LEFT: %|Go to the previous window numerically that is part of the current sticky group (or not part of any sticky group).
RIGHT: %|Go to the next window numerically that is part of the current sticky group (or not part of any sticky group).
STICK: %|Make the currently active window sticky, or stick the window specified by number to the currently visible split window. Or turn off stickyness of the currently active window or the window specified by number.

View File

@ -349,7 +349,7 @@
after connecting to the network. This is useful for automatically
identifying yourself to NickServ, for example
/NETWORK ADD -autosendcmd "/^msg NickServ identify secret" liberachat
/NETWORK ADD -autosendcmd "/^msg NickServ identify secret" freenode
/NETWORK REMOVE <name>

View File

@ -205,12 +205,6 @@ Window::command(cmd)
Windowitem::command(cmd)
Send a command `cmd' (in current channel). The '/' char isn't needed.
version() - return client release date and time (format YYYYMMDD.hhmm)
parse_special(cmd, data="", flags=0)
Server::parse_special(cmd, data="", flags=0)
Windowitem::parse_special(cmd, data="", flags=0)
evaluate a string with special vars
*** Themes

View File

@ -24,7 +24,7 @@ You really should set some password for the proxy with:
Then you'll need to configure the ports/ircnets the proxy listens in,
something like:
/SET irssiproxy_ports IRCnet=2777 EFNet=2778 liberachat=2779
/SET irssiproxy_ports ircnet=2777 efnet=2778 freenode=2779
There we have 3 different irc networks answering in 3 ports. Note that
you'll have to make the correct /IRCNET ADD and /SERVER ADD commands to

View File

@ -151,7 +151,6 @@ irc.c:
"whois default event", SERVER_REC, char *args, char *sender_nick, char *sender_address
"server incoming", SERVER_REC, char *data
"server outgoing modify", SERVER_REC, GString *data, int crlf
(for perl parser..)
"redir "<cmd>, SERVER_REC, char *args, char *sender_nick, char *sender_address
@ -247,12 +246,12 @@ FE common
"gui print text", WINDOW_REC, int fg, int bg, int flags, char *text, TEXT_DEST_REC
(Can be used to determine when all "gui print text"s are sent (not required))
"gui print text finished", WINDOW_REC, TEXT_DEST_REC
"gui print text finished", WINDOW_REC
* Provides signals:
completion.c:
"complete word", GList * of char *s, WINDOW_REC, char *word, char *linestart, int *want_space
"complete word", GList * of char*, WINDOW_REC, char *word, char *linestart, int *want_space
fe-common-core.c:
"irssi init read settings"
@ -286,8 +285,6 @@ keyboard.c:
printtext.c:
"print text", TEXT_DEST_REC *dest, char *text, char *stripped
"print format", THEME_REC *theme, char *module, TEXT_DEST_REC *dest, formatnum_args
"print noformat", TEXT_DEST_REC *dest, char *text
themes.c:
"theme created", THEME_REC
@ -351,18 +348,14 @@ Text FE
gui-readline.c:
"gui key pressed", int key
"paste event", char *paste, char *arg
gui-printtext.c:
"beep"
"gui print text after finished", WINDOW_REC, LINE_REC *line, LINE_REC *prev_line, TEXT_DEST_REC
"gui print text after finished", WINDOW_REC, LINE_REC *line, LINE_REC *prev_line
textbuffer-view.c
"gui textbuffer line removed", TEXTBUFFER_VIEW_REC *view, LINE_REC *line, LINE_REC *prev_line
textbuffer-formats.c
"gui render line text", TEXT_DEST_REC, GString *str, LINE_INFO_META_REC
Perl
----

View File

@ -94,8 +94,6 @@ $A .. $Z is important.
$winname window name
$itemname like $T, but use item's visible_name which may be
different (eg. $T = !12345chan, $itemname = !chan)
$abiversion IRSSI_ABI_VERSION
https://github.com/irssi/irssi/wiki/irssi_abi_version
For example, assume you have the following alias:

View File

@ -1,8 +1,9 @@
<base href='https://irssi.org/documentation/startup/'>
<h1>Startup How-To</h1>
<h3 id="to-new-irssi-users-not-to-new-irc-users-">To new Irssi users (not to new IRC users ..)</h3>
<p>Copyright (c) 2000-2002 by Timo Sirainen, release under <a href="https://www.gnu.org/licenses/fdl.html">GNU FDL</a> 1.1 license.</p>
<h3 id="to-new-irssi-users-not-to-new-irc-users-">To new Irssi users (not to new IRC users ..)</h3>
<p>Copyright (c) 2000-2002 by Timo Sirainen, release under <a href="http://www.gnu.org/licenses/fdl.html">GNU FDL</a> 1.1 license.</p>
<p>Index with some FAQ questions that are answered in the chapter:</p>
@ -68,7 +69,7 @@
<p>And to connect to one of those networks and join a channel:</p>
<div><div><pre><code>/CONNECT liberachat
<div><div><pre><code>/CONNECT Freenode
/JOIN #irssi
</code></pre></div></div>
@ -94,7 +95,7 @@
<p>If you have irssi 0.8.18 or higher and the irc network supports it, you can use SASL instead of nickserv, which is more reliable:</p>
<div><div><pre><code>/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN liberachat
<div><div><pre><code>/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN Freenode
</code></pre></div></div>
<p>These commands have many more options, see their help for details:</p>
@ -160,7 +161,7 @@ Ctrl-P, Ctrl-N - Jump to previous / next window
<h3 id="split-windows-and-window-items">Split windows and window items</h3>
<p><em>Note: <a href="https://quadpoint.org/articles/irssisplit/">this guide</a> might be a better introduction to window splits</em></p>
<p><em>Note: <a href="http://quadpoint.org/articles/irssisplit/">this guide</a> might be a better introduction to window splits</em></p>
<p>Irssi also supports split windows, theyve had some problems in past but I think they should work pretty well now :) Heres some commands related to them:</p>
@ -226,7 +227,7 @@ Ctrl-P, Ctrl-N - Jump to previous / next window
<p>And finally channels:</p>
<div><div><pre><code>/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet
<div><div><pre><code>/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet
/CHANNEL ADD -auto #secret IRCnet password
</code></pre></div></div>
@ -395,7 +396,7 @@ Ctrl-X - set the next server in list active
<p><code>/HELP bind</code> tells pretty much everything there is to know about keyboard bindings. However, theres the problem of how to bind some non-standard keys. They might differ a bit with each terminal, so youll need to find out what exactly the keypress produces. Easiest way to check that would be to see what it prints in <code>cat</code>. Heres an example for pressing F1 key:</p>
<div><div><pre><code> [cras@hurina] ~% cat
<div><div><pre><code> [user@host] ~% cat
^[OP
</code></pre></div></div>
@ -515,12 +516,12 @@ Ctrl-X - set the next server in list active
<p><strong>SOCKS</strong></p>
<p>Using <a href="https://github.com/rofl0r/proxychains-ng">proxychains-ng</a> is recommended for using irssi with a socks proxy.</p>
<p>Irssi does not support socks proxy natively.</p>
<p>Irssi can be compiled with socks support (<code>\--with-socks</code> option to configure), which requires “dante” and routes all connections through the proxy specified in the system-wide /etc/socks.conf. This method is known to have issues in Mac OS X.</p>
<p>Note that <code>/SET proxy</code> settings dont have anything to do with socks.</p>
<p>Using <a href="https://github.com/rofl0r/proxychains-ng">proxychains-ng</a> is recommended over recompiling irssi.</p>
<p><strong>Others</strong></p>
<p>IRC bouncers usually work like IRC servers, and want a password. You can give it with:</p>
@ -683,4 +684,4 @@ Ctrl-X - set the next server in list active
/STATUSBAR &lt;name&gt; REMOVE &lt;item&gt;
</code></pre></div></div>
<p>For statusbar scripts, the item name is usually equivalent to the script name. The documentation of the script ought to tell you if this is not the case. For example, to add mail.pl before the window activity item, use: <code>/STATUSBAR window ADD -before act mail</code>.</p>
<p>For statusbar scripts, the item name is usually equivalent to the script name. The documentation of the script ought to tell you if this is not the case. For example, to add mail.pl before the window activity item, use: <code>/STATUSBAR window ADD -before act mail</code>.</p>

View File

@ -43,7 +43,7 @@ has a few predefined networks, to list them:
And to connect to one of those networks and join a channel:
/CONNECT liberachat
/CONNECT Freenode
/JOIN #irssi
To add more networks:
@ -67,7 +67,7 @@ wait for 2 seconds before joining channels:
If you have irssi 0.8.18 or higher and the irc network supports it, you can use
SASL instead of nickserv, which is more reliable:
/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN liberachat
/NETWORK ADD -sasl_username yourname -sasl_password yourpassword -sasl_mechanism PLAIN Freenode
These commands have many more options, see their help for details:
@ -218,7 +218,7 @@ IRC network, other servers are automatically connected in same network if the
And finally channels:
/CHANNEL ADD -auto -bots *!*bot@host.org -botcmd "/^msg $0 op pass" #irssi efnet
/CHANNEL ADD -auto -bots *!*user@host -botcmd "/^msg $0 op pass" #irssi efnet
/CHANNEL ADD -auto #secret IRCnet password
-bots and -botcmd should be the only ones needing a bit of explaining. Theyre
@ -442,7 +442,7 @@ They might differ a bit with each terminal, so youll need to find out what
exactly the keypress produces. Easiest way to check that would be to see what
it prints in cat. Heres an example for pressing F1 key:
[cras@hurina] ~% cat
[user@host] ~% cat
^[OP
So in irssi you would use /BIND ^[OP /ECHO F1 pressed. If you use multiple
@ -578,12 +578,15 @@ Irssi proxy works fine with other IRC clients as well.
SOCKS
Using [4]proxychains-ng is recommended for using irssi with a socks proxy.
Irssi does not support socks proxy natively.
Irssi can be compiled with socks support (\--with-socks option to configure),
which requires “dante” and routes all connections through the proxy specified
in the system-wide /etc/socks.conf. This method is known to have issues in Mac
OS X.
Note that /SET proxy settings dont have anything to do with socks.
Using [4]proxychains-ng is recommended over recompiling irssi.
Others
IRC bouncers usually work like IRC servers, and want a password. You can give
@ -789,8 +792,8 @@ ADD -before act mail.
References:
[1] https://www.gnu.org/licenses/fdl.html
[1] http://www.gnu.org/licenses/fdl.html
[2] https://www.iterm2.com/
[3] https://quadpoint.org/articles/irssisplit/
[3] http://quadpoint.org/articles/irssisplit/
[4] https://github.com/rofl0r/proxychains-ng
[5] https://irssi.org/documentation/settings/

View File

@ -150,7 +150,7 @@ index ad79e0c..84d0c5c 100644
+++ b/src/fe-text/irssi.c
@@ -314,20 +314,16 @@ int main(int argc, char **argv)
textui_finish_init();
main_loop = g_main_loop_new(NULL, TRUE);
main_loop = g_main_new(TRUE);
+#ifdef __AFL_HAVE_MANUAL_CONTROL
+ __AFL_INIT();
@ -162,7 +162,7 @@ index ad79e0c..84d0c5c 100644
can call our dirty-checker after each iteration */
while (!quitting) {
- term_refresh_freeze();
g_main_context_iteration(NULL, TRUE);
g_main_iteration(TRUE);
- term_refresh_thaw();
-
- if (reload_config) {
@ -174,7 +174,7 @@ index ad79e0c..84d0c5c 100644
- dirty_check();
}
g_main_loop_unref(main_loop);
g_main_destroy(main_loop);
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index b2478c6..cebe260 100644
--- a/src/fe-text/term-terminfo.c

20
irssi-1.pc.in Normal file
View File

@ -0,0 +1,20 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
prog_libs="@PROG_LIBS@"
common_libs="@COMMON_LIBS@"
perl_link_libs="@PERL_LINK_LIBS@"
perl_fe_link_libs="@PERL_FE_LINK_LIBS@"
perl_link_flags="@PERL_LINK_FLAGS@"
chat_modules="@CHAT_MODULES@"
irc_modules="@irc_MODULES@"
Name: Irssi
Description: Irssi chat client
Version: @PACKAGE_VERSION@
Cflags: -I${includedir} @OPENSSL_CFLAGS@
Requires: glib-2.0

View File

@ -1,10 +1,10 @@
servers = (
{ address = "irc.dal.net"; chatnet = "DALnet"; port = "6667"; },
{ address = "ssl.efnet.org"; chatnet = "EFNet"; port = "9999"; use_tls = "yes"; tls_verify = "no"; },
{ address = "ssl.efnet.org"; chatnet = "EFNet"; port = "9999"; use_tls = "yes"; },
{ address = "irc.esper.net"; chatnet = "EsperNet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; },
{ address = "irc.libera.chat"; chatnet = "liberachat";port = "6697"; use_tls = "yes"; tls_verify = "yes"; },
{ address = "chat.freenode.net"; chatnet = "Freenode"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; },
{ address = "irc.gamesurge.net"; chatnet = "GameSurge"; port = "6667"; },
{ address = "ssl.ircnet.ovh"; chatnet = "IRCnet"; port = "6697"; use_tls = "yes"; tls_verify = "yes"; },
{ address = "eu.irc6.net"; chatnet = "IRCnet"; port = "6667"; use_tls = "yes"; },
{ address = "open.ircnet.net"; chatnet = "IRCnet"; port = "6667"; },
{ address = "irc.ircsource.net"; chatnet = "IRCSource"; port = "6667"; },
{ address = "irc.netfuze.net"; chatnet = "NetFuze"; port = "6667"; },
@ -34,7 +34,7 @@ chatnets = {
max_msgs = "4";
max_whois = "1";
};
liberachat = {
Freenode = {
type = "IRC";
max_kicks = "1";
max_msgs = "4";
@ -95,8 +95,8 @@ chatnets = {
channels = (
{ name = "#lobby"; chatnet = "EsperNet"; autojoin = "No"; },
{ name = "#libera"; chatnet = "liberachat";autojoin = "No"; },
{ name = "#irssi"; chatnet = "liberachat";autojoin = "No"; },
{ name = "#freenode"; chatnet = "Freenode"; autojoin = "No"; },
{ name = "#irssi"; chatnet = "Freenode"; autojoin = "No"; },
{ name = "#gamesurge"; chatnet = "GameSurge"; autojoin = "No"; },
{ name = "#irssi"; chatnet = "IRCNet"; autojoin = "No"; },
{ name = "#ircsource"; chatnet = "IRCSource"; autojoin = "No"; },
@ -107,7 +107,7 @@ channels = (
aliases = {
ATAG = "WINDOW SERVER";
ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{visible_name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
ADDALLCHANS = "SCRIPT EXEC foreach my \\$channel (Irssi::channels()) { Irssi::command(\"CHANNEL ADD -auto \\$channel->{name} \\$channel->{server}->{tag} \\$channel->{key}\")\\;}";
B = "BAN";
BACK = "AWAY";
BANS = "BAN";
@ -115,7 +115,6 @@ aliases = {
C = "CLEAR";
CALC = "EXEC - if command -v bc >/dev/null 2>&1\\; then printf '%s=' '$*'\\; echo '$*' | bc -l\\; else echo bc was not found\\; fi";
CHAT = "DCC CHAT";
CS = "QUOTE CS";
DATE = "TIME";
DEHIGHLIGHT = "DEHILIGHT";
DESCRIBE = "ACTION";
@ -134,12 +133,9 @@ aliases = {
LAST = "LASTLOG";
LEAVE = "PART";
M = "MSG";
MS = "QUOTE MS";
MUB = "UNBAN *";
N = "NAMES";
NMSG = "^MSG";
NS = "QUOTE NS";
OS = "QUOTE OS";
P = "PART";
Q = "QUERY";
RESET = "SET -default";
@ -147,7 +143,6 @@ aliases = {
SAY = "MSG *";
SB = "SCROLLBACK";
SBAR = "STATUSBAR";
SHELP = "QUOTE HELP";
SIGNOFF = "QUIT";
SV = "MSG * Irssi $J ($V) - https://irssi.org";
T = "TOPIC";

208
m4/glib-2.0.m4 Normal file
View File

@ -0,0 +1,208 @@
# Configure paths for GLIB
# Owen Taylor 1997-2001
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
dnl gthread is specified in MODULES, pass to pkg-config
dnl
AC_DEFUN([AM_PATH_GLIB_2_0],
[dnl
dnl Get the cflags and libraries from pkg-config
dnl
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
, enable_glibtest=yes)
pkg_config_args=glib-2.0
for module in . $4
do
case "$module" in
gmodule)
pkg_config_args="$pkg_config_args gmodule-2.0"
;;
gmodule-no-export)
pkg_config_args="$pkg_config_args gmodule-no-export-2.0"
;;
gobject)
pkg_config_args="$pkg_config_args gobject-2.0"
;;
gthread)
pkg_config_args="$pkg_config_args gthread-2.0"
;;
esac
done
PKG_PROG_PKG_CONFIG([0.7])
no_glib=""
if test "x$PKG_CONFIG" = x ; then
no_glib=yes
PKG_CONFIG=no
fi
min_glib_version=ifelse([$1], ,2.0.0,$1)
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
if test "x$PKG_CONFIG" != xno ; then
## don't try to run the test against uninstalled libtool libs
if $PKG_CONFIG --uninstalled $pkg_config_args; then
echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
enable_glibtest=no
fi
if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
:
else
no_glib=yes
fi
fi
if test x"$no_glib" = x ; then
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_glibtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$GLIB_LIBS $LIBS"
dnl
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
dnl checks the results of pkg-config to some extent)
dnl
rm -f conf.glibtest
AC_TRY_RUN([
#include <glib.h>
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
int major, minor, micro;
char *tmp_version;
system ("touch conf.glibtest");
/* HP/UX 9 (%@#!) writes to sscanf strings */
tmp_version = g_strdup("$min_glib_version");
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
printf("%s, bad version string\n", "$min_glib_version");
exit(1);
}
if ((glib_major_version != $glib_config_major_version) ||
(glib_minor_version != $glib_config_minor_version) ||
(glib_micro_version != $glib_config_micro_version))
{
printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
glib_major_version, glib_minor_version, glib_micro_version);
printf ("*** was found! If pkg-config was correct, then it is best\n");
printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
printf("*** required on your system.\n");
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
printf("*** to point to the correct configuration files\n");
}
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
(glib_minor_version != GLIB_MINOR_VERSION) ||
(glib_micro_version != GLIB_MICRO_VERSION))
{
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
printf("*** library (version %d.%d.%d)\n",
glib_major_version, glib_minor_version, glib_micro_version);
}
else
{
if ((glib_major_version > major) ||
((glib_major_version == major) && (glib_minor_version > minor)) ||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
{
return 0;
}
else
{
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
glib_major_version, glib_minor_version, glib_micro_version);
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
major, minor, micro);
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
printf("***\n");
printf("*** If you have already installed a sufficiently new version, this error\n");
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
printf("*** being found. The easiest way to fix this is to remove the old version\n");
printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
printf("*** so that the correct libraries are found at run-time))\n");
}
}
return 1;
}
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
if test "x$no_glib" = x ; then
AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$PKG_CONFIG" = "no" ; then
echo "*** A new enough version of pkg-config was not found."
echo "*** See http://www.freedesktop.org/software/pkgconfig/"
else
if test -f conf.glibtest ; then
:
else
echo "*** Could not run GLIB test program, checking why..."
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GLIB_CFLAGS"
LIBS="$LIBS $GLIB_LIBS"
AC_TRY_LINK([
#include <glib.h>
#include <stdio.h>
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occurred. This usually means GLIB is incorrectly installed."])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
fi
GLIB_CFLAGS=""
GLIB_LIBS=""
GLIB_GENMARSHAL=""
GOBJECT_QUERY=""
GLIB_MKENUMS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_GENMARSHAL)
AC_SUBST(GOBJECT_QUERY)
AC_SUBST(GLIB_MKENUMS)
rm -f conf.glibtest
])

28
m4/glibtests.m4 Normal file
View File

@ -0,0 +1,28 @@
dnl GLIB_TESTS
dnl
AC_DEFUN([GLIB_TESTS],
[
AC_ARG_ENABLE(installed-tests,
AS_HELP_STRING([--enable-installed-tests],
[Enable installation of some test cases]),
[case ${enableval} in
yes) ENABLE_INSTALLED_TESTS="1" ;;
no) ENABLE_INSTALLED_TESTS="" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-installed-tests]) ;;
esac])
AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], test "$ENABLE_INSTALLED_TESTS" = "1")
AC_ARG_ENABLE(always-build-tests,
AS_HELP_STRING([--enable-always-build-tests],
[Enable always building tests during 'make all']),
[case ${enableval} in
yes) ENABLE_ALWAYS_BUILD_TESTS="1" ;;
no) ENABLE_ALWAYS_BUILD_TESTS="" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-always-build-tests]) ;;
esac])
AM_CONDITIONAL([ENABLE_ALWAYS_BUILD_TESTS], test "$ENABLE_ALWAYS_BUILD_TESTS" = "1")
if test "$ENABLE_INSTALLED_TESTS" = "1"; then
AC_SUBST(installed_test_metadir, [${datadir}/installed-tests/]AC_PACKAGE_NAME)
AC_SUBST(installed_testdir, [${libexecdir}/installed-tests/]AC_PACKAGE_NAME)
fi
])

143
m4/libgcrypt.m4 Normal file
View File

@ -0,0 +1,143 @@
# libgcrypt.m4 - Autoconf macros to detect libgcrypt
# Copyright (C) 2002, 2003, 2004, 2011, 2014 g10 Code GmbH
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This file is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Last-changed: 2014-10-02
dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
dnl with the API version to also check the API compatibility. Example:
dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
dnl this features allows to prevent build against newer versions of libgcrypt
dnl with a changed API.
dnl
dnl If a prefix option is not used, the config script is first
dnl searched in $SYSROOT/bin and then along $PATH. If the used
dnl config script does not match the host specification the script
dnl is added to the gpg_config_script_warn variable.
dnl
AC_DEFUN([AM_PATH_LIBGCRYPT],
[ AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_WITH(libgcrypt-prefix,
AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
[prefix where LIBGCRYPT is installed (optional)]),
libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
if test x"${LIBGCRYPT_CONFIG}" = x ; then
if test x"${libgcrypt_config_prefix}" != x ; then
LIBGCRYPT_CONFIG="${libgcrypt_config_prefix}/bin/libgcrypt-config"
else
case "${SYSROOT}" in
/*)
if test -x "${SYSROOT}/bin/libgcrypt-config" ; then
LIBGCRYPT_CONFIG="${SYSROOT}/bin/libgcrypt-config"
fi
;;
'')
;;
*)
AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.])
;;
esac
fi
fi
AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
tmp=ifelse([$1], ,1:1.2.0,$1)
if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
else
req_libgcrypt_api=0
min_libgcrypt_version="$tmp"
fi
AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
ok=no
if test "$LIBGCRYPT_CONFIG" != "no" ; then
req_major=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $min_libgcrypt_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
major=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $libgcrypt_config_version | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
fi
if test $ok = yes; then
AC_MSG_RESULT([yes ($libgcrypt_config_version)])
else
AC_MSG_RESULT(no)
fi
if test $ok = yes; then
# If we have a recent libgcrypt, we should also check that the
# API is compatible
if test "$req_libgcrypt_api" -gt 0 ; then
tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
if test "$tmp" -gt 0 ; then
AC_MSG_CHECKING([LIBGCRYPT API version])
if test "$req_libgcrypt_api" -eq "$tmp" ; then
AC_MSG_RESULT([okay])
else
ok=no
AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
fi
fi
fi
fi
if test $ok = yes; then
LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
ifelse([$2], , :, [$2])
libgcrypt_config_host=`$LIBGCRYPT_CONFIG --host 2>/dev/null || echo none`
if test x"$libgcrypt_config_host" != xnone ; then
if test x"$libgcrypt_config_host" != x"$host" ; then
AC_MSG_WARN([[
***
*** The config script $LIBGCRYPT_CONFIG was
*** built for $libgcrypt_config_host and thus may not match the
*** used host $host.
*** You may want to use the configure option --with-libgcrypt-prefix
*** to specify a matching config script or use \$SYSROOT.
***]])
gpg_config_script_warn="$gpg_config_script_warn libgcrypt"
fi
fi
else
LIBGCRYPT_CFLAGS=""
LIBGCRYPT_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
])

134
m4/libotr.m4 Normal file
View File

@ -0,0 +1,134 @@
dnl
dnl Off-the-Record Messaging library
dnl Copyright (C) 2004-2007 Ian Goldberg, Chris Alexander, Nikita Borisov
dnl <otr@cypherpunks.ca>
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of version 2.1 of the GNU Lesser General
dnl Public License as published by the Free Software Foundation.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
dnl
dnl AM_PATH_LIBOTR([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
dnl Test for libotr, and define LIBOTR_CFLAGS and LIBOTR_LIBS as appropriate.
dnl enables arguments --with-libotr-prefix=
dnl --with-libotr-inc-prefix=
dnl
dnl You must already have found libgcrypt with AM_PATH_LIBGCRYPT
dnl
dnl Adapted from alsa.m4, originally by
dnl Richard Boulton <richard-alsa@tartarus.org>
dnl Christopher Lansdown <lansdoct@cs.alfred.edu>
dnl Jaroslav Kysela <perex@suse.cz>
AC_DEFUN([AM_PATH_LIBOTR],
[dnl Save the original CFLAGS, LDFLAGS, and LIBS
libotr_save_CFLAGS="$CFLAGS"
libotr_save_LDFLAGS="$LDFLAGS"
libotr_save_LIBS="$LIBS"
libotr_found=yes
dnl
dnl Get the cflags and libraries for libotr
dnl
AC_ARG_WITH(libotr-prefix,
[ --with-libotr-prefix=PFX Prefix where libotr is installed(optional)],
[libotr_prefix="$withval"], [libotr_prefix=""])
AC_ARG_WITH(libotr-inc-prefix,
[ --with-libotr-inc-prefix=PFX Prefix where libotr includes are (optional)],
[libotr_inc_prefix="$withval"], [libotr_inc_prefix=""])
dnl Add any special include directories
AC_MSG_CHECKING(for libotr CFLAGS)
if test "$libotr_inc_prefix" != "" ; then
LIBOTR_CFLAGS="$LIBOTR_CFLAGS -I$libotr_inc_prefix"
CFLAGS="$CFLAGS $LIBOTR_CFLAGS"
fi
AC_MSG_RESULT($LIBOTR_CFLAGS)
dnl add any special lib dirs
AC_MSG_CHECKING(for libotr LIBS)
if test "$libotr_prefix" != "" ; then
LIBOTR_LIBS="$LIBOTR_LIBS -L$libotr_prefix"
LDFLAGS="$LDFLAGS $LIBOTR_LIBS"
fi
dnl add the libotr library
LIBOTR_LIBS="$LIBOTR_LIBS -lotr"
LIBS="$LIBOTR_LIBS $LIBS"
AC_MSG_RESULT($LIBOTR_LIBS)
dnl Check for a working version of libotr that is of the right version.
min_libotr_version=ifelse([$1], ,3.0.0,$1)
no_libotr=""
libotr_min_major_version=`echo $min_libotr_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
libotr_min_minor_version=`echo $min_libotr_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
libotr_min_sub_version=`echo $min_libotr_version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
AC_MSG_CHECKING(for libotr headers version $libotr_min_major_version.x >= $min_libotr_version)
AC_LANG_SAVE
AC_LANG_C
AC_TRY_COMPILE([
#include <stdlib.h>
#include <libotr/version.h>
], [
# if(OTRL_VERSION_MAJOR != $libotr_min_major_version)
# error not present
# else
# if(OTRL_VERSION_MINOR > $libotr_min_minor_version)
exit(0);
# else
# if(OTRL_VERSION_MINOR < $libotr_min_minor_version)
# error not present
# endif
# if(OTRL_VERSION_SUB < $libotr_min_sub_version)
# error not present
# endif
# endif
# endif
exit(0);
],
[AC_MSG_RESULT(found.)],
[AC_MSG_RESULT(not present.)
ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libotr not found.)])
libotr_found=no]
)
AC_LANG_RESTORE
dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
AC_CHECK_LIB([otr], [otrl_message_receiving],,
[ifelse([$3], , [AC_MSG_ERROR(No linkable libotr was found.)])
libotr_found=no],
$LIBGCRYPT_LIBS
)
LDFLAGS="$libotr_save_LDFLAGS"
LIBS="$libotr_save_LIBS"
if test "x$libotr_found" = "xyes" ; then
ifelse([$2], , :, [$2])
else
LIBOTR_CFLAGS=""
LIBOTR_LIBS=""
ifelse([$3], , :, [$3])
fi
dnl That should be it. Now just export our symbols:
AC_SUBST(LIBOTR_CFLAGS)
AC_SUBST(LIBOTR_LIBS)
])

275
m4/pkg.m4 Normal file
View File

@ -0,0 +1,275 @@
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 12 (pkg-config-0.29.2)
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
dnl 02111-1307, USA.
dnl
dnl As a special exception to the GNU General Public License, if you
dnl distribute this file as part of a program that contains a
dnl configuration script generated by Autoconf, you may include it under
dnl the same distribution terms that you use for the rest of that
dnl program.
dnl PKG_PREREQ(MIN-VERSION)
dnl -----------------------
dnl Since: 0.29
dnl
dnl Verify that the version of the pkg-config macros are at least
dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's
dnl installed version of pkg-config, this checks the developer's version
dnl of pkg.m4 when generating configure.
dnl
dnl To ensure that this macro is defined, also add:
dnl m4_ifndef([PKG_PREREQ],
dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])])
dnl
dnl See the "Since" comment for each macro you use to see what version
dnl of the macros you require.
m4_defun([PKG_PREREQ],
[m4_define([PKG_MACROS_VERSION], [0.29.2])
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG
dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------------------------------
dnl Since: 0.18
dnl
dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
dnl only at the first occurence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
dnl ---------------------------------------------
dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting
dnl pkg_failed based on the result.
m4_define([_PKG_CONFIG],
[if test -n "$$1"; then
pkg_cv_[]$1="$$1"
elif test -n "$PKG_CONFIG"; then
PKG_CHECK_EXISTS([$3],
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes])
else
pkg_failed=untried
fi[]dnl
])dnl _PKG_CONFIG
dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl ---------------------------
dnl Internal check to see if pkg-config supports short errors.
AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi[]dnl
])dnl _PKG_SHORT_ERRORS_SUPPORTED
dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl --------------------------------------------------------------
dnl Since: 0.4.0
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES might not happen, you should be sure to include an
dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
AC_DEFUN([PKG_CHECK_MODULES],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
pkg_failed=no
AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else
$1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
_PKG_TEXT])[]dnl
])
elif test $pkg_failed = untried; then
AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
_PKG_TEXT
To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
$3
fi[]dnl
])dnl PKG_CHECK_MODULES
dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
dnl [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------------------
dnl Since: 0.29
dnl
dnl Checks for existence of MODULES and gathers its build flags with
dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags
dnl and VARIABLE-PREFIX_LIBS from --libs.
dnl
dnl Note that if there is a possibility the first call to
dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to
dnl include an explicit call to PKG_PROG_PKG_CONFIG in your
dnl configure.ac.
AC_DEFUN([PKG_CHECK_MODULES_STATIC],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
_save_PKG_CONFIG=$PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES($@)
PKG_CONFIG=$_save_PKG_CONFIG[]dnl
])dnl PKG_CHECK_MODULES_STATIC
dnl PKG_INSTALLDIR([DIRECTORY])
dnl -------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable pkgconfigdir as the location where a module
dnl should install pkg-config .pc files. By default the directory is
dnl $libdir/pkgconfig, but the default can be changed by passing
dnl DIRECTORY. The user can override through the --with-pkgconfigdir
dnl parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_INSTALLDIR
dnl PKG_NOARCH_INSTALLDIR([DIRECTORY])
dnl --------------------------------
dnl Since: 0.27
dnl
dnl Substitutes the variable noarch_pkgconfigdir as the location where a
dnl module should install arch-independent pkg-config .pc files. By
dnl default the directory is $datadir/pkgconfig, but the default can be
dnl changed by passing DIRECTORY. The user can override through the
dnl --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
])dnl PKG_NOARCH_INSTALLDIR
dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
dnl -------------------------------------------
dnl Since: 0.28
dnl
dnl Retrieves the value of the pkg-config variable for the given module.
AC_DEFUN([PKG_CHECK_VAR],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl
_PKG_CONFIG([$1], [variable="][$3]["], [$2])
AS_VAR_COPY([$1], [pkg_cv_][$1])
AS_VAR_IF([$1], [""], [$5], [$4])dnl
])dnl PKG_CHECK_VAR

View File

@ -1,6 +1,6 @@
project('irssi', 'c',
version : '1.4-head-an',
meson_version : '>=0.53',
version : '1.3-head',
meson_version : '>=0.49',
default_options : ['warning_level=1'])
############################
@ -11,12 +11,6 @@ cc = meson.get_compiler('c')
rootinc = include_directories('.')
dep = []
textui_dep = []
need_dl_cross_link = false
# 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
endif
includedir = get_option('includedir')
incdir = 'irssi'
@ -32,6 +26,8 @@ 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_truecolor = get_option('enable-true-color') == 'yes'
want_gregex = get_option('disable-gregex') != 'yes'
require_capsicum = get_option('with-capsicum') == 'yes'
want_capsicum = get_option('with-capsicum') != 'no'
@ -51,19 +47,12 @@ 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()
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')
error('this tree has been configured with autotools, cannot proceed')
endif
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)
run_command('ln', '-s', meson.current_source_dir() / 'src', meson.current_build_dir() / incdir)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-config.h', meson.current_build_dir() / incdir)
run_command('ln', '-s', meson.current_build_dir() / 'irssi-version.h', meson.current_build_dir() / incdir)
def_moduledir = '-D' + 'MODULEDIR' + '="' + (get_option('prefix') / moduledir) + '"'
def_sysconfdir = '-D' + 'SYSCONFDIR' + '="' + (get_option('prefix') / get_option('sysconfdir')) + '"'
@ -77,13 +66,8 @@ def_suppress_printf_fallback = '-D' + 'SUPPRESS_PRINTF_FALLBACK'
# Help files #
##############
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)
perl = find_program('perl')
run_command(perl, files('utils/syntax.pl'))
###################
# irssi-version.h #
@ -163,7 +147,6 @@ if not socket_found
error('socket not found')
endif
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')
@ -171,7 +154,7 @@ 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)
glib_dep = dependency('glib-2.0', version : '>=2.28', required : not want_glib_internal, static : want_static_dependency)
else
glib_dep = dependency('', required : false)
endif
@ -179,64 +162,15 @@ 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',
command : [ meson_cmd, 'subprojects', 'download', 'glib', '--sourcedir', meson.current_source_dir() ],
console : true,
output : ['glib-internal-download'],
)
glib_internal_dependencies = [
dependency('threads'),
]
glib_internal_configure_args = []
glib_internal_usr_local = false
if not cc.has_function('iconv_open')
prov_lib = cc.find_library('iconv', required : false)
if not prov_lib.found()
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)
if not prov_lib.found()
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']
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)
else
prov_lib = dependency('', required : false)
endif
if prov_lib.found()
glib_internal_dependencies += prov_lib
else
glib_internal_configure_args += '-Dxattr=false'
endif
endif
glib_internal_configure_t = custom_target('glib-internal-configure',
command : [ meson_cmd, 'setup', '--prefix=/irssi-glib-internal',
'--buildtype=' + get_option('buildtype'),
'-Dlibmount=false', '-Dselinux=false', '-Ddefault_library=static', '-Dinternal_pcre=true',
glib_internal_configure_args,
(meson.current_build_dir() / 'build-subprojects' / 'glib'),
(meson.current_source_dir() / 'subprojects' / glib_internal_version) ],
console : true,
@ -250,7 +184,9 @@ if not glib_dep.found()
output : ['glib-internal-build'],
depends : glib_internal_configure_t,)
glib_dep = declare_dependency(
dependencies : glib_internal_dependencies,
dependencies : [
dependency('threads'),
],
sources : glib_internal_build_t,
compile_args : [
'-I' + (meson.current_source_dir() / 'subprojects' / glib_internal_version / 'glib'),
@ -259,7 +195,6 @@ if not glib_dep.found()
],
link_args : [ meson.current_build_dir() / 'build-subprojects' / 'glib' / 'glib' / 'libglib-2.0.a' ],
)
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)
@ -278,12 +213,7 @@ endif
dep += glib_dep
dep += gmodule_dep
if glib_internal and want_static_dependency and want_fuzzer
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)
endif
openssl_dep = dependency('openssl', static : want_static_dependency)
dep += openssl_dep
############
@ -334,46 +264,34 @@ if want_perl
perl_rpath = ''
#### ccopts ####
perl_ccopts = meson.get_cross_property('perl_ccopts', false)
if perl_ccopts == false
res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ccopts', check : true)
perl_ccopts = res.stdout().strip().split()
endif
foreach fl : perl_ccopts
if fl.startswith('-D') or fl.startswith('-U') or fl.startswith('-I') or fl.startswith('-i') or fl.startswith('-f') or fl.startswith('-m')
perl_cflags += fl
endif
res = run_command(perl, '-MExtUtils::Embed', '-e', 'ccopts')
foreach fl : res.stdout().strip().split()
if fl.startswith('-D') or fl.startswith('-U') or fl.startswith('-I') or fl.startswith('-i') or fl.startswith('-f') or fl.startswith('-m')
perl_cflags += fl
endif
endforeach
perl_cflags += cc.get_supported_arguments('-fPIC')
#### ldopts ####
perl_ldopts = meson.get_cross_property('perl_ldopts', false)
if perl_ldopts == false
res = run_command(cross_perl, '-MExtUtils::Embed', '-e', 'ldopts', check : true)
perl_ldopts = res.stdout().strip().split()
endif
res = run_command(perl, '-MExtUtils::Embed', '-e', 'ldopts')
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,')
perl_rpath = fl.split(',')[2]
perl_rpath_flags += fl
else
perl_ldflags += fl
endif
endif
foreach fl : res.stdout().strip().split()
if not fl.startswith('-A') and not skip_libs.contains(fl)
if fl.startswith('-Wl,-rpath,')
perl_rpath = fl.split(',')[2]
perl_rpath_flags += fl
else
perl_ldflags += fl
endif
endif
endforeach
perl_version = meson.get_cross_property('perl_version', false)
if perl_version == false
perl_version = run_command(cross_perl, '-V::version:', check : true).stdout().split('\'')[1]
endif
perl_dep = declare_dependency(compile_args : perl_cflags, link_args : perl_ldflags,
version : perl_version)
version : run_command(perl, '-V::version:').stdout().split('\'')[1])
####
if not cc.links('''
if not cc.run('''
#include <EXTERN.h>
#include <perl.h>
int main()
@ -382,18 +300,15 @@ int main()
return 0;
}
''', args : perl_cflags + perl_ldflags + perl_rpath_flags,
name : 'working Perl support')
name : 'working Perl support').compiled()
if require_perl
error('error linking with perl libraries')
else
warning('error linking with perl libraries')
endif
else
xsubpp_file_c = meson.get_cross_property('perl_xsubpp', false)
if xsubpp_file_c == false
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_file_c = run_command(perl, '-MExtUtils::ParseXS', '-Eprint $INC{"ExtUtils/ParseXS.pm"} =~ s{ParseXS\\.pm$}{xsubpp}r').stdout()
xsubpp = generator(perl,
output : '@BASENAME@.c',
capture : true,
arguments : [ xsubpp_file_c, '@EXTRA_ARGS@', '@INPUT@' ],
@ -401,7 +316,7 @@ 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(perl, '-MText::ParseWords=shellwords', '-e', 'grep { s/^INSTALL_BASE=// && print && exit } shellwords $ENV{PERL_MM_OPT}').stdout()
if perl_install_base == ''
with_perl_lib = ''
endif
@ -413,21 +328,13 @@ int main()
with_perl_lib = 'vendor'
endif
endif
perlmoddir = ''
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']
perlmoddir = meson.get_cross_property('perl_install' + with_perl_lib + 'arch', false)
if perlmoddir == false
perlmoddir = run_command(cross_perl, '-V::install' + with_perl_lib + 'arch:', check : true).stdout().split('\'')[1]
endif
perlmoddir = run_command(perl, '-V::install' + with_perl_lib + 'arch:').stdout().split('\'')[1]
elif with_perl_lib == 'module'
perl_archname = meson.get_cross_property('perl_archname', false)
if perl_archname == false
perl_archname = run_command(cross_perl, '-V::archname:', check : true).stdout().split('\'')[1]
endif
perlmoddir = perl_install_base / 'lib' / 'perl5' / perl_archname
perlmoddir = perl_install_base / 'lib' / 'perl5' / run_command(perl, '-V::archname:').stdout().split('\'')[1]
endif
elif with_perl_lib == ''
set_perl_use_lib = true
@ -437,19 +344,13 @@ int main()
set_perl_use_lib = true
perl_library_dir = 'custom'
perlmoddir = with_perl_lib
endif
if perlmoddir == ''
else
error('Unrecognised with-perl-lib value: ' + with_perl_lib)
endif
perl_use_lib = get_option('prefix') / perlmoddir
if set_perl_use_lib
perl_inc = meson.get_cross_property('perl_inc', false)
if perl_inc == false
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
set_perl_use_lib = run_command(perl, '-e', 'exit ! grep $_ eq $ARGV[0], grep /^\\//, @INC', perl_use_lib).returncode() != 0
if not set_perl_use_lib
perl_library_dir += ' - other path in @INC'
else
@ -489,7 +390,7 @@ 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)
nvlist_create_found = libnv.found() and cc.has_function('nvlist_create_found', dependencies : libnv)
if nvlist_create_found
dep += libnv
have_capsicum = true
@ -505,16 +406,6 @@ if want_capsicum
endif
endif
# dependency helper sets
dep_cflagsonly = []
foreach d : dep
dep_cflagsonly += d.partial_dependency(includes : true, compile_args : true)
endforeach
dl_cross_dep = []
if need_dl_cross_link
dl_cross_dep = dep
endif
##################
# irssi-config.h #
##################
@ -523,10 +414,10 @@ conf = configuration_data()
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.set('HAVE_SOCKS', false, description : 'Build with socks support')
conf.set('TERM_TRUECOLOR', want_truecolor, description : 'true color support in terminal')
conf.set('USE_GREGEX', want_gregex, description : 'use GRegex for regular expressions')
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 = [
'sys/ioctl.h',
@ -534,7 +425,6 @@ headers = [
'sys/time.h',
'sys/utsname.h',
'dirent.h',
'term.h',
'unistd.h',
]
foreach h : headers
@ -544,7 +434,7 @@ foreach h : headers
endforeach
conf.set('HAVE_LIBUTF8PROC', have_libutf8proc)
conf.set_quoted('PACKAGE_VERSION', package_version)
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('PACKAGE_TARNAME', meson.project_name())
configure_file(output : 'irssi-config.h',
@ -556,6 +446,7 @@ configure_file(output : 'irssi-config.h',
##########
#### warnings ####
add_project_arguments('-Wall', language : 'c')
add_project_arguments(cc.get_supported_arguments('-Werror=declaration-after-statement'), language : 'c')
#### personality ####
@ -585,11 +476,7 @@ pc_requires = []
if not glib_internal
pc_requires += glib_dep
endif
pc.generate(filebase : 'irssi-1',
name : 'Irssi',
description : 'Irssi chat client',
version : package_version,
requires : pc_requires)
pc.generate(filebase : 'irssi-1', name : 'Irssi', description : 'Irssi chat client', requires : pc_requires)
###########
# irssi.1 #
@ -629,6 +516,8 @@ if have_perl
endif
message('Install prefix ................... : ' + get_option('prefix'))
message('')
message('Building with true color support.. : ' + want_truecolor.to_string('yes', 'no'))
message('Building with GRegex ............. : ' + want_gregex.to_string('yes', 'no'))
message('Building with Capsicum ........... : ' + have_capsicum.to_string('yes', 'no'))
message('Building with utf8proc ........... : ' + have_libutf8proc.to_string('yes', 'no'))
message('Building with OTR support ........ : ' + have_otr.to_string('yes', 'no'))

View File

@ -7,10 +7,10 @@ option('with-proxy', type : 'combo', description : 'Build irssi-proxy',
option('with-perl-lib', type : 'string', description : 'Specify where to install the Perl libraries for Irssi')
option('with-perl', type : 'combo', description : 'Build with Perl support', choices : ['auto', 'yes', 'no'])
option('with-otr', type : 'combo', description : 'Build with OTR support', choices : ['auto', 'yes', 'no'])
option('enable-true-color', type : 'combo', description : 'Build with true color support in terminal', choices : ['no', 'yes'])
option('disable-gregex', type : 'combo', description : 'Build without GRegex (fall back to regex.h)', choices : ['no', 'yes'])
option('disable-utf8proc', type : 'combo', description : 'Build without Julia\'s utf8proc', choices : ['auto', 'yes', 'no'])
option('with-capsicum', type : 'combo', description : 'Build with Capsicum support', choices : ['auto', 'yes', 'no'])
option('static-dependency', type : 'combo', description : 'Request static dependencies', choices : ['no', 'yes'])
option('install-glib', type : 'combo', description : 'Download and install GLib for you', choices : ['no', 'yes', 'force'])
option('docdir', type : 'string', description : 'Documentation directory')
option('fhs-prefix', type : 'string', description : 'System prefix for Termux')
option('PACKAGE_VERSION', type : 'string', description : 'Override PACKAGE_VERSION in tarballs')

17
scripts/Makefile.am Normal file
View File

@ -0,0 +1,17 @@
SUBDIRS = examples
scriptdir = $(datadir)/irssi/scripts
script_DATA = \
autoop.pl \
autorejoin.pl \
buf.pl \
dns.pl \
kills.pl \
mail.pl \
mlock.pl \
quitmsg.pl \
scriptassist.pl \
usercount.pl
EXTRA_DIST = $(script_DATA)

View File

@ -0,0 +1,8 @@
scriptdir = $(datadir)/irssi/scripts
script_DATA = \
command.pl \
msg-event.pl \
redirect.pl
EXTRA_DIST = $(script_DATA)

View File

@ -6,27 +6,36 @@ use Irssi::Irc;
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "1.01";
$VERSION = "1.00";
%IRSSI = (
authors => 'Timo Sirainen',
name => 'quitmsg',
description => 'Random quit messages',
license => 'Public Domain',
changed => 'Mon Jul 22 20:00 EET 2020'
changed => 'Sun Mar 10 23:18 EET 2002'
);
my $quitfile = Irssi::get_irssi_dir() . "/irssi.quit";
my $quitfile = glob "~/.irssi/irssi.quit";
sub cmd_quit {
my ($data, $server, $channel) = @_;
return if ($data ne "");
open (my $fh, "<", $quitfile) || return;
my @lines = <$fh>;
my $quitmsg = $lines[int(rand(@lines))];
chomp($quitmsg);
close($fh);
open (f, "<", $quitfile) || return;
my $lines = 0; while(<f>) { $lines++; };
my $line = int(rand($lines))+1;
my $quitmsg;
seek(f, 0, 0); $. = 0;
while(<f>) {
next if ($. != $line);
chomp;
$quitmsg = $_;
last;
}
close(f);
foreach my $server (Irssi::servers) {
$server->command("/disconnect ".$server->{tag}." $quitmsg");

View File

@ -5,33 +5,30 @@
use strict;
our $VERSION = '2020042700';
our $VERSION = '2003020806';
our %IRSSI = (
authors => 'Stefan \'tommie\' Tomanek',
contact => 'stefan@pico.ruhr.de',
name => 'scriptassist',
description => 'keeps your scripts on the cutting edge',
license => 'GPLv2',
url => 'https://scripts.irssi.org/',
modules => 'CPAN::Meta::YAML LWP::Protocol::https (GnuPG)',
url => 'http://irssi.org/scripts/',
modules => 'Data::Dumper LWP::UserAgent (GnuPG)',
commands => "scriptassist"
);
our ($forked, %remote_db, $have_gpg, @complist);
use Irssi 20020324;
use CPAN::Meta::YAML;
use Data::Dumper;
use LWP::UserAgent;
use POSIX;
use version;
# GnuPG is not always needed
$have_gpg = 0;
eval "use GnuPG qw(:algo :trust);";
$have_gpg = 1 if not ($@);
my $irssi_version = qv(Irssi::parse_special('v$J') =~ s/-.*//r);
sub show_help {
my $help = "scriptassist $VERSION
/scriptassist check
@ -42,15 +39,15 @@ sub show_help {
Search the script database
/scriptassist info <scripts>
Display information about <scripts>
/scriptassist ratings <scripts|all>
Retrieve the average ratings of the the scripts
/scriptassist top <num>
Retrieve the first <num> top rated scripts
/scriptassist new <num>
".#/scriptassist ratings <scripts>
# Retrieve the average ratings of the the scripts
#/scriptassist top <num>
# Retrieve the first <num> top rated scripts
"/scriptassist new <num>
Display the newest <num> scripts
/scriptassist rate <script>
Rate the script if you like it
/scriptassist contact <script>
".#/scriptassist rate <script> <stars>
# Rate the script with a number of stars ranging from 0-5
"/scriptassist contact <script>
Write an email to the author of the script
(Requires OpenURL)
/scriptassist cpan <module>
@ -98,7 +95,6 @@ sub call_openurl {
$code->($url);
} else {
print CLIENTCRAP "%R>>%n Please install openurl.pl";
print CLIENTCRAP "%R>>%n or open < $url > manually";
}
}
@ -174,13 +170,14 @@ sub bg_do {
my $cmd = $items[1];
$result{data}{unknown}{$cmd} = get_unknown($cmd, $xml);
}
my $yaml = CPAN::Meta::YAML->new(\%result);
my $data = $yaml->write_string();
my $dumper = Data::Dumper->new([\%result]);
$dumper->Purity(1)->Deepcopy(1)->Indent(0);
my $data = $dumper->Dump;
print($wh $data);
};
if ($@) {
print($wh CPAN::Meta::YAML->new(+{data=>+{error=>$@}})
->write_string());
print($wh Data::Dumper->new([+{data=>+{error=>$@}}])
->Purity(1)->Deepcopy(1)->Indent(0)->Dump);
}
close($wh);
POSIX::_exit(1);
@ -192,7 +189,7 @@ sub get_unknown {
foreach (keys %$db) {
next unless defined $db->{$_}{commands};
foreach my $item (split / /, $db->{$_}{commands}) {
return { $_ => +{%{$db->{$_}}} } if ($item =~ /^$cmd$/i);
return { $_ => $db->{$_} } if ($item =~ /^$cmd$/i);
}
}
return undef;
@ -268,80 +265,47 @@ sub script_info {
$result{$sname}{modules}{$mod}{installed} = module_exist($mod);
}
}
# if (defined $xml->{$plname}{depends}) {
# my $depends = $xml->{$plname}{depends};
# foreach my $dep (split(/ /, $depends)) {
# $result{$sname}{depends}{$dep}{installed} = 1; #(defined ${ 'Irssi::Script::'.$dep });
# }
# }
if (defined $xml->{$plname}{depends}) {
my $depends = $xml->{$plname}{depends};
foreach my $dep (split(/ /, $depends)) {
$result{$sname}{depends}{$dep}{installed} = 1;
}
}
}
return \%result;
}
sub get_rate_url {
my ($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);
my $response = $ua->request($request);
unless ($response->is_success) {
my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
die("Fetching ratings location failed: $error");
}
my $votes_url;
for my $tag ($response->content() =~ /<script([^>]*)>/g) {
my $attr = " $tag ";
($votes_url = $1) =~ s/\.\w+$/.yml/
if $attr =~ /\sasync\s/ && $attr =~ m{\ssrc="(https?://.*?/votes\.\w+)"\s};
}
unless ($votes_url) {
die("Fetching ratings failed: Could not find votes script\n");
}
$request = HTTP::Request->new('GET', $votes_url);
$response = $ua->request($request);
if (!$response->is_success) {
my $error = join "\n", $response->status_line(), (grep / at .* line \d+/, split "\n", $response->content()), '';
die("Fetching ratings failed: $error");
}
my $data = $response->content();
utf8::decode($data);
CPAN::Meta::YAML->read_string($data)->[0];
}
sub rate_script {
my ($script, $stars) = @_;
my $xml = get_scripts();
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}
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.2003020803);
my $request = HTTP::Request->new('GET', 'http://ratings.irssi.de/irssirate.pl?&stars='.$stars.'&mode=rate&script='.$script);
my $response = $ua->request($request);
unless ($response->is_success() && $response->content() =~ /You already rated this script/) {
return 1;
} else {
return 0;
}
}
sub get_ratings {
my ($scripts, $limit) = @_;
my $xml = get_scripts();
my $votes = get_rate_url(map { $_->{source} } values %$xml);
foreach (keys %{$votes}) {
if ($xml->{$_}) {
$xml->{$_}{votes} = $votes->{$_}{v};
}
}
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.2003020803);
my $script = join(',', @{$scripts});
my $request = HTTP::Request->new('GET', 'http://ratings.irssi.de/irssirate.pl?script='.$script.'&sort=rating&limit='.$limit);
my $response = $ua->request($request);
my %result;
if (@{$scripts}) {
foreach (@{$scripts}) {
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}
|| $xml->{$b}{modified} cmp $xml->{$a}{modified} }
grep { !$xml->{$_}{HIDDEN} && $xml->{$_}{votes} ne '' } keys %$xml;
foreach (splice @keys, 0, $limit) {
$result{$_} = [$xml->{$_}{votes}];
if ($response->is_success()) {
foreach (split /\n/, $response->content()) {
if (/<tr><td><a href=".*?">(.*?)<\/a>/) {
my $entry = $1;
if (/"><\/td><td>([0-9.]+)<\/td><td>(.*?)<\/td><td>/) {
$result{$entry} = [$1, $2];
}
}
}
}
die "No such script found\n" unless keys %result;
return \%result;
}
@ -349,7 +313,7 @@ sub get_new {
my ($num) = @_;
my $result;
my $xml = get_scripts();
foreach (sort {$xml->{$b}{modified} cmp $xml->{$a}{modified}} keys %$xml) {
foreach (sort {$xml->{$b}{last_modified} cmp $xml->{$a}{last_modified}} keys %$xml) {
my %entry = %{ $xml->{$_} };
next if $entry{HIDDEN};
$result->{$_} = \%entry;
@ -463,8 +427,8 @@ sub pipe_input {
print CLIENTCRAP "%R<<%n Something weird happend (no text)";
return();
}
utf8::decode($text);
my $incoming = CPAN::Meta::YAML->read_string($text)->[0];
local our $VAR1;
my $incoming = eval($text);
if ($incoming->{db} && $incoming->{timestamp}) {
$remote_db{db} = $incoming->{db};
$remote_db{timestamp} = $incoming->{timestamp};
@ -634,8 +598,13 @@ sub print_rate {
my (%data) = @_;
my $line;
foreach my $script (sort keys(%data)) {
call_openurl($data{$script});
if ($data{$script}) {
$line .= "%go%n %9".$script."%9 has been rated";
} else {
$line .= "%ro%n %9".$script."%9 : Already rated this script";
}
}
print CLIENTCRAP draw_box('ScriptAssist', $line, 'rating', 1) ;
}
sub print_ratings {
@ -649,7 +618,8 @@ sub print_ratings {
push @line, "%yo%n";
}
push @line, "%9".$script."%9";
push @line, "[".(length $data{$script}{rating} ? $data{$script}{rating} : 'no')." votes]";
push @line, $data{$script}{rating};
push @line, "[".$data{$script}{votes}." votes]";
push @table, \@line;
}
print CLIENTCRAP draw_box('ScriptAssist', array2table(@table), 'ratings', 1) ;
@ -658,7 +628,7 @@ sub print_ratings {
sub print_new {
my ($list) = @_;
my @table;
foreach (sort {$list->{$b}{modified} cmp $list->{$a}{modified}} keys %$list) {
foreach (sort {$list->{$b}{last_modified} cmp $list->{$a}{last_modified}} keys %$list) {
my @line;
my ($name) = get_names($_);
if (get_local_version($name)) {
@ -667,7 +637,7 @@ sub print_new {
push @line, "%yo%n";
}
push @line, "%9".$name."%9";
push @line, $list->{$_}{modified};
push @line, $list->{$_}{last_modified};
push @table, \@line;
}
print CLIENTCRAP draw_box('ScriptAssist', array2table(@table), 'new scripts', 1) ;
@ -852,7 +822,7 @@ sub contact_author {
sub get_scripts {
my $ua = LWP::UserAgent->new(env_proxy=>1, keep_alive=>1, timeout=>30);
$ua->agent('ScriptAssist/'.$VERSION);
$ua->agent('ScriptAssist/'.2003020803);
$ua->env_proxy();
my @mirrors = split(/ /, Irssi::settings_get_str('scriptassist_script_sources'));
my %sites_db;
@ -876,32 +846,28 @@ sub get_scripts {
}
$fetched = 1;
my $data = $response->content();
my $src = $site;
my $type = '';
my ($src, $type);
if ($site =~ /(.*\/).+\.(.+)/) {
$src = $1;
$type = $2;
}
push @sources, $src;
#my @header = ('name', 'contact', 'authors', 'description', 'version', 'modules', 'modified');
#my @header = ('name', 'contact', 'authors', 'description', 'version', 'modules', 'last_modified');
if ($type eq 'dmp') {
die("Support for $type script database has been removed. Please /set scriptassist_script_sources and change $type -> yml.\n");
} elsif ($type eq 'yml') {
utf8::decode($data);
my $new_db = CPAN::Meta::YAML->read_string($data);
foreach (@{$new_db->[0]}) {
my $K = $_->{filename};
if (defined $sites_db{script}{$K}) {
my $old = $sites_db{$K}{version};
my $new = $_->{version};
no strict 'vars';
my $new_db = eval "$data";
foreach (keys %$new_db) {
if (defined $sites_db{script}{$_}) {
my $old = $sites_db{$_}{version};
my $new = $new_db->{$_}{version};
next if (compare_versions($old, $new) eq 'newer');
}
#foreach my $key (@header) {
foreach my $key (keys %$_) {
next unless defined $_->{$key};
$sites_db{$K}{$key} = $_->{$key};
foreach my $key (keys %{ $new_db->{$_} }) {
next unless defined $new_db->{$_}{$key};
$sites_db{$_}{$key} = $new_db->{$_}{$key};
}
$sites_db{$K}{source} = $src;
$sites_db{$_}{source} = $src;
}
} else {
die("Unknown script database type ($type).\n");
@ -1127,7 +1093,6 @@ sub missing_module {
sub cmd_scripassist {
my ($arg, $server, $witem) = @_;
utf8::decode($arg);
my @args = split(/ /, $arg);
if ($args[0] eq 'help' || $args[0] eq '-h') {
show_help();
@ -1147,9 +1112,9 @@ sub cmd_scripassist {
} elsif ($args[0] eq 'ratings' && defined $args[1]) {
shift @args;
bg_do("ratings ".join(' ', @args));
} elsif ($args[0] eq 'rate' && defined $args[1]) {
} elsif ($args[0] eq 'rate' && defined $args[1] && defined $args[2]) {
shift @args;
bg_do("rate ".join(' ', @args));
bg_do("rate ".join(' ', @args)) if ($args[2] >= 0 && $args[2] < 6);
} elsif ($args[0] eq 'info' && defined $args[1]) {
shift @args;
bg_do("info ".join(' ', @args));
@ -1190,7 +1155,6 @@ sub sig_command_script_load {
sub sig_default_command {
my ($cmd, $server) = @_;
return unless Irssi::settings_get_bool("scriptassist_check_unknown_commands");
return if ($cmd =~ /^\d+$/ && $irssi_version >= v1.2.0 && Irssi::settings_get_bool("window_number_commands"));
bg_do('unknown '.$cmd);
}
@ -1212,7 +1176,7 @@ sub sig_complete {
}
Irssi::settings_add_str($IRSSI{name}, 'scriptassist_script_sources', 'https://scripts.irssi.org/scripts.yml');
Irssi::settings_add_str($IRSSI{name}, 'scriptassist_script_sources', 'https://scripts.irssi.org/scripts.dmp');
Irssi::settings_add_bool($IRSSI{name}, 'scriptassist_cache_sources', 1);
Irssi::settings_add_bool($IRSSI{name}, 'scriptassist_update_verbose', 1);
Irssi::settings_add_bool($IRSSI{name}, 'scriptassist_check_verbose', 1);
@ -1246,11 +1210,11 @@ foreach my $cmd ( ( 'check',
'search',
# '-h',
'help',
'ratings',
'rate',
# 'ratings',
# 'rate',
'info',
# 'echo',
'top',
# 'top',
'cpan',
'autorun',
'new' ) ) {

25
src/Makefile.am Normal file
View File

@ -0,0 +1,25 @@
if BUILD_TEXTUI
TEXTUI=fe-text
endif
if BUILD_IRSSIBOT
BOTUI=fe-none
endif
if BUILD_IRSSIFUZZER
FUZZERUI=fe-fuzz
endif
if HAVE_PERL
PERLDIR=perl
endif
if HAVE_OTR
OTRDIR=otr
endif
pkginc_srcdir=$(pkgincludedir)/src
pkginc_src_HEADERS = \
common.h
SUBDIRS = lib-config core irc fe-common $(PERLDIR) $(OTRDIR) $(TEXTUI) $(BOTUI) $(FUZZERUI)

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 48
#define IRSSI_ABI_VERSION 23
#define DEFAULT_SERVER_ADD_PORT 6667
#define DEFAULT_SERVER_ADD_TLS_PORT 6697
@ -37,20 +37,23 @@
#include <fcntl.h>
#include <glib.h>
#include <gmodule.h>
#ifdef HAVE_GMODULE
# include <gmodule.h>
#endif
typedef guint64 uoff_t;
#define PRIuUOFF_T G_GUINT64_FORMAT
/* input functions */
#define I_INPUT_READ (1 << 0)
#define I_INPUT_WRITE (1 << 1)
#define G_INPUT_READ (1 << 0)
#define G_INPUT_WRITE (1 << 1)
typedef void (*GInputFunction) (void *data, GIOChannel *source, int condition);
int i_input_add(GIOChannel *source, int condition, GInputFunction function, void *data);
int i_input_add_full(GIOChannel *source, int priority, int condition, GInputFunction function,
void *data);
int g_input_add(GIOChannel *source, int condition,
GInputFunction function, void *data);
int g_input_add_full(GIOChannel *source, int priority, int condition,
GInputFunction function, void *data);
/* return full path for ~/.irssi */
const char *get_irssi_dir(void);

119
src/core/Makefile.am Normal file
View File

@ -0,0 +1,119 @@
noinst_LIBRARIES = libcore.a
AM_CPPFLAGS = \
$(GLIB_CFLAGS) \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DMODULEDIR=\""$(libdir)/irssi/modules"\"
if USE_GREGEX
regex_impl=iregex-gregex.c
else
regex_impl=iregex-regexh.c
endif
libcore_a_SOURCES = \
args.c \
channels.c \
channels-setup.c \
commands.c \
chat-commands.c \
chat-protocols.c \
chatnets.c \
core.c \
expandos.c \
ignore.c \
levels.c \
line-split.c \
log.c \
log-away.c \
masks.c \
misc.c \
modules.c \
modules-load.c \
net-disconnect.c \
net-nonblock.c \
net-sendbuffer.c \
network.c \
network-openssl.c \
nicklist.c \
nickmatch-cache.c \
pidwait.c \
queries.c \
rawlog.c \
recode.c \
refstrings.c \
servers.c \
servers-reconnect.c \
servers-setup.c \
session.c \
settings.c \
signals.c \
special-vars.c \
utf8.c \
$(regex_impl) \
wcwidth.c \
wcwidth-wrapper.c \
tls.c \
write-buffer.c
if HAVE_CAPSICUM
libcore_a_SOURCES += \
capsicum.c
endif
structure_headers = \
channel-rec.h \
channel-setup-rec.h \
chatnet-rec.h \
query-rec.h \
server-rec.h \
server-setup-rec.h \
server-connect-rec.h \
window-item-rec.h
pkginc_coredir=$(pkgincludedir)/src/core
pkginc_core_HEADERS = \
args.h \
capsicum.h \
channels.h \
channels-setup.h \
commands.h \
chat-protocols.h \
chatnets.h \
core.h \
expandos.h \
ignore.h \
levels.h \
line-split.h \
log.h \
masks.h \
misc.h \
module.h \
modules.h \
modules-load.h \
net-disconnect.h \
net-nonblock.h \
net-sendbuffer.h \
network.h \
network-openssl.h \
nick-rec.h \
nicklist.h \
nickmatch-cache.h \
pidwait.h \
queries.h \
rawlog.h \
recode.h \
refstrings.h \
servers.h \
servers-reconnect.h \
servers-setup.h \
session.h \
settings.h \
signals.h \
special-vars.h \
utf8.h \
iregex.h \
window-item-def.h \
tls.h \
write-buffer.h \
$(structure_headers)

View File

@ -34,10 +34,6 @@ static int compare_channel_setup (CONFIG_NODE *node, CHANNEL_SETUP_REC *channel)
{
char *name, *chatnet;
/* skip comment nodes */
if (node->type == NODE_TYPE_COMMENT)
return -1;
name = config_node_get_str(node, "name", NULL);
chatnet = config_node_get_str(node, "chatnet", NULL);
@ -207,18 +203,9 @@ static void channels_read_config(void)
/* Read channels */
node = iconfig_node_traverse("channels", FALSE);
if (node != NULL) {
int i = 0;
tmp = config_node_first(node->value);
for (; tmp != NULL; tmp = config_node_next(tmp), i++) {
node = tmp->data;
if (node->type != NODE_TYPE_BLOCK) {
g_critical("Expected block node at `channels[%d]' was of %s type. "
"Corrupt config?",
i, node->type == NODE_TYPE_LIST ? "list" : "scalar");
} else {
channel_setup_read(node);
}
}
for (; tmp != NULL; tmp = config_node_next(tmp))
channel_setup_read(tmp->data);
}
}
@ -227,7 +214,8 @@ void channels_setup_init(void)
setupchannels = NULL;
source_host_ok = FALSE;
signal_add("setup reread channels", (SIGNAL_FUNC) channels_read_config);
signal_add("setup reread", (SIGNAL_FUNC) channels_read_config);
signal_add("irssi init read settings", (SIGNAL_FUNC) channels_read_config);
}
void channels_setup_deinit(void)
@ -235,5 +223,6 @@ void channels_setup_deinit(void)
while (setupchannels != NULL)
channel_setup_destroy(setupchannels->data);
signal_remove("setup reread channels", (SIGNAL_FUNC) channels_read_config);
signal_remove("setup reread", (SIGNAL_FUNC) channels_read_config);
signal_remove("irssi init read settings", (SIGNAL_FUNC) channels_read_config);
}

View File

@ -126,8 +126,9 @@ CHANNEL_REC *channel_find(SERVER_REC *server, const char *name)
return channel_find_server(server, name);
/* find from any server */
return i_slist_foreach_find(servers, (FOREACH_FIND_FUNC) channel_find_server,
(void *) name);
return gslist_foreach_find(servers,
(FOREACH_FIND_FUNC) channel_find_server,
(void *) name);
}
void channel_change_name(CHANNEL_REC *channel, const char *name)
@ -152,8 +153,9 @@ void channel_change_visible_name(CHANNEL_REC *channel, const char *name)
static CHANNEL_REC *channel_find_servers(GSList *servers, const char *name)
{
return i_slist_foreach_find(servers, (FOREACH_FIND_FUNC) channel_find_server,
(void *) name);
return gslist_foreach_find(servers,
(FOREACH_FIND_FUNC) channel_find_server,
(void *) name);
}
static GSList *servers_find_chatnet_except(SERVER_REC *server)

View File

@ -40,7 +40,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
CHAT_PROTOCOL_REC *proto;
SERVER_CONNECT_REC *conn;
GHashTable *optlist;
char *addr, *portstr, *password, *nick, *chatnet, *host;
char *addr, *portstr, *password, *nick, *chatnet, *host, *tmp;
void *free_arg;
g_return_val_if_fail(data != NULL, NULL);
@ -71,8 +71,8 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
if (chatnet == NULL)
chatnet = g_hash_table_lookup(optlist, "network");
conn = server_create_conn_opt(proto != NULL ? proto->id : -1, addr, atoi(portstr), chatnet,
password, nick, optlist);
conn = server_create_conn(proto != NULL ? proto->id : -1, addr,
atoi(portstr), chatnet, password, nick);
if (conn == NULL) {
signal_emit("error command", 1,
GINT_TO_POINTER(CMDERR_NO_SERVER_DEFINED));
@ -94,7 +94,46 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
if (strchr(addr, '/') != NULL)
conn->unix_socket = TRUE;
/* TLS options are handled in server_create_conn_opt ... -> server_setup_fill_optlist */
if (g_hash_table_lookup(optlist, "6") != NULL)
conn->family = AF_INET6;
else if (g_hash_table_lookup(optlist, "4") != NULL)
conn->family = AF_INET;
if (g_hash_table_lookup(optlist, "tls") != NULL || g_hash_table_lookup(optlist, "ssl") != NULL)
conn->use_tls = TRUE;
if ((tmp = g_hash_table_lookup(optlist, "tls_cert")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_cert")) != NULL)
conn->tls_cert = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "tls_pkey")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_pkey")) != NULL)
conn->tls_pkey = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "tls_pass")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_pass")) != NULL)
conn->tls_pass = g_strdup(tmp);
if (g_hash_table_lookup(optlist, "tls_verify") != NULL || g_hash_table_lookup(optlist, "ssl_verify") != NULL)
conn->tls_verify = TRUE;
if ((tmp = g_hash_table_lookup(optlist, "tls_cafile")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_cafile")) != NULL)
conn->tls_cafile = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "tls_capath")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_capath")) != NULL)
conn->tls_capath = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "tls_ciphers")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_ciphers")) != NULL)
conn->tls_ciphers = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "tls_pinned_cert")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_pinned_cert")) != NULL)
conn->tls_pinned_cert = g_strdup(tmp);
if ((tmp = g_hash_table_lookup(optlist, "tls_pinned_pubkey")) != NULL || (tmp = g_hash_table_lookup(optlist, "ssl_pinned_pubkey")) != NULL)
conn->tls_pinned_pubkey = g_strdup(tmp);
if ((conn->tls_capath != NULL && conn->tls_capath[0] != '\0')
|| (conn->tls_cafile != NULL && conn->tls_cafile[0] != '\0'))
conn->tls_verify = TRUE;
if ((conn->tls_cert != NULL && conn->tls_cert[0] != '\0') || conn->tls_verify)
conn->use_tls = TRUE;
if (g_hash_table_lookup(optlist, "!") != NULL)
conn->no_autojoin_channels = TRUE;
if (g_hash_table_lookup(optlist, "noautosendcmd") != NULL)
conn->no_autosendcmd = TRUE;
if (g_hash_table_lookup(optlist, "noproxy") != NULL)
g_free_and_null(conn->proxy);
*rawlog_file = g_strdup(g_hash_table_lookup(optlist, "rawlog"));
@ -110,13 +149,13 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr,
return conn;
}
/* SYNTAX: CONNECT [-4 | -6] [-tls_cert <cert>] [-tls_pkey <pkey>] [-tls_pass <password>]
/* SYNTAX: 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] [-tls | -notls]
[-starttls | -disallow_starttls] [-noproxy] [-network <network>]
[-host <hostname>] [-rawlog <file>]
<address>|<chatnet> [<port> [<password> [<nick>]]] */
[-tls_ciphers <list>] [-tls_pinned_cert <fingerprint>] [-tls_pinned_pubkey <fingerprint>]
[-!] [-noautosendcmd]
[-noproxy] [-network <network>] [-host <hostname>]
[-rawlog <file>]
<address>|<chatnet> [<port> [<password> [<nick>]]] */
/* NOTE: -network replaces the old -ircnet flag. */
static void cmd_connect(const char *data)
{
@ -478,12 +517,7 @@ void chat_commands_init(void)
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg);
command_set_options(
"connect",
"4 6 !! -network ~ssl ~+ssl_cert ~+ssl_pkey ~+ssl_pass ~ssl_verify ~+ssl_cafile "
"~+ssl_capath ~+ssl_ciphers ~+ssl_pinned_cert ~+ssl_pinned_pubkey tls notls +tls_cert "
"+tls_pkey +tls_pass tls_verify notls_verify +tls_cafile +tls_capath +tls_ciphers "
"+tls_pinned_cert +tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_pinned_cert +ssl_pinned_pubkey tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
command_set_options("msg", "channel nick");
}

View File

@ -47,7 +47,7 @@ int chat_protocol_lookup(const char *name)
g_return_val_if_fail(name != NULL, -1);
rec = chat_protocol_find(name);
return rec == NULL ? -1 : rec->not_initialized ? CHAT_PROTOCOL_NOT_INITIALIZED : rec->id;
return rec == NULL ? -1 : rec->id;
}
CHAT_PROTOCOL_REC *chat_protocol_find(const char *name)
@ -99,22 +99,6 @@ CHAT_PROTOCOL_REC *chat_protocol_find_net(GHashTable *optlist)
return NULL;
}
static void chat_protocol_destroy(CHAT_PROTOCOL_REC *rec)
{
g_return_if_fail(rec != NULL);
chat_protocols = g_slist_remove(chat_protocols, rec);
if (default_proto == rec) {
chat_protocol_set_default(chat_protocols == NULL ? NULL : chat_protocols->data);
}
signal_emit("chat protocol destroyed", 1, rec);
g_free(rec->name);
g_free(rec);
}
/* Register new chat protocol. */
CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec)
{
@ -124,11 +108,7 @@ CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec)
g_return_val_if_fail(rec != NULL, NULL);
newrec = chat_protocol_find(rec->name);
if (newrec != NULL && newrec->not_initialized) {
chat_protocol_destroy(newrec);
newrec = NULL;
}
created = newrec == NULL;
created = newrec == NULL;
if (newrec == NULL) {
newrec = g_new0(CHAT_PROTOCOL_REC, 1);
chat_protocols = g_slist_append(chat_protocols, newrec);
@ -151,6 +131,23 @@ CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec)
return newrec;
}
static void chat_protocol_destroy(CHAT_PROTOCOL_REC *rec)
{
g_return_if_fail(rec != NULL);
chat_protocols = g_slist_remove(chat_protocols, rec);
if (default_proto == rec) {
chat_protocol_set_default(chat_protocols == NULL ? NULL :
chat_protocols->data);
}
signal_emit("chat protocol destroyed", 1, rec);
g_free(rec->name);
g_free(rec);
}
/* Unregister chat protocol. */
void chat_protocol_unregister(const char *name)
{
@ -194,6 +191,15 @@ static CHANNEL_SETUP_REC *create_channel_setup(void)
return g_new0(CHANNEL_SETUP_REC, 1);
}
static SERVER_CONNECT_REC *create_server_connect(void)
{
return g_new0(SERVER_CONNECT_REC, 1);
}
static void destroy_server_connect(SERVER_CONNECT_REC *conn)
{
}
/* Return "unknown chat protocol" record. Used when protocol name is
specified but it isn't registered yet. */
CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name)
@ -212,10 +218,8 @@ CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name)
rec->create_chatnet = create_chatnet;
rec->create_server_setup = create_server_setup;
rec->create_channel_setup = create_channel_setup;
/*
rec->create_server_connect = create_server_connect;
rec->destroy_server_connect = destroy_server_connect;
*/
newrec = chat_protocol_register(rec);
g_free(rec);

View File

@ -35,8 +35,6 @@ void *chat_protocol_check_cast(void *object, int type_pos, const char *id);
((object) == NULL ? chat_protocol_get_default() : \
chat_protocol_find_id((object)->chat_type))
#define CHAT_PROTOCOL_NOT_INITIALIZED -2
/* Register new chat protocol. */
CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec);

View File

@ -24,13 +24,12 @@
#include <irssi/src/core/special-vars.h>
#include <irssi/src/lib-config/iconfig.h>
#include <irssi/src/core/settings.h>
#include <irssi/src/core/misc.h>
#include <irssi/src/core/chat-protocols.h>
#include <irssi/src/core/chatnets.h>
#include <irssi/src/core/servers.h>
GSList *chatnets, *chatnets_unavailable; /* list of available chat networks */
GSList *chatnets; /* list of available chat networks */
static void chatnet_config_save(CHATNET_REC *chatnet)
{
@ -61,9 +60,8 @@ static void chatnet_config_remove(CHATNET_REC *chatnet)
void chatnet_create(CHATNET_REC *chatnet)
{
g_return_if_fail(chatnet != NULL);
g_return_if_fail(!CHAT_PROTOCOL(chatnet)->not_initialized);
chatnet->type = module_get_uniq_id("CHATNET", 0);
chatnet->type = module_get_uniq_id("CHATNET", 0);
if (g_slist_find(chatnets, chatnet) == NULL)
chatnets = g_slist_append(chatnets, chatnet);
@ -114,21 +112,6 @@ CHATNET_REC *chatnet_find(const char *name)
return NULL;
}
gboolean chatnet_find_unavailable(const char *name)
{
CHAT_PROTOCOL_REC *proto;
if (i_slist_find_icase_string(chatnets_unavailable, name) != NULL)
return TRUE;
proto = CHAT_PROTOCOL(chatnet_find(name));
if (proto == NULL || proto->not_initialized)
return TRUE;
return FALSE;
}
static void sig_connected(SERVER_REC *server)
{
CHATNET_REC *rec;
@ -153,23 +136,15 @@ static void chatnet_read(CONFIG_NODE *node)
return;
type = config_node_get_str(node, "type", NULL);
if (type == NULL) {
proto = chat_protocol_get_default();
} else {
proto = chat_protocol_find(type);
}
proto = type == NULL ? NULL : chat_protocol_find(type);
if (proto == NULL) {
/* protocol not loaded */
if (i_slist_find_icase_string(chatnets_unavailable, node->key) == NULL)
chatnets_unavailable =
g_slist_append(chatnets_unavailable, g_strdup(node->key));
return;
} else if (type == NULL) {
iconfig_node_set_str(node, "type", proto->name);
proto = type == NULL ? chat_protocol_get_default() :
chat_protocol_get_unknown(type);
}
if (type == NULL)
iconfig_node_set_str(node, "type", proto->name);
rec = proto->create_chatnet();
rec->type = module_get_uniq_id("CHATNET", 0);
rec->chat_type = proto->id;
@ -192,12 +167,6 @@ static void read_chatnets(void)
while (chatnets != NULL)
chatnet_destroy(chatnets->data);
while (chatnets_unavailable != NULL) {
char *name = chatnets_unavailable->data;
chatnets_unavailable = g_slist_remove(chatnets_unavailable, name);
g_free(name);
}
node = iconfig_node_traverse("chatnets", FALSE);
if (node != NULL) {
tmp = config_node_first(node->value);
@ -211,7 +180,8 @@ void chatnets_init(void)
chatnets = NULL;
signal_add_first("event connected", (SIGNAL_FUNC) sig_connected);
signal_add("setup reread chatnets", (SIGNAL_FUNC) read_chatnets);
signal_add("setup reread", (SIGNAL_FUNC) read_chatnets);
signal_add_first("irssi init read settings", (SIGNAL_FUNC) read_chatnets);
}
void chatnets_deinit(void)
@ -219,5 +189,6 @@ void chatnets_deinit(void)
module_uniq_destroy("CHATNET");
signal_remove("event connected", (SIGNAL_FUNC) sig_connected);
signal_remove("setup reread chatnets", (SIGNAL_FUNC) read_chatnets);
signal_remove("setup reread", (SIGNAL_FUNC) read_chatnets);
signal_remove("irssi init read settings", (SIGNAL_FUNC) read_chatnets);
}

View File

@ -25,8 +25,6 @@ void chatnet_destroy(CHATNET_REC *chatnet);
/* Find the chat network by name */
CHATNET_REC *chatnet_find(const char *name);
/* Check if this chatnet is unavailable because the protocol is not loaded */
gboolean chatnet_find_unavailable(const char *name);
void chatnets_init(void);
void chatnets_deinit(void);

View File

@ -339,28 +339,11 @@ void command_runsub(const char *cmd, const char *data,
g_free(orig);
}
static char *optname(char *option)
{
char *opt = option;
if (*opt == '~')
opt++;
if (iscmdtype(*opt))
opt++;
return opt;
}
static gboolean optflag(char *option, char *flag)
{
if (*option == '~')
return optflag(option + 1, flag);
return (strchr(flag, *option) != NULL) || (!iscmdtype(*option) && strchr(flag, ' '));
}
static GSList *optlist_find(GSList *optlist, const char *option)
{
while (optlist != NULL) {
char *name = optname(optlist->data);
char *name = optlist->data;
if (iscmdtype(*name)) name++;
if (g_ascii_strcasecmp(name, option) == 0)
return optlist;
@ -386,7 +369,7 @@ int command_have_option(const char *cmd, const char *option)
return FALSE;
for (tmp = rec->options; *tmp != NULL; tmp++) {
char *name = optname(*tmp);
char *name = iscmdtype(**tmp) ? (*tmp)+1 : *tmp;
if (g_ascii_strcasecmp(name, option) == 0)
return TRUE;
@ -416,7 +399,7 @@ static void command_calc_options(COMMAND_REC *rec, const char *options)
/* merge the options */
for (tmp = optlist; *tmp != NULL; tmp++) {
name = optname(*tmp);
name = iscmdtype(**tmp) ? (*tmp)+1 : *tmp;
oldopt = optlist_find(list, name);
if (oldopt != NULL) {
@ -431,7 +414,7 @@ static void command_calc_options(COMMAND_REC *rec, const char *options)
g_strfreev(optlist);
/* linked list -> string[] */
str = i_slist_to_string(list, " ");
str = gslist_to_string(list, " ");
rec->options = g_strsplit(str, " ", -1);
g_free(str);
@ -518,7 +501,7 @@ char *cmd_get_quoted_param(char **data)
while (**data != '\0' && (**data != quote ||
((*data)[1] != ' ' && (*data)[1] != '\0'))) {
if (**data == '\\' && (*data)[1] != '\0')
memmove(*data, (*data)+1, strlen(*data));
g_memmove(*data, (*data)+1, strlen(*data));
(*data)++;
}
@ -546,7 +529,7 @@ static int option_find(char **array, const char *option)
found = -1; index = 0; multiple = FALSE;
for (tmp = array; *tmp != NULL; tmp++, index++) {
const char *text = optname(*tmp);
const char *text = *tmp + iscmdtype(**tmp);
if (g_ascii_strncasecmp(text, option, len) == 0) {
if (text[len] == '\0') {
@ -585,9 +568,9 @@ static int get_cmd_options(char **data, int ignore_unknown,
option = NULL; pos = -1;
for (;;) {
if (**data == '\0' || **data == '-') {
if (option != NULL && optflag(optlist[pos], "+")) {
if (option != NULL && *optlist[pos] == '+') {
/* required argument missing! */
*data = optname(optlist[pos]);
*data = optlist[pos] + 1;
return CMDERR_OPTION_ARG_MISSING;
}
}
@ -638,12 +621,14 @@ static int get_cmd_options(char **data, int ignore_unknown,
if (pos >= 0) {
/* if we used a shortcut of parameter, put
the whole parameter name in options table */
option = optname(optlist[pos]);
option = optlist[pos] +
iscmdtype(*optlist[pos]);
}
if (options != NULL && pos != -3)
g_hash_table_insert(options, option, "");
if (pos < 0 || optflag(optlist[pos], " !"))
if (pos < 0 || !iscmdtype(*optlist[pos]) ||
*optlist[pos] == '!')
option = NULL;
while (**data == ' ') (*data)++;
@ -653,7 +638,7 @@ static int get_cmd_options(char **data, int ignore_unknown,
if (option == NULL)
break;
if (optflag(optlist[pos], "@") && !is_numeric(*data, ' '))
if (*optlist[pos] == '@' && !is_numeric(*data, ' '))
break; /* expected a numeric argument */
/* save the argument */
@ -740,7 +725,8 @@ int cmd_get_params(const char *data, gpointer *free_me, int count, ...)
opthash = (GHashTable **) va_arg(args, GHashTable **);
rec->options = *opthash =
g_hash_table_new((GHashFunc) i_istr_hash, (GCompareFunc) i_istr_equal);
g_hash_table_new((GHashFunc) g_istr_hash,
(GCompareFunc) g_istr_equal);
ignore_unknown = count & PARAM_FLAG_UNKNOWN_OPTIONS;
error = get_cmd_options(&datad, ignore_unknown,
@ -831,7 +817,7 @@ void commands_remove_module(const char *module)
COMMAND_REC *rec = tmp->data;
next = tmp->next;
modlist = i_slist_find_string(rec->modules, module);
modlist = gslist_find_string(rec->modules, module);
if (modlist != NULL)
command_module_unbind_all(rec, modlist->data);
}
@ -865,7 +851,8 @@ static int cmd_protocol_match(COMMAND_REC *cmd, SERVER_REC *server)
#define alias_runstack_pop(alias) \
alias_runstack = g_slist_remove(alias_runstack, alias)
#define alias_runstack_find(alias) (i_slist_find_icase_string(alias_runstack, alias) != NULL)
#define alias_runstack_find(alias) \
(gslist_find_icase_string(alias_runstack, alias) != NULL)
static void parse_command(const char *command, int expand_aliases,
SERVER_REC *server, void *item)

View File

@ -34,17 +34,16 @@
#endif
#include <irssi/src/core/chat-protocols.h>
#include <irssi/src/core/servers.h>
#include <irssi/src/core/chatnets.h>
#include <irssi/src/core/commands.h>
#include <irssi/src/core/expandos.h>
#include <irssi/src/core/ignore.h>
#include <irssi/src/core/write-buffer.h>
#include <irssi/src/core/log.h>
#include <irssi/src/core/rawlog.h>
#include <irssi/src/core/ignore.h>
#include <irssi/src/core/recode.h>
#include <irssi/src/core/refstrings.h>
#include <irssi/src/core/servers.h>
#include <irssi/src/core/special-vars.h>
#include <irssi/src/core/write-buffer.h>
#include <irssi/src/core/channels.h>
#include <irssi/src/core/queries.h>
@ -67,7 +66,7 @@ void wcwidth_wrapper_deinit(void);
int irssi_gui;
int irssi_init_finished;
int sighup_received;
int reload_config;
time_t client_start_time;
static char *irssi_dir, *irssi_config_file;
@ -84,9 +83,9 @@ const char *get_irssi_config(void)
return irssi_config_file;
}
static void sig_hup(int signo)
static void sig_reload_config(int signo)
{
sighup_received = TRUE;
reload_config = TRUE;
}
static void read_settings(void)
@ -109,7 +108,8 @@ static void read_settings(void)
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = sig_hup;
/* reload config on SIGHUP */
act.sa_handler = sig_reload_config;
sigaction(SIGHUP, &act, NULL);
for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) {
@ -223,13 +223,6 @@ static void sig_irssi_init_finished(void)
irssi_init_finished = TRUE;
}
static void reread_setup(void)
{
signal_emit("setup reread chatnets", 0);
signal_emit("setup reread servers", 0);
signal_emit("setup reread channels", 0);
}
void core_init(void)
{
dialog_type_queue = NULL;
@ -270,22 +263,16 @@ void core_init(void)
chat_commands_init();
i_refstr_init();
special_vars_init();
wcwidth_wrapper_init();
settings_add_str("misc", "ignore_signals", "");
settings_add_bool("misc", "override_coredump_limit", FALSE);
settings_add_bool("misc", "quit_on_hup", FALSE);
settings_add_str("misc", "autoload_modules", "irc dcc flood notifylist perl otr");
#ifdef HAVE_SYS_RESOURCE_H
getrlimit(RLIMIT_CORE, &orig_core_rlimit);
#endif
read_settings();
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
signal_add("setup reread", (SIGNAL_FUNC) reread_setup);
signal_add("irssi init read settings", (SIGNAL_FUNC) reread_setup);
signal_add_last("chat protocol created", (SIGNAL_FUNC) reread_setup);
signal_add("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
settings_check();
@ -298,13 +285,9 @@ void core_deinit(void)
module_uniq_destroy("WINDOW ITEM TYPE");
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
signal_remove("setup reread", (SIGNAL_FUNC) reread_setup);
signal_remove("irssi init read settings", (SIGNAL_FUNC) reread_setup);
signal_remove("chat protocol created", (SIGNAL_FUNC) reread_setup);
signal_remove("irssi init finished", (SIGNAL_FUNC) sig_irssi_init_finished);
wcwidth_wrapper_deinit();
special_vars_deinit();
i_refstr_deinit();
chat_commands_deinit();

View File

@ -13,7 +13,7 @@
extern int irssi_gui;
extern int irssi_init_finished; /* TRUE after "irssi init finished" signal is sent */
extern int sighup_received; /* TRUE after received SIGHUP. */
extern int reload_config; /* TRUE after received SIGHUP. */
extern time_t client_start_time;
void core_preinit(const char *path);

View File

@ -48,7 +48,6 @@ typedef struct {
} EXPANDO_REC;
const char *current_expando = NULL;
time_t reference_time = (time_t) -1;
time_t current_time = (time_t)-1;
static int timer_tag;
@ -60,7 +59,6 @@ static char *last_privmsg_from, *last_public_from;
static char *sysname, *sysrelease, *sysarch;
static char *timestamp_format;
static char *timestamp_format_alt;
static int timestamp_seconds;
static time_t last_timestamp;
@ -443,24 +441,12 @@ static char *expando_time(SERVER_REC *server, void *item, int *free_ret)
time_t now;
struct tm *tm;
char str[256];
char *format;
now = current_time != (time_t) -1 ? current_time : time(NULL);
now = current_time != (time_t)-1 ? current_time : time(NULL);
tm = localtime(&now);
format = timestamp_format;
if (reference_time != (time_t) -1) {
time_t ref = reference_time;
struct tm tm_ref;
if (localtime_r(&ref, &tm_ref)) {
if (tm_ref.tm_yday != tm->tm_yday || tm_ref.tm_year != tm->tm_year) {
format = timestamp_format_alt;
}
}
}
if (strftime(str, sizeof(str), format, tm) == 0)
return "";
if (strftime(str, sizeof(str), timestamp_format, tm) == 0)
return "";
*free_ret = TRUE;
return g_strdup(str);
@ -590,9 +576,7 @@ static int sig_timer(void)
static void read_settings(void)
{
g_free_not_null(timestamp_format);
g_free_not_null(timestamp_format_alt);
timestamp_format = g_strdup(settings_get_str("timestamp_format"));
timestamp_format_alt = g_strdup(settings_get_str("timestamp_format_alt"));
timestamp_seconds =
strstr(timestamp_format, "%r") != NULL ||
@ -610,7 +594,6 @@ void expandos_init(void)
#endif
settings_add_str("misc", "STATUS_OPER", "*");
settings_add_str("lookandfeel", "timestamp_format", "%H:%M");
settings_add_str("lookandfeel", "timestamp_format_alt", "%a %e %b %H:%M");
settings_add_bool("lookandfeel", "chanmode_expando_strip", FALSE);
last_sent_msg = NULL; last_sent_msg_body = NULL;
@ -747,7 +730,6 @@ void expandos_deinit(void)
g_free_not_null(sysrelease);
g_free_not_null(sysarch);
g_free_not_null(timestamp_format);
g_free_not_null(timestamp_format_alt);
g_source_remove(timer_tag);
signal_remove("message public", (SIGNAL_FUNC) sig_message_public);

View File

@ -18,7 +18,6 @@ typedef char* (*EXPANDO_FUNC)
extern const char *current_expando;
extern time_t current_time;
extern time_t reference_time;
/* Create expando - overrides any existing ones.
... = signal, type, ..., NULL - list of signals that might change the

View File

@ -81,7 +81,7 @@ static int ignore_match_pattern(IGNORE_REC *rec, const char *text)
* used as a flag to indicate it should only look at ignore items with NO_ACT.
* However we also want to allow NO_ACT combined with levels, so mask it out and
* match levels if set. */
#define FLAG_MSGLEVELS (MSGLEVEL_NO_ACT | MSGLEVEL_HIDDEN | MSGLEVEL_NOHILIGHT)
#define FLAG_MSGLEVELS ( MSGLEVEL_NO_ACT | MSGLEVEL_HIDDEN )
static int ignore_match_level(IGNORE_REC *rec, int level, int flags)
{
level &= ~FLAG_MSGLEVELS;
@ -214,9 +214,6 @@ int ignore_check_plus(SERVER_REC *server, const char *nick, const char *address,
if (ignore_check_flags(server, nick, address, target, msg, olevel, MSGLEVEL_HIDDEN))
*level |= MSGLEVEL_HIDDEN;
if (ignore_check_flags(server, nick, address, target, msg, olevel, MSGLEVEL_NOHILIGHT))
*level |= MSGLEVEL_NOHILIGHT;
return FALSE;
}
@ -255,12 +252,6 @@ IGNORE_REC *ignore_find_full(const char *servertag, const char *mask, const char
if (!(flags & IGNORE_FIND_HIDDEN) && (rec->level & MSGLEVEL_HIDDEN) != 0)
continue;
if ((flags & IGNORE_FIND_NOHILIGHT) && (rec->level & MSGLEVEL_NOHILIGHT) == 0)
continue;
if (!(flags & IGNORE_FIND_NOHILIGHT) && (rec->level & MSGLEVEL_NOHILIGHT) != 0)
continue;
if ((rec->mask == NULL && mask != NULL) ||
(rec->mask != NULL && mask == NULL))
continue;
@ -308,6 +299,16 @@ IGNORE_REC *ignore_find(const char *servertag, const char *mask, char **channels
return ignore_find_full(servertag, mask, NULL, channels, 0);
}
IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, char **channels, int noact)
{
return ignore_find_full(servertag, mask, NULL, channels, IGNORE_FIND_NOACT);
}
IGNORE_REC *ignore_find_hidden(const char *servertag, const char *mask, char **channels, int hidden)
{
return ignore_find_full(servertag, mask, NULL, channels, IGNORE_FIND_HIDDEN);
}
static void ignore_set_config(IGNORE_REC *rec)
{
CONFIG_NODE *node;

View File

@ -31,10 +31,9 @@ int ignore_check_plus(SERVER_REC *server, const char *nick, const char *host,
const char *channel, const char *text, int *level, int test_ignore);
enum {
IGNORE_FIND_PATTERN = 0x01, /* Match the pattern */
IGNORE_FIND_NOACT = 0x02, /* Exclude the targets with NOACT level */
IGNORE_FIND_HIDDEN = 0x04, /* Exclude the targets with HIDDEN level */
IGNORE_FIND_NOHILIGHT = 0x08, /* Exclude the targets with NOHILIGHT level */
IGNORE_FIND_PATTERN = 0x01, /* Match the pattern */
IGNORE_FIND_NOACT = 0x02, /* Exclude the targets with NOACT level */
IGNORE_FIND_HIDDEN = 0x04, /* Exclude the targets with HIDDEN level */
};
IGNORE_REC *ignore_find_full (const char *servertag, const char *mask, const char *pattern,
@ -43,6 +42,8 @@ IGNORE_REC *ignore_find_full (const char *servertag, const char *mask, const cha
/* Convenience wrappers around ignore_find_full, for compatibility purpose */
IGNORE_REC *ignore_find(const char *servertag, const char *mask, char **channels);
IGNORE_REC *ignore_find_noact(const char *servertag, const char *mask, char **channels, int noact);
IGNORE_REC *ignore_find_hidden(const char *servertag, const char *mask, char **channels, int hidden);
void ignore_add_rec(IGNORE_REC *rec);
void ignore_update_rec(IGNORE_REC *rec);

99
src/core/iregex-regexh.c Normal file
View File

@ -0,0 +1,99 @@
#include <irssi/src/core/iregex.h>
Regex *
i_regex_new (const gchar *pattern,
GRegexCompileFlags compile_options,
GRegexMatchFlags match_options,
GError **error)
{
Regex *regex;
char *errbuf;
int cflags;
int errcode, errbuf_len;
regex = g_new0(Regex, 1);
cflags = REG_EXTENDED;
if (compile_options & G_REGEX_CASELESS)
cflags |= REG_ICASE;
if (compile_options & G_REGEX_MULTILINE)
cflags |= REG_NEWLINE;
if (match_options & G_REGEX_MATCH_NOTBOL)
cflags |= REG_NOTBOL;
if (match_options & G_REGEX_MATCH_NOTEOL)
cflags |= REG_NOTEOL;
errcode = regcomp(regex, pattern, cflags);
if (errcode != 0) {
errbuf_len = regerror(errcode, regex, 0, 0);
errbuf = g_malloc(errbuf_len);
regerror(errcode, regex, errbuf, errbuf_len);
g_set_error(error, G_REGEX_ERROR, errcode, "%s", errbuf);
g_free(errbuf);
g_free(regex);
return NULL;
} else {
return regex;
}
}
void
i_regex_unref (Regex *regex)
{
regfree(regex);
g_free(regex);
}
gboolean
i_regex_match (const Regex *regex,
const gchar *string,
GRegexMatchFlags match_options,
MatchInfo **match_info)
{
int groups;
int eflags;
g_return_val_if_fail(regex != NULL, FALSE);
if (match_info != NULL) {
groups = 1 + regex->re_nsub;
*match_info = g_new0(MatchInfo, groups);
} else {
groups = 0;
}
eflags = 0;
if (match_options & G_REGEX_MATCH_NOTBOL)
eflags |= REG_NOTBOL;
if (match_options & G_REGEX_MATCH_NOTEOL)
eflags |= REG_NOTEOL;
return regexec(regex, string, groups, groups ? *match_info : NULL, eflags) == 0;
}
gboolean
i_match_info_fetch_pos (const MatchInfo *match_info,
gint match_num,
gint *start_pos,
gint *end_pos)
{
if (start_pos != NULL)
*start_pos = match_info[match_num].rm_so;
if (end_pos != NULL)
*end_pos = match_info[match_num].rm_eo;
return TRUE;
}
gboolean
i_match_info_matches (const MatchInfo *match_info)
{
g_return_val_if_fail(match_info != NULL, FALSE);
return match_info[0].rm_so != -1;
}
void
i_match_info_free (MatchInfo *match_info)
{
g_free(match_info);
}

View File

@ -3,10 +3,20 @@
#include <irssi/src/common.h>
#ifdef USE_GREGEX
#include <glib.h>
typedef GRegex Regex;
typedef struct _MatchInfo MatchInfo;
#else
#include <regex.h>
typedef regex_t Regex;
typedef regmatch_t MatchInfo;
#endif
gboolean
i_match_info_matches (const MatchInfo *match_info);

View File

@ -23,12 +23,10 @@
/* the order of these levels must match the bits in levels.h */
static const char *levels[] = {
/* clang-format off */
"CRAP",
"MSGS",
"PUBLICS",
"NOTICES",
"PUBNOTICES",
"SNOTES",
"CTCPS",
"ACTIONS",
@ -48,7 +46,6 @@ static const char *levels[] = {
"CLIENTERRORS",
"HILIGHTS",
NULL
/* clang-format on */
};
int level_get(const char *level)
@ -64,9 +61,6 @@ int level_get(const char *level)
if (g_ascii_strcasecmp(level, "NO_ACT") == 0)
return MSGLEVEL_NO_ACT;
if (g_ascii_strcasecmp(level, "NOHILIGHT") == 0)
return MSGLEVEL_NOHILIGHT;
if (g_ascii_strcasecmp(level, "HIDDEN") == 0)
return MSGLEVEL_HIDDEN;
@ -160,9 +154,6 @@ char *bits2level(int bits)
}
}
if (bits & MSGLEVEL_NOHILIGHT)
g_string_append(str, "NOHILIGHT ");
if (bits & MSGLEVEL_HIDDEN)
g_string_append(str, "HIDDEN ");

View File

@ -6,46 +6,40 @@
difficult message leveling system (which might be done if really
needed..). */
/* clang-format off */
/* Message levels */
enum {
MSGLEVEL_CRAP = 0x0000001,
MSGLEVEL_MSGS = 0x0000002,
MSGLEVEL_PUBLIC = 0x0000004,
MSGLEVEL_NOTICES = 0x0000008,
MSGLEVEL_PUBNOTICES = 0x0000010,
MSGLEVEL_SNOTES = 0x0000020,
MSGLEVEL_CTCPS = 0x0000040,
MSGLEVEL_ACTIONS = 0x0000080,
MSGLEVEL_JOINS = 0x0000100,
MSGLEVEL_PARTS = 0x0000200,
MSGLEVEL_QUITS = 0x0000400,
MSGLEVEL_KICKS = 0x0000800,
MSGLEVEL_MODES = 0x0001000,
MSGLEVEL_TOPICS = 0x0002000,
MSGLEVEL_WALLOPS = 0x0004000,
MSGLEVEL_INVITES = 0x0008000,
MSGLEVEL_NICKS = 0x0010000,
MSGLEVEL_DCC = 0x0020000,
MSGLEVEL_DCCMSGS = 0x0040000,
MSGLEVEL_CLIENTNOTICE = 0x0080000,
MSGLEVEL_CLIENTCRAP = 0x0100000,
MSGLEVEL_CLIENTERROR = 0x0200000,
MSGLEVEL_HILIGHT = 0x0400000,
MSGLEVEL_SNOTES = 0x0000010,
MSGLEVEL_CTCPS = 0x0000020,
MSGLEVEL_ACTIONS = 0x0000040,
MSGLEVEL_JOINS = 0x0000080,
MSGLEVEL_PARTS = 0x0000100,
MSGLEVEL_QUITS = 0x0000200,
MSGLEVEL_KICKS = 0x0000400,
MSGLEVEL_MODES = 0x0000800,
MSGLEVEL_TOPICS = 0x0001000,
MSGLEVEL_WALLOPS = 0x0002000,
MSGLEVEL_INVITES = 0x0004000,
MSGLEVEL_NICKS = 0x0008000,
MSGLEVEL_DCC = 0x0010000,
MSGLEVEL_DCCMSGS = 0x0020000,
MSGLEVEL_CLIENTNOTICE = 0x0040000,
MSGLEVEL_CLIENTCRAP = 0x0080000,
MSGLEVEL_CLIENTERROR = 0x0100000,
MSGLEVEL_HILIGHT = 0x0200000,
MSGLEVEL_ALL = 0x07fffff,
MSGLEVEL_ALL = 0x03fffff,
MSGLEVEL_NOHILIGHT = 0x1000000, /* Don't highlight this message */
MSGLEVEL_NO_ACT = 0x2000000, /* Don't trigger channel activity */
MSGLEVEL_NEVER = 0x4000000, /* never ignore / never log */
MSGLEVEL_LASTLOG = 0x8000000, /* used for /lastlog */
MSGLEVEL_HIDDEN = 0x10000000, /* Hidden from view */
MSGLEVEL_RESERVED1 = 0x20000000,
MSGLEVEL_RESERVED2 = 0x40000000,
MSGLEVEL_FORMAT = (int)0x80000000 /* Format data */
MSGLEVEL_HIDDEN = 0x10000000 /* Hidden from view */
};
/* clang-format on */
int level_get(const char *level);
int level2bits(const char *level, int *errorp);

View File

@ -96,7 +96,7 @@ int line_split(const char *data, int len, char **output, LINEBUF_REC **buffer)
if (rec->remove > 0) {
rec->len -= rec->remove;
memmove(rec->str, rec->str+rec->remove, rec->len);
g_memmove(rec->str, rec->str+rec->remove, rec->len);
rec->remove = 0;
}

View File

@ -204,10 +204,11 @@ static void log_rotate_check(LOG_REC *log)
g_free(new_fname);
}
void log_write_rec(LOG_REC *log, const char *str, int level, time_t now)
void log_write_rec(LOG_REC *log, const char *str, int level)
{
char *colorstr;
struct tm *tm;
time_t now;
int hour, day;
g_return_if_fail(log != NULL);
@ -216,8 +217,7 @@ void log_write_rec(LOG_REC *log, const char *str, int level, time_t now)
if (log->handle == -1)
return;
if (now == (time_t) -1)
now = time(NULL);
now = time(NULL);
tm = localtime(&now);
hour = tm->tm_hour;
day = tm->tm_mday;
@ -282,8 +282,8 @@ LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
return NULL;
}
void log_file_write(const char *server_tag, const char *item, int level, time_t t, const char *str,
int no_fallbacks)
void log_file_write(const char *server_tag, const char *item, int level,
const char *str, int no_fallbacks)
{
GSList *tmp, *fallbacks;
char *tmpstr;
@ -309,7 +309,7 @@ void log_file_write(const char *server_tag, const char *item, int level, time_t
fallbacks = g_slist_append(fallbacks, rec);
else if (log_item_find(rec, LOG_ITEM_TARGET, item,
server_tag) != NULL)
log_write_rec(rec, str, level, t);
log_write_rec(rec, str, level);
}
if (!found && !no_fallbacks && fallbacks != NULL) {
@ -319,7 +319,7 @@ void log_file_write(const char *server_tag, const char *item, int level, time_t
g_strdup(str);
for (tmp = fallbacks; tmp != NULL; tmp = tmp->next)
log_write_rec(tmp->data, tmpstr, level, t);
log_write_rec(tmp->data, tmpstr, level);
g_free(tmpstr);
}
@ -561,7 +561,7 @@ static void log_read_config(void)
if (node != NULL)
log_items_read_config(node, log);
if (log->autoopen || i_slist_find_string(fnames, log->fname))
if (log->autoopen || gslist_find_string(fnames, log->fname))
log_start_logging(log);
}

View File

@ -51,9 +51,9 @@ void log_item_destroy(LOG_REC *log, LOG_ITEM_REC *item);
LOG_ITEM_REC *log_item_find(LOG_REC *log, int type, const char *item,
const char *servertag);
void log_file_write(const char *server_tag, const char *item, int level, time_t t, const char *str,
int no_fallbacks);
void log_write_rec(LOG_REC *log, const char *str, int level, time_t now);
void log_file_write(const char *server_tag, const char *item, int level,
const char *str, int no_fallbacks);
void log_write_rec(LOG_REC *log, const char *str, int level);
int log_start_logging(LOG_REC *log);
void log_stop_logging(LOG_REC *log);

View File

@ -1,7 +1,13 @@
# this file is part of irssi
if want_gregex
regex_impl = files('iregex-gregex.c')
else
regex_impl = files('iregex-regexh.c')
endif
if have_capsicum
core_capsicum_source = files('capsicum.c')
core_capsicum_source = files('fe-capsicum.c')
else
core_capsicum_source = []
endif
@ -18,7 +24,6 @@ libcore_a = static_library('core',
'core.c',
'expandos.c',
'ignore.c',
'iregex-gregex.c',
'levels.c',
'line-split.c',
'log-away.c',
@ -53,6 +58,7 @@ libcore_a = static_library('core',
'write-buffer.c',
)
+ core_capsicum_source
+ regex_impl
+ [
default_config_h,
irssi_version_h,

View File

@ -37,15 +37,15 @@ static int irssi_io_invoke(GIOChannel *source, GIOCondition condition,
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
/* error, we have to call the function.. */
if (rec->condition & G_IO_IN)
icond |= I_INPUT_READ;
icond |= G_INPUT_READ;
else
icond |= I_INPUT_WRITE;
icond |= G_INPUT_WRITE;
}
if (condition & (G_IO_IN | G_IO_PRI))
icond |= I_INPUT_READ;
icond |= G_INPUT_READ;
if (condition & G_IO_OUT)
icond |= I_INPUT_WRITE;
icond |= G_INPUT_WRITE;
if (rec->condition & icond)
rec->function(rec->data, source, icond);
@ -53,8 +53,8 @@ static int irssi_io_invoke(GIOChannel *source, GIOCondition condition,
return TRUE;
}
int i_input_add_full(GIOChannel *source, int priority, int condition, GInputFunction function,
void *data)
int g_input_add_full(GIOChannel *source, int priority, int condition,
GInputFunction function, void *data)
{
IRSSI_INPUT_REC *rec;
unsigned int result;
@ -66,9 +66,9 @@ int i_input_add_full(GIOChannel *source, int priority, int condition, GInputFunc
rec->data = data;
cond = (GIOCondition) (G_IO_ERR|G_IO_HUP|G_IO_NVAL);
if (condition & I_INPUT_READ)
if (condition & G_INPUT_READ)
cond |= G_IO_IN|G_IO_PRI;
if (condition & I_INPUT_WRITE)
if (condition & G_INPUT_WRITE)
cond |= G_IO_OUT;
result = g_io_add_watch_full(source, priority, cond,
@ -77,22 +77,23 @@ int i_input_add_full(GIOChannel *source, int priority, int condition, GInputFunc
return result;
}
int i_input_add(GIOChannel *source, int condition, GInputFunction function, void *data)
int g_input_add(GIOChannel *source, int condition,
GInputFunction function, void *data)
{
return i_input_add_full(source, G_PRIORITY_DEFAULT, condition, function, data);
return g_input_add_full(source, G_PRIORITY_DEFAULT, condition,
function, data);
}
/* easy way to bypass glib polling of io channel internal buffer */
int i_input_add_poll(int fd, int priority, int condition, GInputFunction function, void *data)
int g_input_add_poll(int fd, int priority, int condition,
GInputFunction function, void *data)
{
GIOChannel *source = g_io_channel_unix_new(fd);
int ret = i_input_add_full(source, priority, condition, function, data);
int ret = g_input_add_full(source, priority, condition, function, data);
g_io_channel_unref(source);
return ret;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2)
{
if (tv1->tv_sec < tv2->tv_sec)
@ -118,22 +119,6 @@ long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2)
return usecs;
}
#pragma GCC diagnostic pop
#if GLIB_CHECK_VERSION(2, 56, 0)
/* nothing */
#else
/* compatibility code for old GLib */
GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz)
{
GTimeVal time;
if (g_time_val_from_iso8601(iso_date, &time)) {
return g_date_time_new_from_timeval_utc(&time);
} else {
return NULL;
}
}
#endif
int find_substr(const char *list, const char *item)
{
@ -179,7 +164,7 @@ int strarray_find(char **array, const char *item)
return -1;
}
GSList *i_slist_find_string(GSList *list, const char *key)
GSList *gslist_find_string(GSList *list, const char *key)
{
for (; list != NULL; list = list->next)
if (g_strcmp0(list->data, key) == 0) return list;
@ -187,7 +172,7 @@ GSList *i_slist_find_string(GSList *list, const char *key)
return NULL;
}
GSList *i_slist_find_icase_string(GSList *list, const char *key)
GSList *gslist_find_icase_string(GSList *list, const char *key)
{
for (; list != NULL; list = list->next)
if (g_ascii_strcasecmp(list->data, key) == 0) return list;
@ -195,7 +180,7 @@ GSList *i_slist_find_icase_string(GSList *list, const char *key)
return NULL;
}
void *i_slist_foreach_find(GSList *list, FOREACH_FIND_FUNC func, const void *data)
void *gslist_foreach_find(GSList *list, FOREACH_FIND_FUNC func, const void *data)
{
void *ret;
@ -209,7 +194,7 @@ void *i_slist_foreach_find(GSList *list, FOREACH_FIND_FUNC func, const void *dat
return NULL;
}
void i_slist_free_full(GSList *list, GDestroyNotify free_func)
void gslist_free_full (GSList *list, GDestroyNotify free_func)
{
GSList *tmp;
@ -222,7 +207,7 @@ void i_slist_free_full(GSList *list, GDestroyNotify free_func)
g_slist_free(list);
}
GSList *i_slist_remove_string(GSList *list, const char *str)
GSList *gslist_remove_string (GSList *list, const char *str)
{
GSList *l;
@ -233,7 +218,7 @@ GSList *i_slist_remove_string(GSList *list, const char *str)
return list;
}
GSList *i_slist_delete_string(GSList *list, const char *str, GDestroyNotify free_func)
GSList *gslist_delete_string (GSList *list, const char *str, GDestroyNotify free_func)
{
GSList *l;
@ -267,7 +252,7 @@ char *gslistptr_to_string(GSList *list, int offset, const char *delimiter)
}
/* `list' contains char* */
char *i_slist_to_string(GSList *list, const char *delimiter)
char *gslist_to_string(GSList *list, const char *delimiter)
{
GString *str;
char *ret;
@ -305,7 +290,7 @@ GList *optlist_remove_known(const char *cmd, GHashTable *optlist)
return list;
}
GList *i_list_find_string(GList *list, const char *key)
GList *glist_find_string(GList *list, const char *key)
{
for (; list != NULL; list = list->next)
if (g_strcmp0(list->data, key) == 0) return list;
@ -313,7 +298,7 @@ GList *i_list_find_string(GList *list, const char *key)
return NULL;
}
GList *i_list_find_icase_string(GList *list, const char *key)
GList *glist_find_icase_string(GList *list, const char *key)
{
for (; list != NULL; list = list->next)
if (g_ascii_strcasecmp(list->data, key) == 0) return list;
@ -420,17 +405,17 @@ char *convert_home(const char *path)
}
}
int i_istr_equal(gconstpointer v, gconstpointer v2)
int g_istr_equal(gconstpointer v, gconstpointer v2)
{
return g_ascii_strcasecmp((const char *) v, (const char *) v2) == 0;
}
int i_istr_cmp(gconstpointer v, gconstpointer v2)
int g_istr_cmp(gconstpointer v, gconstpointer v2)
{
return g_ascii_strcasecmp((const char *) v, (const char *) v2);
}
guint i_istr_hash(gconstpointer v)
guint g_istr_hash(gconstpointer v)
{
const signed char *p;
guint32 h = 5381;

View File

@ -1,7 +1,8 @@
#ifndef IRSSI_CORE_MISC_H
#define IRSSI_CORE_MISC_H
int i_input_add_poll(int fd, int priority, int condition, GInputFunction function, void *data);
int g_input_add_poll(int fd, int priority, int condition,
GInputFunction function, void *data);
/* `str' should be type char[MAX_INT_STRLEN] */
#define ltoa(str, num) \
@ -10,37 +11,27 @@ int i_input_add_poll(int fd, int priority, int condition, GInputFunction functio
typedef void* (*FOREACH_FIND_FUNC) (void *item, void *data);
typedef int (*COLUMN_LEN_FUNC)(void *data);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* Returns 1 if tv1 > tv2, -1 if tv2 > tv1 or 0 if they're equal. */
int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATED;
int g_timeval_cmp(const GTimeVal *tv1, const GTimeVal *tv2);
/* Returns "tv1 - tv2", returns the result in milliseconds. Note that
if the difference is too large, the result might be invalid. */
long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2) G_GNUC_DEPRECATED;
#pragma GCC diagnostic pop
long get_timeval_diff(const GTimeVal *tv1, const GTimeVal *tv2);
#if GLIB_CHECK_VERSION(2, 56, 0)
/* nothing */
#else
/* compatibility code for old GLib */
GDateTime *g_date_time_new_from_iso8601(const gchar *iso_date, GTimeZone *default_tz);
#endif
GSList *gslist_find_string(GSList *list, const char *key);
GSList *gslist_find_icase_string(GSList *list, const char *key);
GList *glist_find_string(GList *list, const char *key);
GList *glist_find_icase_string(GList *list, const char *key);
GSList *gslist_remove_string (GSList *list, const char *str) G_GNUC_DEPRECATED;
GSList *gslist_delete_string (GSList *list, const char *str, GDestroyNotify free_func);
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);
GList *i_list_find_icase_string(GList *list, const char *key);
GSList *i_slist_remove_string(GSList *list, const char *str) G_GNUC_DEPRECATED;
GSList *i_slist_delete_string(GSList *list, const char *str, GDestroyNotify free_func);
void gslist_free_full (GSList *list, GDestroyNotify free_func);
void i_slist_free_full(GSList *list, GDestroyNotify free_func);
void *i_slist_foreach_find(GSList *list, FOREACH_FIND_FUNC func, const void *data);
void *gslist_foreach_find(GSList *list, FOREACH_FIND_FUNC func, const void *data);
/* `list' contains pointer to structure with a char* to string. */
char *gslistptr_to_string(GSList *list, int offset, const char *delimiter);
/* `list' contains char* */
char *i_slist_to_string(GSList *list, const char *delimiter);
char *gslist_to_string(GSList *list, const char *delimiter);
GList *optlist_remove_known(const char *cmd, GHashTable *optlist);
@ -48,11 +39,11 @@ GList *optlist_remove_known(const char *cmd, GHashTable *optlist);
char *convert_home(const char *path);
/* Case-insensitive string hash functions */
int i_istr_equal(gconstpointer v, gconstpointer v2);
unsigned int i_istr_hash(gconstpointer v);
int g_istr_equal(gconstpointer v, gconstpointer v2);
unsigned int g_istr_hash(gconstpointer v);
/* Case-insensitive GCompareFunc func */
int i_istr_cmp(gconstpointer v, gconstpointer v2);
int g_istr_cmp(gconstpointer v, gconstpointer v2);
/* Find `mask' from `data', you can use * and ? wildcards. */
int match_wildcards(const char *mask, const char *data);

View File

@ -27,6 +27,8 @@
#include <irssi/src/core/commands.h>
#include <irssi/src/core/misc.h>
#ifdef HAVE_GMODULE
/* Returns the module name without path, "lib" prefix or ".so" suffix */
static char *module_get_name(const char *path, int *start, int *end)
{
@ -393,6 +395,15 @@ static void module_file_deinit_gmodule(MODULE_FILE_REC *file)
g_module_close(file->gmodule);
}
#else /* !HAVE_GMODULE - modules are not supported */
int module_load(const char *path, char **prefixes)
{
return FALSE;
}
#endif
void module_file_unload(MODULE_FILE_REC *file)
{
MODULE_REC *root;
@ -403,8 +414,10 @@ void module_file_unload(MODULE_FILE_REC *file)
if (file->initialized)
signal_emit("module unloaded", 2, file->root, file);
#ifdef HAVE_GMODULE
if (file->gmodule != NULL)
module_file_deinit_gmodule(file);
#endif
g_free(file->name);
g_free(file->defined_module_name);

View File

@ -214,7 +214,7 @@ MODULE_FILE_REC *module_register_full(const char *name, const char *submodule,
module = g_new0(MODULE_REC, 1);
module->name = g_strdup(name);
modules = g_slist_prepend(modules, module);
modules = g_slist_append(modules, module);
}
file = module_file_find(module, submodule);
@ -226,8 +226,8 @@ MODULE_FILE_REC *module_register_full(const char *name, const char *submodule,
file->name = g_strdup(submodule);
file->defined_module_name = g_strdup(defined_module_name);
module->files = g_slist_prepend(module->files, file);
return file;
module->files = g_slist_append(module->files, file);
return file;
}
MODULE_REC *module_find(const char *name)

View File

@ -16,7 +16,13 @@
#define MODULE_DATA(rec) \
g_hash_table_lookup((rec)->module_data, MODULE_NAME)
#define MODULE_IS_STATIC(rec) ((rec)->gmodule == NULL)
#ifdef HAVE_GMODULE
# define MODULE_IS_STATIC(rec) \
((rec)->gmodule == NULL)
#else
# define MODULE_IS_STATIC(rec) TRUE
#endif
#define MODULE_ABICHECK(fn_modulename) \
void fn_modulename ## _abicheck(int *version) \
@ -39,7 +45,9 @@ typedef struct {
char *defined_module_name;
void (*module_deinit) (void);
#ifdef HAVE_GMODULE
GModule *gmodule; /* static, if NULL */
#endif
unsigned int initialized:1;
} MODULE_FILE_REC;

View File

@ -97,7 +97,8 @@ void net_disconnect_later(GIOChannel *handle)
rec = g_new(NET_DISCONNECT_REC, 1);
rec->created = time(NULL);
rec->handle = handle;
rec->tag = i_input_add(handle, I_INPUT_READ, (GInputFunction) sig_disconnect, rec);
rec->tag = g_input_add(handle, G_INPUT_READ,
(GInputFunction) sig_disconnect, rec);
if (timeout_tag == -1) {
timeout_tag = g_timeout_add(10000, (GSourceFunc)

View File

@ -27,13 +27,13 @@
/* 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)
int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe,
int reverse_lookup)
{
RESOLVED_IP_REC rec;
const char *errorstr;
int pid;
(void) reverse_lookup; /* Kept for API backward compatibility */
int len;
g_return_val_if_fail(addr != NULL, FALSE);
@ -57,14 +57,37 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_l
rec.error = net_gethostbyname(addr, &rec.ip4, &rec.ip6);
if (rec.error == 0) {
errorstr = NULL;
if (reverse_lookup) {
/* reverse lookup the IP, ignore any error */
if (rec.ip4.family != 0)
net_gethostbyaddr(&rec.ip4, &rec.host4);
if (rec.ip6.family != 0)
net_gethostbyaddr(&rec.ip6, &rec.host6);
}
} else {
errorstr = net_gethosterror(rec.error);
rec.errlen = errorstr == NULL ? 0 : strlen(errorstr)+1;
}
i_io_channel_write_block(pipe, &rec, sizeof(rec));
g_io_channel_write_block(pipe, &rec, sizeof(rec));
if (rec.errlen != 0)
i_io_channel_write_block(pipe, (void *) errorstr, rec.errlen);
g_io_channel_write_block(pipe, (void *) errorstr, rec.errlen);
else {
if (rec.host4) {
len = strlen(rec.host4) + 1;
g_io_channel_write_block(pipe, (void *) &len,
sizeof(int));
g_io_channel_write_block(pipe, (void *) rec.host4,
len);
}
if (rec.host6) {
len = strlen(rec.host6) + 1;
g_io_channel_write_block(pipe, (void *) &len,
sizeof(int));
g_io_channel_write_block(pipe, (void *) rec.host6,
len);
}
}
if (pid == 0)
_exit(99);
@ -76,13 +99,17 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_l
/* get the resolved IP address */
int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec)
{
int len;
rec->error = -1;
rec->errorstr = NULL;
rec->host4 = NULL;
rec->host6 = 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) {
if (g_io_channel_read_block(pipe, rec, sizeof(*rec)) == -1) {
rec->errorstr = g_strdup_printf("Host name lookup: %s",
g_strerror(errno));
return -1;
@ -92,7 +119,18 @@ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec)
/* 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);
g_io_channel_read_block(pipe, rec->errorstr, rec->errlen);
} else {
if (rec->host4) {
g_io_channel_read_block(pipe, &len, sizeof(int));
rec->host4 = g_malloc0(len);
g_io_channel_read_block(pipe, rec->host4, len);
}
if (rec->host6) {
g_io_channel_read_block(pipe, &len, sizeof(int));
rec->host6 = g_malloc0(len);
g_io_channel_read_block(pipe, rec->host6, len);
}
}
return 0;

View File

@ -9,10 +9,12 @@ typedef struct {
int errlen; /* error text length */
char *errorstr; /* error string - dynamically allocated, you'll
need to free() it yourself unless it's NULL */
char *host4, *host6; /* dito */
} RESOLVED_IP_REC;
/* nonblocking gethostbyname(), PID of the resolver child is returned. */
int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, int reverse_lookup);
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);

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