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

Add editor setting flag to retain Ctrl-A codes in QUOTES.TXT file

Previously, any Ctrl-A codes in the quoted message text (QUOTES.TXT) would be
retained, but not all editors actually support Ctrl-A codes, so make this
an optin (defaults to No/false).
parent d9463f81
Branches
No related tags found
No related merge requests found
...@@ -421,6 +421,7 @@ typedef enum { // Values for xtrn_t.event ...@@ -421,6 +421,7 @@ typedef enum { // Values for xtrn_t.event
#define XTRN_UART (1 << 25) // Enable the virtual UART driver #define XTRN_UART (1 << 25) // Enable the virtual UART driver
#define XTRN_FOSSIL (1 << 26) // Enable the int14h/FOSSIL driver #define XTRN_FOSSIL (1 << 26) // Enable the int14h/FOSSIL driver
#define XTRN_NODISPLAY (1 << 27) // Disable local screen/display #define XTRN_NODISPLAY (1 << 27) // Disable local screen/display
#define KEEP_CTRL_A (1 << 28) // Strip Ctrl-A quotes from quoted text
#define XTRN_CONIO (1U << 31) // Intercept Windows Console I/O (Drwy) #define XTRN_CONIO (1U << 31) // Intercept Windows Console I/O (Drwy)
// Bits in user.qwk // Bits in user.qwk
......
...@@ -1725,16 +1725,16 @@ void xedit_cfg() ...@@ -1725,16 +1725,16 @@ void xedit_cfg()
done = 0; done = 0;
while (!done) { while (!done) {
k = 0; k = 0;
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Name", cfg.xedit[i]->name); snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Name", cfg.xedit[i]->name);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Internal Code", cfg.xedit[i]->code); snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Internal Code", cfg.xedit[i]->code);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Command Line", cfg.xedit[i]->rcmd); snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Command Line", cfg.xedit[i]->rcmd);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Access Requirements", cfg.xedit[i]->arstr); snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Access Requirements", cfg.xedit[i]->arstr);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "I/O Method", io_method(cfg.xedit[i]->misc)); snprintf(opt[k++], MAX_OPLN, "%-32s%s", "I/O Method", io_method(cfg.xedit[i]->misc));
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", native_opt snprintf(opt[k++], MAX_OPLN, "%-32s%s", native_opt
, cfg.xedit[i]->misc & XTRN_NATIVE ? "Yes" : "No"); , cfg.xedit[i]->misc & XTRN_NATIVE ? "Yes" : "No");
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", use_shell_opt snprintf(opt[k++], MAX_OPLN, "%-32s%s", use_shell_opt
, cfg.xedit[i]->misc & XTRN_SH ? "Yes" : "No"); , cfg.xedit[i]->misc & XTRN_SH ? "Yes" : "No");
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Record Terminal Width" snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Record Terminal Width"
, cfg.xedit[i]->misc & SAVECOLUMNS ? "Yes" : "No"); , cfg.xedit[i]->misc & SAVECOLUMNS ? "Yes" : "No");
str[0] = 0; str[0] = 0;
if (cfg.xedit[i]->misc & QUOTEWRAP) { if (cfg.xedit[i]->misc & QUOTEWRAP) {
...@@ -1743,17 +1743,19 @@ void xedit_cfg() ...@@ -1743,17 +1743,19 @@ void xedit_cfg()
else else
SAFEPRINTF(str, ", for %u columns", (uint)cfg.xedit[i]->quotewrap_cols); SAFEPRINTF(str, ", for %u columns", (uint)cfg.xedit[i]->quotewrap_cols);
} }
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s%s", "Word-wrap Quoted Text" snprintf(opt[k++], MAX_OPLN, "%-32s%s%s", "Word-wrap Quoted Text"
, cfg.xedit[i]->misc & QUOTEWRAP ? "Yes":"No", str); , cfg.xedit[i]->misc & QUOTEWRAP ? "Yes":"No", str);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Automatically Quoted Text" snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Retain Ctrl-A Codes in Quotes"
, cfg.xedit[i]->misc & KEEP_CTRL_A ? "Yes":"No");
snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Automatically Quoted Text"
, cfg.xedit[i]->misc & QUOTEALL ? "All":cfg.xedit[i]->misc & QUOTENONE , cfg.xedit[i]->misc & QUOTEALL ? "All":cfg.xedit[i]->misc & QUOTENONE
? "None" : "Prompt User"); ? "None" : "Prompt User");
SAFECOPY(str, cfg.xedit[i]->misc & QUICKBBS ? "MSGINF/MSGTMP ": "EDITOR.INF/RESULT.ED"); SAFECOPY(str, cfg.xedit[i]->misc & QUICKBBS ? "MSGINF/MSGTMP ": "EDITOR.INF/RESULT.ED");
if (cfg.xedit[i]->misc & XTRN_LWRCASE) if (cfg.xedit[i]->misc & XTRN_LWRCASE)
strlwr(str); strlwr(str);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s %s", "Editor Information Files" snprintf(opt[k++], MAX_OPLN, "%-32s%s %s", "Editor Information Files"
, cfg.xedit[i]->misc & QUICKBBS ? "QuickBBS":"WWIV", str); , cfg.xedit[i]->misc & QUICKBBS ? "QuickBBS":"WWIV", str);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Expand Line Feeds to CRLF" snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Expand Line Feeds to CRLF"
, cfg.xedit[i]->misc & EXPANDLF ? "Yes":"No"); , cfg.xedit[i]->misc & EXPANDLF ? "Yes":"No");
const char* p; const char* p;
if (cfg.xedit[i]->misc & XTRN_UTF8) { if (cfg.xedit[i]->misc & XTRN_UTF8) {
...@@ -1775,12 +1777,12 @@ void xedit_cfg() ...@@ -1775,12 +1777,12 @@ void xedit_cfg()
break; break;
} }
} }
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Handle Soft CRs", p); snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Handle Soft CRs", p);
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Strip FidoNet Kludges" snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Strip FidoNet Kludges"
, cfg.xedit[i]->misc & STRIPKLUDGE ? "Yes":"No"); , cfg.xedit[i]->misc & STRIPKLUDGE ? "Yes":"No");
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "Support UTF-8 Encoding" snprintf(opt[k++], MAX_OPLN, "%-32s%s", "Support UTF-8 Encoding"
, cfg.xedit[i]->misc & XTRN_UTF8 ? "Yes":"No"); , cfg.xedit[i]->misc & XTRN_UTF8 ? "Yes":"No");
snprintf(opt[k++], MAX_OPLN, "%-27.27s%s", "BBS Drop File Type" snprintf(opt[k++], MAX_OPLN, "%-32s%s", "BBS Drop File Type"
, dropfile(cfg.xedit[i]->type, cfg.xedit[i]->misc)); , dropfile(cfg.xedit[i]->type, cfg.xedit[i]->misc));
opt[k][0] = 0; opt[k][0] = 0;
uifc.helpbuf = uifc.helpbuf =
...@@ -1930,6 +1932,13 @@ void xedit_cfg() ...@@ -1930,6 +1932,13 @@ void xedit_cfg()
} }
break; break;
case 9: case 9:
toggle_flag("Retain Ctrl-A Codes in Quoted Text", &cfg.xedit[i]->misc, KEEP_CTRL_A, false
, "`Retain Ctrl-A Codes in Quoted Text:`\n"
"\n"
"If this editor supports Ctrl-A codes in the generated `QUOTES.TXT` file,\n"
"set this option to `Yes`.\n");
break;
case 10:
switch (cfg.xedit[i]->misc & (QUOTEALL | QUOTENONE)) { switch (cfg.xedit[i]->misc & (QUOTEALL | QUOTENONE)) {
case 0: /* prompt user */ case 0: /* prompt user */
k = 2; k = 2;
...@@ -1975,7 +1984,7 @@ void xedit_cfg() ...@@ -1975,7 +1984,7 @@ void xedit_cfg()
uifc.changes = TRUE; uifc.changes = TRUE;
} }
break; break;
case 10: case 11:
k = cfg.xedit[i]->misc & QUICKBBS ? 0:1; k = cfg.xedit[i]->misc & QUICKBBS ? 0:1;
strcpy(opt[0], "QuickBBS MSGINF/MSGTMP"); strcpy(opt[0], "QuickBBS MSGINF/MSGTMP");
strcpy(opt[1], "WWIV EDITOR.INF/RESULT.ED"); strcpy(opt[1], "WWIV EDITOR.INF/RESULT.ED");
...@@ -2000,7 +2009,7 @@ void xedit_cfg() ...@@ -2000,7 +2009,7 @@ void xedit_cfg()
} }
goto lowercase_filename; goto lowercase_filename;
break; break;
case 11: case 12:
toggle_flag("Expand LF to CRLF" toggle_flag("Expand LF to CRLF"
, &cfg.xedit[i]->misc, EXPANDLF, false, , &cfg.xedit[i]->misc, EXPANDLF, false,
"`Expand Line Feeds to Carriage Return/Line Feed Pairs:`\n" "`Expand Line Feeds to Carriage Return/Line Feed Pairs:`\n"
...@@ -2009,7 +2018,7 @@ void xedit_cfg() ...@@ -2009,7 +2018,7 @@ void xedit_cfg()
"instead of a carriage return/line feed pair, set this option to `Yes`.\n" "instead of a carriage return/line feed pair, set this option to `Yes`.\n"
); );
break; break;
case 12: case 13:
if (cfg.xedit[i]->misc & XTRN_UTF8) if (cfg.xedit[i]->misc & XTRN_UTF8)
break; // N/A break; // N/A
k = cfg.xedit[i]->soft_cr; k = cfg.xedit[i]->soft_cr;
...@@ -2041,7 +2050,7 @@ void xedit_cfg() ...@@ -2041,7 +2050,7 @@ void xedit_cfg()
uifc.changes = TRUE; uifc.changes = TRUE;
} }
break; break;
case 13: case 14:
toggle_flag("Strip FidoNet Kludge Lines" toggle_flag("Strip FidoNet Kludge Lines"
, &cfg.xedit[i]->misc, STRIPKLUDGE, false, , &cfg.xedit[i]->misc, STRIPKLUDGE, false,
"`Strip FidoNet Kludge Lines From Messages:`\n" "`Strip FidoNet Kludge Lines From Messages:`\n"
...@@ -2050,7 +2059,7 @@ void xedit_cfg() ...@@ -2050,7 +2059,7 @@ void xedit_cfg()
"set this option to `Yes` to strip those lines from the message.\n" "set this option to `Yes` to strip those lines from the message.\n"
); );
break; break;
case 14: case 15:
toggle_flag("Support UTF-8 Encoding" toggle_flag("Support UTF-8 Encoding"
, &cfg.xedit[i]->misc, XTRN_UTF8, false, , &cfg.xedit[i]->misc, XTRN_UTF8, false,
"`Support UTF-8 Encoding:`\n" "`Support UTF-8 Encoding:`\n"
...@@ -2060,7 +2069,7 @@ void xedit_cfg() ...@@ -2060,7 +2069,7 @@ void xedit_cfg()
"option to `Yes`." "option to `Yes`."
); );
break; break;
case 15: case 16:
k = 0; k = 0;
strcpy(opt[k++], "None"); strcpy(opt[k++], "None");
snprintf(opt[k++], MAX_OPLN, "%-15s %s", "Synchronet", "XTRN.DAT"); snprintf(opt[k++], MAX_OPLN, "%-15s %s", "Synchronet", "XTRN.DAT");
......
...@@ -92,7 +92,10 @@ bool sbbs_t::quotemsg(smb_t* smb, smbmsg_t* msg, bool tails) ...@@ -92,7 +92,10 @@ bool sbbs_t::quotemsg(smb_t* smb, smbmsg_t* msg, bool tails)
if (tails) if (tails)
mode |= GETMSGTXT_TAILS; mode |= GETMSGTXT_TAILS;
if ((buf = smb_getmsgtxt(smb, msg, mode)) != NULL) { if ((buf = smb_getmsgtxt(smb, msg, mode)) != NULL) {
if (useron_xedit && (cfg.xedit[useron_xedit - 1]->misc & KEEP_CTRL_A))
strip_invalid_attr(buf); strip_invalid_attr(buf);
else
remove_ctrl_a(buf, buf);
truncsp(buf); truncsp(buf);
BOOL is_utf8 = FALSE; BOOL is_utf8 = FALSE;
if (!str_is_ascii(buf)) { if (!str_is_ascii(buf)) {
...@@ -395,14 +398,12 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, int mode, ...@@ -395,14 +398,12 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, int mode,
free(buf); free(buf);
return false; return false;
} }
if (useron_xedit > 0 && cfg.xedit[useron_xedit - 1]->type == XTRN_WWIV) { // 2 lines of metadata if (useron_xedit > 0 && cfg.xedit[useron_xedit - 1]->type == XTRN_WWIV) { // 2 lines of metadata
if (fgets(str, sizeof(str), stream) == NULL) if (fgets(str, sizeof(str), stream) == NULL)
errormsg(WHERE, ERR_READ, path, sizeof(str)); errormsg(WHERE, ERR_READ, path, sizeof(str));
if (fgets(str, sizeof(str), stream) == NULL) if (fgets(str, sizeof(str), stream) == NULL)
errormsg(WHERE, ERR_READ, path, sizeof(str)); errormsg(WHERE, ERR_READ, path, sizeof(str));
} }
if ((file = nopen(msgtmp, O_WRONLY | O_CREAT | O_TRUNC)) == -1) { if ((file = nopen(msgtmp, O_WRONLY | O_CREAT | O_TRUNC)) == -1) {
errormsg(WHERE, ERR_OPEN, msgtmp, O_WRONLY | O_CREAT | O_TRUNC); errormsg(WHERE, ERR_OPEN, msgtmp, O_WRONLY | O_CREAT | O_TRUNC);
free(buf); free(buf);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment