Skip to content
Snippets Groups Projects
Commit 26d0b46e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Support per-sub-board user signature (.sig files)

This feature was long overdue.

And "SIG" command to view, create or edit default signature (same function as
available from user_settings.js, in fact a copy/pasted the code).
Add "SUBSIG" command to view, create, or edit sub-board signture (no other
method is available to this other than direct file system access, e.g. by the
sysop).
parent 1b911f58
No related branches found
No related tags found
No related merge requests found
Pipeline #8536 passed
...@@ -820,6 +820,29 @@ function str_cmds(str) ...@@ -820,6 +820,29 @@ function str_cmds(str)
console.printfile(plan); console.printfile(plan);
} }
} }
if(str=="HELP") {
writeln("SIG\tEdit or delete your default message signature.");
writeln("SUBSIG\tEdit or delete your signature for this sub-board (over-rides default).");
}
if(str=="SIG" || str=="SUBSIG") {
var userSigFilename = system.data_dir + "user/" + format("%04u", user.number);
if(str == "SUBSIG")
userSigFilename += "." + bbs.cursub_code;
userSigFilename += ".sig";
if (file_exists(userSigFilename)) {
if (console.yesno(bbs.text(bbs.text.ViewSignatureQ)))
console.printfile(userSigFilename);
}
if (console.yesno(bbs.text(bbs.text.CreateEditSignatureQ)))
console.editfile(userSigFilename);
else if (!console.aborted) {
if (file_exists(userSigFilename)) {
if (console.yesno(bbs.text(bbs.text.DeleteSignatureQ)))
file_remove(userSigFilename);
}
}
}
} }
if(str=="HELP") { if(str=="HELP") {
......
...@@ -750,6 +750,12 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, int mode, ...@@ -750,6 +750,12 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, int mode,
/* Signature file */ /* Signature file */
if ((subnum == INVALID_SUB && cfg.msg_misc & MM_EMAILSIG) if ((subnum == INVALID_SUB && cfg.msg_misc & MM_EMAILSIG)
|| (subnum != INVALID_SUB && !(cfg.sub[subnum]->misc & SUB_NOUSERSIG))) { || (subnum != INVALID_SUB && !(cfg.sub[subnum]->misc & SUB_NOUSERSIG))) {
bool got_sig = false;
if (subnum_is_valid(subnum)) {
snprintf(str, sizeof str, "%suser/%04u.%s.sig", cfg.data_dir, useron.number, cfg.sub[subnum]->code);
got_sig = fexistcase(str);
}
if (!got_sig)
SAFEPRINTF2(str, "%suser/%04u.sig", cfg.data_dir, useron.number); SAFEPRINTF2(str, "%suser/%04u.sig", cfg.data_dir, useron.number);
FILE* sig; FILE* sig;
if (fexistcase(str) && (sig = fopen(str, "r")) != NULL) { if (fexistcase(str) && (sig = fopen(str, "r")) != NULL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment