Skip to content
Snippets Groups Projects
Commit 09a87ec7 authored by rswindell's avatar rswindell
Browse files

When listing messages:

- Use the P_TRUNCATE pmode flag to prevent long msg subj from wrapping the
  terminal
- Use msghdr_text() to do the magic UTF-8/CP437 dance for messages with UTF-8
  header fields (e.g. to/from/subject)

This is why I assigned MSG_HFIELDS_UTF8 the same bit-flag value as P_UTF8. :-)
parent ff4e4cc9
Branches
Tags
No related merge requests found
...@@ -142,7 +142,8 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode) ...@@ -142,7 +142,8 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
if(loadmsg(&msg,mail[smb.curmsg].number) < 1) if(loadmsg(&msg,mail[smb.curmsg].number) < 1)
continue; continue;
smb_unlockmsghdr(&smb,&msg); smb_unlockmsghdr(&smb,&msg);
bprintf(text[MailWaitingLstFmt],smb.curmsg+1 bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailWaitingLstFmt), smb.curmsg+1
,which==MAIL_SENT ? msg.to ,which==MAIL_SENT ? msg.to
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP ? text[Anonymous] : (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP ? text[Anonymous]
: msg.from : msg.from
...@@ -489,12 +490,14 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode) ...@@ -489,12 +490,14 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
continue; continue;
smb_unlockmsghdr(&smb,&msg); smb_unlockmsghdr(&smb,&msg);
if(which==MAIL_ALL) if(which==MAIL_ALL)
bprintf(text[MailOnSystemLstFmt] bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailOnSystemLstFmt)
,u+1,msg.from,msg.to ,u+1,msg.from,msg.to
,mail_listing_flag(&msg) ,mail_listing_flag(&msg)
,msg.subj); ,msg.subj);
else else
bprintf(text[MailWaitingLstFmt],u+1 bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailWaitingLstFmt),u+1
,which==MAIL_SENT ? msg.to ,which==MAIL_SENT ? msg.to
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP : (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from ? text[Anonymous] : msg.from
...@@ -660,12 +663,14 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode) ...@@ -660,12 +663,14 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
continue; continue;
smb_unlockmsghdr(&smb,&msg); smb_unlockmsghdr(&smb,&msg);
if(which==MAIL_ALL) if(which==MAIL_ALL)
bprintf(text[MailOnSystemLstFmt] bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailOnSystemLstFmt)
,u+1,msg.from,msg.to ,u+1,msg.from,msg.to
,mail_listing_flag(&msg) ,mail_listing_flag(&msg)
,msg.subj); ,msg.subj);
else else
bprintf(text[MailWaitingLstFmt],u+1 bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailWaitingLstFmt),u+1
,which==MAIL_SENT ? msg.to ,which==MAIL_SENT ? msg.to
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP : (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from ? text[Anonymous] : msg.from
...@@ -828,12 +833,14 @@ long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const ch ...@@ -828,12 +833,14 @@ long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const ch
bprintf(text[MailWaitingLstHdr], order); bprintf(text[MailWaitingLstHdr], order);
} }
if(which==MAIL_ALL) if(which==MAIL_ALL)
bprintf(text[MailOnSystemLstFmt] bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailOnSystemLstFmt)
,l+1,msg.from,msg.to ,l+1,msg.from,msg.to
,mail_listing_flag(&msg) ,mail_listing_flag(&msg)
,msg.subj); ,msg.subj);
else else
bprintf(text[MailWaitingLstFmt],l+1 bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, MailWaitingLstFmt),l+1
,which==MAIL_SENT ? msg.to ,which==MAIL_SENT ? msg.to
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP : (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from ? text[Anonymous] : msg.from
......
...@@ -74,7 +74,8 @@ long sbbs_t::listmsgs(uint subnum, long mode, post_t *post, long i, long posts, ...@@ -74,7 +74,8 @@ long sbbs_t::listmsgs(uint subnum, long mode, post_t *post, long i, long posts,
smb_unlockmsghdr(&smb,&msg); smb_unlockmsghdr(&smb,&msg);
if(listed==0) if(listed==0)
bputs(text[MailOnSystemLstHdr]); bputs(text[MailOnSystemLstHdr]);
bprintf(text[SubMsgLstFmt], reading ? (i+1) : post[i].num bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, SubMsgLstFmt), reading ? (i+1) : post[i].num
,msg.hdr.attr&MSG_ANONYMOUS && !sub_op(subnum) ,msg.hdr.attr&MSG_ANONYMOUS && !sub_op(subnum)
? text[Anonymous] : msg.from ? text[Anonymous] : msg.from
,msg.to ,msg.to
...@@ -1764,7 +1765,8 @@ long sbbs_t::searchposts(uint subnum, post_t *post, long start, long posts ...@@ -1764,7 +1765,8 @@ long sbbs_t::searchposts(uint subnum, post_t *post, long start, long posts
|| (msg.tags != NULL && strcasestr(msg.tags, search) != NULL)) { || (msg.tags != NULL && strcasestr(msg.tags, search) != NULL)) {
if(!found) if(!found)
bputs(text[MailOnSystemLstHdr]); bputs(text[MailOnSystemLstHdr]);
bprintf(text[SubMsgLstFmt],l+1 bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, SubMsgLstFmt),l+1
,(msg.hdr.attr&MSG_ANONYMOUS) && !sub_op(subnum) ? text[Anonymous] ,(msg.hdr.attr&MSG_ANONYMOUS) && !sub_op(subnum) ? text[Anonymous]
: msg.from : msg.from
,msg.to ,msg.to
...@@ -1819,7 +1821,8 @@ long sbbs_t::showposts_toyou(uint subnum, post_t *post, ulong start, long posts, ...@@ -1819,7 +1821,8 @@ long sbbs_t::showposts_toyou(uint subnum, post_t *post, ulong start, long posts,
if(!found) if(!found)
bputs(text[MailOnSystemLstHdr]); bputs(text[MailOnSystemLstHdr]);
found++; found++;
bprintf(text[SubMsgLstFmt],l+1 bprintf(P_TRUNCATE|(msg.hdr.auxattr&MSG_HFIELDS_UTF8)
,msghdr_text(&msg, SubMsgLstFmt),l+1
,(msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP ,(msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from ? text[Anonymous] : msg.from
,msg.to ,msg.to
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment