From e4e040929b247b2432190b84b6edca997dacd600 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 15 Dec 2015 01:52:44 +0100 Subject: [PATCH 1/7] option to clear the history --- src/fe-common/core/command-history.c | 45 ++++++++++++++++++++++++---- src/fe-common/core/command-history.h | 1 + src/fe-common/core/fe-windows.c | 7 ++++- src/fe-common/core/fe-windows.h | 1 + src/fe-common/core/window-commands.c | 21 +++++++++++-- 5 files changed, 66 insertions(+), 9 deletions(-) diff --git a/src/fe-common/core/command-history.c b/src/fe-common/core/command-history.c index f9c3884c..9f46ee99 100644 --- a/src/fe-common/core/command-history.c +++ b/src/fe-common/core/command-history.c @@ -33,6 +33,7 @@ static HISTORY_REC *global_history; static int window_history; static GSList *histories; +static HISTORY_REC *last_cleared_history; void command_history_add(HISTORY_REC *history, const char *text) { @@ -41,6 +42,13 @@ void command_history_add(HISTORY_REC *history, const char *text) g_return_if_fail(history != NULL); g_return_if_fail(text != NULL); + if (last_cleared_history == history) { + last_cleared_history = NULL; + return; /* ignore this history addition, we just + cleared it */ + } + last_cleared_history = NULL; + link = g_list_last(history->list); if (link != NULL && g_strcmp0(link->data, text) == 0) return; /* same as previous entry */ @@ -94,13 +102,13 @@ HISTORY_REC *command_history_current(WINDOW_REC *window) if (window == NULL) return global_history; - if (window_history) - return window->history; - rec = command_history_find_name(window->history_name); if (rec != NULL) return rec; + if (window_history) + return window->history; + return global_history; } @@ -178,6 +186,18 @@ HISTORY_REC *command_history_create(const char *name) return rec; } +void command_history_clear(HISTORY_REC *history) +{ + g_return_if_fail(history != NULL); + + command_history_clear_pos_func(history, NULL); + g_list_foreach(history->list, (GFunc) g_free, NULL); + g_list_free(history->list); + history->list = NULL; + history->lines = 0; + last_cleared_history = history; +} + void command_history_destroy(HISTORY_REC *history) { g_return_if_fail(history != NULL); @@ -186,9 +206,8 @@ void command_history_destroy(HISTORY_REC *history) g_return_if_fail(history->refcount == 0); histories = g_slist_remove(histories, history); - - g_list_foreach(history->list, (GFunc) g_free, NULL); - g_list_free(history->list); + command_history_clear(history); + last_cleared_history = NULL; /* was destroyed */ g_free_not_null(history->name); g_free(history); @@ -229,6 +248,18 @@ static void sig_window_destroyed(WINDOW_REC *window) g_free_not_null(window->history_name); } +static void sig_window_history_cleared(WINDOW_REC *window, const char *name) { + HISTORY_REC *history; + + if (name == NULL || *name == '\0') { + history = command_history_current(window); + } else { + history = command_history_find_name(name); + } + + command_history_clear(history); +} + static void sig_window_history_changed(WINDOW_REC *window, const char *oldname) { command_history_link(window->history_name); @@ -279,6 +310,7 @@ void command_history_init(void) signal_add("window created", (SIGNAL_FUNC) sig_window_created); signal_add("window destroyed", (SIGNAL_FUNC) sig_window_destroyed); signal_add("window history changed", (SIGNAL_FUNC) sig_window_history_changed); + signal_add_last("window history cleared", (SIGNAL_FUNC) sig_window_history_cleared); signal_add("setup changed", (SIGNAL_FUNC) read_settings); } @@ -287,6 +319,7 @@ void command_history_deinit(void) signal_remove("window created", (SIGNAL_FUNC) sig_window_created); signal_remove("window destroyed", (SIGNAL_FUNC) sig_window_destroyed); signal_remove("window history changed", (SIGNAL_FUNC) sig_window_history_changed); + signal_remove("window history cleared", (SIGNAL_FUNC) sig_window_history_cleared); signal_remove("setup changed", (SIGNAL_FUNC) read_settings); command_history_destroy(global_history); diff --git a/src/fe-common/core/command-history.h b/src/fe-common/core/command-history.h index 7b76246b..a572216b 100644 --- a/src/fe-common/core/command-history.h +++ b/src/fe-common/core/command-history.h @@ -28,6 +28,7 @@ const char *command_history_next(WINDOW_REC *window, const char *text); void command_history_clear_pos(WINDOW_REC *window); HISTORY_REC *command_history_create(const char *name); +void command_history_clear(HISTORY_REC *history); void command_history_destroy(HISTORY_REC *history); void command_history_link(const char *name); void command_history_unlink(const char *name); diff --git a/src/fe-common/core/fe-windows.c b/src/fe-common/core/fe-windows.c index 1049137f..46c1593b 100644 --- a/src/fe-common/core/fe-windows.c +++ b/src/fe-common/core/fe-windows.c @@ -229,11 +229,16 @@ void window_set_history(WINDOW_REC *window, const char *name) else window->history_name = g_strdup(name); - signal_emit("window history changed", 1, window, oldname); + signal_emit("window history changed", 2, window, oldname); g_free_not_null(oldname); } +void window_clear_history(WINDOW_REC *window, const char *name) +{ + signal_emit("window history cleared", 2, window, name); +} + void window_set_level(WINDOW_REC *window, int level) { g_return_if_fail(window != NULL); diff --git a/src/fe-common/core/fe-windows.h b/src/fe-common/core/fe-windows.h index 613f15f8..32d6cfcd 100644 --- a/src/fe-common/core/fe-windows.h +++ b/src/fe-common/core/fe-windows.h @@ -66,6 +66,7 @@ void window_change_server(WINDOW_REC *window, void *server); void window_set_refnum(WINDOW_REC *window, int refnum); void window_set_name(WINDOW_REC *window, const char *name); void window_set_history(WINDOW_REC *window, const char *name); +void window_clear_history(WINDOW_REC *window, const char *name); void window_set_level(WINDOW_REC *window, int level); void window_set_immortal(WINDOW_REC *window, int immortal); diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index c6ab68c0..e5005144 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -33,6 +33,7 @@ #include "window-items.h" #include "windows-layout.h" #include "printtext.h" +#include "command-history.h" static void window_print_binds(WINDOW_REC *win) { @@ -615,10 +616,25 @@ static void cmd_window_name(const char *data) } } -/* SYNTAX: WINDOW HISTORY */ +/* SYNTAX: WINDOW HISTORY [-clear] */ void cmd_window_history(const char *data) { - window_set_history(active_win, data); + GHashTable *optlist; + char *name; + void *free_arg; + + if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, + "window history", &optlist, &name)) + return; + + if (g_hash_table_lookup(optlist, "clear") != NULL) { + signal_continue(1, data); + window_clear_history(active_win, name); + } else { + window_set_history(active_win, name); + } + + cmd_params_free(free_arg); } /* we're moving the first window to last - move the first contiguous block @@ -883,6 +899,7 @@ void window_commands_init(void) command_set_options("window number", "sticky"); command_set_options("window server", "sticky unsticky"); command_set_options("window theme", "delete"); + command_set_options("window history", "clear"); } void window_commands_deinit(void) From 653fd590aff1d2f602ceef999b3df2719e0835b1 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sun, 13 Dec 2015 12:35:27 +0100 Subject: [PATCH 2/7] add new authors since 0.8.17 --- AUTHORS | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index d2cb58c0..dc8e578c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,6 +11,8 @@ Irssi staff (current maintainers) : Jilles Tjoelker (jilles) Alexander Færøy (ahf) Jase Thew (bazerka) + dequis (dx) + Ailin Nemui (Nei) Former developers: @@ -24,6 +26,7 @@ Large feature patches by: Heikki Orsila : DCC SEND queueing Mark Trumbull : DCC SERVER Francesco Fracassi : Passive DCC + Giuseppe (The Lemon Man) Other patches (grep for "patch" in ChangeLog) by: @@ -78,6 +81,20 @@ Other patches (grep for "patch" in ChangeLog) by: Ismael Luceno Thomas Karpiniec Svante Kvarnström - Ailin Nemui (Nei) Tom Feist (shabble) - Sebastian Thorarensen + Sebastian Thorarensen (Sebban) + Hans Nielsen + Jari Matilainen (vague) + Thibault B (isundil) + kyak + Vesa Pirila (Lohhari) + Haw Loeung + François Revol (mmuman) + blha303 + Guillaume Brogi (guiniol) + Adam- + Robert C Jensen + Paul Johnson + mauke + KindOne + Fabian Kurz From ab809d8d2a9cfb3f0d879c098f2d2d88ce60d3fe Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sun, 13 Dec 2015 14:14:41 +0100 Subject: [PATCH 3/7] list NEWS since 0.8.17 --- NEWS | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 511f495a..c37129bb 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,57 @@ -v0.8.18-head 2014-XX-YY The Irssi team - + Garbage Collection support has been removed. This will hardly have any +v0.8.18-rc1 2015-12-15 The Irssi team + * Modules will now require to define a + void MODULENAME ## _abicheck(int *version) + method to ensure that they are compiled against the correct Irssi + version. + * The signature of "message private" has been changed to + 5: server, message, nick, address, target + in order to support "self messages". Module authors should + implement this change if they are using this signal. + * Removing networks will now remove all attached servers and channels + (#45). + * /proxy command has been renamed to /irssiproxy + * sb_search has been moved to scripts.irssi.org + * WIN32 has been completely removed (it had not been working and is + lacking a maintainer.) + * Garbage Collection support has been removed. This will hardly have any effect for anyone given that it has been unsupported for several years. - + Disable SSLv3 due to the POODLE vulnerability. + + CAP SASL PLAIN login is now supported natively. + + Paste bracket markers can be requested from terminal with + /set paste_use_bracketed_mode on + + "Self messages" generated by some bouncers can now be received in the + proper window. + Try to split long lines on spaces to avoid words being splitted. Adds a new option: 'split_line_on_space' which defaults to on. + + Add setting hilight_nick_matches_everywhere (#56). + + The config parser is more robust and prints out better diagnostics on + incorrect config files. + + Ctrl+^ (FS#721) and Ctrl+J can now be bound. + + Command history can be cleared with /window history -clear + + /hilight -mask -line is now supported (FS#275). + + CHANTYPES are now supported. + + Improved reload speed of ignores. + + Add -date feature to /lastlog + + irssiproxy can be more easily enabled and disabled. + + Expando for hostname (FS#829). + + UNIX sockets can now also be specified in the config file. + + Disable SSLv3 due to the POODLE vulnerability. + + SSL ciphers can now be specified per server. + + Added SNI support for SSL. + - irssiproxy (BNC) module now uses correct line endings. + - Fix missing lines on large pastes (FS#905). + - Correctly preserve STATUSMSG prefixes (#291). + - Fix infinite recursion in key bindings (FS#817). + - Fix incomplete awaylog caused by buffering. + - Fix calculation of UTF-8 string length display in some cases. + - Fix some Perl warnings related to @ISA. + - EXEC windowitems now get proper references on the Perl side. + - Incremental help file improvements. + - ANSI attributes are now properly reset. + - Fixed regression where text would blink when terminal lacks color + support. + - Permit the usage of Freenode extban syntax in /ban (#150) + - Fixed regression in scriptassist on unload of scripts. + - Fixed regression in -actcolor %n v0.8.17 2014-10-11 The Irssi team + Document that SSL connections aren't properly handled during /UPGRADE. See Github PR #39. From 77143aee7dcff85f0b8656543c185a9e6a8131bb Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sun, 13 Dec 2015 14:17:33 +0100 Subject: [PATCH 4/7] remove mention of ./autogen.sh from releases INSTALL --- INSTALL | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index 234c6cf6..a83a6c76 100644 --- a/INSTALL +++ b/INSTALL @@ -11,8 +11,7 @@ To compile irssi you need: For most people, this should work just fine: - ./autogen.sh (for people who just cloned the repository) - ./configure (if this script already exists, skip ./autogen.sh) + ./configure make su make install (not _really_ required except for perl support) From d495111bde29796430e34832f15025f3708a7166 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 15 Dec 2015 10:59:23 +0100 Subject: [PATCH 5/7] tag as 0.8.18-beta1 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c0efd5e3..92ca04ae 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT(irssi, 0.8.18-head) +AC_INIT(irssi, 0.8.18-beta1) AC_CONFIG_SRCDIR([src]) AC_CONFIG_AUX_DIR(build-aux) AC_PREREQ(2.50) From f6d4b11079e0e8c2619989e3550a8ebd161eb1ae Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Tue, 22 Dec 2015 00:51:57 +0100 Subject: [PATCH 6/7] correct incorrect pre-release tag in NEWS --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c37129bb..6155f7bd 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -v0.8.18-rc1 2015-12-15 The Irssi team +v0.8.18-beta1 2015-12-15 The Irssi team * Modules will now require to define a void MODULENAME ## _abicheck(int *version) method to ensure that they are compiled against the correct Irssi From c6a85721a6e9d5a6f67f76f0062c750146c6805f Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Mon, 28 Dec 2015 00:07:42 +0100 Subject: [PATCH 7/7] keep track of address in text_dest for hilight purposes --- src/fe-common/core/fe-messages.c | 10 ++++------ src/fe-common/core/formats.c | 2 -- src/fe-common/core/formats.h | 5 ++--- src/fe-common/core/hilight-text.c | 7 ++++--- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/fe-common/core/fe-messages.c b/src/fe-common/core/fe-messages.c index e06a4571..3240fd10 100644 --- a/src/fe-common/core/fe-messages.c +++ b/src/fe-common/core/fe-messages.c @@ -175,7 +175,6 @@ static void sig_message_public(SERVER_REC *server, const char *msg, int for_me, print_channel, level; char *nickmode, *color, *freemsg = NULL; HILIGHT_REC *hilight; - int match_beg = 0, match_end = 0; /* NOTE: this may return NULL if some channel is just closed with /WINDOW CLOSE and server still sends the few last messages */ @@ -188,8 +187,8 @@ static void sig_message_public(SERVER_REC *server, const char *msg, nick_match_msg(chanrec, msg, server->nick) : nick_match_msg_everywhere(chanrec, msg, server->nick); hilight = for_me ? NULL : - hilight_match(server, target, nick, address, MSGLEVEL_PUBLIC, msg, &match_beg, &match_end); - color = (hilight == NULL || !hilight->nick) ? NULL : hilight_get_color(hilight); + hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg); + color = (hilight == NULL) ? NULL : hilight_get_color(hilight); print_channel = chanrec == NULL || !window_item_is_active((WI_ITEM_REC *) chanrec); @@ -217,9 +216,8 @@ static void sig_message_public(SERVER_REC *server, const char *msg, TEXT_DEST_REC dest; format_create_dest(&dest, server, target, level, NULL); - dest.hilight = hilight; - dest.match_beg = match_beg; - dest.match_end = match_end; + dest.address = address; + dest.nick = nick; if (color != NULL) { /* highlighted nick */ hilight_update_text_dest(&dest,hilight); diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index b95b3966..ccf48394 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -416,8 +416,6 @@ void format_create_dest_tag(TEXT_DEST_REC *dest, void *server, dest->server_tag = server != NULL ? SERVER(server)->tag : server_tag; dest->target = target; dest->level = level; - dest->match_beg = 0; - dest->match_end = 0; dest->window = window != NULL ? window : window_find_closest(server, target, level); } diff --git a/src/fe-common/core/formats.h b/src/fe-common/core/formats.h index a4b26852..8efd204c 100644 --- a/src/fe-common/core/formats.h +++ b/src/fe-common/core/formats.h @@ -52,11 +52,10 @@ typedef struct _TEXT_DEST_REC { SERVER_REC *server; const char *server_tag; /* if server is non-NULL, must be server->tag */ const char *target; + const char *nick; + const char *address; int level; - HILIGHT_REC *hilight; - int match_beg; - int match_end; int hilight_priority; char *hilight_color; int flags; diff --git a/src/fe-common/core/hilight-text.c b/src/fe-common/core/hilight-text.c index 2c0075ec..b746f636 100644 --- a/src/fe-common/core/hilight-text.c +++ b/src/fe-common/core/hilight-text.c @@ -325,9 +325,10 @@ static void sig_print_text(TEXT_DEST_REC *dest, const char *text, if (dest->level & MSGLEVEL_NOHILIGHT) return; - hilight_start = dest->match_beg; - hilight_end = dest->match_end; - hilight = dest->hilight; + hilight_start = hilight_end = 0; + hilight = hilight_match(dest->server, dest->target, dest->nick, + dest->address, dest->level, stripped, + &hilight_start, &hilight_end); if (hilight == NULL) return;