quoteflt_dummy() usage: FIX usage without preceeding _reset() (Jürgen Bruckner)
[s-mailx.git] / TODO
blobb3ed5e9b1766bd44b5751de2d83de42d152f293c
1 TODO reminder.
3 Rename S-nail to S-mailx in v15.0, change things i've messed with
4 a single, massively backward incompatible change.
6 Release S-mailx v20 on 2020-03-25, the 42nd anniversary of BSD Mail.
7 With a clean, conforming and efficient codebase, then.
9 In general the code is in a pretty bad shape due to the signal handling.
10 I should have sat back in 2012/13 and consider what i am doing.
11 My fault.  If i would, we would have a blocked signal mask anywhere in
12 this software except in a few cases where it is necessary and/or
13 possible to deal with signals, and possibly we would not even have to
14 consider to switch the entire codebase to (the much superior, and the
15 only sane approach) SysV signal handling, without SA_RESTART.
17 But some things are already pretty good, except for normal iterations
18 and a review once we have a better signal handling, and can be taken
19 with us.  For example termcap.c, most of tty.c, shexp.c, memory.c.
20 It all has to be converted to use a m_ prefix and follow the coding
21 style of the mentioned.  Note n_(UN)?LIKELY() usage is yet a bit weird,
22 we should not use it for entire conditions but instead repeat its use
23 for each subcondition.
25 - We should have generic ENOMEM conditions, now that we have $!.
26   I.e., test overflow (e.g., nam-a-grp.c, whether an alias _can_ be
27   created / extended), like n_ENOMEM_CHECK(INTTYPE, SIZE1, SIZE2, NULL
28   or message), which returns m_bool (now bool_t).
29   Callers need to be aware of NULL returns and pass through errors,
30   then.
32 - We need a "void" box that can be jumped to, i.e., a state in which no box
33   at all is active.
35 -- When a MBOX mailbox is removed while it is opened then changing the
36   folder is not possible.  This is an inherent problem of the Berkeley
37   Mail codebase, and we need to have a fully functional intermediate
38   VOID box mechanism plus an object-based mailbox implementation to
39   overcome it.
41 -- Also, when the folder was modified concurrently we should bail, or,
42    in an interactive session, prompt the user what to do.
44 - IDNA decoding.  Needs a complete design change.
45   (Unless wants to brute force decode anything before display, of course.)
47 - If pipes fail for part viewers then at least the usual PART X.Y should be
48   shown, maybe even including some error message.
49   I had 'set pipe-text/html="lynx -dump -force_html /dev/stdin"' but NetBSD
50   does not have lynx(1), and i thought i've found a S-nail(1) bug.
52 - It would be nice if it would be possible to define a format string for
53   *quote*, like 'set quote="format=some formats"'.
55 - Line editing should gain possibility of context sensitive tab completion.
57 - Maybe there should be an additional ZOMBIE directive that is served in
58   equal spirit to DEAD, but that could be a valid MBOX... ?
59   What i want is a *real* resend, best if possible from command line.
60   Meaning, also the possibility to postpone a message.  In general.
62 - Having a newsreader would be a really cool thing.  (RFC 977 and 2980)
64 - printhead()/hprf(): support %n newline format (%t tab?).
65   Make it possible to use the *datefield* algorithm for plain From_ derived
66   dates (needs a From_ parser, i.e., strptime()-alike).
67   Once we have that, rename *datefield-markout-older* to
68   *date-markout-older* ??
69   Note that NetBSD's mail(1) has some other nice things.
70   Note also that our code is quite unflexible.
72 -- NetBSD's mail(1) has nice *indentprefix* and *indentpostscript*
73    variables (though prefix and appendix or prefix and suffix, but..).
74    Note that our code is quite unflexible.
76 - headerpick: add resend-retain/ignore!  (Ralph Corderoy, Norman Shapiro)
77         (Delivered-To thread on nmh.  Will be hard to do because of
78         codepaths!)
80 - -r should be the Sender:, which should automatically propagate to
81   From: if possible and/or necessary.  It should be possible to suppress
82   -r stuff from From: and Sender:, but fallback to special -r arg as
83   appropriate.
85 Low-Level
86 ---------
88 - Improve name extraction rules.  And field parsing.  There
89   are structured and unstructured fields.  There are quoted pairs and
90   comments etc.  Rewrite the entire parsing mechanism to comply to RFC
91   5322, and try to merge all those many subparsers around in the codebase,
92   and accordingly.  So much duplicated work ...
93   Name parsing has been improved a bit for v13, but it's still broken.
94   yankword(), *extract(), etc.: RFC 5322 says that comments in address
95   fields SHOULD NOT be used (mutt(1) maps them to full name-addr forms if
96   approbiate, even if that actually changes content!!?), and that full
97   name-addr SHOULD be used.  Our functions are yet quite silly (i.e.,
98   leading comments remain, as in "(bier2) <a2@b2.de>", unless the address
99   doesn't come in angle brackets, trailing go away, as in "<a6@b6.de>
100   (bier6)", that becomes "<a6@b6.de>").
101   Something silly like
102     (co$mm1) abc@däf.de (cö,mm,2)   ('c'o"m"m.3)
103   Should eventually become
104     co$mm1 cö,mm,2 'c'o"m"m.3 <abc@xn--df-via.de>
105   on the display, or, with IDNA decoding (and thus rather unlikely)
106     co$mm1 cö,mm,2 'c'o"m"m.3 <abc@däf.de>
107   It should NOT become this mutt(1)ism:
108     "co$mm1 cö,mm,2 'c'omm.3" <abc@däf.de>
109   Or?
111 - many uses of whitechar() should be spacechar(), and spacechar() should
112   be blankspacechar(), and blankspacechar() should be dropped.  then
113   drop onlywhitechar() again, too.  maybe reduce char_class bits then.
115 - In v15.0, when we can address attachments of a message individually,
116   it would be nice to provide even more access, just like nmh(1) does
117   (Johan Commelin: Are s-nail and mh related?).
119 - I never used anything but the *datefield* option, and it would really be
120   nice if the date strings would be parsed off into some 16 byte or what
121   storage when about to producing the summary, so that it would be directly
122   available and there would be no need to reread the mail.  Moreover, or
123   even more than that - the m_date field exists and should possibly simply
124   be init, at least in these cases.  (P.S.: this doesn't contradict the
125   statement somewhere else in this file that the structure should be
126   slacked; simply use multiple thereof or so)
128 - After I/O layer rework we should optionally be able to read RSS
129   (Atom?) feeds -- Expat should be available almost everywhere and
130   should be able to parse that?
131   Atom is harder because it may support html+.
132   I mean, yeah, it's stupid, but we could fill in header fields with
133   dummies and still use S-nail to look into the separated feeds as if
134   they were mail messages; anyway i would like to save me from using too
135   many tools -- three seems reasonable.
137 -- `sync'hronize commando -- robin@stjerndorff.org (Robin Stjerndorff):
138     Wondering how to update back to my Maildir, moving new read mails
139     in ~/Maildir from new to cur, without exiting the application.
140     Automation available?  [And simply re-`[Ff]i' involves a lot of
141     unnecessary work]
143 -- Provide sync'ing options -- Jacob Gelbman <gelbman@gmail.com>:
144     If I open two instances of mailx, I then delete a message and then
145     quit in one. Then in the other one I read a message and quit, mailx
146     saves the status of the read message and the fact that a message was
147     deleted, even though it was opened before the other instance deleted
148     it. How is it doing that?  [Of course he was using Maildir]
150 - Add TODO notes for those RFCs:
151   RFC 977 -> 3977 - Network News Transfer Protocol
152   RFC 1036 - Standard for USENET Messages
153   RFC 1524 - True support for mailcap files?
154     TODO YES!  We really need to replace the pipe-TYPE/SUBTYPE mechanism
155     with something real.  When we can work on the parsed MAIL DOM.
156   RFC 1939 - Post Office Protocol v3
157   RFC 2017 - URL External-Body Access-Type
158   RFC 2183 - The Content-Disposition Header
159   RFC 2369 - The Use of URLs as Meta-Syntax for Core Mail List Commands
160              and their Transport through Message Header Fields
161              (RFC 6068 - The 'mailto' URL scheme)
162   RFC 2384,1738 - I.e., Much better URL support
163   RFC 2387 - multipart/related  -- yet handled like /alternative
164   RFC 2392 - Content-ID and Message-ID Uniform Resource Locators
165   RFC 2405 - The format of MIME message bodies.
166   RFC 2406 - Common multimedia types.
167   RFC 2407 - Encoding of non-ASCII text in message headers.
168   RFC 2449 - POP3 Extensions (including SASL)
169   RFC 2595 - TLS for POP3 (among others)
170   RFC 2980 - Common NNTP Extensions
171   RFC 3156 - MIME Security with OpenPGP
172   RFC 3207 - SMTP over TLS
173   RFC 3461, 3464 -
174     Simple Mail Transfer Protocol (SMTP) Service Extension for Delivery
175       Status Notifications (DSNs),
176     An Extensible Message Format for Delivery Status Notifications
177   RFC 3676 - Updates to the text/plain MIME type and extensions for flowed
178     text (format=flowed).   (Martin Neitzel)
179   RFC 4422, 4505 - Simple Authentication and Security layer (SASL)
180             (Tarqi Kazan)
181   RFC 4880 - OpenPGP Message Format
182   RFC 4954 - SMTP Authentication
183   rfc5198.txt Unicode Format for Network Interchange
184   RFC 5246 - Transport Layer Security (TLS)
185   RFC 5321 - Simple Mail Transfer Protocol.
186   RFC 5322 - The basic format of email messages.
187   RFC 5598 - Internet Mail Architecture
188   RFC 5751 - Secure/Multipurpose Internet Mail Extensions (S/MIME)
189     TODO NOTE that our S/MIME support is extremely weak regarding
190     TODO understanding, we should not rely on OpenSSL but instead
191     TODO handle it ourselfs; the RFC says:
192     S/MIME is used to secure MIME entities.  A MIME entity can be a sub-
193        part, sub-parts of a message, or the whole message with all its sub-
194        parts.  A MIME entity that is the whole message includes only the
195        MIME message headers and MIME body, and does not include the RFC-822
196        header.  Note that S/MIME can also be used to secure MIME entities
197        used in applications other than Internet mail.  If protection of the
198        RFC-822 header is required, the use of the message/rfc822 media type
199        is explained later in this section.
200   RFC 6125 - Representation and Verification of Domain-Based Application
201     Service Identity within Internet Public Key Infrastructure Using
202     X.509 (PKIX) Certificates in the Context of Transport Layer Security
203     (TLS)
204   RFC 6152 - SMTP Service Extension for 8-bit MIME Transport
205   RFC 6409 - Message Submission for Mail
206   rfc6530.txt Overview and Framework for Internationalized Email
207   rfc6531.txt SMTP Extension for Internationalized Email
208   rfc6532.txt Internationalized Email Headers
209   rfc6854.txt Update to Internet Message Format to Allow Group Syntax in
210     the "From:" and "Sender:" Header Fields
211   rfc6855.txt IMAP Support for UTF-8
212   rfc6856.txt Post Office Protocol Version 3 (POP3) Support for UTF-8
213   rfc6857.txt Post-Delivery Message Downgrading for Internationalized
214     Email Messages
215   rfc6858.txt Simplified POP and IMAP Downgrading for Internationalized Email
216   RFC 8058 Signaling One-Click Functionality for List Email Headers
218   draft-ietf-uta-email-tls-certs-01.txt
219    SMTP security via opportunistic DANE TLS draft-ietf-dane-smtp-with-dane-15
220   draft-melnikov-smime-header-signing
221    Considerations for protecting Email header with S/MIME
222   Read https://tools.ietf.org/html/draft-ietf-uta-tls-bcp-07.
223     Can we implement OCSP (see RFC 6066; -> RFC 6960)????
225 - This is how the codebase has to be reworked in respect to signals and
226   jumping:
228   1. We introduce some environment/carrier structs: struct eval_ctx,
229      struct cmd_ctx, (struct send_ctx).  All of these form lists.
230      eval_ctx gets a new instance every time evaluate() is entered; for
231      the interactive mode, commands() instantiates an outermost eval_ctx
232      that "cannot be left".
234      cmd_ctx knows about the eval_ctx in which it is was created; it is
235      created for each command that has an entry in cmd_tab and is passed
236      as the new argument of these kind of functions.
237      (send_ctx is the carrier for the MIME and send layer rewrite.)
238   2. cmd_tab handling becomes more intelligent: add bit fields so that
239      for some arguments (i.e., the first two or three) automatic
240      normalization can be specified, like whitespace trimming, like
241      automatic expansion of variables etc.  For getrawlist.
242      It knows about the short synopsis and longer help of its program.
244       - and: commands that work only in interactive mode, and are
245         _silently_ ignored otherwise (no error).
246         I.e., commands which work on only with true user interaction
247         should not need to take care no more, but simply assume that
248         there will be true user interaction.  And like that.
250      E.g., customhdr header field is always to be WS trimmed, just the
251      same as the body.  shortcut at least should have trimmed name, etc.
252      To do that right, properly parse from left to right, take care
253      about backslash escaping, and (optionally) expand shell variables
254      and backtick substituations.
256      The cmd_ctx needs to carry around the cmd_tab structure so that the
257      commands can themselves print the synopsis in case of errors --
258      alternatively we need a return bit which should cause the command
259      callee to emit the synopsis as an error message, whatever is best.
260      Some (hopefully) duplicate occurrances of such strings can vanish.
261   2.1 We have some commands which offer "show" subcommands.
262       Those should only work in interactive mode OR SO.
263       This could be done with a flag, too.  (Driven from the lexer.)
264   X. Offer a central "`[un]onevent' EVENT MACRO [conditions]" register.
265      Change all hooks to use that one, optimize the case where a single
266      macro is registered for a single event but with different
267      preconditions.
269      E.g., "on_interactive_mode_enter" could then be hooked to call
270      `bind' and set `colour's, for example.  In conjunction with 2.
271      above those commands could simply be (silent, successful) no-ops
272      before we reach that state (and again after
273      on_interactive_mode_leave is processed).
275   X.x We should make the message accessible at least a bit on macro level.
276       I.e., so that message specification checks can be applied on the
277       macro level, as in
278         if `message match-spec '@~t@bank.com'`
279           set smime-sign customhdr='X-BlahBlahBlah:Banks are monsters'
280         endif
281       where `message' (or so) would refer to the currently active
282       message (in compose mode) or the "dot" (otherwise).
283       `message' would gain some keywords.  Something like that.
284       `~^' for compose mode is a starter, but we need such access from
285       the top level, too.
286   8. The line buffer used in evaluate() that is passed through to
287      commands (thus: in cmd_ctx, then) needs to become `const'.
288      (I tried to do so in the past, but some commands write into it,
289      thus i stopped and iirc even added some changes on my own which
290      take favour of reusing that buffer.)
291      + Macro execution then no longer needs to clone the macro content
292      lines before executing then.
293      + The command context also takes preparsed command array if so
294      specified in cmd_tab, and entries are cleaned up (see 2.)
295   9. We should unite all the un*() commands with their non-un*
296      versions, if they have one.  They may take a different argument
297      list etc., but only one entry in the command table for such.
298      - The POSIX standard command abbreviations must remain, so maybe
299        outsource those in a hashtable or whatever that is checked first,
300        but detach command table order from that anyway.
301      - Offer a(n optional, and on/off switchable) Damerau-Levenshtein
302        mode for command completion;
303  10. We MUST switch the entire codebase to use SysV signal handling, don't
304      do the BSDish SA_RESTART, which is why we still suffer the way we
305      do and need jumps.  I can't dig BSD signal handling, and never ever
306      did so myself until i got here.
307  20. The attachment charset selection loop can then be rewritten to
308      check whether an ^C occurred and treat that as end-of-loop
309      condition.  In v14.6.3 this was introduced, but it should act
310      differently depending on whether the interrupt occurred during
311      character set selection or attachment filename input.
312      Also in respect whether the interrupt is "propagated" or not.
313      It's ugly, and documented accordingly.
314  30. Mail protocols and mail messages are accessed through a "VFS".
315      URL should then support file:// and maildir:// etc.  Update manual!
317      . It should be considered to drop many variables in favour of
318        ?SEARCH usage for keys, or key=value pairs, e.g.
319         smtp://exam.ple?starttls=yes;smtp-hostname=;
320        etc.   USER@HOST is neat, but that is possibly preferable?
321        We could then also extend *mta* and drop *smtp* as such, e.g.,
322        mta=smtp://dSDAS, mta=builtin://XZ, mta=bltin://XZ.
323        Question: what is with smtp-hostname and such??
324  31. Flag updates of individual messages must find their way through to
325      the protocol.
326  32. Use deque (on partial views).
327  34. We need a new abstraction: `vie[ws]'.  I.e, viewset, viewclear,
328      view(show|look)?  We will have (possibly readonly) boxes, a summary
329      cache file, which is created when a mailbox is read in, and all
330      that crap that we currently have (setptr(), setmsize(), etc.!) must
331      vanish.  Instead there is another, in-memory abstraction, the view.
332      Some views are built-in and are somehow selectable (the "all" view,
333      for example, and the "new" view).
334      It is possible to make a view persistent by giving it a name, e.g.,
335      'viewset NAME MSG-SPEC' -- 'viewset allnew :n' (and 'viewset XY `'
336      or something must be capable to tag the last a.k.a current).
337      Switching to a named view would thus look over the entire current
338      view (!) for all messages that comply to the message-spec of the
339      view, then create a sorted/threaded display of that subset and
340      create a new anonymous "result" view.  It must be possible to
341      specify that a view is to be applied to the entire mailbox instead
342      of the current view, via a simple easy understandable syntax.
344      Or name it "msgset".
345      We won't extend macros that much because it would require much too
346      much logic for no purpose, instead we'll (hopefully) add some
347      scriptable abstraction, with an optional built-in Lua binding.
348      E.g., it would be too complicated to create a language to access
349      individual message parts (headers etc.), add error handling etc.
350      Better to make it all directly accessible via language binding, and
351      offer commands which relinquish execution to such a binding, maybe
352      even with some arguments, as in "? lua ARG" - it should be possible
353      that ARG is a msgset, then.
354      On the other hand, ~^ text-protocol stuff isn't that bad, and if
355      a text-protocol command mode could be added, that would be cool.
356      Even things like 'create temporary file', write data until EOT in
357      descriptor / temporary file / etc. and such!
359      But what macros should be able to do is iterating over such
360      a msgset / view, as in
361         msgset create NAME :SPEC:
362         msgset add NAME :SPEC:
363       and then either
364         for[-each] NAME
365           normal-cmd SOMEHOW-REFER-TO-ITER
366           if SOMEHOW-ACCESS-LAST-STATUS
367           endif
368         endfor
369       as well as
370         msgset cmd NAME normal-cmd
371       and even
372         normal-cmd NAME
373       in which case NAME should simply be treated as a SPEC, likely that
374       this requires a new trigger, though, e.g. {NAME}, [NAME] or !NAME...
375       I.e., the new namelist (likely a deque) should contain MsgRef
376       objects which point to a Message and a Mailbox (for cross-mailbox
377       msgset's and without the need for a Message to store a pointer to
378       the owning mailbox?  Or make MsgRef a superclass that may have
379       a subclass which offers such cross-refs).
381  50. Support SASL, unite all GSS-API etc. under an abstraction!
382      Maybe even drop direct GSS-API and support only through SASL.
383      That is, we can very well provide our own little SASL-client
384      abstraction with what we have already by simply defining some
385      "readline" abstraction plus struct ccred for use by the
386      authentication layer: the protocols must set it up by passing in
387      a line of authentication mechanisms and a callback mechanism.
388      Possibly the user should be able to permit or forbid automatic
389      selection of GSS-API (to avoid useless round-trips) etc. etc.
390  80. The MIME rewrite: mime_parser <-> mime "DOM" analyzer <->
391      selectively create filter chains per part and do XY.
393      This also affects sending, and it will allow us to dig MIME
394      (multipart) mail for -t/-m _correctly_.  Also in sofar as we can
395      hook a content-decoder before diving into the MIME structure, and
396      with a DOM, we can re-encode such things properly as we (re)send
397      such mails.  All this is wrong at the time of this writing!
398      We still need to special treat things like, e.g., RFC 2046, 5.2.1.
399      But on top of we-can, as opposed to the opposite.
401     (Brezn Stangl, brezn DOT stangl AT yandex DOT com)
402  99. Now i'm dreaming some more: with the new object-based approach
403      multiple mailboxes could be in an open state.  And it should be
404      possible to do so for the user (`file' and `folder' are required to
405      quit the current mailbox [first -- this not yet]), which is why we
406      either need new trigger characters or new commands.
407      The absolute sensation would be joinable operations over multiple
408      open mailboxes, e.g., views over multiple such!
409 100. If i say `p 3 2 1' then i mean `3 2 1' not `1 2 3'.
411 - The thread sort doesn't get
413     [A is deleted]
414     B answers A
415       C answers B
416       D answers B
417     E is unrelated
418     F answers A
420   The current sort fails to recognize that F and the thread starting at
421   B are related, which results in a mess.
422   Tests: 41.bad-thread, 58.bad-thread ..
424 -- Being able to sort the outermost level of threads was a suggestion
425    of Rudolf Sykora, especially being able to sort the outermost level
426    according to the date of the newest message in a thread.
428 - Drop **use-starttls* in favour of something better: support 'auto',
429   'no' and 'yes' and act accordingly.  For the former be smart enough on
430   the protocol side.  (RFC 3207 describes man-in-the-middle attacks due
431   to 'auto' TLS, so explicit 'yes' should be favoured).
433 - NOTE: we do not really support IPv6 sofar in that we are not prepared to
434   deal with IPv6 addresses (as in '[ADDR]:PORT').  Pimp url_parse().
435   And socket I/O.
437 - I had a connection collapse during a POP3 download, and neither was
438   there a chance to get access to the 22 yet downloaded mails (after
439   five minutes of waiting followed by CNTRL-C), nor did the layer
440   recognize this very well (got myriads of `POP3 connection already
441   closed.' messages, btw., the thirty-something messages which were not
442   yet downloaded caused (after CNTRL-C) this: ETC. ETC.
444 - I got an email in base64 that obviously used CRNL line endings, and once
445   i've replied the CR where quoted as *control* characters.
446   Get rid of those (kwcrtest.mbox; may be hard to do everywhere for some
447   time, due to how we deal with I/O and Send layer etc).
449 - edit.c doesn't do NEED_BODY (but IMAP won't work anyway).
451 - Stuff
452   .. s-nail </dev/null should work interactively when STDERR_FILENO is
453     a terminal!  (Built-in editor; how do editline and readline work?
454     should this be documented?  What does NetBSD Mail do?  Should we NOT
455     be interactive??  POSIX says for sh(1) (APPLICATION USAGE): 'sh
456     2>FILE' is not interactive, even though it accepts terminal input.)
457   . Just like the RFC 3676 link above, it would be nice if it would be
458     somehow possible to recognize links in a document; i don't know yet
459     how this could be achieved without loosing formatting information (i
460     mean, we could enable this and inject terminal colour sequences, but
461     one should be able to say 'follow link x', starting an action
462     handler, and the 'x' must come from somwhere - simply injecting
463     '[NUMBER]' references distorts visual).  Anyway, it's just a filter
464     that recognized the usual <SCHEME:/> stuff, and of course we can
465     simply have a buffer which records all such occurrences, so that
466     user can say '? xy NUMBER', but without the context it soon gets
467     hard.
468   . TTY layer: the tc*() family may fail with EINTR, which MUST be
469     handled; setting also generates SIGTTOU when we're not in foreground
470     pgrp, so we better deal with all that and ENSURE WE GET THROUGH when
471     resetting terminal attributes!
472   .. TTY "I guess it would be much better to create our own session via
473      setpgid(2) and then tcsetpgrp(3) any processes we run synchronously,
474      and properly deal with SIGTTOU, but it always has been like that and
475      i won't do that before other things have been changed.
476   .. NOTE: TTY: place (at least n_child_run()) childs which go over
477      terminal into own group.
478      Introduce global "terminal state" manager which tracks who
479      currently owns the terminal, so that we can gracefully switch it
480      on/off, check in main loop whether restore is necessary.
481      It that can deal with multiple "windows" then we could have open
482      multiple of those, i.e., multiple PAGER instances, and non-PAGER
483      instances (fflush() if there is FILE before switch off).
485      TTY thus: "needsterminal" could be driven gracefully EVEN IF
486      a PAGER is open because the current user action is "print*", since
487      we KNOW that there is a PAGER and can temporarily lay it down to
488      sleep, fflush()ing/adjusting as necessary, and wake it up again
489      afterwards (or, with some work, gracefully shut it down if ^C ^C).
490      This is of course also true for user questions ("really display
491      part XY?", "need decryption password:", etc.!!!)!!
492   . Remove all occurrences of mbtowc() with mbrtowc(); temporarily add (some)
493     global mbstate_t objects until the send / MIME layer rewrite is done and
494     has the carrier.  Use flip states and add aux funs with only update the
495     state+toggle on success -- CURRENTLY MBTOWC FAILURES ARE PRACTICALLY NOT
496     HANDLED!!
497     P.S.: the standards do not allow that well at all.
498     Since we work so much with *ttycharset* we would need
499     a setlocale_from_charset(), but which does not exist (except
500     implicitly for UTF-8 locales).  But we need char classification!
501     This task up to S-CText.
502   . pop3,mime_cte +++: \r,\n -> \015,\012, to avoid ANY problems..
503     Maybe our passed carrier should pass desired output newline (as
504     opposed to data-embedded newlines)
505   . which_protocol(), *newmail* mechanism, displayname, mailname: all of
506     this <rude>SHIT</rude> must vanish and be replaced by a URL, and
507     a nice "VFS" mailbox object that carries all necessary state so that
508     one can work with it.
510     If not mentioned somewhere else: struct message should be splitted
511     into a tree of objects, with a base class that has as few fields as
512     possible; the global *message should be a deque, only accessible via
513     iterator; it should store pointers to (the actually used subtype of)
514     message structures instead; i.e., for maildir boxes the path is yet
515     allocated separately, then it could be part of the message object,
516     etc.
517     It should contain a ui8_t that tracks the number of contained parts,
518     so that the "fits-onto-the-screen" tests are more useful than today;
519     i think 8-bit is sufficient, with 0xFF meaning more-than-fits-here.
520   . Given how many temporary files we use, it would make sense to
521     support a reusable single temporary file, as in singletmp_take() and
522     singletmp_release(), where singletmp_release() would close and thus
523     drop the file if it excesses a specific (configurable) size, and the
524     mainloop tick would close it (after X (configurable) unused ticks))
525     otherwise.  I guess this would improve performance for searching
526     etc. etc.
527   . _(), N_(), V_():
528     use GNU tools for extraction etc., and write a simple helper program
529     which converts these files to a serialized hashmap, just like we did
530     for the okeys (and *exactly* so); add a config check whether the ({})
531     extension is supported and finally use that for some ({static char
532     const *tr_res;}) injection optimization, then.  (Think SFSYS)
533   . Searching body/text yet includes headers from attachments and
534     attachment data.  This is shit.  :)
535   . The "nifty" unregister_file()->_compress() mechanism that even
536     shovels '-Sfolder=imaps://user1@localhost -Srecord="+Sent Items"'
537     *records* calls clearerr() on the descriptor before performing it's
538     action anyway.  when we really make it even to the I/O rewrite, it
539     should be possible to dis-/allow such -- it doesn't make sense to
540     add something faulty to whatever was not faulty before!
541   . `dp' prints EOF at the end of a thread even if unread messages
542     follow
543   . `resend' doesn't smime-sign.
544   . Really do extend the test already today; test S/MIME
545     signing/encryption/decryption with two pairs of identities, instead
546     of of one.
547   . RFC 5751 describes a message multipart layout that also includes the
548     headers in the signature; it would be nice (for completeness sake)
549     to be able to support that.  Note shutup@ietf.org.
550   . The capability to save a message under the name of a recipient is in
551     the standard etc., but i've never used it.
552     What would be cool, otoh, would be if there would be the possibility
553     to register a regular expression, and if just *any* recipient of
554     a message matches, store the message in the given folder instead.
555     I.e., if i send a message to s-nail-users@ then i most likely want
556     to get a copy to the corresponding box, regardless of whoever the
557     message was sent To: Cc: or Bcc: else..
558   . mutt list handling (`~') is very powerful
559   . We have some use of *at() functions, especially anything which
560     temporarily switches cwd.
561   . *newmail* is terrible.  At some later time we need to do somethings
562     with timeouts etc. (for MBOX and Maildir it's not that bad, but for
563     anything over the network, yet the mentioned may come in over NFS).
564     Remove it until we have something better?
565   . The RFC 3798 *disposition-notification-send* mechanism is yet not
566     truly conforming (and works with *from*).  Also, this is only the
567     sender side, there should be support for creating the MDN response.
568     (Maybe ternary option: off (default),
569     create-when-unread-flag-goes-away, ditto-but-also-strip-header)
570   .. Also, there is DSN as a SMTP extension, see the RFCs 3461, 346 (as
571      above) and 6522 (Wikipedia).
572   . The var_* series should return "const char*" not "char*".
573     This should already work today because otherwise we would get SEGV
574     all through the way.
575   .. While here: rename enum okeys to enum internal_variables, and the
576      ok_*() series to iv_().  And see below for env_*() series.
577   . fexpand() the 2nd: it should return structure because we need to
578      check for FEDIT_SYSBOX, which currently only checks whether the first
579      character of a file name is '%', not whether it is '%', '%:FILEPATH'
580      or '%VALIDUSER', because that is impossible to do!
581   . On the long run in-memory password storage should be zeroed after
582     use, possibly even encoded *during* use.  After v15.
583   . We need a `spamcheck' command that is like `spamrate' but updates
584     the mail in-place, i.e., with the headers that the spam engine adds.
585   . __narrow_suffix() is wrong (for stateful encodings that we
586     don't support yet) and should inject a reset sequence if it shortens
587     the string.
588   . When a user edits a specific header, it should no longer be
589     modified.  (Do not loose knowledge that collect() edited it.)
590   . Regular expression list resorting is no good; the user should be
591     able to specify a match order weight, as in:
592       mlist 10 a@b.org 8 c@d.org .*@else@org 0 almost@never.com
593     So: optional digit 0-10, where 0-4 are never relinked and always
594     placed at the tail, 6-10 are never relinked and always placed at
595     head (all in decreasing order, head to tail), and 5 is the implicit
596     value, placed in between and automatically resorted just as is the
597     sole algorithm we currently have.
598   .. And maybe we should have an event mechanism with one-shot etc..
599      Then install a resorter function when we actually have lookups and
600      one-shot sort the entire thing once (when the loop ticks).
601      Instead of busy resorting, that is.
602   . The new internal ~/$ expansion mechanism should get support
603      for POSIX parameter expansions ${[:]-} and ${[:]+} (and ${[:]?}).
604      There is no real way to get the functionality otherwise...
605   . Make S/MIME an option separate of SSL/TLS, i.e., optional.
606   . With very long input Heirloom mailx(1) / S-nail(1) can produce
607     encoded-words (RFC 2047) with incomplete multibyte sequences (i.e.,
608     non self-contained encoded-words).
609   . Group addresses, especially the undisclosed recipients but also
610     "Bla": addresses; are missing.
611   . Cleanup:  mx_ is anything public / external,
612     mx__ is public/e but not really, FILENAME/ABBREV_symbol are statics,
613     FILENAME/ABBREV__symbol are helpers of a single other static
614     (function group) (-> colour.c, lex_input.c: done).
615   . Per-folder (S/MIME) en- and decryption key (Tarqi Kazan): if a xy
616     variable is set (that points to a key) add a transparent en- and
617     decryption layer on top of any per-message operation (for boxes for
618     which the variable is set).
619   . For v15.0: remember private thread with Tarqi Kazan (2015-05) and
620     try to improve situation with *record*, so that only messages enter
621     it which have really been sent.  If we support postponing and have
622     a multi-process layout and add an intermediate *record-queue* we
623     may be able to improve the situation.
624   . [Dd]ecrypt should transport decryption errors, not silently be like
625     copy and copy undecrypted content, because this is what it's for?
626     ..We need atomic operations with rollback support in order to make
627       this happen, but i think maybe file truncation (decryption always
628       appends?) is enough provided that files are locked?
629       WE NEED ATOMIC OPERATION SUPPORT for quite some operations.
630       Man, are we far from that.
631   . `pipe' is total shit regarding MIME.  We need some defined and
632      documented method to configure which parts are displayed and/or how
633      they are visually separated.
634   . The new n_err() facility is nice, but we need n_msg() too, maybe
635     more.  Maybe à la Log:: and macro wrappers with priority unrolled,
636     then add user-settable treshold, too.  Btw. C99 adds vararg macros.
637     .. We must handle embedded newlines properly
638     .. In PARTICULAR we MUST NOT use stdout when in batch mode:
639          ssh X "echo 'move * |cat' | s-nail -#f %" >> download
640        should do the right thing, but can't like that due to unwanted
641        noise in the stdout output!  Best would be if it would be
642        possible to explicitly define a file/dev to be used, but falling
643        back to stderr in batch mode otherwise. (think S-Web42)
644   . Exit status handling is sick.
645   . *mime-allow-text-controls* is a no-brainer: instead we should
646      introduce something that allows us to switch and detect UTF-16 once
647      we run into the problematic situation, then start all over in an
648      Unicode mode?  I.e.: continue to force the user to set such
649      a switch, but do it in a sensible fashion, because the UTF-16 data
650      stream may nonetheless contain control characters??
653   . We can "steal" features from msmtp(1) that make sense: SOCKS support
654     (primitive) and /etc/aliases ($mta_alias_file).  At least postfix(1)
655     supports file and pipe addressees in the latter...  It also
656     supports include files via :include:/filename but which i think
657     should be supported in a second step.  Ditto caching (timestamp
658     check and a mechanism to support/disable caching.)
662 . smime_verify(): only dump the multipart that is signed into the file for
663   verification purposes.  DOCUMENT that only the FIRST such part is verified.
664   Ditto, we don't decrypt but on toplevel.  Sic.
666 . convert iconv so that it always "places the reset sequence" i.e.
667  finalizes the string properly.  we don't do this at all right now!
669 . wysh: support a -- terminator, also in getmsglist();
670         then: `pipe' etc.: add support for wysh prefix, which uses the new
671         syntax: like this we can obsolete the ridiculous lastring() hack of nail
672         in v15!  (Stanley Lieber, Gavin Troy)
674 . -:, *mimetypes-load-control*, ?, should honour the given load order; as
675   appropriate, add a "b" for built-in!
676   It happened to me that i searched for at least 30 minutes for a bug
677   that resulted in text/plain not text/x-diff only to find out that this
678   was because of ArchLinux's /etc/mime.types!
680 . getapproval() should support a TRUM1 return, meaning "cancel",
681   to be understood as appropriate.
683 . `mbox' _can_ be made usable anywhere with yet another PS_MBOX global
684   bypass!  ditto touch,save,Save
686 . with *mime-alternative-favour-rich* it is possibly time to support GMAIL
687   style quotes, as well as class="quote" and such.
689 . We should be much smarter regarding when we allow a PAGER
690   etc. to be used, which is supposed to be a possibly useful thing in
691      $ s-nail -Scrt=0 >LOG 2>&1
693 . when doing Lreply we may ask for Reply-To:, but strip out the address
694   actively even if user said yes to the question.  That should not
695   happen?  It somehow matches the documentation however.  unsure.
697 . if -t is used and the file includes Mail-Followup-To:, then we should
698   NOT add to it, OR we need to offer a way to get there!
700 . stale dotlock files should be removed - postfix has
701   a stale_lock_time=500s variable to configure that
703 # s-ts-mode