Compare commits

..

No commits in common. "49d9980662b123824dea607db0e764220ba5f7a5" and "ef0cbe9a596a8c251d451a1b54858c9a1e988bf9" have entirely different histories.

4 changed files with 14 additions and 23 deletions

View File

@ -196,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/share or /usr/share
# XXX: our defaults for XDG_DATA_DIRS expect /usr/local/shore or /usr/share
install (DIRECTORY plugins/xB/
DESTINATION ${CMAKE_INSTALL_DATADIR}/xB/plugins USE_SOURCE_PERMISSIONS)
install (DIRECTORY plugins/xC/

2
NEWS
View File

@ -1,7 +1,5 @@
Unreleased
* xC: improved backlog helper integration capabilities
* xC: made it show WALLOPS messages, as PRIVMSG for the server buffer
* xD: implemented WALLOPS, choosing to make it target even non-operators

@ -1 +1 @@
Subproject commit f545be725df9195a5b5897ad95a0220acf10f148
Subproject commit 1b9d89cab3bb1df73c58ccd8528eafd21a8c6e40

31
xC.c
View File

@ -2480,11 +2480,9 @@ static struct config_schema g_config_behaviour[] =
.default_ = "1000",
.on_change = on_config_backlog_limit_change },
{ .name = "backlog_helper",
.comment = "Shell command to page buffer history (args: name [path])",
.comment = "Shell command to display a buffer's history",
.type = CONFIG_ITEM_STRING,
.default_ = "`name=$(echo \"$1\" | sed 's/[%?:.]/\\\\&/g'); "
"prompt='?f%F:'$name'. ?db- page %db?L of %D. .(?eEND:?PB%PB\\%..)'; "
"LESSSECURE=1 less +Gb -Ps\"$prompt\" \"${2:--R}\"`" },
.default_ = "\"LESSSECURE=1 less -M -R +Gb\"" },
{ .name = "backlog_helper_strip_formatting",
.comment = "Strip formatting from backlog helper input",
.type = CONFIG_ITEM_BOOLEAN,
@ -13368,19 +13366,15 @@ input_editor_cleanup (struct app_context *ctx)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static void
launch_backlog_helper (struct app_context *ctx, int backlog_fd,
const char *name, const char *path)
launch_backlog_helper (struct app_context *ctx, int backlog_fd)
{
hard_assert (!ctx->running_backlog_helper);
switch (spawn_helper_child (ctx))
{
case 0:
dup2 (backlog_fd, STDIN_FILENO);
char *localized_name =
iconv_xstrdup (ctx->term_from_utf8, (char *) name, -1, NULL);
execl ("/bin/sh", "/bin/sh", "-c",
get_config_string (ctx->config.root, "behaviour.backlog_helper"),
PROGRAM_NAME, localized_name, path, NULL);
execl ("/bin/sh", "/bin/sh", "-c", get_config_string
(ctx->config.root, "behaviour.backlog_helper"), NULL);
print_error ("%s: %s",
"Failed to launch backlog helper", strerror (errno));
_exit (EXIT_FAILURE);
@ -13425,7 +13419,7 @@ display_backlog (struct app_context *ctx, int flush_opts)
rewind (backlog);
set_cloexec (fileno (backlog));
launch_backlog_helper (ctx, fileno (backlog), buffer->name, NULL);
launch_backlog_helper (ctx, fileno (backlog));
fclose (backlog);
return true;
}
@ -13453,25 +13447,24 @@ on_display_full_log (int count, int key, void *user_data)
(void) key;
struct app_context *ctx = user_data;
struct buffer *buffer = ctx->current_buffer;
char *path = buffer_get_log_path (buffer);
char *path = buffer_get_log_path (ctx->current_buffer);
FILE *full_log = fopen (path, "rb");
free (path);
if (!full_log)
{
log_global_error (ctx, "Failed to open log file for #s: #l",
ctx->current_buffer->name, strerror (errno));
free (path);
return false;
}
if (buffer->log_file)
if (ctx->current_buffer->log_file)
// The regular flush will log any error eventually
(void) fflush (buffer->log_file);
(void) fflush (ctx->current_buffer->log_file);
set_cloexec (fileno (full_log));
launch_backlog_helper (ctx, fileno (full_log), buffer->name, path);
launch_backlog_helper (ctx, fileno (full_log));
fclose (full_log);
free (path);
return true;
}