Compare commits
47 Commits
v1.3.0
...
91db8e6e54
| Author | SHA1 | Date | |
|---|---|---|---|
|
91db8e6e54
|
|||
|
dbe95fa298
|
|||
|
9d5e57a501
|
|||
|
4ed6693f57
|
|||
|
bea8d13227
|
|||
|
ecebeace0e
|
|||
|
ca33adeeee
|
|||
|
b31e079256
|
|||
|
57597bf8a2
|
|||
|
c0996fcbe7
|
|||
|
03d8ea4c5a
|
|||
|
dc002a2db4
|
|||
|
a32916ffcf
|
|||
|
f7be510d26
|
|||
|
83764d1e1b
|
|||
|
a717782480
|
|||
|
c50c959f4d
|
|||
|
0dd7536b5a
|
|||
|
0750096827
|
|||
|
49d9980662
|
|||
|
2f7fbcdc5d
|
|||
|
ef0cbe9a59
|
|||
|
2d8808d795
|
|||
|
60d52ad479
|
|||
|
b358f53ec3
|
|||
|
2eb315f5c4
|
|||
|
851c2ee548
|
|||
|
f9848ed627
|
|||
|
686a39df38
|
|||
|
9cea3fca91
|
|||
|
5165f76b7c
|
|||
|
92ac13f3c6
|
|||
|
df4ca74580
|
|||
|
9e297244a4
|
|||
|
d32ba133c0
|
|||
|
ce3976e1ec
|
|||
|
e5ed89646b
|
|||
|
5e728f6d31
|
|||
|
766f68e070
|
|||
|
3dc5242d43
|
|||
|
fd9d5db1d2
|
|||
|
cb480b4c71
|
|||
|
59cc423694
|
|||
|
9323089d66
|
|||
|
de7df1f60d
|
|||
|
b082e82b62
|
|||
|
b8dbc70a9c
|
32
.clang-format
Normal file
32
.clang-format
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# clang-format is fairly limited, and these rules are approximate:
|
||||||
|
# - array initializers can get terribly mangled with clang-format 12.0,
|
||||||
|
# - sometimes it still aligns with space characters,
|
||||||
|
# - struct name NL { NL ... NL } NL name; is unachievable.
|
||||||
|
BasedOnStyle: GNU
|
||||||
|
ColumnLimit: 80
|
||||||
|
IndentWidth: 4
|
||||||
|
TabWidth: 4
|
||||||
|
UseTab: ForContinuationAndIndentation
|
||||||
|
BreakBeforeBraces: Allman
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
AlignAfterOpenBracket: DontAlign
|
||||||
|
AlignOperands: DontAlign
|
||||||
|
AlignConsecutiveMacros: Consecutive
|
||||||
|
AllowAllArgumentsOnNextLine: false
|
||||||
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
|
IndentGotoLabels: false
|
||||||
|
|
||||||
|
# IncludeCategories has some potential, but it may also break the build.
|
||||||
|
# Note that the documentation says the value should be "Never".
|
||||||
|
SortIncludes: false
|
||||||
|
|
||||||
|
# This is a compromise, it generally works out aesthetically better.
|
||||||
|
BinPackArguments: false
|
||||||
|
|
||||||
|
# Unfortunately, this can't be told to align to column 40 or so.
|
||||||
|
SpacesBeforeTrailingComments: 2
|
||||||
|
|
||||||
|
# liberty-specific macro body wrappers.
|
||||||
|
MacroBlockBegin: "BLOCK_START"
|
||||||
|
MacroBlockEnd: "BLOCK_END"
|
||||||
|
ForEachMacros: ["LIST_FOR_EACH"]
|
||||||
10
.gitignore
vendored
10
.gitignore
vendored
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
# Qt Creator files
|
# Qt Creator files
|
||||||
/CMakeLists.txt.user*
|
/CMakeLists.txt.user*
|
||||||
/uirc3.config
|
/xK.config
|
||||||
/uirc3.files
|
/xK.files
|
||||||
/uirc3.creator*
|
/xK.creator*
|
||||||
/uirc3.includes
|
/xK.includes
|
||||||
|
/xK.cflags
|
||||||
|
/xK.cxxflags
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
cmake_minimum_required (VERSION 3.0)
|
# Ubuntu 18.04 LTS and OpenBSD 6.4
|
||||||
project (uirc3 VERSION 1.3.0 LANGUAGES C)
|
cmake_minimum_required (VERSION 3.10)
|
||||||
|
project (xK VERSION 1.5.0 DESCRIPTION "IRC client, daemon and bot" LANGUAGES C)
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
option (WANT_READLINE "Use GNU Readline for the UI (better)" ON)
|
option (WANT_READLINE "Use GNU Readline for the UI (better)" ON)
|
||||||
option (WANT_LIBEDIT "Use BSD libedit for the UI" OFF)
|
option (WANT_LIBEDIT "Use BSD libedit for the UI" OFF)
|
||||||
|
|
||||||
# Moar warnings
|
# Moar warnings
|
||||||
|
set (CMAKE_C_STANDARD 99)
|
||||||
|
set (CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set (CMAKE_C_EXTENSIONS OFF)
|
||||||
|
|
||||||
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
|
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
|
||||||
# -Wunused-function is pretty annoying here, as everything is static
|
# -Wunused-function is pretty annoying here, as everything is static
|
||||||
set (wdisabled "-Wno-unused-function")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function")
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}")
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Version
|
# Version
|
||||||
@@ -57,6 +61,8 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
|
|||||||
# Need this for SIGWINCH in FreeBSD and OpenBSD respectively;
|
# Need this for SIGWINCH in FreeBSD and OpenBSD respectively;
|
||||||
# our POSIX version macros make it undefined
|
# our POSIX version macros make it undefined
|
||||||
add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
|
add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
|
||||||
|
elseif (APPLE)
|
||||||
|
add_definitions (-D_DARWIN_C_SOURCE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# -lrt is only for glibc < 2.17
|
# -lrt is only for glibc < 2.17
|
||||||
@@ -112,10 +118,16 @@ endif ()
|
|||||||
if ((WANT_READLINE AND WANT_LIBEDIT) OR (NOT WANT_READLINE AND NOT WANT_LIBEDIT))
|
if ((WANT_READLINE AND WANT_LIBEDIT) OR (NOT WANT_READLINE AND NOT WANT_LIBEDIT))
|
||||||
message (SEND_ERROR "You have to choose either GNU Readline or libedit")
|
message (SEND_ERROR "You have to choose either GNU Readline or libedit")
|
||||||
elseif (WANT_READLINE)
|
elseif (WANT_READLINE)
|
||||||
|
pkg_check_modules (readline readline)
|
||||||
|
|
||||||
# OpenBSD's default readline is too old
|
# OpenBSD's default readline is too old
|
||||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
|
if ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
|
||||||
include_directories (${OPENBSD_LOCALBASE}/include/ereadline)
|
include_directories (${OPENBSD_LOCALBASE}/include/ereadline)
|
||||||
list (APPEND xC_libraries ereadline)
|
list (APPEND xC_libraries ereadline)
|
||||||
|
elseif (readline_FOUND)
|
||||||
|
list (APPEND xC_libraries ${readline_LIBRARIES})
|
||||||
|
include_directories (${readline_INCLUDE_DIRS})
|
||||||
|
link_directories (${readline_LIBRARY_DIRS})
|
||||||
else ()
|
else ()
|
||||||
list (APPEND xC_libraries readline)
|
list (APPEND xC_libraries readline)
|
||||||
endif ()
|
endif ()
|
||||||
@@ -136,7 +148,7 @@ include_directories (${PROJECT_SOURCE_DIR} ${PROJECT_BINARY_DIR})
|
|||||||
|
|
||||||
# Generate IRC replies--we need a custom target because of the multiple outputs
|
# Generate IRC replies--we need a custom target because of the multiple outputs
|
||||||
add_custom_command (OUTPUT xD-replies.c xD.msg
|
add_custom_command (OUTPUT xD-replies.c xD.msg
|
||||||
COMMAND ${PROJECT_SOURCE_DIR}/xD-gen-replies.sh
|
COMMAND env LC_ALL=C awk -f ${PROJECT_SOURCE_DIR}/xD-gen-replies.awk
|
||||||
> xD-replies.c < ${PROJECT_SOURCE_DIR}/xD-replies
|
> xD-replies.c < ${PROJECT_SOURCE_DIR}/xD-replies
|
||||||
DEPENDS ${PROJECT_SOURCE_DIR}/xD-replies
|
DEPENDS ${PROJECT_SOURCE_DIR}/xD-replies
|
||||||
COMMENT "Generating files from the list of server numerics")
|
COMMENT "Generating files from the list of server numerics")
|
||||||
@@ -184,7 +196,7 @@ add_custom_target (clang-tidy
|
|||||||
# Installation
|
# Installation
|
||||||
install (TARGETS xB xC xD DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install (TARGETS xB xC xD DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||||
# XXX: our defaults for XDG_DATA_DIRS expect /usr/local/shore or /usr/share
|
# XXX: our defaults for XDG_DATA_DIRS expect /usr/local/share or /usr/share
|
||||||
install (DIRECTORY plugins/xB/
|
install (DIRECTORY plugins/xB/
|
||||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS)
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS)
|
||||||
install (DIRECTORY plugins/xC/
|
install (DIRECTORY plugins/xC/
|
||||||
@@ -192,20 +204,31 @@ install (DIRECTORY plugins/xC/
|
|||||||
|
|
||||||
# Generate documentation from text markup
|
# Generate documentation from text markup
|
||||||
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)
|
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)
|
||||||
if (NOT ASCIIDOCTOR_EXECUTABLE)
|
find_program (A2X_EXECUTABLE a2x)
|
||||||
message (FATAL_ERROR "asciidoctor not found")
|
if (NOT ASCIIDOCTOR_EXECUTABLE AND NOT A2X_EXECUTABLE)
|
||||||
|
message (FATAL_ERROR "Neither asciidoctor nor a2x were found")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
foreach (page xB xC xD)
|
foreach (page xB xC xD)
|
||||||
set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
|
set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
|
||||||
list (APPEND project_MAN_PAGES "${page_output}")
|
list (APPEND project_MAN_PAGES "${page_output}")
|
||||||
add_custom_command (OUTPUT ${page_output}
|
if (ASCIIDOCTOR_EXECUTABLE)
|
||||||
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage
|
add_custom_command (OUTPUT ${page_output}
|
||||||
-a release-version=${project_version}
|
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage
|
||||||
"${PROJECT_SOURCE_DIR}/${page}.adoc"
|
-a release-version=${project_version}
|
||||||
-o "${page_output}"
|
-o "${page_output}"
|
||||||
DEPENDS ${page}.adoc
|
"${PROJECT_SOURCE_DIR}/${page}.adoc"
|
||||||
COMMENT "Generating man page for ${page}" VERBATIM)
|
DEPENDS ${page}.adoc
|
||||||
|
COMMENT "Generating man page for ${page}" VERBATIM)
|
||||||
|
elseif (A2X_EXECUTABLE)
|
||||||
|
add_custom_command (OUTPUT ${page_output}
|
||||||
|
COMMAND ${A2X_EXECUTABLE} --doctype manpage --format manpage
|
||||||
|
-a release-version=${project_version}
|
||||||
|
-D "${PROJECT_BINARY_DIR}"
|
||||||
|
"${PROJECT_SOURCE_DIR}/${page}.adoc"
|
||||||
|
DEPENDS ${page}.adoc
|
||||||
|
COMMENT "Generating man page for ${page}" VERBATIM)
|
||||||
|
endif ()
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES})
|
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES})
|
||||||
@@ -217,7 +240,6 @@ foreach (page ${project_MAN_PAGES})
|
|||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
# CPack
|
# CPack
|
||||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unreasonable IRC client, daemon and bot")
|
|
||||||
set (CPACK_PACKAGE_VERSION "${project_version_safe}")
|
set (CPACK_PACKAGE_VERSION "${project_version_safe}")
|
||||||
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
||||||
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2014 - 2021, Přemysl Eric Janouch <p@janouch.name>
|
Copyright (c) 2014 - 2022, Přemysl Eric Janouch <p@janouch.name>
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
purpose with or without fee is hereby granted.
|
purpose with or without fee is hereby granted.
|
||||||
|
|||||||
44
NEWS
44
NEWS
@@ -1,3 +1,47 @@
|
|||||||
|
Unreleased
|
||||||
|
|
||||||
|
* xC: all behaviour.* configuration options have been renamed to general.*,
|
||||||
|
with the exception of editor_command/editor, backlog_helper/pager,
|
||||||
|
and backlog_helper_strip_formatting/pager_strip_formatting
|
||||||
|
|
||||||
|
* xC: replaced behaviour.save_on_quit with general.autosave
|
||||||
|
|
||||||
|
* xC: improved pager integration capabilities
|
||||||
|
|
||||||
|
* xC: normalized editline's history behaviour, making it a viable frontend
|
||||||
|
|
||||||
|
* xC: made it show WALLOPS messages, as PRIVMSG for the server buffer
|
||||||
|
|
||||||
|
* xD: implemented WALLOPS, choosing to make it target even non-operators
|
||||||
|
|
||||||
|
|
||||||
|
1.5.0 (2021-12-21) "The Show Must Go On"
|
||||||
|
|
||||||
|
* xC: made it possible to pass the cursor position to external editors,
|
||||||
|
in particular VIM and Emacs
|
||||||
|
|
||||||
|
* xC: started quoting text coming from bracketed pastes,
|
||||||
|
to minimize the risk of trying to execute filesystem paths as commands
|
||||||
|
|
||||||
|
* xC: fixed to work with post-2021-08-29 editline
|
||||||
|
|
||||||
|
* xC: extended editline's autocomplete to show all options
|
||||||
|
|
||||||
|
* utm-filter.lua: added Facebook's tracking parameter to the filter
|
||||||
|
|
||||||
|
|
||||||
|
1.4.0 (2021-10-06) "Call Me Scruffy Scruffington"
|
||||||
|
|
||||||
|
* xC: made message autosplitting respect text formatting
|
||||||
|
|
||||||
|
* xC: fixed displaying IRC colours above 16
|
||||||
|
|
||||||
|
* xC: offer IRCnet as an IRC network to connect to,
|
||||||
|
rather than the lunatic new Freenode
|
||||||
|
|
||||||
|
* xD: started bumping the soft limit on file descriptors to the hard one
|
||||||
|
|
||||||
|
|
||||||
1.3.0 (2021-08-07) "New World Order"
|
1.3.0 (2021-08-07) "New World Order"
|
||||||
|
|
||||||
* xC: made nick autocompletion offer recent speakers first
|
* xC: made nick autocompletion offer recent speakers first
|
||||||
|
|||||||
122
README.adoc
122
README.adoc
@@ -1,56 +1,42 @@
|
|||||||
uirc3
|
xK
|
||||||
=====
|
==
|
||||||
:compact-option:
|
|
||||||
|
|
||||||
The unreasonable IRC trinity. This project consists of an IRC client, daemon,
|
'xK' (chat kit) is an IRC software suite consisting of a terminal client,
|
||||||
and bot. It's all you're ever going to need for chatting, as long as you can
|
daemon, and bot. It's all you're ever going to need for chatting,
|
||||||
make do with minimalist software.
|
so long as you can make do with slightly minimalist software.
|
||||||
|
|
||||||
All of them have these potentially interesting properties:
|
They're all lean on dependencies, and offer a maximally permissive licence.
|
||||||
|
|
||||||
- IPv6 support
|
|
||||||
- TLS support, including client certificates
|
|
||||||
- lean on dependencies (with the exception of 'xC')
|
|
||||||
- compact and arguably easy to hack on
|
|
||||||
- very permissive license
|
|
||||||
|
|
||||||
xC
|
xC
|
||||||
--
|
--
|
||||||
The IRC client. It is largely defined by being built on top of GNU Readline
|
The IRC client, and the core of 'xK'. It is largely defined by building on top
|
||||||
that has been hacked to death. Its interface should feel somewhat familiar for
|
of GNU Readline or BSD Editline that have been hacked to death. Its interface
|
||||||
weechat or irssi users.
|
should feel somewhat familiar for weechat or irssi users.
|
||||||
|
|
||||||
image::xC.png[align="center"]
|
image::xC.png[align="center"]
|
||||||
|
|
||||||
This is the largest application within the project. It has most of the stuff
|
It has most features you'd expect of an IRC client, such as being multiserver,
|
||||||
you'd expect of an IRC client, such as being able to set up multiple servers,
|
a powerful configuration system, integrated help, text formatting, automatic
|
||||||
a powerful configuration system, integrated help, text formatting, CTCP queries,
|
message splitting, multiline editing, bracketed paste support, word wrapping
|
||||||
automatic splitting of overlong messages, autocomplete, logging to file,
|
that doesn't break links, autocomplete, logging, CTCP queries, auto-away,
|
||||||
auto-away, command aliases and basic support for Lua scripting.
|
command aliases, SOCKS proxying, SASL EXTERNAL authentication using TLS client
|
||||||
|
certificates, or basic support for Lua scripting. As a unique bonus, you can
|
||||||
|
launch a full text editor from within.
|
||||||
|
|
||||||
xD
|
xD
|
||||||
--
|
--
|
||||||
The IRC daemon. It is designed to be used as a regular user application rather
|
The IRC daemon. It is designed for use as a regular user application rather
|
||||||
than a system-wide daemon. If all you want is a decent, minimal IRCd for
|
than a system-wide daemon, and follows the XDG Base Directory Specification.
|
||||||
testing purposes or a small network of respectful users (or bots), this one will
|
If all you want is a decent, minimal IRCd for testing purposes or a small
|
||||||
do it just fine.
|
network of respectful users (or bots), this one will do it just fine.
|
||||||
|
|
||||||
Notable features:
|
It autodetects TLS on incoming connections (I'm still wondering why everyone
|
||||||
|
doesn't have this), authenticates operators via TLS client certificate
|
||||||
|
fingerprints, and supports a number of IRCv3 capabilities.
|
||||||
|
|
||||||
- TLS autodetection (why doesn't everyone have this?), using secure defaults
|
What it notably doesn't support is online changes to configuration, any limits
|
||||||
- IRCop authentication via TLS client certificates
|
besides the total number of connections and mode `+l`, or server linking
|
||||||
- epoll/kqueue support; this means that it should be able to handle quite
|
(which also means no services).
|
||||||
a number of concurrent user connections
|
|
||||||
- partial IRCv3 support
|
|
||||||
|
|
||||||
Not supported:
|
|
||||||
|
|
||||||
- server linking (which also means no services); I consider existing protocols
|
|
||||||
for this purpose ugly and tricky to implement correctly; I've also found no
|
|
||||||
use for this feature yet
|
|
||||||
- online changes to configuration; the configuration system from 'xC' could
|
|
||||||
be used to implement this feature if needed
|
|
||||||
- limits of almost any kind, just connections and mode `+l`
|
|
||||||
|
|
||||||
This program has been
|
This program has been
|
||||||
https://git.janouch.name/p/haven/src/branch/master/hid[ported to Go],
|
https://git.janouch.name/p/haven/src/branch/master/hid[ported to Go],
|
||||||
@@ -58,16 +44,14 @@ and development continues over there.
|
|||||||
|
|
||||||
xB
|
xB
|
||||||
--
|
--
|
||||||
The IRC bot. It builds upon the concept of my other VitaminA IRC bot. The main
|
The IRC bot. While originally intended to be a simple rewrite of my old GNU AWK
|
||||||
characteristic of these two bots is that they run plugins as coprocesses, which
|
bot in C, it fairly quickly became a playground, and it eventually got me into
|
||||||
allows for enhanced reliability and programming language freedom.
|
writing the rest of this package.
|
||||||
|
|
||||||
While originally intended to be a simple rewrite of the original AWK bot in C,
|
Its main characteristic is that it runs plugins as coprocesses, allowing for
|
||||||
it fairly quickly became a playground, and it eventually got me into writing
|
enhanced reliability and programming language freedom. Moreover, it recovers
|
||||||
the rest of the package.
|
from any crashes, and offers native SOCKS support (even though socksify can add
|
||||||
|
that easily to any program).
|
||||||
It survives crashes, server disconnects and timeouts, and also has native SOCKS
|
|
||||||
support (even though socksify can add that easily to any program).
|
|
||||||
|
|
||||||
Packages
|
Packages
|
||||||
--------
|
--------
|
||||||
@@ -76,18 +60,16 @@ a package with the latest development version from Archlinux's AUR.
|
|||||||
|
|
||||||
Building
|
Building
|
||||||
--------
|
--------
|
||||||
Build dependencies: CMake, pkg-config, asciidoctor, awk, liberty (included) +
|
Build dependencies: CMake, pkg-config, asciidoctor or asciidoc, awk,
|
||||||
|
liberty (included) +
|
||||||
Runtime dependencies: openssl +
|
Runtime dependencies: openssl +
|
||||||
Additionally for 'xC': curses, libffi, lua >= 5.3 (optional),
|
Additionally for 'xC': curses, libffi, lua >= 5.3 (optional),
|
||||||
readline >= 6.0 or libedit >= 2013-07-12
|
readline >= 6.0 or libedit >= 2013-07-12
|
||||||
|
|
||||||
Avoid libedit if you can, in general it works but at the moment history is
|
$ git clone --recursive https://git.janouch.name/p/xK.git
|
||||||
acting up and I have no clue about fixing it.
|
$ mkdir xK/build
|
||||||
|
$ cd xK/build
|
||||||
$ git clone --recursive https://git.janouch.name/p/uirc3.git
|
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||||
$ mkdir uirc3/build
|
|
||||||
$ cd uirc3/build
|
|
||||||
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug \
|
|
||||||
-DWANT_READLINE=ON -DWANT_LIBEDIT=OFF -DWANT_LUA=ON
|
-DWANT_READLINE=ON -DWANT_LIBEDIT=OFF -DWANT_LUA=ON
|
||||||
$ make
|
$ make
|
||||||
|
|
||||||
@@ -95,10 +77,10 @@ To install the application, you can do either the usual:
|
|||||||
|
|
||||||
# make install
|
# make install
|
||||||
|
|
||||||
Or you can try telling CMake to make a package for you. For Debian it is:
|
Or you can try telling CMake to make a package for you:
|
||||||
|
|
||||||
$ cpack -G DEB
|
$ cpack -G DEB # also supported: RPM, FreeBSD
|
||||||
# dpkg -i uirc3-*.deb
|
# dpkg -i xK-*.deb
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
-----
|
-----
|
||||||
@@ -156,14 +138,18 @@ Beware that you can easily break the program if you're not careful.
|
|||||||
|
|
||||||
How do I make xC look like the screenshot?
|
How do I make xC look like the screenshot?
|
||||||
------------------------------------------
|
------------------------------------------
|
||||||
First of all, you must build it with Lua support. With the defaults, 'xC'
|
With the defaults, 'xC' doesn't look too fancy because I don't want to have
|
||||||
doesn't look too fancy because I don't want to depend on Lua or 256-colour
|
a hard dependency on either Lua for the bundled script that provides an easily
|
||||||
terminals. In addition to that, I appear to be one of the few people who use
|
adjustable enhanced prompt, or on 256-colour terminals. Moreover, it's nearly
|
||||||
black on white terminals.
|
impossible to come up with a colour theme that would work well with both
|
||||||
|
black-on-white and white-on-black terminals, or anything wild in between.
|
||||||
|
|
||||||
/set behaviour.date_change_line = "%a %e %b %Y"
|
Assuming that your build supports Lua plugins, and that you have a decent,
|
||||||
/set behaviour.plugin_autoload += "fancy-prompt.lua"
|
properly set-up terminal emulator, it suffices to run:
|
||||||
/set behaviour.backlog_helper = "LESSSECURE=1 less -R +Gb1d -Ps'Backlog ?ltlines %lt-%lb?L/%L. .?e(END):?pB%pB\\%..'"
|
|
||||||
|
/set general.pager = Press Tab here and change +Gb to +Gb1d
|
||||||
|
/set general.date_change_line = "%a %e %b %Y"
|
||||||
|
/set general.plugin_autoload += "fancy-prompt.lua"
|
||||||
/set attributes.userhost = "\x1b[38;5;109m"
|
/set attributes.userhost = "\x1b[38;5;109m"
|
||||||
/set attributes.join = "\x1b[38;5;108m"
|
/set attributes.join = "\x1b[38;5;108m"
|
||||||
/set attributes.part = "\x1b[38;5;138m"
|
/set attributes.part = "\x1b[38;5;138m"
|
||||||
@@ -184,7 +170,7 @@ configurations accordingly, but I consider it rather messy and unnecessary.
|
|||||||
|
|
||||||
Contributing and Support
|
Contributing and Support
|
||||||
------------------------
|
------------------------
|
||||||
Use https://git.janouch.name/p/uirc3 to report any bugs, request features,
|
Use https://git.janouch.name/p/xK to report any bugs, request features,
|
||||||
or submit pull requests. `git send-email` is tolerated. If you want to discuss
|
or submit pull requests. `git send-email` is tolerated. If you want to discuss
|
||||||
the project, feel free to join me at ircs://irc.janouch.name, channel #dev.
|
the project, feel free to join me at ircs://irc.janouch.name, channel #dev.
|
||||||
|
|
||||||
|
|||||||
24
common.c
24
common.c
@@ -22,11 +22,11 @@
|
|||||||
#define LIBERTY_WANT_PROTO_IRC
|
#define LIBERTY_WANT_PROTO_IRC
|
||||||
|
|
||||||
#ifdef WANT_SYSLOG_LOGGING
|
#ifdef WANT_SYSLOG_LOGGING
|
||||||
#define print_fatal_data ((void *) LOG_ERR)
|
#define print_fatal_data ((void *) LOG_ERR)
|
||||||
#define print_error_data ((void *) LOG_ERR)
|
#define print_error_data ((void *) LOG_ERR)
|
||||||
#define print_warning_data ((void *) LOG_WARNING)
|
#define print_warning_data ((void *) LOG_WARNING)
|
||||||
#define print_status_data ((void *) LOG_INFO)
|
#define print_status_data ((void *) LOG_INFO)
|
||||||
#define print_debug_data ((void *) LOG_DEBUG)
|
#define print_debug_data ((void *) LOG_DEBUG)
|
||||||
#endif // WANT_SYSLOG_LOGGING
|
#endif // WANT_SYSLOG_LOGGING
|
||||||
|
|
||||||
#include "liberty/liberty.c"
|
#include "liberty/liberty.c"
|
||||||
@@ -87,15 +87,15 @@ static time_t
|
|||||||
unixtime_msec (long *msec)
|
unixtime_msec (long *msec)
|
||||||
{
|
{
|
||||||
#ifdef _POSIX_TIMERS
|
#ifdef _POSIX_TIMERS
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
hard_assert (clock_gettime (CLOCK_REALTIME, &tp) != -1);
|
hard_assert (clock_gettime (CLOCK_REALTIME, &tp) != -1);
|
||||||
*msec = tp.tv_nsec / 1000000;
|
*msec = tp.tv_nsec / 1000000;
|
||||||
#else // ! _POSIX_TIMERS
|
#else // ! _POSIX_TIMERS
|
||||||
struct timeval tp;
|
struct timeval tp;
|
||||||
hard_assert (gettimeofday (&tp, NULL) != -1);
|
hard_assert (gettimeofday (&tp, NULL) != -1);
|
||||||
*msec = tp.tv_usec / 1000;
|
*msec = tp.tv_usec / 1000;
|
||||||
#endif // ! _POSIX_TIMERS
|
#endif // ! _POSIX_TIMERS
|
||||||
return tp.tv_sec;
|
return tp.tv_sec;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Logging -----------------------------------------------------------------
|
// --- Logging -----------------------------------------------------------------
|
||||||
|
|||||||
2
liberty
2
liberty
Submodule liberty updated: 9639777814...f545be725d
@@ -1,7 +1,7 @@
|
|||||||
--
|
--
|
||||||
-- fancy-prompt.lua: the fancy multiline prompt you probably want
|
-- fancy-prompt.lua: the fancy multiline prompt you probably want
|
||||||
--
|
--
|
||||||
-- Copyright (c) 2016, Přemysl Eric Janouch <p@janouch.name>
|
-- Copyright (c) 2016 - 2022, Přemysl Eric Janouch <p@janouch.name>
|
||||||
--
|
--
|
||||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
-- Permission to use, copy, modify, and/or distribute this software for any
|
||||||
-- purpose with or without fee is hereby granted.
|
-- purpose with or without fee is hereby granted.
|
||||||
@@ -40,7 +40,7 @@ xC.hook_prompt (function (hook)
|
|||||||
if buffer == current then
|
if buffer == current then
|
||||||
current_n = i
|
current_n = i
|
||||||
elseif buffer.new_messages_count ~= buffer.new_unimportant_count then
|
elseif buffer.new_messages_count ~= buffer.new_unimportant_count then
|
||||||
if active ~= "" then active = active .. "," end
|
active = active .. ","
|
||||||
if buffer.highlighted then
|
if buffer.highlighted then
|
||||||
active = active .. "!"
|
active = active .. "!"
|
||||||
bg_color = "224"
|
bg_color = "224"
|
||||||
@@ -48,7 +48,6 @@ xC.hook_prompt (function (hook)
|
|||||||
active = active .. i
|
active = active .. i
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if active ~= "" then active = "(" .. active .. ")" end
|
|
||||||
local x = current_n .. ":" .. current.name
|
local x = current_n .. ":" .. current.name
|
||||||
if chan and chan.users_len ~= 0 then
|
if chan and chan.users_len ~= 0 then
|
||||||
local params = ""
|
local params = ""
|
||||||
@@ -56,25 +55,34 @@ xC.hook_prompt (function (hook)
|
|||||||
params = params .. " +" .. mode .. " " .. param
|
params = params .. " +" .. mode .. " " .. param
|
||||||
end
|
end
|
||||||
local modes = chan.no_param_modes .. params:sub (3)
|
local modes = chan.no_param_modes .. params:sub (3)
|
||||||
if modes ~= "" then x = x .. "(+" .. modes .. ")" end
|
if modes ~= "" then
|
||||||
|
x = x .. "(+" .. modes .. ")"
|
||||||
|
end
|
||||||
x = x .. "{" .. chan.users_len .. "}"
|
x = x .. "{" .. chan.users_len .. "}"
|
||||||
end
|
end
|
||||||
if current.hide_unimportant then x = x .. "<H>" end
|
if current.hide_unimportant then
|
||||||
|
x = x .. "<H>"
|
||||||
local lines, cols = xC.get_screen_size ()
|
end
|
||||||
x = x .. " " .. active .. string.rep (" ", cols)
|
if active ~= "" then
|
||||||
|
x = x .. " (" .. active:sub (2) .. ")"
|
||||||
|
end
|
||||||
|
|
||||||
-- Readline 7.0.003 seems to be broken and completely corrupts the prompt.
|
-- Readline 7.0.003 seems to be broken and completely corrupts the prompt.
|
||||||
-- However 8.0.004 seems to be fine with these, as is libedit 20191231-3.1.
|
-- However 8.0.004 seems to be fine with these, as is libedit 20191231-3.1.
|
||||||
--x = x:gsub("[\128-\255]", "?")
|
--x = x:gsub("[\128-\255]", "?")
|
||||||
|
|
||||||
-- Cut off extra characters and apply formatting, including the hack.
|
-- Align to the terminal's width and apply formatting, including the hack.
|
||||||
-- FIXME: this doesn't count with full-width or zero-width characters.
|
local lines, cols = xC.get_screen_size ()
|
||||||
-- We might want to export wcwidth() above term_from_utf8 somehow.
|
local trailing, width = " ", xC.measure (x)
|
||||||
local overflow = utf8.offset (x, cols - 1)
|
while cols > 0 and width >= cols do
|
||||||
if overflow then x = x:sub (1, overflow) end
|
x = x:sub (1, utf8.offset (x, -1) - 1)
|
||||||
|
trailing, width = ">", xC.measure (x)
|
||||||
|
end
|
||||||
|
|
||||||
x = "\x01\x1b[0;4;1;38;5;16m\x1b[48;5;" .. bg_color .. "m\x02" ..
|
x = "\x01\x1b[0;4;1;38;5;16m\x1b[48;5;" .. bg_color .. "m\x02" ..
|
||||||
x .. "\x01\x1b[0;4;1;7;38;5;" .. bg_color .. "m\x02 \x01\x1b[0;1m\x02"
|
x .. string.rep (" ", cols - width - 1) ..
|
||||||
|
"\x01\x1b[0;4;1;7;38;5;" .. bg_color .. "m\x02" ..
|
||||||
|
trailing .. "\x01\x1b[0;1m\x02"
|
||||||
|
|
||||||
local user_prefix = function (chan, user)
|
local user_prefix = function (chan, user)
|
||||||
for i, chan_user in ipairs (chan.users) do
|
for i, chan_user in ipairs (chan.users) do
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--
|
--
|
||||||
-- utm-filter.lua: filter out Google Analytics bullshit from URLs
|
-- utm-filter.lua: filter out Google Analytics bullshit etc. from URLs
|
||||||
--
|
--
|
||||||
-- Copyright (c) 2015, Přemysl Eric Janouch <p@janouch.name>
|
-- Copyright (c) 2015 - 2021, Přemysl Eric Janouch <p@janouch.name>
|
||||||
--
|
--
|
||||||
-- Permission to use, copy, modify, and/or distribute this software for any
|
-- Permission to use, copy, modify, and/or distribute this software for any
|
||||||
-- purpose with or without fee is hereby granted.
|
-- purpose with or without fee is hereby granted.
|
||||||
@@ -19,6 +19,10 @@
|
|||||||
local banned = {
|
local banned = {
|
||||||
gclid = 1,
|
gclid = 1,
|
||||||
|
|
||||||
|
-- Alas, Facebook no longer uses this parameter, see:
|
||||||
|
-- https://news.ycombinator.com/item?id=32117489
|
||||||
|
fbclid = 1,
|
||||||
|
|
||||||
utm_source = 1,
|
utm_source = 1,
|
||||||
utm_medium = 1,
|
utm_medium = 1,
|
||||||
utm_term = 1,
|
utm_term = 1,
|
||||||
|
|||||||
12
xB.adoc
12
xB.adoc
@@ -1,8 +1,8 @@
|
|||||||
xB(1)
|
xB(1)
|
||||||
=====
|
=====
|
||||||
:doctype: manpage
|
:doctype: manpage
|
||||||
:manmanual: uirc3 Manual
|
:manmanual: xK Manual
|
||||||
:mansource: uirc3 {release-version}
|
:mansource: xK {release-version}
|
||||||
|
|
||||||
Name
|
Name
|
||||||
----
|
----
|
||||||
@@ -60,14 +60,14 @@ using the IRC protocol. (Caveat: the standard C library doesn't automatically
|
|||||||
flush FILE streams for pipes on newlines.) A special *XB* command is introduced
|
flush FILE streams for pipes on newlines.) A special *XB* command is introduced
|
||||||
for RPC, with the following subcommands:
|
for RPC, with the following subcommands:
|
||||||
|
|
||||||
*XB get_config* _key_::
|
*XB get_config* __key__::
|
||||||
Request the value of the given configuration option. If no such option
|
Request the value of the given configuration option. If no such option
|
||||||
exists, the value will be empty. The response will be delivered in
|
exists, the value will be empty. The response will be delivered in
|
||||||
the following format:
|
the following format:
|
||||||
+
|
+
|
||||||
```
|
....
|
||||||
XB :value
|
XB :value
|
||||||
```
|
....
|
||||||
+
|
+
|
||||||
This is particularly useful for retrieving the *prefix* string.
|
This is particularly useful for retrieving the *prefix* string.
|
||||||
|
|
||||||
@@ -100,5 +100,5 @@ _/usr/share/xB/plugins/_::
|
|||||||
|
|
||||||
Reporting bugs
|
Reporting bugs
|
||||||
--------------
|
--------------
|
||||||
Use https://git.janouch.name/p/uirc3 to report bugs, request features,
|
Use https://git.janouch.name/p/xK to report bugs, request features,
|
||||||
or submit pull requests.
|
or submit pull requests.
|
||||||
|
|||||||
19
xC.adoc
19
xC.adoc
@@ -1,8 +1,8 @@
|
|||||||
xC(1)
|
xC(1)
|
||||||
=====
|
=====
|
||||||
:doctype: manpage
|
:doctype: manpage
|
||||||
:manmanual: uirc3 Manual
|
:manmanual: xK Manual
|
||||||
:mansource: uirc3 {release-version}
|
:mansource: xK {release-version}
|
||||||
|
|
||||||
Name
|
Name
|
||||||
----
|
----
|
||||||
@@ -25,9 +25,9 @@ Options
|
|||||||
other formatting marks to ANSI codes retrieved from the *terminfo*(5)
|
other formatting marks to ANSI codes retrieved from the *terminfo*(5)
|
||||||
database:
|
database:
|
||||||
+
|
+
|
||||||
```
|
....
|
||||||
printf '\x02bold\x02\n' | xC -f
|
printf '\x02bold\x02\n' | xC -f
|
||||||
```
|
....
|
||||||
+
|
+
|
||||||
This feature may be used to preview server MOTD files.
|
This feature may be used to preview server MOTD files.
|
||||||
|
|
||||||
@@ -62,10 +62,10 @@ their respective function names:
|
|||||||
*M-a*: *goto-activity*::
|
*M-a*: *goto-activity*::
|
||||||
Go to the first following buffer with unseen activity.
|
Go to the first following buffer with unseen activity.
|
||||||
*PageUp*: *display-backlog*::
|
*PageUp*: *display-backlog*::
|
||||||
Show the in-memory backlog for this buffer in the backlog helper,
|
Show the in-memory backlog for this buffer using *general.pager*,
|
||||||
which is almost certainly the *less*(1) program.
|
which is almost certainly the *less*(1) program.
|
||||||
*M-h*: *display-full-log*::
|
*M-h*: *display-full-log*::
|
||||||
Show the log file for this buffer in the backlog helper.
|
Show the log file for this buffer using *general.pager*.
|
||||||
*M-H*: *toggle-unimportant*::
|
*M-H*: *toggle-unimportant*::
|
||||||
Hide all join, part and quit messages, as well as all channel mode changes
|
Hide all join, part and quit messages, as well as all channel mode changes
|
||||||
that only relate to user channel modes. Intended to reduce noise in
|
that only relate to user channel modes. Intended to reduce noise in
|
||||||
@@ -105,7 +105,7 @@ _~/.config/xC/xC.conf_::
|
|||||||
as the */set* command, to make changes in it.
|
as the */set* command, to make changes in it.
|
||||||
|
|
||||||
_~/.local/share/xC/logs/_::
|
_~/.local/share/xC/logs/_::
|
||||||
When enabled by *behaviour.logging*, log files are stored here.
|
When enabled by *general.logging*, log files are stored here.
|
||||||
|
|
||||||
_~/.local/share/xC/plugins/_::
|
_~/.local/share/xC/plugins/_::
|
||||||
_/usr/local/share/xC/plugins/_::
|
_/usr/local/share/xC/plugins/_::
|
||||||
@@ -114,12 +114,11 @@ _/usr/share/xC/plugins/_::
|
|||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
----
|
----
|
||||||
The editline (libedit) frontend is more of a proof of concept that mostly seems
|
The editline (libedit) frontend may exhibit some unexpected behaviour.
|
||||||
to work but exhibits bugs that are not our fault.
|
|
||||||
|
|
||||||
Reporting bugs
|
Reporting bugs
|
||||||
--------------
|
--------------
|
||||||
Use https://git.janouch.name/p/uirc3 to report bugs, request features,
|
Use https://git.janouch.name/p/xK to report bugs, request features,
|
||||||
or submit pull requests.
|
or submit pull requests.
|
||||||
|
|
||||||
See also
|
See also
|
||||||
|
|||||||
29
xD-gen-replies.awk
Executable file
29
xD-gen-replies.awk
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/awk -f
|
||||||
|
BEGIN {
|
||||||
|
# The message catalog is a by-product
|
||||||
|
msg = "xD.msg"
|
||||||
|
print "$quote \"" > msg;
|
||||||
|
print "$set 1" > msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
|
||||||
|
match($0, /".*"/);
|
||||||
|
ids[$1] = $2;
|
||||||
|
texts[$2] = substr($0, RSTART, RLENGTH);
|
||||||
|
print $1 " " texts[$2] > msg
|
||||||
|
}
|
||||||
|
|
||||||
|
END {
|
||||||
|
printf("enum\n{")
|
||||||
|
for (i in ids) {
|
||||||
|
if (seen_first)
|
||||||
|
printf(",")
|
||||||
|
seen_first = 1
|
||||||
|
printf("\n\t%s = %s", ids[i], i)
|
||||||
|
}
|
||||||
|
print "\n};\n"
|
||||||
|
print "static const char *g_default_replies[] =\n{"
|
||||||
|
for (i in ids)
|
||||||
|
print "\t[" ids[i] "] = " texts[ids[i]] ","
|
||||||
|
print "};"
|
||||||
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
LC_ALL=C exec awk '
|
|
||||||
BEGIN {
|
|
||||||
# The message catalog is a by-product
|
|
||||||
msg = "xD.msg"
|
|
||||||
print "$quote \"" > msg;
|
|
||||||
print "$set 1" > msg;
|
|
||||||
}
|
|
||||||
/^[0-9]+ *IRC_(ERR|RPL)_[A-Z]+ *".*"$/ {
|
|
||||||
match($0, /".*"/);
|
|
||||||
ids[$1] = $2;
|
|
||||||
texts[$2] = substr($0, RSTART, RLENGTH);
|
|
||||||
print $1 " " texts[$2] > msg
|
|
||||||
}
|
|
||||||
END {
|
|
||||||
printf("enum\n{")
|
|
||||||
for (i in ids) {
|
|
||||||
if (seen_first)
|
|
||||||
printf(",")
|
|
||||||
seen_first = 1
|
|
||||||
printf("\n\t%s = %s", ids[i], i)
|
|
||||||
}
|
|
||||||
print "\n};\n"
|
|
||||||
print "static const char *g_default_replies[] =\n{"
|
|
||||||
for (i in ids)
|
|
||||||
print "\t[" ids[i] "] = " texts[ids[i]] ","
|
|
||||||
print "};"
|
|
||||||
}'
|
|
||||||
6
xD.adoc
6
xD.adoc
@@ -1,8 +1,8 @@
|
|||||||
xD(1)
|
xD(1)
|
||||||
=====
|
=====
|
||||||
:doctype: manpage
|
:doctype: manpage
|
||||||
:manmanual: uirc3 Manual
|
:manmanual: xK Manual
|
||||||
:mansource: uirc3 {release-version}
|
:mansource: xK {release-version}
|
||||||
|
|
||||||
Name
|
Name
|
||||||
----
|
----
|
||||||
@@ -49,5 +49,5 @@ _/etc/xdg/xD/xD.conf_::
|
|||||||
|
|
||||||
Reporting bugs
|
Reporting bugs
|
||||||
--------------
|
--------------
|
||||||
Use https://git.janouch.name/p/uirc3 to report bugs, request features,
|
Use https://git.janouch.name/p/xK to report bugs, request features,
|
||||||
or submit pull requests.
|
or submit pull requests.
|
||||||
|
|||||||
44
xD.c
44
xD.c
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* xD.c: an IRC daemon
|
* xD.c: an IRC daemon
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 - 2020, Přemysl Eric Janouch <p@janouch.name>
|
* Copyright (c) 2014 - 2022, Přemysl Eric Janouch <p@janouch.name>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
* purpose with or without fee is hereby granted.
|
* purpose with or without fee is hereby granted.
|
||||||
@@ -22,7 +22,9 @@
|
|||||||
#define WANT_SYSLOG_LOGGING
|
#define WANT_SYSLOG_LOGGING
|
||||||
#include "common.c"
|
#include "common.c"
|
||||||
#include "xD-replies.c"
|
#include "xD-replies.c"
|
||||||
|
|
||||||
#include <nl_types.h>
|
#include <nl_types.h>
|
||||||
|
#include <sys/resource.h>
|
||||||
|
|
||||||
enum { PIPE_READ, PIPE_WRITE };
|
enum { PIPE_READ, PIPE_WRITE };
|
||||||
|
|
||||||
@@ -2930,6 +2932,29 @@ irc_handle_links (const struct irc_message *msg, struct client *c)
|
|||||||
irc_send_reply (c, IRC_RPL_ENDOFLINKS, mask);
|
irc_send_reply (c, IRC_RPL_ENDOFLINKS, mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
irc_handle_wallops (const struct irc_message *msg, struct client *c)
|
||||||
|
{
|
||||||
|
if (msg->params.len < 1)
|
||||||
|
RETURN_WITH_REPLY (c, IRC_ERR_NEEDMOREPARAMS, msg->command);
|
||||||
|
if (!(c->mode & IRC_USER_MODE_OPERATOR))
|
||||||
|
RETURN_WITH_REPLY (c, IRC_ERR_NOPRIVILEGES);
|
||||||
|
|
||||||
|
const char *message = msg->params.vector[0];
|
||||||
|
|
||||||
|
// Our interpretation: anonymize the sender,
|
||||||
|
// and target all users who want to receive these messages
|
||||||
|
struct str_map_iter iter = str_map_iter_make (&c->ctx->users);
|
||||||
|
struct client *target;
|
||||||
|
while ((target = str_map_iter_next (&iter)))
|
||||||
|
{
|
||||||
|
if (target != c && !(target->mode & IRC_USER_MODE_RX_WALLOPS))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
client_send (target, ":%s WALLOPS :%s", c->ctx->server_name, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
irc_handle_kill (const struct irc_message *msg, struct client *c)
|
irc_handle_kill (const struct irc_message *msg, struct client *c)
|
||||||
{
|
{
|
||||||
@@ -2992,6 +3017,7 @@ irc_register_handlers (struct server_context *ctx)
|
|||||||
{ "ADMIN", true, irc_handle_admin, 0, 0 },
|
{ "ADMIN", true, irc_handle_admin, 0, 0 },
|
||||||
{ "STATS", true, irc_handle_stats, 0, 0 },
|
{ "STATS", true, irc_handle_stats, 0, 0 },
|
||||||
{ "LINKS", true, irc_handle_links, 0, 0 },
|
{ "LINKS", true, irc_handle_links, 0, 0 },
|
||||||
|
{ "WALLOPS", true, irc_handle_wallops, 0, 0 },
|
||||||
|
|
||||||
{ "MODE", true, irc_handle_mode, 0, 0 },
|
{ "MODE", true, irc_handle_mode, 0, 0 },
|
||||||
{ "PRIVMSG", true, irc_handle_privmsg, 0, 0 },
|
{ "PRIVMSG", true, irc_handle_privmsg, 0, 0 },
|
||||||
@@ -3984,6 +4010,21 @@ daemonize (struct server_context *ctx)
|
|||||||
poller_post_fork (&ctx->poller);
|
poller_post_fork (&ctx->poller);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
setup_limits (void)
|
||||||
|
{
|
||||||
|
struct rlimit limit;
|
||||||
|
if (getrlimit (RLIMIT_NOFILE, &limit))
|
||||||
|
{
|
||||||
|
print_warning ("%s: %s", "getrlimit", strerror (errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
limit.rlim_cur = limit.rlim_max;
|
||||||
|
if (setrlimit (RLIMIT_NOFILE, &limit))
|
||||||
|
print_warning ("%s: %s", "setrlimit", strerror (errno));
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -4030,6 +4071,7 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
print_status (PROGRAM_NAME " " PROGRAM_VERSION " starting");
|
print_status (PROGRAM_NAME " " PROGRAM_VERSION " starting");
|
||||||
setup_signal_handlers ();
|
setup_signal_handlers ();
|
||||||
|
setup_limits ();
|
||||||
init_openssl ();
|
init_openssl ();
|
||||||
|
|
||||||
struct server_context ctx;
|
struct server_context ctx;
|
||||||
|
|||||||
Reference in New Issue
Block a user