mirror of
https://codeberg.org/scip/note.git
synced 2025-12-16 20:21:04 +01:00
revert filechanged() fix
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
1.3.19:
|
||||||
|
revert fix in NOTEDB::pwsafe3::filechanged(), use > again.
|
||||||
|
================================================================================
|
||||||
1.3.18:
|
1.3.18:
|
||||||
fixed unit tests and added more (lots of them)
|
fixed unit tests and added more (lots of them)
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ package NOTEDB;
|
|||||||
use Exporter ();
|
use Exporter ();
|
||||||
use vars qw(@ISA @EXPORT $crypt_supported);
|
use vars qw(@ISA @EXPORT $crypt_supported);
|
||||||
|
|
||||||
$NOTEDB::VERSION = "1.39";
|
$NOTEDB::VERSION = "1.40";
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
# make sure, it works, otherwise encryption
|
# make sure, it works, otherwise encryption
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
package NOTEDB::pwsafe3;
|
package NOTEDB::pwsafe3;
|
||||||
|
|
||||||
$NOTEDB::pwsafe3::VERSION = "1.04";
|
$NOTEDB::pwsafe3::VERSION = "1.05";
|
||||||
use lib qw(/home/scip/D/github/Crypt--PWSafe3/blib/lib);
|
use lib qw(/home/scip/D/github/Crypt--PWSafe3/blib/lib);
|
||||||
use strict;
|
use strict;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
@@ -35,6 +35,7 @@ sub new {
|
|||||||
$self->{unread} = 1;
|
$self->{unread} = 1;
|
||||||
$self->{data} = {};
|
$self->{data} = {};
|
||||||
$self->{LOCKFILE} = $param{dbname} . "~LOCK";
|
$self->{LOCKFILE} = $param{dbname} . "~LOCK";
|
||||||
|
$self->{keepkey} = 0;
|
||||||
|
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
@@ -63,7 +64,7 @@ sub filechanged {
|
|||||||
my ($this) = @_;
|
my ($this) = @_;
|
||||||
my $current = $this->get_stat();
|
my $current = $this->get_stat();
|
||||||
|
|
||||||
if ($current >= $this->{mtime}) {
|
if ($current > $this->{mtime}) {
|
||||||
$this->{mtime} = $current;
|
$this->{mtime} = $current;
|
||||||
return $current;
|
return $current;
|
||||||
}
|
}
|
||||||
@@ -93,7 +94,6 @@ sub get_single {
|
|||||||
sub get_all {
|
sub get_all {
|
||||||
my $this = shift;
|
my $this = shift;
|
||||||
my($num, $note, $date, %res);
|
my($num, $note, $date, %res);
|
||||||
|
|
||||||
if ($this->unchanged) {
|
if ($this->unchanged) {
|
||||||
return %{$this->{cache}};
|
return %{$this->{cache}};
|
||||||
}
|
}
|
||||||
@@ -496,12 +496,13 @@ sub _getpass {
|
|||||||
# to fetch data from the actual file OR want to write
|
# to fetch data from the actual file OR want to write
|
||||||
# to it. To minimize reads, we use caching by default.
|
# to it. To minimize reads, we use caching by default.
|
||||||
my($this) = @_;
|
my($this) = @_;
|
||||||
|
|
||||||
if ($this->{key}) {
|
if ($this->{key}) {
|
||||||
return $this->{key};
|
return $this->{key};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
my $key;
|
my $key;
|
||||||
print "password: ";
|
print "pwsafe password: ";
|
||||||
eval {
|
eval {
|
||||||
local($|) = 1;
|
local($|) = 1;
|
||||||
local(*TTY);
|
local(*TTY);
|
||||||
|
|||||||
4
bin/note
4
bin/note
@@ -144,7 +144,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc");
|
|||||||
$USER = getlogin || getpwuid($<);
|
$USER = getlogin || getpwuid($<);
|
||||||
chomp $USER;
|
chomp $USER;
|
||||||
$TOPIC = 1;
|
$TOPIC = 1;
|
||||||
$version = "1.3.18";
|
$version = "1.3.19";
|
||||||
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
||||||
$maxlen = "auto";
|
$maxlen = "auto";
|
||||||
$timelen = 22;
|
$timelen = 22;
|
||||||
@@ -409,7 +409,7 @@ if ($conf{useencryption} && $NOTEDB::crypt_supported == 1) {
|
|||||||
$conf{cryptmethod} = "Crypt::IDEA";
|
$conf{cryptmethod} = "Crypt::IDEA";
|
||||||
}
|
}
|
||||||
if (!exists $ENV{'NOTE_PASSWD'}) {
|
if (!exists $ENV{'NOTE_PASSWD'}) {
|
||||||
print "password: ";
|
print "note password: ";
|
||||||
eval {
|
eval {
|
||||||
local($|) = 1;
|
local($|) = 1;
|
||||||
local(*TTY);
|
local(*TTY);
|
||||||
|
|||||||
250
rc
Normal file
250
rc
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
# note 1.3.1 -*- sh -*-
|
||||||
|
#
|
||||||
|
# This is a sample config for the note script
|
||||||
|
# There are useful defaults set in note itself.
|
||||||
|
#
|
||||||
|
# Copy it to your $HOME as .noterc
|
||||||
|
#
|
||||||
|
# note is Copyright (c) 1999-2004 Thomas Linden.
|
||||||
|
# You can contact me per email: <tom@daemon.de>
|
||||||
|
#
|
||||||
|
# Comments start with #, empty lines will be ignored.
|
||||||
|
#
|
||||||
|
# To turn on an option, set it to: 1, on or yes
|
||||||
|
# To turn off an option, set it to: 0, off or no
|
||||||
|
#
|
||||||
|
# An option consists of an atribute-value pair separated
|
||||||
|
# by minimum one space (more spaces and/or tabs are allowed)
|
||||||
|
# and an optional equal sign in between.
|
||||||
|
#
|
||||||
|
# Variable names are case in-sensitive.
|
||||||
|
#
|
||||||
|
# Refer to the manpage to learn more about the config
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# you need to decide which database backend you want
|
||||||
|
# to use. Please refer to the corresponding documentation
|
||||||
|
# for closer information about the certain backend!
|
||||||
|
# Currently supported types: "binary", "dbm", "mysql",
|
||||||
|
# "general" or "text".
|
||||||
|
# You must also edit/uncomment one section below for the
|
||||||
|
# backend you want to use!
|
||||||
|
dbdriver = general
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# BINARY backend (the default)
|
||||||
|
binary::dbname = ~/.notedb # filename
|
||||||
|
binary::MaxNoteByte = 4096 # max bytes per note entry
|
||||||
|
binary::MaxTimeByte = 64 # max bytes for the date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# MYSQL backend
|
||||||
|
mysql::dbhost = localhost # hostname
|
||||||
|
mysql::dbport = 3306 # tcp port
|
||||||
|
mysql::dbuser = you # db login
|
||||||
|
mysql::dbpasswd = # db password
|
||||||
|
mysql::dbname = # database name (default: note)
|
||||||
|
mysql::encrypt_passwd = 0 # mysql::dbpasswd is
|
||||||
|
# encrypted (note --encrypt)
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# DBM backend
|
||||||
|
dbm::directory = ~/.note.d # directory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# GENERAL backend
|
||||||
|
general::dbname = t/general.out # filename
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# TEXT backend
|
||||||
|
text::dbname = ~/.notedb # filename
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can use encryption with note, that means notes and
|
||||||
|
# timestamps will be stored encrypted. This is supported
|
||||||
|
# by every db-backend.
|
||||||
|
UseEncryption = no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Specify the encryption protocol. The appropriate perl
|
||||||
|
# module needs to be installed. Possible velues are
|
||||||
|
# IDEA, DES or Blowfish, the default is IDEA.
|
||||||
|
CryptMethod = Rijndael
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can run note always in interactive mode by simply
|
||||||
|
# typing "note". The default is: YES.
|
||||||
|
AlwaysInteractive = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# In interactive mode, note issues a list command if you
|
||||||
|
# simply hit enter. By turning this on, it will issue a
|
||||||
|
# longlist command instead if you hit just enter.
|
||||||
|
# The default is: NO
|
||||||
|
DefaultLong = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can use an external editor everytime from note instead
|
||||||
|
# of STDIN for creating new notes. The default is: NO
|
||||||
|
AlwaysEditor = yes
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# By default, note looks in the environment for a variable
|
||||||
|
# $EDITOR or, if this is not the case, for $VISUAL and as
|
||||||
|
# fallback it uses 'vi'.
|
||||||
|
# You can override this by setting this variable here.
|
||||||
|
PreferredEditor = vi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# If you don't prefer that note updates the timestamp of a
|
||||||
|
# note after editing, turn this on. It will
|
||||||
|
# keep the original timestamp if this option is set.
|
||||||
|
# The default is: NO
|
||||||
|
KeepTimeStamp = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can specify your own topic separator here.
|
||||||
|
# The default topic separator is a normal slash: "/"
|
||||||
|
TopicSeparator = /
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The maximum width for displaying a note, in CHARS.
|
||||||
|
# Depends on your screen-size. You can set it to
|
||||||
|
# "auto", if you wish that note should determine the
|
||||||
|
# available size automatically.
|
||||||
|
MaxLen = auto
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Turn this off if you dont want note to automatically
|
||||||
|
# clear the screen after displaying something and after
|
||||||
|
# exit. The default is: YES
|
||||||
|
AutoClear = YES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# note can use colors for output, turn this of, if
|
||||||
|
# you don't like it, or if your terminal does
|
||||||
|
# not support it. The default is: YES
|
||||||
|
UseColors = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Color-definitions of the various items. Will only
|
||||||
|
# take effect, if "UseColors" is turned on!
|
||||||
|
#
|
||||||
|
# The following colors are available:
|
||||||
|
# black, red, green, yellow, blue, magenta, cyan and white.
|
||||||
|
#
|
||||||
|
# For bold color write it uppercase (BLACK will be bold black).
|
||||||
|
# For underlined color append an underscore (blue_ will be underlined blue).
|
||||||
|
# For inverted color append an "I" (greenI will be inverted green).
|
||||||
|
BorderColor BLACK
|
||||||
|
NumberColor blue
|
||||||
|
NoteColor green
|
||||||
|
TimeColor black
|
||||||
|
TopicColor BLACK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Additional to colors, you can also do a little bit of formatting your
|
||||||
|
# notes (bold, underlined, italic) text. The default is: YES.
|
||||||
|
FormatText = YES
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You might specify your own directory for temporary files.
|
||||||
|
# note needs to create some temp files during editing of notes.
|
||||||
|
# You could protect this directory using the command: chmod 700 directory.
|
||||||
|
# The default is: /tmp
|
||||||
|
TempDirectory = ~/tmp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can jump to a topic by typing "cd 13" in interactive mode.
|
||||||
|
# The deault is: NO
|
||||||
|
ShortCd = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# note can use a cached copy of the note database for list/tree/search
|
||||||
|
# this is currently only supported by the binary and the mysql backends,
|
||||||
|
# the general and text backends have an internal cache.
|
||||||
|
# The default is: NO
|
||||||
|
Cache = no
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can define your very own time format for time stamps
|
||||||
|
# YY - the last 2 digits of a year
|
||||||
|
# YYYY - year
|
||||||
|
# MM - month
|
||||||
|
# DD - day
|
||||||
|
# hh - hours
|
||||||
|
# mm - minutes
|
||||||
|
# ss - seconds
|
||||||
|
# This is the default: (18.10.2000 21:32:08)
|
||||||
|
TimeFormat = DD.MM.YYYY hh:mm:ss
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# You can make note readonly which is useful for database copies
|
||||||
|
# The default is: NO
|
||||||
|
ReadOnly = NO
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Note separates titles and topics using horizontal lines when
|
||||||
|
# listing them. You can turn off this behavior by setting
|
||||||
|
# PrintLines to NO.
|
||||||
|
# The default is: YES
|
||||||
|
PrintLines = NO
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# That's all about it for now.
|
||||||
|
# If you still have any questiosn, please feel free to contact
|
||||||
|
# me by email: Thomas Linden <tom@daemon.de>
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
Less = YES
|
||||||
7
t/run.t
7
t/run.t
@@ -120,13 +120,16 @@ sub wrdb3 {
|
|||||||
$n = $db->get_nextnum;
|
$n = $db->get_nextnum;
|
||||||
$db->set_new($n, $ex3->{2}->{note}, $ex3->{2}->{date});
|
$db->set_new($n, $ex3->{2}->{note}, $ex3->{2}->{date});
|
||||||
$ex3->{$n} = delete $ex3->{2};
|
$ex3->{$n} = delete $ex3->{2};
|
||||||
|
|
||||||
|
# hack db file mtime, since we're too fast here
|
||||||
|
$db->{mtime} = 0;
|
||||||
|
|
||||||
my %all = $db->get_all();
|
my %all = $db->get_all();
|
||||||
# hack %all to that it passes the next test
|
# hack %all to that it passes the next test
|
||||||
foreach my $n (keys %all) {
|
foreach my $n (keys %all) {
|
||||||
chomp $all{$n}->{note};
|
chomp $all{$n}->{note};
|
||||||
}
|
}
|
||||||
|
|
||||||
is_deeply($ex3, \%all, "$name: Get all notes hash") or diag(Dumper(\%all));
|
is_deeply($ex3, \%all, "$name: Get all notes hash") or diag(Dumper(\%all));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user