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