mirror of
https://codeberg.org/scip/note.git
synced 2025-12-17 04:31:02 +01:00
CHANGED: does no more use the external touch command to create a new
file, use perls open() instead.
CHANGED: excluded some of the help texts from the usage message and the
interactive help command to a manpage.
ADDED: new commandline flag "--encrypt" which one can use to encrypt
the mysql database password. This will be decrypted before
connecting to the db. There is also a new config file option
"encrypt_passwd" which indicates an encrypted db-password.
ADDED: another new config option "ShortCd", which can be set to "yes"
or 1 and if set, then a command like "cd 13" would jump
directly to the topic of the note with the number 13.
ADDED: now you can at any time cd back to the "root" of the
topic-structure using the command "cd /".
CHANGED: mysql.pm does now only do a table-lock on single write
accesses, no more on the whole session. This allows one to
access the same db twice or more.
FIXED: Changed README and Changelog for readability on 80 by 25
displays. And changed indentation of the note script itself.
ADDED: NOTEDB.pm - a generic module, which holds some methods, which
are used by binary.pm, mysql.pm and dbm.pm.
ADDED: NOTEDB.pm generate_search(), which allows one to
use AND, OR and various combinations of them using ( and ).
ADDED: a search does now return the 2nd line of a note if a matching
note's first line is a topic.
CHANGED: use "unshift" instead of push to add $libpath to @INC.
ADDED: a new feature, Caching of notes. supported by binary.pm and
mysql.pm. To turn it on, one need to set "Cache" in the config
to a true value.
This commit is contained in:
@@ -1,25 +1,15 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: dbm.pm,v 1.2 2000/06/25 19:51:11 scip Exp scip $
|
||||
# $Id: dbm.pm,v 1.1.1.1 2000/07/01 14:40:52 zarahg Exp $
|
||||
# Perl module for note
|
||||
# DBM database backend. see docu: perldoc NOTEDB::dbm
|
||||
#
|
||||
|
||||
use DB_File;
|
||||
#use Data::Dumper;
|
||||
use NOTEDB;
|
||||
use strict;
|
||||
package NOTEDB;
|
||||
|
||||
BEGIN {
|
||||
# make sure, it works, although encryption
|
||||
# not supported on this system!
|
||||
eval { require Crypt::CBC; };
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
else {
|
||||
$NOTEDB::crypt_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Globals:
|
||||
my ($dbm_dir, $notefile, $timefile, $version, $cipher, %note, %date);
|
||||
@@ -52,25 +42,6 @@ sub version {
|
||||
return $version;
|
||||
}
|
||||
|
||||
sub no_crypt {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
|
||||
sub use_crypt {
|
||||
my($this, $key, $method) = @_;
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$cipher = new Crypt::CBC($key, $method);
|
||||
};
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported == 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
print "warning: Crypt::CBC not supported by system!\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub get_single
|
||||
{
|
||||
@@ -104,13 +75,23 @@ sub get_nextnum
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res);
|
||||
my($num, $note, $date, %res, $match);
|
||||
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
}
|
||||
$match = 0;
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
if (ude($note{$num}) =~ /\Q$searchstring\E/i) {
|
||||
$_ = ude($note{$num});
|
||||
eval $regex;
|
||||
if ($match) {
|
||||
$res{$num}->{'note'} = ude($note{$num});
|
||||
$res{$num}->{'date'} = ude($date{$num});
|
||||
}
|
||||
$match = 0;
|
||||
}
|
||||
|
||||
return %res;
|
||||
@@ -196,6 +177,8 @@ sub ude
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
1; # keep this!
|
||||
|
||||
__END__
|
||||
|
||||
Reference in New Issue
Block a user