added 'motd' and changed prompt to show readonly status, if any

This commit is contained in:
TLINDEN
2012-11-14 11:04:35 +01:00
parent fcb9cb4e7d
commit afe46a308a
6 changed files with 43 additions and 10 deletions

View File

@@ -133,7 +133,8 @@ my (
'topicseparator' => '/',
'printlines' => 0,
'cache' => 0,
'preferrededitor' => ''
'preferrededitor' => '',
'motd' => ''
);
# these are not customizable at runtime!
@@ -143,7 +144,7 @@ $CONF = File::Spec->catfile($ENV{HOME}, ".noterc");
$USER = getlogin || getpwuid($<);
chomp $USER;
$TOPIC = 1;
$version = "1.3.12";
$version = "1.3.13";
$CurDepth = 1; # the current depth inside the topic "directory" structure...
$maxlen = "auto";
$timelen = 22;
@@ -534,7 +535,15 @@ sub encrypt_passwd {
print "Encrypted password:\n$crypt_string\n";
}
}
############################### MOTD ##################################
sub motd {
my($N,$match,$note,$date,$num);
# display a configured motd note, if any
($note, $date) = $db->get_single($conf{motd});
if ($note) {
print "\n\n$note\n\n";
}
}
############################### DISPLAY ##################################
sub display {
@@ -1044,6 +1053,13 @@ sub interactive {
# Initially do a list command!
&determine_width;
$ListType = ($conf{defaultlong}) ? "LONG" : "";
# show initial note entry
if ($conf{motd}) {
&motd;
}
# show initial listing
&list;
my ($term, $prompt, $attribs);
@@ -1058,12 +1074,18 @@ sub interactive {
$ListType = ($conf{defaultlong}) ? "LONG" : "";
undef $SetTitle;
if ($CurDepth > 2) {
print C $menu . $TOPICC . "../" . $CurTopic . $_TOPICC . ">";
print C $menu . $TOPICC . "../" . $CurTopic . $_TOPICC;
}
else {
print C $menu . $TOPICC . $CurTopic . $_TOPICC . ">";
print C $menu . $TOPICC . $CurTopic . $_TOPICC;
}
if ($conf{readonly}) {
print " [readonly] ";
}
print ">";
# endless until user press "Q" or "q"!
if ($term) {
if (defined ($char = $term->readline(" "))) {