diff --git a/src/sbbs3/bulkmail.cpp b/src/sbbs3/bulkmail.cpp index 073e208d67cf543e6c490fa643a312c7be60a481..cc4e3ac3c78b376b18ce46a8160206571e35b96a 100644 --- a/src/sbbs3/bulkmail.cpp +++ b/src/sbbs3/bulkmail.cpp @@ -111,9 +111,7 @@ bool sbbs_t::bulkmail(uchar *ar) msg.hdr.when_written.time=time32(NULL); msg.hdr.when_written.zone=sys_timezone(&cfg); - if(editor!=NULL) - smb_hfield_str(&msg,SMB_EDITOR,editor); - smb_hfield_bin(&msg, SMB_COLUMNS, cols); + editor_info_to_msg(&msg, editor); memset(&smb,0,sizeof(smb)); smb.subnum=INVALID_SUB; /* mail database */ diff --git a/src/sbbs3/email.cpp b/src/sbbs3/email.cpp index 667f8082ced5e889a91865333b953807d4ec258b..3826b82763a24f6c2848a79c5d7d5d0b47f9bffd 100644 --- a/src/sbbs3/email.cpp +++ b/src/sbbs3/email.cpp @@ -317,9 +317,7 @@ bool sbbs_t::email(int usernumber, const char *top, const char *subj, long mode, add_msg_ids(&cfg, &smb, &msg, remsg); - if(editor!=NULL) - smb_hfield_str(&msg,SMB_EDITOR,editor); - smb_hfield_bin(&msg, SMB_COLUMNS, cols); + editor_info_to_msg(&msg, editor); smb_dfield(&msg,TEXT_BODY,length); diff --git a/src/sbbs3/fido.cpp b/src/sbbs3/fido.cpp index 30515b8b3f2d3efcf0ca121a628490fae97ebe93..126c722bcc961ae2e861eeba6d2b0fac1ce03d89 100644 --- a/src/sbbs3/fido.cpp +++ b/src/sbbs3/fido.cpp @@ -350,9 +350,7 @@ bool sbbs_t::netmail(const char *into, const char *title, long mode, smb_t* resm smb_hfield_str(&msg,SUBJECT, subj); - if(editor!=NULL) - smb_hfield_str(&msg,SMB_EDITOR,editor); - smb_hfield_bin(&msg, SMB_COLUMNS, cols); + editor_info_to_msg(&msg, editor); if(cfg.netmail_misc&NMAIL_DIRECT) msg.hdr.netattr |= MSG_DIRECT; diff --git a/src/sbbs3/netmail.cpp b/src/sbbs3/netmail.cpp index 47c4aaa62266b96b7757fe0e2fa1dfaae8a30cac..2437040850e1901cba210e348fedd6b8187e7810 100644 --- a/src/sbbs3/netmail.cpp +++ b/src/sbbs3/netmail.cpp @@ -279,9 +279,7 @@ bool sbbs_t::inetmail(const char *into, const char *subj, long mode, smb_t* resm add_msg_ids(&cfg, &smb, &msg, remsg); - if(editor!=NULL) - smb_hfield_str(&msg,SMB_EDITOR,editor); - smb_hfield_bin(&msg, SMB_COLUMNS, cols); + editor_info_to_msg(&msg, editor); smb_dfield(&msg,TEXT_BODY,length); @@ -493,9 +491,7 @@ bool sbbs_t::qnetmail(const char *into, const char *subj, long mode, smb_t* resm add_msg_ids(&cfg, &smb, &msg, /* remsg: */NULL); - if(editor!=NULL) - smb_hfield_str(&msg,SMB_EDITOR,editor); - smb_hfield_bin(&msg, SMB_COLUMNS, cols); + editor_info_to_msg(&msg, editor); smb_dfield(&msg,TEXT_BODY,length); diff --git a/src/sbbs3/postmsg.cpp b/src/sbbs3/postmsg.cpp index 7006b3d09c2b0c12ff0b328b64b1ab1a3fb779fd..ff5d26790e904877da2a02c912c963e709d9605e 100644 --- a/src/sbbs3/postmsg.cpp +++ b/src/sbbs3/postmsg.cpp @@ -290,9 +290,7 @@ bool sbbs_t::postmsg(uint subnum, long wm_mode, smb_t* resmb, smbmsg_t* remsg) add_msg_ids(&cfg, &smb, &msg, remsg); - if(editor!=NULL) - smb_hfield_str(&msg,SMB_EDITOR,editor); - smb_hfield_bin(&msg, SMB_COLUMNS, cols); + editor_info_to_msg(&msg, editor); if((cfg.sub[subnum]->misc&SUB_MSGTAGS) && (tags[0] || text[TagMessageQ][0] == 0 || !noyes(text[TagMessageQ]))) { diff --git a/src/sbbs3/sbbs.h b/src/sbbs3/sbbs.h index c443fb40838bb33881e248b1a44bd7bdb1711c8a..4245a362ac1d7d211db41c91e029c60f5103e845 100644 --- a/src/sbbs3/sbbs.h +++ b/src/sbbs3/sbbs.h @@ -668,6 +668,7 @@ public: bool movemsg(smbmsg_t* msg, uint subnum); int process_edited_text(char* buf, FILE* stream, long mode, unsigned* lines, unsigned maxlines); int process_edited_file(const char* src, const char* dest, long mode, unsigned* lines, unsigned maxlines); + void editor_info_to_msg(smbmsg_t*, const char* editor); /* postmsg.cpp */ bool postmsg(uint subnum, long wm_mode = WM_NONE, smb_t* resmb = NULL, smbmsg_t* remsg = NULL); diff --git a/src/sbbs3/sbbsdefs.h b/src/sbbs3/sbbsdefs.h index 1ddf306e90f650e1a73b511b754923e06773afe7..23c67d6b3e536e7b512f157b63b8abe2c1b63b5e 100644 --- a/src/sbbs3/sbbsdefs.h +++ b/src/sbbs3/sbbsdefs.h @@ -410,6 +410,7 @@ typedef enum { /* Values for xtrn_t.event */ #define XTRN_PAUSE (1<<19) /* Force a screen pause on exit */ #define XTRN_NOECHO (1<<20) /* Don't echo stdin to stdout */ #define QUOTEWRAP (1<<21) /* Word-wrap quoted message text */ +#define SAVECOLUMNS (1<<22) /* Save/share current terminal width */ #define XTRN_CONIO (1<<31) /* Intercept Windows Console I/O (Drwy) */ /* Bits in cfg.xtrn_misc */ diff --git a/src/sbbs3/writemsg.cpp b/src/sbbs3/writemsg.cpp index ffd060a4ee429407daff9892dc0dbb1ad27d49cc..fc2df30e8cbe93e0139c41c13d19f42728bde547 100644 --- a/src/sbbs3/writemsg.cpp +++ b/src/sbbs3/writemsg.cpp @@ -657,6 +657,20 @@ bool sbbs_t::writemsg(const char *fname, const char *top, char *subj, long mode, return(true); } +void sbbs_t::editor_info_to_msg(smbmsg_t* msg, const char* editor) +{ + if(editor != NULL) + smb_hfield_str(msg, SMB_EDITOR, editor); + + ushort useron_xedit = useron.xedit; + + if(useron_xedit > 0 && !chk_ar(cfg.xedit[useron_xedit - 1]->ar, &useron, &client)) + useron_xedit = 0; + + if(editor == NULL || useron_xedit == 0 || (cfg.xedit[useron_xedit - 1]->misc&SAVECOLUMNS)) + smb_hfield_bin(msg, SMB_COLUMNS, cols); +} + /****************************************************************************/ /****************************************************************************/ /* Modify 'str' to for quoted format. Remove ^A codes, etc. */