From 0c1881b9210794821c71380969c54e1034679f21 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bonicoli Date: Fri, 8 Oct 2021 18:02:54 +0200 Subject: [PATCH] Deprecate backlog_no_timestamp parameter backlog_timestamp must be used instead. The default behavior is unchanged and can explicitly used with: backlog_timestamp = "time"; The "none" value can be used with the backlog_timestamp parameter in order to use the same behavior that the "no" value of the deprecated parameter backlog_no_timestamp provided. The date can now be displayed (in addition to the time) while backlogging: backlog_timestamp = "datetime"; --- NEWS | 7 +++++++ samples/bip.conf | 7 +++++-- scripts/bipgenconfig | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b5be991..4eb6fa1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +2021-10-08 (0.9.0) +Visible changes: +- "backlog_no_timestamp" is deprecated, "backlog_timestamp" should be used + instead. The allowed values for this new parameter are: "none", "time", + "datetime". "time" is the default value and allow to keep the default + behavior. + 2009-01-24 (0.8.x) Visible changes: - One logfile per nick for queries, instead of the messy privates.x.log diff --git a/samples/bip.conf b/samples/bip.conf index 4ca444d..9963b67 100644 --- a/samples/bip.conf +++ b/samples/bip.conf @@ -181,8 +181,11 @@ # when no client attached anymore. #backlog_always = false; - # When true, disables time stamps if you find them ugly. - #backlog_no_timestamp = false; + # "none", "time" or "datetime": disables time stamps, use time or datetime. + #backlog_timestamp = "time"; + + # This parameter is deprecated, use backlog_timestamp instead. + #backlog_no_timestamp = false; # implies backlog_timestamp = "none"; # If blreset_on_talk talking on an irc network has the same effect of # issuing /bip blreset , meaning that stuffed logged diff --git a/scripts/bipgenconfig b/scripts/bipgenconfig index 72f28ba..ddaef70 100755 --- a/scripts/bipgenconfig +++ b/scripts/bipgenconfig @@ -124,10 +124,11 @@ my %optdesc = ( 'depends' => 'backlog', 'depval' => 'true', 'desc' => 'How much line do you want bip to play back upon client connect' . " {0 => replay everything since backlog's last reset} ?" }, - 'backlog_no_timestamp' => { 'type' => 'b', 'adv' => 0, + 'backlog_timestamp' => { 'type' => 's', 'adv' => 0, 'optional' => 1, - 'default' => 'false', 'depends' => 'backlog', 'depval' => 'true', - 'desc' => 'Disable timestamp in backlog ?' }, + 'default' => 'time', 'depends' => 'backlog', 'depval' => 'true', + 'desc' => 'Use time, datetime or disable prefix in backlog', + 'values' => ['none', 'time', 'datetime'] }, 'backlog_msg_only' => { 'type' => 'b', 'adv' => 0, 'optional' => 1, 'default' => 'false', 'depends' => 'backlog', 'depval' => 'true', @@ -248,7 +249,7 @@ my %optorder = ( undef, 'backlog' , 'backlog_lines' , - 'backlog_no_timestamp' , + 'backlog_timestamp' , 'backlog_msg_only' , 'backlog_always' , 'backlog_reset_on_talk' , @@ -313,6 +314,10 @@ sub askOpt { } else { $o = askval($e->{'desc'}, $sel, ($mayempty && ($opt ne 1 || $e->{'type'} eq 'i' ? 1 : undef)), 1); + if (defined $e->{'values'} && !grep(/^$o$/, @{$e->{'values'}})) { + print("The allowed values are '@{[ join '\', \'', @{$e->{'values'}} ]}'\n"); + next; + } } if ($o eq undef && $opt eq 0) { print("This value is mandatory, please enter a value\n"); @@ -462,6 +467,11 @@ sub loadConfig { $_->{'server'} = [ values %{$_->{'server'}} ]; } foreach my $tcu (@{$cf{'users'}}) { + my $backlog_no_timestamp = delete($tcu->{'backlog_no_timestamp'}); + if (defined $backlog_no_timestamp) { + grep(/^$backlog_no_timestamp$/, ('false', 'true')) || return "Invalid value for backlog_no_timestamp: '$backlog_no_timestamp'"; + $tcu->{'backlog_timestamp'} = $backlog_no_timestamp == 'false' ? 'time' : 'none'; + } $tcu->{'connection'} = [ values %{$tcu->{'connection'}} ]; foreach my $tcc (@{$tcu->{'connection'}}) { $tcc->{'channel'} = [ values %{$tcc->{'channel'}} ];