Compare commits

...

6 Commits

Author SHA1 Message Date
Přemysl Eric Janouch cd7133e173
README.adoc: minor documentation update 2020-10-31 16:06:13 +01:00
Přemysl Eric Janouch b4ed52015a
degesch: mark some issues for later resolution 2020-10-31 16:06:12 +01:00
Přemysl Eric Janouch 271689da99
fancy-prompt.lua: allow non-ASCII buffer names
It may theoretically bite us in the ass with non-UTF-8-compliant
IRC servers, and certainly with double-width characters.
2020-10-31 16:05:15 +01:00
Přemysl Eric Janouch 38c23d0d38
degesch: fix fancy-prompt.lua with libedit
Partly by unifying the interface for prompt hooks to match GNU Readline.
2020-10-31 16:04:30 +01:00
Přemysl Eric Janouch 439af8884c
degesch: make PageUp actually scroll a page up
Now that the input to the backlog helper is wrapped the same way
as what we display.  There's a slight issue always triggered by
fancy-prompt.lua where a multiline prompt/command line makes less(1)
go too high up but it's nothing too important.
2020-10-31 16:00:55 +01:00
Přemysl Eric Janouch 8ccf38ad76
Minor rebranding
There's nothing experimental about this project anymore.  It's stable.

Maybe we should add a photo of Hitler or something.
2020-10-31 13:42:56 +01:00
9 changed files with 40 additions and 21 deletions

View File

@ -216,7 +216,7 @@ foreach (page ${project_MAN_PAGES})
endforeach ()
# CPack
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Experimental IRC client, daemon and bot")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Unethical 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>")

View File

@ -3,8 +3,8 @@ uirc3
:compact-option:
The [line-through]#unethical# edgy IRC trinity. This project consists of an
experimental 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.
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.
All of them have these potentially interesting properties:
@ -103,6 +103,7 @@ Or you can try telling CMake to make a package for you. For Debian it is:
Usage
-----
'degesch' has in-program configuration. Just run it and read the instructions.
Consult its link:degesch.adoc[man page] for details about the interface.
For the rest you might want to generate a configuration file:
@ -124,7 +125,7 @@ as a `forking` type systemd user service.
Client Certificates
-------------------
'kike' uses SHA1 fingerprints of TLS client certificates to authenticate users.
'kike' uses SHA-1 fingerprints of TLS client certificates to authenticate users.
To get the fingerprint from a certificate file in the required form, use:
$ openssl x509 -in public.pem -outform DER | sha1sum
@ -152,9 +153,9 @@ Beware that you can easily break the program if you're not careful.
How do I make degesch look like the screenshot?
-----------------------------------------------
First of all, you must build it with Lua support. With the defaults, degesch
doesn't look very fancy because some things are rather hackish, and I also don't
want to depend on UTF-8 or 256color terminals in the code. In addition to that,
I appear to be one of the few people who use black on white terminals.
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.
/set behaviour.date_change_line = "%a %e %b %Y"
/set behaviour.plugin_autoload += "fancy-prompt.lua"

View File

@ -6,7 +6,7 @@ degesch(1)
Name
----
degesch - an experimental IRC client
degesch - terminal-based IRC client
Synopsis
--------

View File

