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 35c1d051 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Make msg/file scan configuration prompts and keys configurable

For localization purposes, no more hard-coded text strings or characters in the new-file and file scan configuration menus.

This change fixes issue 232.

A Hungarian sysop also requested this change via Facebook not long ago.
parent 5b8577ae
Pipeline #2474 passed with stage
in 22 minutes and 17 seconds
......@@ -523,6 +523,10 @@ public:
/*********************************/
char *text[TOTAL_TEXT]; /* Text from ctrl\text.dat */
char *text_sav[TOTAL_TEXT]; /* Text from ctrl\text.dat */
char yes_key(void) { return text[YNQP][0]; }
char no_key(void) { return text[YNQP][1]; }
char quit_key(void) { return text[YNQP][2]; }
char all_key(void) { return text[AllKey][0]; }
char dszlog[127]; /* DSZLOG environment variable */
int keybuftop,keybufbot; /* Keyboard input buffer pointers (for ungetkey) */
......
......@@ -26,18 +26,20 @@
/****************************************************************************/
void sbbs_t::scandirs(long mode)
{
char keys[32];
char ch,str[256]="";
int s;
uint i,k;
if(!usrlibs) return;
mnemonics(text[DirLibOrAll]);
ch=(char)getkeys("DLA\r",0);
SAFEPRINTF2(keys, "%s%c\r", text[DirLibKeys], all_key());
ch=(char)getkeys(keys, 0);
if(sys_status&SS_ABORT || ch==CR) {
lncntr=0;
return;
}
if(ch!='A') {
if(ch!=all_key()) {
if(mode&FL_ULTIME) { /* New file scan */
bprintf(text[NScanHdr],timestr(ns_time));
}
......@@ -59,7 +61,7 @@ void sbbs_t::scandirs(long mode)
}
}
}
if(ch=='D') {
if(ch==text[DirLibKeys][0]) {
if((s=listfiles(usrdir[curlib][curdir[curlib]],str,0,mode))==-1)
return;
bputs(text[Scanned]);
......@@ -69,7 +71,7 @@ void sbbs_t::scandirs(long mode)
bputs(text[FileNotFound]);
return;
}
if(ch=='L') {
if(ch==text[DirLibKeys][1]) {
k=0;
for(i=0;i<usrdirs[curlib] && !msgabort();i++) {
progress(text[Scanning], i, usrdirs[curlib], (mode & FL_ULTIME) ? 10 : 1);
......
......@@ -26,6 +26,7 @@
/****************************************************************************/
void sbbs_t::scansubs(long mode)
{
char keys[32];
char ch,str[256] = "";
char tmp[512];
uint i=0,found=0;
......@@ -43,11 +44,12 @@ void sbbs_t::scansubs(long mode)
}
mnemonics(text[SubGroupOrAll]);
ch=(char)getkeys("SGA\r",0);
SAFEPRINTF2(keys, "%s%c\r", text[SubGroupKeys], all_key());
ch=(char)getkeys(keys, 0);
if(sys_status&SS_ABORT || ch==CR)
return;
if(ch!='A' && mode&(SCAN_FIND|SCAN_TOYOU)) {
if(ch!=all_key() && mode&(SCAN_FIND|SCAN_TOYOU)) {
if(text[DisplaySubjectsOnlyQ][0])
subj_only = yesno(text[DisplaySubjectsOnlyQ]);
if((mode&SCAN_TOYOU) && !(mode&SCAN_UNREAD)
......@@ -58,10 +60,10 @@ void sbbs_t::scansubs(long mode)
if(!getstr(str,40,K_LINE|K_UPPER))
return;
if(subj_only) {
if(ch=='S') {
if(ch==text[SubGroupKeys][0] /* 'S' */) {
found=listsub(usrsub[curgrp][cursub[curgrp]],SCAN_FIND,0,str);
subs_scanned++;
} else if(ch=='G')
} else if(ch==text[SubGroupKeys][1] /* 'G' */)
for(i=0;i<usrsubs[curgrp] && !msgabort();i++) {
found=listsub(usrsub[curgrp][i],SCAN_FIND,0,str);
subs_scanned++;
......@@ -74,9 +76,9 @@ void sbbs_t::scansubs(long mode)
}
}
else if(mode&SCAN_TOYOU && subj_only) {
if(ch=='S')
if(ch==text[SubGroupKeys][0] /* 'S' */)
found=listsub(usrsub[curgrp][cursub[curgrp]],mode,0,NULL);
else if(ch=='G')
else if(ch==text[SubGroupKeys][1] /* 'G' */)
for(i=0;i<usrsubs[curgrp] && !msgabort();i++) {
if(subscan[usrsub[curgrp][i]].cfg&SUB_CFG_SSCAN)
found=listsub(usrsub[curgrp][i],mode,0,NULL);
......@@ -87,7 +89,7 @@ void sbbs_t::scansubs(long mode)
}
}
if(ch=='S') {
if(ch==text[SubGroupKeys][0] /* 'S' */) {
if(useron.misc&(RIP|WIP|HTML) && !(useron.misc&EXPERT)) {
menu("msgscan");
}
......@@ -98,7 +100,7 @@ void sbbs_t::scansubs(long mode)
else bprintf(text[MessageScanComplete],subs_scanned);
return;
}
if(ch=='G') {
if(ch==text[SubGroupKeys][1] /* 'G' */) {
if(useron.misc&(RIP|WIP|HTML) && !(useron.misc&EXPERT)) {
menu("msgscan");
}
......@@ -238,6 +240,7 @@ void sbbs_t::scanallsubs(long mode)
void sbbs_t::new_scan_ptr_cfg()
{
char keys[32];
uint i,j;
long s;
uint32_t l;
......@@ -255,16 +258,17 @@ void sbbs_t::new_scan_ptr_cfg()
}
SYNC;
mnemonics(text[WhichOrAll]);
s=getkeys("AQ",usrgrps);
if(!s || s==-1 || s=='Q')
sprintf(keys, "%c%c", all_key(), quit_key());
s=getkeys(keys,usrgrps);
if(!s || s==-1 || s==quit_key())
break;
if(s=='A') {
mnemonics("\r\nEnter number of messages from end, ~Date, ~Quit, or"
" [Last Message]: ");
s=getkeys("DLQ",9999);
if(s==-1 || s=='Q')
if(s==all_key()) {
mnemonics(text[SetMsgPtrPrompt]);
SAFEPRINTF2(keys, "%s%c", text[DateLastKeys], quit_key());
s=getkeys(keys, 9999);
if(s==-1 || s==quit_key())
continue;
if(s=='D') {
if(s==text[DateLastKeys][0]) {
t=time(NULL);
for(i=0, total_subs=0; i<usrgrps; i++)
total_subs += usrsubs[i];
......@@ -280,7 +284,7 @@ void sbbs_t::new_scan_ptr_cfg()
}
continue;
}
if(s=='L')
if(s==text[DateLastKeys][1])
s=0;
if(s)
s&=~0x80000000L;
......@@ -319,20 +323,21 @@ void sbbs_t::new_scan_ptr_cfg()
}
SYNC;
mnemonics(text[WhichOrAll]);
s=getkeys("AQ",usrsubs[i]);
sprintf(keys, "%c%c", all_key(), quit_key());
s=getkeys(keys,usrsubs[i]);
if(sys_status&SS_ABORT) {
lncntr=0;
return;
}
if(s==-1 || !s || s=='Q')
if(s==-1 || !s || s==quit_key())
break;
if(s=='A') { /* The entire group */
mnemonics("\r\nEnter number of messages from end, ~Date, ~Quit, or"
" [Last Message]: ");
s=getkeys("DLQ",9999);
if(s==-1 || s=='Q')
if(s==*text[AllKey]) { /* The entire group */
mnemonics(text[SetMsgPtrPrompt]);
SAFEPRINTF2(keys, "%s%c", text[DateLastKeys], quit_key());
s=getkeys(keys, 9999);
if(s==-1 || s==quit_key())
continue;
if(s=='D') {
if(s==text[DateLastKeys][0]) {
t=l;
if(inputnstime(&t) && !(sys_status&SS_ABORT)) {
for(j=0;j<usrsubs[i] && online;j++) {
......@@ -344,7 +349,7 @@ void sbbs_t::new_scan_ptr_cfg()
}
continue;
}
if(s=='L')
if(s==text[DateLastKeys][1])
s=0;
if(s)
s&=~0x80000000L;
......@@ -366,12 +371,12 @@ void sbbs_t::new_scan_ptr_cfg()
}
else {
j=(s&~0x80000000L)-1;
mnemonics("\r\nEnter number of messages from end, ~Date, ~Quit, or"
" [Last Message]: ");
s=getkeys("DLQ",9999);
if(s==-1 || s=='Q')
mnemonics(text[SetMsgPtrPrompt]);
SAFEPRINTF2(keys, "%s%c", text[DateLastKeys], quit_key());
s=getkeys(keys, 9999);
if(s==-1 || s==quit_key())
continue;
if(s=='D') {
if(s==text[DateLastKeys][0]) {
t=getmsgtime(usrsub[i][j],subscan[usrsub[i][j]].ptr);
if(inputnstime(&t) && !(sys_status&SS_ABORT)) {
bputs(text[LoadingMsgPtrs]);
......@@ -379,7 +384,7 @@ void sbbs_t::new_scan_ptr_cfg()
}
continue;
}
if(s=='L') {
if(s==text[DateLastKeys][1]) {
subscan[usrsub[i][j]].ptr = ~0;
continue;
}
......@@ -397,6 +402,7 @@ void sbbs_t::new_scan_ptr_cfg()
void sbbs_t::new_scan_cfg(ulong misc)
{
char keys[32];
long s;
ulong i,j;
ulong t;
......@@ -430,24 +436,25 @@ void sbbs_t::new_scan_cfg(ulong misc)
,cfg.sub[usrsub[i][j]]->lname
,subscan[usrsub[i][j]].cfg&misc ?
(misc&SUB_CFG_NSCAN && subscan[usrsub[i][j]].cfg&SUB_CFG_YSCAN) ?
"To You Only" : text[On] : text[Off]);
text[ToYouOnly] : text[On] : text[Off]);
}
SYNC;
if(misc&SUB_CFG_NSCAN)
mnemonics(text[NScanCfgWhichSub]);
else
mnemonics(text[SScanCfgWhichSub]);
s=getkeys("AQ",usrsubs[i]);
sprintf(keys, "%c%c", all_key(), quit_key());
s=getkeys(keys,usrsubs[i]);
if(sys_status&SS_ABORT) {
lncntr=0;
return;
}
if(!s || s==-1 || s=='Q')
if(!s || s==-1 || s==quit_key())
break;
if(s=='A') {
if(s==all_key()) {
t=subscan[usrsub[i][0]].cfg&misc;
if(misc&SUB_CFG_NSCAN && !t && !(useron.misc&FLAG('Q')))
if(!noyes("Messages to you only"))
if(!noyes(text[MsgsToYouOnlyQ]))
misc|=SUB_CFG_YSCAN;
for(j=0;j<usrsubs[i] && online;j++) {
checkline();
......@@ -462,7 +469,7 @@ void sbbs_t::new_scan_cfg(ulong misc)
}
j=(s&~0x80000000L)-1;
if(misc&SUB_CFG_NSCAN && !(subscan[usrsub[i][j]].cfg&misc)) {
if(!(useron.rest&FLAG('Q')) && !noyes("Messages to you only"))
if(!(useron.rest&FLAG('Q')) && !noyes(text[MsgsToYouOnlyQ]))
subscan[usrsub[i][j]].cfg|=SUB_CFG_YSCAN;
else
subscan[usrsub[i][j]].cfg&=~SUB_CFG_YSCAN;
......
......@@ -857,6 +857,13 @@ enum {
,InternetMailSent
,FidoNetMailSent
,QWKNetMailSent
,MsgsToYouOnlyQ
,ToYouOnly
,SetMsgPtrPrompt
,DateLastKeys
,DirLibKeys
,SubGroupKeys
,AllKey
,TOTAL_TEXT
};
......
......@@ -1392,4 +1392,13 @@ const char * const text_defaults[TOTAL_TEXT]={
"\x40\x25\x73\x01\x6e\x0d\x0a" // 845 FidoNetMailSent
,"\x01\x5b\x01\x6e\x01\x6d\x51\x57\x4b\x20\x4e\x65\x74\x4d\x61\x69\x6c\x20\x73\x65\x6e\x74\x20\x74\x6f\x20\x01\x68\x25\x73\x20\x28"
"\x25\x73\x29\x01\x6e\x0d\x0a" // 846 QWKNetMailSent
,"\x4d\x65\x73\x73\x61\x67\x65\x73\x20\x74\x6f\x20\x79\x6f\x75\x20\x6f\x6e\x6c\x79" // 847 MsgsToYouOnlyQ
,"\x54\x6f\x20\x59\x6f\x75\x20\x4f\x6e\x6c\x79" // 848 ToYouOnly
,"\x0d\x0a\x45\x6e\x74\x65\x72\x20\x6e\x75\x6d\x62\x65\x72\x20\x6f\x66\x20\x6d\x65\x73\x73\x61\x67\x65\x73\x20\x66\x72\x6f\x6d\x20"
"\x65\x6e\x64\x2c\x20\x7e\x44\x61\x74\x65\x2c\x20\x7e\x51\x75\x69\x74\x2c\x20\x6f\x72\x20\x5b\x4c\x61\x73\x74\x20\x4d\x65\x73\x73"
"\x61\x67\x65\x5d\x3a\x20" // 849 SetMsgPtrPrompt
,"\x44\x4c" // 850 DateLastKeys
,"\x44\x4c" // 851 DirLibKeys
,"\x53\x47" // 852 SubGroupKeys
,"\x41" // 853 AllKey
};
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