Compare commits
37 Commits
v1.4.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
|
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
|
||||
/CMakeLists.txt.user*
|
||||
/uirc3.config
|
||||
/uirc3.files
|
||||
/uirc3.creator*
|
||||
/uirc3.includes
|
||||
/xK.config
|
||||
/xK.files
|
||||
/xK.creator*
|
||||
/xK.includes
|
||||
/xK.cflags
|
||||
/xK.cxxflags
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
cmake_minimum_required (VERSION 3.0)
|
||||
project (uirc3 VERSION 1.4.0 LANGUAGES C)
|
||||
# Ubuntu 18.04 LTS and OpenBSD 6.4
|
||||
cmake_minimum_required (VERSION 3.10)
|
||||
project (xK VERSION 1.5.0 DESCRIPTION "IRC client, daemon and bot" LANGUAGES C)
|
||||
|
||||
# Options
|
||||
option (WANT_READLINE "Use GNU Readline for the UI (better)" ON)
|
||||
option (WANT_LIBEDIT "Use BSD libedit for the UI" OFF)
|
||||
|
||||
# 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)
|
||||
# -Wunused-function is pretty annoying here, as everything is static
|
||||
set (wdisabled "-Wno-unused-function")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra ${wdisabled}")
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-unused-function")
|
||||
endif ()
|
||||
|
||||
# Version
|
||||
@@ -57,6 +61,8 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")
|
||||
# Need this for SIGWINCH in FreeBSD and OpenBSD respectively;
|
||||
# our POSIX version macros make it undefined
|
||||
add_definitions (-D__BSD_VISIBLE=1 -D_BSD_SOURCE=1)
|
||||
elseif (APPLE)
|
||||
add_definitions (-D_DARWIN_C_SOURCE)
|
||||
endif ()
|
||||
|
||||
# -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))
|
||||
message (SEND_ERROR "You have to choose either GNU Readline or libedit")
|
||||
elseif (WANT_READLINE)
|
||||
pkg_check_modules (readline readline)
|
||||
|
||||
# OpenBSD's default readline is too old
|
||||
if ("${CMAKE_SYSTEM_NAME}" MATCHES "OpenBSD")
|
||||
include_directories (${OPENBSD_LOCALBASE}/include/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 ()
|
||||
list (APPEND xC_libraries readline)
|
||||
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
|
||||
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
|
||||
DEPENDS ${PROJECT_SOURCE_DIR}/xD-replies
|
||||
COMMENT "Generating files from the list of server numerics")
|
||||
@@ -184,7 +196,7 @@ add_custom_target (clang-tidy
|
||||
# Installation
|
||||
install (TARGETS xB xC xD DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
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/
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS)
|
||||
install (DIRECTORY plugins/xC/
|
||||
@@ -192,20 +204,31 @@ install (DIRECTORY plugins/xC/
|
||||
|
||||
# Generate documentation from text markup
|
||||
find_program (ASCIIDOCTOR_EXECUTABLE asciidoctor)
|
||||
if (NOT ASCIIDOCTOR_EXECUTABLE)
|
||||
message (FATAL_ERROR "asciidoctor not found")
|
||||
find_program (A2X_EXECUTABLE a2x)
|
||||
if (NOT ASCIIDOCTOR_EXECUTABLE AND NOT A2X_EXECUTABLE)
|
||||
message (FATAL_ERROR "Neither asciidoctor nor a2x were found")
|
||||
endif ()
|
||||
|
||||
foreach (page xB xC xD)
|
||||
set (page_output "${PROJECT_BINARY_DIR}/${page}.1")
|
||||
list (APPEND project_MAN_PAGES "${page_output}")
|
||||
if (ASCIIDOCTOR_EXECUTABLE)
|
||||
add_custom_command (OUTPUT ${page_output}
|
||||
COMMAND ${ASCIIDOCTOR_EXECUTABLE} -b manpage
|
||||
-a release-version=${project_version}
|
||||
"${PROJECT_SOURCE_DIR}/${page}.adoc"
|
||||
-o "${page_output}"
|
||||
"${PROJECT_SOURCE_DIR}/${page}.adoc"
|
||||
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 ()
|
||||
|
||||
add_custom_target (docs ALL DEPENDS ${project_MAN_PAGES})
|
||||
@@ -217,7 +240,6 @@ foreach (page ${project_MAN_PAGES})
|
||||
endforeach ()
|
||||
|
||||
# CPack
|
||||
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unreasonable IRC client, daemon and bot")
|
||||
set (CPACK_PACKAGE_VERSION "${project_version_safe}")
|
||||
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
||||
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
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
32
NEWS
32
NEWS
@@ -1,3 +1,35 @@
|
||||
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
|
||||
|
||||
122
README.adoc
122
README.adoc
@@ -1,56 +1,42 @@
|
||||
uirc3
|
||||
=====
|
||||
:compact-option:
|
||||
xK
|
||||
==
|
||||
|
||||
The unreasonable IRC trinity. This project consists of an IRC client, daemon,
|
||||
and bot. It's all you're ever going to need for chatting, as long as you can
|
||||
make do with minimalist software.
|
||||
'xK' (chat kit) is an IRC software suite consisting of a terminal client,
|
||||
daemon, and bot. It's all you're ever going to need for chatting,
|
||||
so long as you can make do with slightly minimalist software.
|
||||
|
||||
All of them have these potentially interesting properties:
|
||||
|
||||
- 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
|
||||
They're all lean on dependencies, and offer a maximally permissive licence.
|
||||
|
||||
xC
|
||||
--
|
||||
The IRC client. It is largely defined by being built on top of GNU Readline
|
||||
that has been hacked to death. Its interface should feel somewhat familiar for
|
||||
weechat or irssi users.
|
||||
The IRC client, and the core of 'xK'. It is largely defined by building on top
|
||||
of GNU Readline or BSD Editline that have been hacked to death. Its interface
|
||||
should feel somewhat familiar for weechat or irssi users.
|
||||
|
||||
image::xC.png[align="center"]
|
||||
|
||||
This is the largest application within the project. It has most of the stuff
|
||||
you'd expect of an IRC client, such as being able to set up multiple servers,
|
||||
a powerful configuration system, integrated help, text formatting, CTCP queries,
|
||||
automatic splitting of overlong messages, autocomplete, logging to file,
|
||||
auto-away, command aliases and basic support for Lua scripting.
|
||||
It has most features you'd expect of an IRC client, such as being multiserver,
|
||||
a powerful configuration system, integrated help, text formatting, automatic
|
||||
message splitting, multiline editing, bracketed paste support, word wrapping
|
||||
that doesn't break links, autocomplete, logging, CTCP queries, auto-away,
|
||||
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
|
||||
--
|
||||
The IRC daemon. It is designed to be used as a regular user application rather
|
||||
than a system-wide daemon. If all you want is a decent, minimal IRCd for
|
||||
testing purposes or a small network of respectful users (or bots), this one will
|
||||
do it just fine.
|
||||
The IRC daemon. It is designed for use as a regular user application rather
|
||||
than a system-wide daemon, and follows the XDG Base Directory Specification.
|
||||
If all you want is a decent, minimal IRCd for testing purposes or a small
|
||||
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
|
||||
- IRCop authentication via TLS client certificates
|
||||
- epoll/kqueue support; this means that it should be able to handle quite
|
||||
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`
|
||||
What it notably doesn't support is online changes to configuration, any limits
|
||||
besides the total number of connections and mode `+l`, or server linking
|
||||
(which also means no services).
|
||||
|
||||
This program has been
|
||||
https://git.janouch.name/p/haven/src/branch/master/hid[ported to Go],
|
||||
@@ -58,16 +44,14 @@ and development continues over there.
|
||||
|
||||
xB
|
||||
--
|
||||
The IRC bot. It builds upon the concept of my other VitaminA IRC bot. The main
|
||||
characteristic of these two bots is that they run plugins as coprocesses, which
|
||||
allows for enhanced reliability and programming language freedom.
|
||||
The IRC bot. While originally intended to be a simple rewrite of my old GNU AWK
|
||||
bot in C, it fairly quickly became a playground, and it eventually got me into
|
||||
writing the rest of this package.
|
||||
|
||||
While originally intended to be a simple rewrite of the original AWK bot in C,
|
||||
it fairly quickly became a playground, and it eventually got me into writing
|
||||
the rest of the package.
|
||||
|
||||
It survives crashes, server disconnects and timeouts, and also has native SOCKS
|
||||
support (even though socksify can add that easily to any program).
|
||||
Its main characteristic is that it runs plugins as coprocesses, allowing for
|
||||
enhanced reliability and programming language freedom. Moreover, it recovers
|
||||
from any crashes, and offers native SOCKS support (even though socksify can add
|
||||
that easily to any program).
|
||||
|
||||
Packages
|
||||
--------
|
||||
@@ -76,18 +60,16 @@ a package with the latest development version from Archlinux's AUR.
|
||||
|
||||
Building
|
||||
--------
|
||||
Build dependencies: CMake, pkg-config, asciidoctor, awk, liberty (included) +
|
||||
Build dependencies: CMake, pkg-config, asciidoctor or asciidoc, awk,
|
||||
liberty (included) +
|
||||
Runtime dependencies: openssl +
|
||||
Additionally for 'xC': curses, libffi, lua >= 5.3 (optional),
|
||||
readline >= 6.0 or libedit >= 2013-07-12
|
||||
|
||||
Avoid libedit if you can, in general it works but at the moment history is
|
||||
acting up and I have no clue about fixing it.
|
||||
|
||||
$ git clone --recursive https://git.janouch.name/p/uirc3.git
|
||||
$ mkdir uirc3/build
|
||||
$ cd uirc3/build
|
||||
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug \
|
||||
$ git clone --recursive https://git.janouch.name/p/xK.git
|
||||
$ mkdir xK/build
|
||||
$ cd xK/build
|
||||
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DWANT_READLINE=ON -DWANT_LIBEDIT=OFF -DWANT_LUA=ON
|
||||
$ make
|
||||
|
||||
@@ -95,10 +77,10 @@ To install the application, you can do either the usual:
|
||||
|
||||
# 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
|
||||
# dpkg -i uirc3-*.deb
|
||||
$ cpack -G DEB # also supported: RPM, FreeBSD
|
||||
# dpkg -i xK-*.deb
|
||||
|
||||
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?
|
||||
------------------------------------------
|
||||
First of all, you must build it with Lua support. With the defaults, 'xC'
|
||||
doesn't look too fancy because I don't want to depend on Lua or 256-colour
|
||||
terminals. In addition to that, I appear to be one of the few people who use
|
||||
black on white terminals.
|
||||
With the defaults, 'xC' doesn't look too fancy because I don't want to have
|
||||
a hard dependency on either Lua for the bundled script that provides an easily
|
||||
adjustable enhanced prompt, or on 256-colour terminals. Moreover, it's nearly
|
||||
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"
|
||||
/set behaviour.plugin_autoload += "fancy-prompt.lua"
|
||||
/set behaviour.backlog_helper = "LESSSECURE=1 less -R +Gb1d -Ps'Backlog ?ltlines %lt-%lb?L/%L. .?e(END):?pB%pB\\%..'"
|
||||
Assuming that your build supports Lua plugins, and that you have a decent,
|
||||
properly set-up terminal emulator, it suffices to run:
|
||||
|
||||
/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.join = "\x1b[38;5;108m"
|
||||
/set attributes.part = "\x1b[38;5;138m"
|
||||
@@ -184,7 +170,7 @@ configurations accordingly, but I consider it rather messy and unnecessary.
|
||||
|
||||
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
|
||||
the project, feel free to join me at ircs://irc.janouch.name, channel #dev.
|
||||
|
||||
|
||||
10
common.c
10
common.c
@@ -22,11 +22,11 @@
|
||||
#define LIBERTY_WANT_PROTO_IRC
|
||||
|
||||
#ifdef WANT_SYSLOG_LOGGING
|
||||
#define print_fatal_data ((void *) LOG_ERR)
|
||||
#define print_error_data ((void *) LOG_ERR)
|
||||
#define print_warning_data ((void *) LOG_WARNING)
|
||||
#define print_status_data ((void *) LOG_INFO)
|
||||
#define print_debug_data ((void *) LOG_DEBUG)
|
||||
#define print_fatal_data ((void *) LOG_ERR)
|
||||
#define print_error_data ((void *) LOG_ERR)
|
||||
#define print_warning_data ((void *) LOG_WARNING)
|
||||
#define print_status_data ((void *) LOG_INFO)
|
||||
#define print_debug_data ((void *) LOG_DEBUG)
|
||||
#endif // WANT_SYSLOG_LOGGING
|
||||
|
||||
#include "liberty/liberty.c"
|
||||
|
||||
2
liberty
2
liberty
Submodule liberty updated: 1b9d89cab3...f545be725d
@@ -1,7 +1,7 @@
|
||||
--
|
||||
-- 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
|
||||
-- purpose with or without fee is hereby granted.
|
||||
@@ -40,7 +40,7 @@ xC.hook_prompt (function (hook)
|
||||
if buffer == current then
|
||||
current_n = i
|
||||
elseif buffer.new_messages_count ~= buffer.new_unimportant_count then
|
||||
if active ~= "" then active = active .. "," end
|
||||
active = active .. ","
|
||||
if buffer.highlighted then
|
||||
active = active .. "!"
|
||||
bg_color = "224"
|
||||
@@ -48,7 +48,6 @@ xC.hook_prompt (function (hook)
|
||||
active = active .. i
|
||||
end
|
||||
end
|
||||
if active ~= "" then active = "(" .. active .. ")" end
|
||||
local x = current_n .. ":" .. current.name
|
||||
if chan and chan.users_len ~= 0 then
|
||||
local params = ""
|
||||
@@ -56,25 +55,34 @@ xC.hook_prompt (function (hook)
|
||||
params = params .. " +" .. mode .. " " .. param
|
||||
end
|
||||
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 .. "}"
|
||||
end
|
||||
if current.hide_unimportant then x = x .. "<H>" end
|
||||
|
||||
local lines, cols = xC.get_screen_size ()
|
||||
x = x .. " " .. active .. string.rep (" ", cols)
|
||||
if current.hide_unimportant then
|
||||
x = x .. "<H>"
|
||||
end
|
||||
if active ~= "" then
|
||||
x = x .. " (" .. active:sub (2) .. ")"
|
||||
end
|
||||
|
||||
-- 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.
|
||||
--x = x:gsub("[\128-\255]", "?")
|
||||
|
||||
-- Cut off extra characters and apply formatting, including the hack.
|
||||
-- FIXME: this doesn't count with full-width or zero-width characters.
|
||||
-- We might want to export wcwidth() above term_from_utf8 somehow.
|
||||
local overflow = utf8.offset (x, cols - 1)
|
||||
if overflow then x = x:sub (1, overflow) end
|
||||
-- Align to the terminal's width and apply formatting, including the hack.
|
||||
local lines, cols = xC.get_screen_size ()
|
||||
local trailing, width = " ", xC.measure (x)
|
||||
while cols > 0 and width >= cols do
|
||||
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;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)
|
||||
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
|
||||
-- purpose with or without fee is hereby granted.
|
||||
@@ -19,6 +19,10 @@
|
||||
local banned = {
|
||||
gclid = 1,
|
||||
|
||||
-- Alas, Facebook no longer uses this parameter, see:
|
||||
-- https://news.ycombinator.com/item?id=32117489
|
||||
fbclid = 1,
|
||||
|
||||
utm_source = 1,
|
||||
utm_medium = 1,
|
||||
utm_term = 1,
|
||||
|
||||
12
xB.adoc
12
xB.adoc
@@ -1,8 +1,8 @@
|
||||
xB(1)
|
||||
=====
|
||||
:doctype: manpage
|
||||
:manmanual: uirc3 Manual
|
||||
:mansource: uirc3 {release-version}
|
||||
:manmanual: xK Manual
|
||||
:mansource: xK {release-version}
|
||||
|
||||
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
|
||||
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
|
||||
exists, the value will be empty. The response will be delivered in
|
||||
the following format:
|
||||
+
|
||||
```
|
||||
....
|
||||
XB :value
|
||||
```
|
||||
....
|
||||
+
|
||||
This is particularly useful for retrieving the *prefix* string.
|
||||
|
||||
@@ -100,5 +100,5 @@ _/usr/share/xB/plugins/_::
|
||||
|
||||
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.
|
||||
|
||||
19
xC.adoc
19
xC.adoc
@@ -1,8 +1,8 @@
|
||||
xC(1)
|
||||
=====
|
||||
:doctype: manpage
|
||||
:manmanual: uirc3 Manual
|
||||
:mansource: uirc3 {release-version}
|
||||
:manmanual: xK Manual
|
||||
:mansource: xK {release-version}
|
||||
|
||||
Name
|
||||
----
|
||||
@@ -25,9 +25,9 @@ Options
|
||||
other formatting marks to ANSI codes retrieved from the *terminfo*(5)
|
||||
database:
|
||||
+
|
||||
```
|
||||
....
|
||||
printf '\x02bold\x02\n' | xC -f
|
||||
```
|
||||
....
|
||||
+
|
||||
This feature may be used to preview server MOTD files.
|
||||
|
||||
@@ -62,10 +62,10 @@ their respective function names:
|
||||
*M-a*: *goto-activity*::
|
||||
Go to the first following buffer with unseen activity.
|
||||
*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.
|
||||
*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*::
|
||||
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
|
||||
@@ -105,7 +105,7 @@ _~/.config/xC/xC.conf_::
|
||||
as the */set* command, to make changes in it.
|
||||
|
||||
_~/.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/_::
|
||||
_/usr/local/share/xC/plugins/_::
|
||||
@@ -114,12 +114,11 @@ _/usr/share/xC/plugins/_::
|
||||
|
||||
Bugs
|
||||
----
|
||||
The editline (libedit) frontend is more of a proof of concept that mostly seems
|
||||
to work but exhibits bugs that are not our fault.
|
||||
The editline (libedit) frontend may exhibit some unexpected behaviour.
|
||||
|
||||
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.
|
||||
|
||||
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)
|
||||
=====
|
||||
:doctype: manpage
|
||||
:manmanual: uirc3 Manual
|
||||
:mansource: uirc3 {release-version}
|
||||
:manmanual: xK Manual
|
||||
:mansource: xK {release-version}
|
||||
|
||||
Name
|
||||
----
|
||||
@@ -49,5 +49,5 @@ _/etc/xdg/xD/xD.conf_::
|
||||
|
||||
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.
|
||||
|
||||
26
xD.c
26
xD.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* xD.c: an IRC daemon
|
||||
*
|
||||
* 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
|
||||
* purpose with or without fee is hereby granted.
|
||||
@@ -2932,6 +2932,29 @@ irc_handle_links (const struct irc_message *msg, struct client *c)
|
||||
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
|
||||
irc_handle_kill (const struct irc_message *msg, struct client *c)
|
||||
{
|
||||
@@ -2994,6 +3017,7 @@ irc_register_handlers (struct server_context *ctx)
|
||||
{ "ADMIN", true, irc_handle_admin, 0, 0 },
|
||||
{ "STATS", true, irc_handle_stats, 0, 0 },
|
||||
{ "LINKS", true, irc_handle_links, 0, 0 },
|
||||
{ "WALLOPS", true, irc_handle_wallops, 0, 0 },
|
||||
|
||||
{ "MODE", true, irc_handle_mode, 0, 0 },
|
||||
{ "PRIVMSG", true, irc_handle_privmsg, 0, 0 },
|
||||
|
||||
Reference in New Issue
Block a user