@ -1,5 +1,5 @@
/*
* degesch.c: the experimental IRC client
* degesch.c: a terminal-based IRC client
*
* Copyright (c) 2015 - 2020, Přemysl Eric Janouch <p@janouch.name>
*
@ -2458,7 +2458,7 @@ static struct config_schema g_config_behaviour[] =
{ .name = "backlog_helper",
.comment = "Shell command to display a buffer's history",
.type = CONFIG_ITEM_STRING,
.default_ = "\"LESSSECURE=1 less -M -R +G\"" },
.default_ = "\"LESSSECURE=1 less -M -R +Gb\"" },
{ .name = "backlog_helper_strip_formatting",
.comment = "Strip formatting from backlog helper input",
.type = CONFIG_ITEM_BOOLEAN,
@ -4497,6 +4497,7 @@ irc_get_or_make_user_buffer (struct server *s, const char *nickname)
// Open a new buffer for the user
buffer = buffer_new (s->ctx->input);
buffer->type = BUFFER_PM;
// FIXME: this probably needs to be converted to UTF-8
buffer->name = xstrdup_printf ("%s.%s", s->name, nickname);
buffer->server = s;
buffer->user = user;
@ -6028,6 +6029,14 @@ make_prompt (struct app_context *ctx, struct str *output)
static void
input_maybe_set_prompt (struct input *self, char *new_prompt)
{
// Fix libedit's expectations to see a non-control character following
// the end mark (see prompt.c and literal.c) by cleaning this up
for (char *p = new_prompt; *p; )
if (p[0] == INPUT_END_IGNORE && p[1] == INPUT_START_IGNORE)
memmove (p, p + 2, strlen (p + 2) + 1);
else
p++;
// Redisplay can be an expensive operation
const char *prompt = CALL (self, get_prompt);
if (prompt && !strcmp (new_prompt, prompt))
@ -6055,6 +6064,12 @@ on_refresh_prompt (struct app_context *ctx)
prompt.str[--prompt.len] = 0;
attributed_suffix = " ";
}
// Also enable a uniform interface for prompt hooks by assuming it uses
// GNU Readline escapes: turn this into libedit's almost-flip-flop
for (size_t i = 0; i < prompt.len; i++)
if (prompt.str[i] == '\x01' || prompt.str[i] == '\x02')
prompt.str[i] = INPUT_START_IGNORE /* == INPUT_END_IGNORE */;
#endif // HAVE_EDITLINE
char *localized = iconv_xstrdup (ctx->term_from_utf8, prompt.str, -1, NULL);
@ -6630,6 +6645,7 @@ irc_handle_join (struct server *s, const struct irc_message *msg)
buffer = buffer_new (s->ctx->input);
buffer->type = BUFFER_CHANNEL;
// FIXME: this probably needs to be converted to UTF-8
buffer->name = xstrdup_printf ("%s.%s", s->name, channel_name);
buffer->server = s;
buffer->channel = channel =
@ -6637,6 +6653,7 @@ irc_handle_join (struct server *s, const struct irc_message *msg)
str_map_set (&s->irc_buffer_map, channel->name, buffer);
buffer_add (s->ctx, buffer);
// XXX: this is annoying, consider only doing it a while after /join
buffer_activate (s->ctx, buffer);
}
@ -14064,7 +14081,7 @@ main (int argc, char *argv[])
};
struct opt_handler oh =
opt_handler_make (argc, argv, opts, NULL, "Experimental IRC client.");
opt_handler_make (argc, argv, opts, NULL, "Terminal-based IRC client.");
bool format_mode = false;
int c;

View File

@ -6,7 +6,7 @@ kike(1)
Name
----
kike - an experimental IRC daemon
kike - IRC daemon
Synopsis
--------

4
kike.c
View File

@ -1,5 +1,5 @@
/*
* kike.c: the experimental IRC daemon
* kike.c: an IRC daemon
*
* Copyright (c) 2014 - 2020, Přemysl Eric Janouch <p@janouch.name>
*
@ -3991,7 +3991,7 @@ main (int argc, char *argv[])
};
struct opt_handler oh =
opt_handler_make (argc, argv, opts, NULL, "Experimental IRC daemon.");
opt_handler_make (argc, argv, opts, NULL, "IRC daemon.");
int c;
while ((c = opt_handler_get (&oh)) != -1)

View File

@ -64,12 +64,13 @@ degesch.hook_prompt (function (hook)
local lines, cols = degesch.get_screen_size ()
x = x .. " " .. active .. string.rep (" ", cols)
-- Readline seems to be broken and completely corrupts the prompt
-- (tested on 7.0.003 Archlinux, 7.0-5 Debian buster)
x = x:gsub("[\128-\255]", "?")
-- 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.
-- Note that this doesn't count with full-width or zero-width characters.
-- 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
x = "\x01\x1b[0;4;1;38;5;16m\x1b[48;5;" .. bg_color .. "m\x02" ..

View File

@ -6,7 +6,7 @@ zyklonb(1)
Name
----
zyklonb - an experimental IRC bot
zyklonb - modular IRC bot
Synopsis
--------

View File

@ -1,5 +1,5 @@
/*
* zyklonb.c: the experimental IRC bot
* zyklonb.c: a modular IRC bot
*
* Copyright (c) 2014 - 2020, Přemysl Eric Janouch <p@janouch.name>
*
@ -1983,7 +1983,7 @@ main (int argc, char *argv[])
};
struct opt_handler oh =
opt_handler_make (argc, argv, opts, NULL, "Experimental IRC bot.");
opt_handler_make (argc, argv, opts, NULL, "Modular IRC bot.");
int c;
while ((c = opt_handler_get (&oh)) != -1)