From 86a5e8085ae404f250ddf8eea5b2d7a1401044fd Mon Sep 17 00:00:00 2001 From: Emanuele Giaquinta Date: Tue, 21 Oct 2008 11:09:51 +0000 Subject: [PATCH] Remove scrollback_levelclear_levels setting and add a 'level' option to 'sb levelclear' to specify a comma separated list of levels. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4876 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- docs/help/in/scrollback.in | 2 +- src/fe-text/textbuffer-commands.c | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/help/in/scrollback.in b/docs/help/in/scrollback.in index f1e31848..4124cf6f 100644 --- a/docs/help/in/scrollback.in +++ b/docs/help/in/scrollback.in @@ -5,7 +5,7 @@ /SB LEVELCLEAR - Remove lines with level matching one of those - specified in scrollback_levelclear_levels. + specified in the comma-separated list . /SB CLEAR - Clear screen, free all memory used by texts in window. /SB HOME diff --git a/src/fe-text/textbuffer-commands.c b/src/fe-text/textbuffer-commands.c index a89c1f51..8dbc9632 100644 --- a/src/fe-text/textbuffer-commands.c +++ b/src/fe-text/textbuffer-commands.c @@ -129,7 +129,7 @@ static void cmd_scrollback_clear(const char *data) cmd_params_free(free_arg); } -/* SYNTAX: SCROLLBACK LEVELCLEAR [-all] [] */ +/* SYNTAX: SCROLLBACK LEVELCLEAR [-all] [-level ] [] */ static void cmd_scrollback_levelclear(const char *data) { WINDOW_REC *window; @@ -138,13 +138,16 @@ static void cmd_scrollback_levelclear(const char *data) void *free_arg; GSList *tmp; int level; + char *levelarg; g_return_if_fail(data != NULL); if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS, "scrollback levelclear", &optlist, &refnum)) return; - level = settings_get_level("scrollback_levelclear_levels"); + levelarg = g_hash_table_lookup(optlist, "level"); + level = (levelarg == NULL || *levelarg == '\0') ? 0 : + level2bits(replace_chars(levelarg, ',', ' ')); if (level == 0) { cmd_params_free(free_arg); return; @@ -374,7 +377,6 @@ static void sig_away_changed(SERVER_REC *server) void textbuffer_commands_init(void) { - settings_add_level("misc", "scrollback_levelclear_levels", "crap clientcrap"); command_bind("clear", NULL, (SIGNAL_FUNC) cmd_clear); command_bind("window scroll", NULL, (SIGNAL_FUNC) cmd_window_scroll); command_bind("scrollback", NULL, (SIGNAL_FUNC) cmd_scrollback); @@ -388,7 +390,7 @@ void textbuffer_commands_init(void) command_set_options("clear", "all"); command_set_options("scrollback clear", "all"); - command_set_options("scrollback levelclear", "all"); + command_set_options("scrollback levelclear", "all -level"); signal_add("away mode changed", (SIGNAL_FUNC) sig_away_changed); }