Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit bc1d0100 authored by rswindell's avatar rswindell

Display age of messages in message headers (e.g. "2 days ago").

Display local time and time zone in system info list.
Display local time zone in Ctrl-T output.
parent 6ae097bb
......@@ -7,7 +7,7 @@
"\r\n\1w \1bFrom\1n\1b: \1h\1c%.70s" 006 MsgFrom
" #%s" 007 MsgFromExt
" (%.40s)" 008 MsgFromNet
"\r\n\1w \1bDate\1n\1b: \1h\1c%.24s %s\r\n"\ 009 MsgDate
"\r\n\1w \1bDate\1n\1b: \1h\1c%.24s %s (%s)\r\n"\ 009 MsgDate
"\1w\1c\1n\1h\1k"\
"\1n\1c\1b\1n"
"\1_\r\n\1b\1hE-mail (User name or number): \1w" 010 Email
......@@ -126,7 +126,7 @@
"\1bQWK ID : \1c%s\r\n" 101 SiSysID
"\1bFidoNet Address : \1c%s\r\n" 102 SiSysFaddr
"\1bPostLink Site : \1c%s %u\r\n" 103 SiSysPsite
"\1bLocation : \1c%s\r\n" 104 SiSysLocation
"\1bLocation : \1c%s\r\n" 104 SiSysLocation
"\1bOperator : \1c%s\r\n" 105 SiSysop
"\1bNodes : \1c%u\r\n" 106 SiSysNodes
"\1bNode #\1c%-3d \1b: \1c%s\r\n" 107 SiNodeNumberName
......@@ -668,10 +668,10 @@
"\r\nTime's up.\r\n" 549 TimesUp
"\1_\1w\1hNode %2d: \1g%s\1n\1g logged off\r\n\1n" 550 NodeLoggedOff
"\1_\1w\1hNode %2d: \1g%s\1n\1g logged on %s\r\n\1n" 551 NodeLoggedOnAtNbps
"\1n\r\n\r\nLogon : %s" 552 TiLogon
"\r\nNow : %s" 553 TiNow
"\r\nTime on : %s" 554 TiTimeon
"\r\nTime left : %s\r\n\r\n" 555 TiTimeLeft
"\1n\1b\1h\r\n\r\nLogon Time : \1c%s\r\n" 552 TiLogon
"\1bLocal Time : \1c%s %s\r\n" 553 TiNow
"\1bTime Used : \1c%s\r\n" 554 TiTimeon
"\1bTime Remaining : \1c%s\r\n\r\n" 555 TiTimeLeft
"\r\n\r\n\1nCtrl-Key Commands (from most anywhere)\r\n"\ 556 ControlKeyMenu
"\r\nCtrl-K This Menu"\
"\r\nCtrl-C Abort Current Process"\
......@@ -737,19 +737,19 @@
"\r\n\1_\1w\1hPosting anonymously...\r\n" 601 PostingAnonymously
"\r\nCan't delete posts on this sub-board.\r\n" 602 CantDeletePosts
"\r\n\1h\1gSub-board Information:\r\n\r\n\1n" 603 SubInfoHdr
"Long Name : %s\r\n" 604 SubInfoLongName
"Short Name : %s\r\n" 605 SubInfoShortName
"QWK Name : %s\r\n" 606 SubInfoQWKName
"Max Msgs : %u\r\n" 607 SubInfoMaxMsgs
"\1n\1h\1bDescription : \1c%s\r\n" 604 SubInfoLongName
"\1n\1h\1bName : \1c%s\r\n" 605 SubInfoShortName
"\1n\1h\1bQWK Name : \1c%s\r\n" 606 SubInfoQWKName
"\1n\1h\1bMessages Retained : \1c%u\r\n" 607 SubInfoMaxMsgs
"\r\nQWK packet network using the tagline:\r\n%s\1n\r\n" 608 SubInfoTagLine
"\r\n\1nFidoNet EchoMail Conference:\r\n%s (%s)\r\n" 609 SubInfoFidoNet
"View sub-board information file" 610 SubInfoViewFileQ
"\r\n\1g\1hDirectory Information:\r\n\r\n\1n" 611 DirInfoHdr
"Long Name : %s\r\n" 612 DirInfoLongName
"Short Name : %s\r\n" 613 DirInfoShortName
"Allowed File Extensions : %s\r\n" 614 DirInfoAllowedExts
"Maximum Files : %u\r\n" 615 DirInfoMaxFiles
"View directory information file" 616 DirInfoViewFileQ
"\1n\1h\1bLong Name : \1c%s\r\n" 612 DirInfoLongName
"\1n\1h\1bShort Name : \1c%s\r\n" 613 DirInfoShortName
"\1n\1h\1bAllowed File Extensions : \1c%s\r\n" 614 DirInfoAllowedExts
"\1n\1h\1bMaximum Files : \1c%u\r\n" 615 DirInfoMaxFiles
"\1n\1h\1bView directory information file" 616 DirInfoViewFileQ
"\1n\r\nNo NetMail allowed.\r\n" 617 NoNetMailAllowed
"\r\nIt will cost you %u credits to send NetMail. "\ 618 NetMailCostContinueQ
"Continue"
......@@ -935,3 +935,12 @@
"Display Unread Messages Only" 766 DisplayUnreadMessagesOnlyQ
"No messages found." 767 NoMessagesFound
"\1n\1cIP Addr : \1h%s\r\n" 768 UserIpAddr
"seconds" 769 Seconds
"minutes" 770 Minutes
"hours" 771 Hours
"days" 772 Days
"months" 773 Months
"years" 774 Years
"ago" 775 InThePast
"from now" 776 InTheFuture
"%s %s %s" 777 AgeOfPostedItem
\ No newline at end of file
......@@ -119,6 +119,7 @@ void sbbs_t::show_msgattr(ushort attr)
void sbbs_t::show_msghdr(smbmsg_t* msg)
{
char str[MAX_PATH+1];
char age[64];
char *sender=NULL;
int i;
......@@ -152,7 +153,8 @@ void sbbs_t::show_msghdr(smbmsg_t* msg)
}
bprintf(text[MsgDate]
,timestr(msg->hdr.when_written.time)
,smb_zonestr(msg->hdr.when_written.zone,NULL));
,smb_zonestr(msg->hdr.when_written.zone,NULL)
,age_of_posted_item(age, sizeof(age), msg->hdr.when_written.time - (smb_tzutc(msg->hdr.when_written.zone) * 60)));
CRLF;
......
......@@ -236,7 +236,7 @@ char sbbs_t::handle_ctrlkey(char ch, long mode)
attr(LIGHTGRAY);
now=time(NULL);
bprintf(text[TiLogon],timestr(logontime));
bprintf(text[TiNow],timestr(now));
bprintf(text[TiNow],timestr(now),smb_zonestr(sys_timezone(&cfg),NULL));
bprintf(text[TiTimeon]
,sectostr((uint)(now-logontime),tmp));
bprintf(text[TiTimeLeft]
......
......@@ -589,6 +589,7 @@ public:
/* str.cpp */
char* timestr(time_t intime);
char timestr_output[60];
char* age_of_posted_item(char* buf, size_t max, time_t);
void userlist(long mode);
size_t gettmplt(char *outstr, const char *tmplt, long mode);
void sif(char *fname, char *answers, long len); /* Synchronet Interface File */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -857,6 +857,7 @@ void sbbs_t::sys_info()
bprintf(text[SiSysPsite],cfg.sys_psname,cfg.sys_psnum);
if(cfg.sys_location[0])
bprintf(text[SiSysLocation],cfg.sys_location);
bprintf(text[TiNow],timestr(now),smb_zonestr(sys_timezone(&cfg),NULL));
if(cfg.sys_op[0])
bprintf(text[SiSysop],cfg.sys_op);
bprintf(text[SiSysNodes],cfg.sys_nodes);
......@@ -1227,3 +1228,38 @@ void sbbs_t::change_user(void)
sprintf(str,"Changed into %s #%u",useron.alias,useron.number);
logline("S+",str);
}
/* 't' value must be adjusted for timezone offset */
char* sbbs_t::age_of_posted_item(char* buf, size_t max, time_t t)
{
time_t now = time(NULL) - (xpTimeZone_local()*60);
char* past = text[InThePast];
char* units = text[Years];
char value[128];
double diff = difftime(now, t);
if(diff < 0) {
past = text[InTheFuture];
diff = -diff;
}
if(diff < 60) {
sprintf(value, "%.0f", diff);
units = text[Seconds];
} else if(diff < 60*60) {
sprintf(value, "%.0f", diff / 60.0);
units = text[Minutes];
} else if(diff < 60*60*24) {
sprintf(value, "%.1f", diff / (60.0 * 60.0));
units = text[Hours];
} else if(diff < 60*60*24*30) {
sprintf(value, "%.1f", diff / (60.0 * 60.0 * 24.0));
units = text[Days];
} else if(diff < 60*60*24*365) {
sprintf(value, "%.1f", diff / (60.0 * 60.0 * 24.0 * 30.0));
units = text[Months];
} else
sprintf(value, "%.1f", diff / (60.0 * 60.0 * 24.0 * 365.25));
safe_snprintf(buf, max, text[AgeOfPostedItem], value, units, past);
return buf;
}
......@@ -812,6 +812,15 @@ enum {
,DisplayUnreadMessagesOnlyQ
,NoMessagesFound
,UserIpAddr
,Seconds
,Minutes
,Hours
,Days
,Months
,Years
,InThePast
,InTheFuture
,AgeOfPostedItem
,TOTAL_TEXT
};
......
......@@ -18,10 +18,10 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x0d\x0a\x01\x77\xb3\x20\x01\x62\x46\x72\x6f\x6d\x01\x6e\x01\x62\x3a\x20\x01\x68\x01\x63\x25\x2e\x37\x30\x73"
,"\x20\x23\x25\x73"
,"\x20\x28\x25\x2e\x34\x30\x73\x29"
,"\x0d\x0a\x01\x77\xb3\x20\x01\x62\x44\x61\x74\x65\x01\x6e\x01\x62\x3a\x20\x01\x68\x01\x63\x25\x2e\x32\x34\x73\x20\x25\x73\x0d\x0a"
"\x01\x77\xc0\xc4\xc4\xc4\xc4\xc4\xc4\x01\x63\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x01\x6e\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4"
"\x01\x68\x01\x6b\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x01\x6e\x01\x63\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x01\x62\xc4\xc4\xc4\xc4\xc4\xc4\xc4"
"\xfa\xfa\xfa\xfa\xfa\xfa\x01\x6e"
,"\x0d\x0a\x01\x77\xb3\x20\x01\x62\x44\x61\x74\x65\x01\x6e\x01\x62\x3a\x20\x01\x68\x01\x63\x25\x2e\x32\x34\x73\x20\x25\x73\x20\x28"
"\x25\x73\x29\x0d\x0a\x01\x77\xc0\xc4\xc4\xc4\xc4\xc4\xc4\x01\x63\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x01\x6e\xc4\xc4\xc4\xc4\xc4"
"\xc4\xc4\xc4\xc4\xc4\x01\x68\x01\x6b\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x01\x6e\x01\x63\xc4\xc4\xc4\xc4\xc4\xc4\xc4\x01\x62\xc4\xc4"
"\xc4\xc4\xc4\xc4\xc4\xfa\xfa\xfa\xfa\xfa\xfa\x01\x6e"
,"\x01\x5f\x0d\x0a\x01\x62\x01\x68\x45\x2d\x6d\x61\x69\x6c\x20\x28\x55\x73\x65\x72\x20\x6e\x61\x6d\x65\x20\x6f\x72\x20\x6e\x75\x6d"
"\x62\x65\x72\x29\x3a\x20\x01\x77"
,"\x0d\x0a\x50\x6f\x73\x74\x20\x6f\x6e\x20\x25\x73\x20\x25\x73"
......@@ -902,10 +902,11 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x6f\x66\x66\x0d\x0a\x01\x6e"
,"\x01\x5f\x01\x77\x01\x68\x4e\x6f\x64\x65\x20\x25\x32\x64\x3a\x20\x01\x67\x25\x73\x01\x6e\x01\x67\x20\x6c\x6f\x67\x67\x65\x64\x20"
"\x6f\x6e\x20\x25\x73\x0d\x0a\x01\x6e"
,"\x01\x6e\x0d\x0a\x0d\x0a\x4c\x6f\x67\x6f\x6e\x20\x20\x20\x20\x20\x3a\x20\x25\x73"
,"\x0d\x0a\x4e\x6f\x77\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x25\x73"
,"\x0d\x0a\x54\x69\x6d\x65\x20\x6f\x6e\x20\x20\x20\x3a\x20\x25\x73"
,"\x0d\x0a\x54\x69\x6d\x65\x20\x6c\x65\x66\x74\x20\x3a\x20\x25\x73\x0d\x0a\x0d\x0a"
,"\x01\x6e\x01\x62\x01\x68\x0d\x0a\x0d\x0a\x4c\x6f\x67\x6f\x6e\x20\x54\x69\x6d\x65\x20\x20\x20\x20\x20\x20\x3a\x20\x01\x63\x25\x73"
"\x0d\x0a"
,"\x01\x62\x4c\x6f\x63\x61\x6c\x20\x54\x69\x6d\x65\x20\x20\x20\x20\x20\x20\x3a\x20\x01\x63\x25\x73\x20\x25\x73\x0d\x0a"
,"\x01\x62\x54\x69\x6d\x65\x20\x55\x73\x65\x64\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x01\x63\x25\x73\x0d\x0a"
,"\x01\x62\x54\x69\x6d\x65\x20\x52\x65\x6d\x61\x69\x6e\x69\x6e\x67\x20\x20\x3a\x20\x01\x63\x25\x73\x0d\x0a\x0d\x0a"
,"\x0d\x0a\x0d\x0a\x01\x6e\x43\x74\x72\x6c\x2d\x4b\x65\x79\x20\x43\x6f\x6d\x6d\x61\x6e\x64\x73\x20\x28\x66\x72\x6f\x6d\x20\x6d\x6f"
"\x73\x74\x20\x61\x6e\x79\x77\x68\x65\x72\x65\x29\x0d\x0a\x0d\x0a\x43\x74\x72\x6c\x2d\x4b\x20\x20\x54\x68\x69\x73\x20\x4d\x65\x6e"
"\x75\x0d\x0a\x43\x74\x72\x6c\x2d\x43\x20\x20\x41\x62\x6f\x72\x74\x20\x43\x75\x72\x72\x65\x6e\x74\x20\x50\x72\x6f\x63\x65\x73\x73"
......@@ -997,10 +998,14 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x2d\x62\x6f\x61\x72\x64\x2e\x0d\x0a"
,"\x0d\x0a\x01\x68\x01\x67\x53\x75\x62\x2d\x62\x6f\x61\x72\x64\x20\x49\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x3a\x0d\x0a\x0d\x0a"
"\x01\x6e"
,"\x4c\x6f\x6e\x67\x20\x4e\x61\x6d\x65\x20\x20\x3a\x20\x25\x73\x0d\x0a"
,"\x53\x68\x6f\x72\x74\x20\x4e\x61\x6d\x65\x20\x3a\x20\x25\x73\x0d\x0a"
,"\x51\x57\x4b\x20\x4e\x61\x6d\x65\x20\x20\x20\x3a\x20\x25\x73\x0d\x0a"
,"\x4d\x61\x78\x20\x4d\x73\x67\x73\x20\x20\x20\x3a\x20\x25\x75\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x44\x65\x73\x63\x72\x69\x70\x74\x69\x6f\x6e\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x73\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x73\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x51\x57\x4b\x20\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x73\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x4d\x65\x73\x73\x61\x67\x65\x73\x20\x52\x65\x74\x61\x69\x6e\x65\x64\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x75\x0d\x0a"
,"\x0d\x0a\x51\x57\x4b\x20\x70\x61\x63\x6b\x65\x74\x20\x6e\x65\x74\x77\x6f\x72\x6b\x20\x75\x73\x69\x6e\x67\x20\x74\x68\x65\x20\x74"
"\x61\x67\x6c\x69\x6e\x65\x3a\x0d\x0a\x25\x73\x01\x6e\x0d\x0a"
,"\x0d\x0a\x01\x6e\x46\x69\x64\x6f\x4e\x65\x74\x20\x45\x63\x68\x6f\x4d\x61\x69\x6c\x20\x43\x6f\x6e\x66\x65\x72\x65\x6e\x63\x65\x3a"
......@@ -1008,11 +1013,16 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x56\x69\x65\x77\x20\x73\x75\x62\x2d\x62\x6f\x61\x72\x64\x20\x69\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x20\x66\x69\x6c\x65"
,"\x0d\x0a\x01\x67\x01\x68\x44\x69\x72\x65\x63\x74\x6f\x72\x79\x20\x49\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x3a\x0d\x0a\x0d\x0a"
"\x01\x6e"
,"\x4c\x6f\x6e\x67\x20\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x25\x73\x0d\x0a"
,"\x53\x68\x6f\x72\x74\x20\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x25\x73\x0d\x0a"
,"\x41\x6c\x6c\x6f\x77\x65\x64\x20\x46\x69\x6c\x65\x20\x45\x78\x74\x65\x6e\x73\x69\x6f\x6e\x73\x20\x3a\x20\x25\x73\x0d\x0a"
,"\x4d\x61\x78\x69\x6d\x75\x6d\x20\x46\x69\x6c\x65\x73\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20\x25\x75\x0d\x0a"
,"\x56\x69\x65\x77\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x20\x69\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e\x20\x66\x69\x6c\x65"
,"\x01\x6e\x01\x68\x01\x62\x4c\x6f\x6e\x67\x20\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x73\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x53\x68\x6f\x72\x74\x20\x4e\x61\x6d\x65\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x73\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x41\x6c\x6c\x6f\x77\x65\x64\x20\x46\x69\x6c\x65\x20\x45\x78\x74\x65\x6e\x73\x69\x6f\x6e\x73\x20\x3a\x20"
"\x01\x63\x25\x73\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x4d\x61\x78\x69\x6d\x75\x6d\x20\x46\x69\x6c\x65\x73\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x3a\x20"
"\x01\x63\x25\x75\x0d\x0a"
,"\x01\x6e\x01\x68\x01\x62\x56\x69\x65\x77\x20\x64\x69\x72\x65\x63\x74\x6f\x72\x79\x20\x69\x6e\x66\x6f\x72\x6d\x61\x74\x69\x6f\x6e"
"\x20\x66\x69\x6c\x65"
,"\x01\x6e\x0d\x0a\x4e\x6f\x20\x4e\x65\x74\x4d\x61\x69\x6c\x20\x61\x6c\x6c\x6f\x77\x65\x64\x2e\x0d\x0a"
,"\x0d\x0a\x49\x74\x20\x77\x69\x6c\x6c\x20\x63\x6f\x73\x74\x20\x79\x6f\x75\x20\x25\x75\x20\x63\x72\x65\x64\x69\x74\x73\x20\x74\x6f"
"\x20\x73\x65\x6e\x64\x20\x4e\x65\x74\x4d\x61\x69\x6c\x2e\x20\x43\x6f\x6e\x74\x69\x6e\x75\x65"
......@@ -1260,4 +1270,13 @@ const char * const text_defaults[TOTAL_TEXT]={
,"\x44\x69\x73\x70\x6c\x61\x79\x20\x55\x6e\x72\x65\x61\x64\x20\x4d\x65\x73\x73\x61\x67\x65\x73\x20\x4f\x6e\x6c\x79"
,"\x4e\x6f\x20\x6d\x65\x73\x73\x61\x67\x65\x73\x20\x66\x6f\x75\x6e\x64\x2e"
,"\x01\x6e\x01\x63\x49\x50\x20\x41\x64\x64\x72\x20\x20\x20\x3a\x20\x01\x68\x25\x73\x0d\x0a"
,"\x73\x65\x63\x6f\x6e\x64\x73"
,"\x6d\x69\x6e\x75\x74\x65\x73"
,"\x68\x6f\x75\x72\x73"
,"\x64\x61\x79\x73"
,"\x6d\x6f\x6e\x74\x68\x73"
,"\x79\x65\x61\x72\x73"
,"\x61\x67\x6f"
,"\x66\x72\x6f\x6d\x20\x6e\x6f\x77"
,"\x25\x73\x20\x25\x73\x20\x25\x73"
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment