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 09a87ec7 authored by rswindell's avatar rswindell

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
......@@ -142,7 +142,8 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
if(loadmsg(&msg,mail[smb.curmsg].number) < 1)
continue;
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
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP ? text[Anonymous]
: msg.from
......@@ -489,12 +490,14 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
continue;
smb_unlockmsghdr(&smb,&msg);
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
,mail_listing_flag(&msg)
,msg.subj);
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
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from
......@@ -660,12 +663,14 @@ void sbbs_t::readmail(uint usernumber, int which, long lm_mode)
continue;
smb_unlockmsghdr(&smb,&msg);
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
,mail_listing_flag(&msg)
,msg.subj);
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
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from
......@@ -828,12 +833,14 @@ long sbbs_t::searchmail(mail_t *mail, long start, long msgs, int which, const ch
bprintf(text[MailWaitingLstHdr], order);
}
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
,mail_listing_flag(&msg)
,msg.subj);
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
: (msg.hdr.attr&MSG_ANONYMOUS) && !SYSOP
? text[Anonymous] : msg.from
......
......@@ -74,7 +74,8 @@ long sbbs_t::listmsgs(uint subnum, long mode, post_t *post, long i, long posts,
smb_unlockmsghdr(&smb,&msg);
if(listed==0)
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)
? text[Anonymous] : msg.from
,msg.to
......@@ -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)) {
if(!found)
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.from
,msg.to
......@@ -1819,7 +1821,8 @@ long sbbs_t::showposts_toyou(uint subnum, post_t *post, ulong start, long posts,
if(!found)
bputs(text[MailOnSystemLstHdr]);
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
? text[Anonymous] : msg.from
,msg.to
......
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