privsep.c: and just verify the box is also in CWD (wapiflapi)
[s-mailx.git] / TODO
blob790c51b630af45ccddbd50b0b4229d8a1d64568a
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 - At least optionally disallow silent discarding of invalid addresses,
10   i.e., cause sending to be aborted if not all recipient addresses pass the
11   validity test.
13 - Ditto if a resource file can't be found that has been explicitly set via
14   environment variables there should be some feedback.
16 - We should possibly get away of using command line utilities for
17   compression.  (At least optionally?)  Instead we should link against
18   zlib(3), bz2lib(3) and lzma(3), if found.  Or we may use dlopen(3)
19   instead, if found, to avoid linking (though those libraries don't need
20   much linker work unless actually used afaik, 'should look in detail).
21   We should also drop lzw.c, it is used for the IMAP cache.
23 - We should maybe turn -~ into the meaning "force interactive".
24   We should extend cc-test.sh, then, to test some interactive things.
25   E.g., via (tcl(1) or, better.., perl(1) (CPAN)) expect.
27 - We need a "void" box that can be jumped to, i.e., a state in which no box
28   at all is active.
30 -- When a MBOX mailbox is removed while it is opened then changing the
31   folder is not possible.  This is an inherent problem of the Berkeley
32   Mail codebase, and we need to have a fully functional intermediate
33   VOID box mechanism plus an object-based mailbox implementation to
34   overcome it.
36 -- Also, when the folder was modified concurrently we should bail, or,
37    in an interactive session, prompt the user what to do.
39 - IDNA decoding.  Needs a complete design change.
40   (Unless wants to brute force decode anything before display, of course.)
42 - If pipes fail for part viewers then at least the usual PART X.Y should be
43   shown, maybe even including some error message.
44   I had 'set pipe-text/html="lynx -dump -force_html /dev/stdin"' but NetBSD
45   does not have lynx(1), and i thought i've found a S-nail(1) bug.
47 -- Also, when we run a pipe handler asynchronously there should possible
48    written something like [pipe-handler xy started] or something
50 - It would be nice if it would be possible to define a format string for
51   *quote*, like 'set quote="format=some formats"'.
52   In general the current approach is somewhat messy IMO.  I.e., it would
53   make more sense to act rather like mutt(1) and as written elsewhere in
54   this document, i.e., have some toggles that act on the display and use it
55   for multiple modes (show/reply/forward etc.)
56   Otherwise introduce commands which include all the headers plus, e.g.,
57   "hreply" or "freply", and then the ditto series, i.e., "hReply" ...
59 -- This would also mean that interactive message editing would work
60   accordingly.  PleasE!
62 - Line editing should gain possibility of context sensitive tab completion.
64 - Maybe there should be an additional ZOMBIE directive that is served in
65   equal spirit to DEAD, but that could be a valid MBOX... ?
66   What i want is a *real* resend, best if possible from command line.
67   Meaning, also the possibility to postpone a message.  In general.
69 - Having a newsreader would be a really cool thing.  (RFC 977 and 2980)
71 - There should be a variable that controls whether leading and trailing
72   empty lines of parts and/or messages as such should be printed or not.
74 - printhead()/hprf(): support %n newline format (%t tab?).
75   Make it possible to use the *datefield* algorithm for plain From_ derived
76   dates (needs a From_ parser, i.e., strptime()-alike).
77   Once we have that, rename *datefield-markout-older* to
78   *date-markout-older* ??
79   Note that NetBSD's mail(1) has some other nice things.
80   Note also that our code is quite unflexible.
82 -- NetBSD's mail(1) has nice *indentprefix* and *indentpostscript*
83    variables (though prefix and appendix or prefix and suffix, but..).
84    Note that our code is quite unflexible.
86 - It irritates me that a message with 5 visible lines but 115 header lines
87   goes through the pager, even if i have *crt=*.
89 Low-Level
90 ---------
92 - Improve name extraction rules.  And field parsing.  There
93   are structured and unstructured fields.  There are quoted pairs and
94   comments etc.  Rewrite the entire parsing mechanism to comply to RFC
95   5322, and try to merge all those many subparsers around in the codebase,
96   and accordingly.  So much duplicated work ...
97   Name parsing has been improved a bit for v13, but it's still broken.
98   yankword(), *extract(), etc.: RFC 5322 says that comments in address
99   fields SHOULD NOT be used (mutt(1) maps them to full name-addr forms if
100   approbiate, even if that actually changes content!!?), and that full
101   name-addr SHOULD be used.  Our functions are yet quite silly (i.e.,
102   leading comments remain, as in "(bier2) <a2@b2.de>", unless the address
103   doesn't come in angle brackets, trailing go away, as in "<a6@b6.de>
104   (bier6)", that becomes "<a6@b6.de>").
105   Something silly like
106     (co$mm1) abc@däf.de (cö,mm,2)   ('c'o"m"m.3)
107   Should eventually become
108     co$mm1 cö,mm,2 'c'o"m"m.3 <abc@xn--df-via.de>
109   on the display, or, with IDNA decoding (and thus rather unlikely)
110     co$mm1 cö,mm,2 'c'o"m"m.3 <abc@däf.de>
111   It should NOT become this mutt(1)ism:
112     "co$mm1 cö,mm,2 'c'omm.3" <abc@däf.de>
113   Or?
115 ++  NOTE: 'alternates' tracking happens BEFORE we enter composing, this
116     means that an account switch during message composing will NOT cause
117     reevaluation of all that very very clumy
118     elide/delete_alternates/gexpand/is_myname etc. handling.
120 - many uses of whitechar() should be spacechar(), and spacechar() should
121   be blankspacechar(), and blankspacechar() should be dropped.  then
122   drop onlywhitechar() again, too.  maybe reduce char_class bits then.
124 - In v15.0, when we can address attachments of a message individually,
125   it would be nice to provide even more access, just like nmh(1) does
126   (Johan Commelin: Are s-nail and mh related?).
128 - I never used anything but the *datefield* option, and it would really be
129   nice if the date strings would be parsed off into some 16 byte or what
130   storage when about to producing the summary, so that it would be directly
131   available and there would be no need to reread the mail.  Moreover, or
132   even more than that - the m_date field exists and should possibly simply
133   be init, at least in these cases.  (P.S.: this doesn't contradict the
134   statement somewhere else in this file that the structure should be
135   slacked; simply use multiple thereof or so)
137 - At some later time extend the logic behind -# -- it should not have
138   a current folder, but start in VOID mode (...), and unless one is
139   explicitly chosen..  We need a reliable batch mode.
140   P.S.: then drop again the special casing of /dev/null.
142 - After I/O layer rework we should optionally be able to read RSS
143   (Atom?) feeds -- Expat should be available almost everywhere and
144   should be able to parse that?
145   Atom is harder because it may support html+.
146   I mean, yeah, it's stupid, but we could fill in header fields with
147   dummies and still use S-nail to look into the separated feeds as if
148   they were mail messages; anyway i would like to save me from using too
149   many tools -- three seems reasonable.
151 -- `sync'hronize commando -- robin@stjerndorff.org (Robin Stjerndorff):
152     Wondering how to update back to my Maildir, moving new read mails
153     in ~/Maildir from new to cur, without exiting the application.
154     Automation available?  [And simply re-`[Ff]i' involves a lot of
155     unnecessary work]
157 -- Provide sync'ing options -- Jacob Gelbman <gelbman@gmail.com>:
158     If I open two instances of mailx, I then delete a message and then
159     quit in one. Then in the other one I read a message and quit, mailx
160     saves the status of the read message and the fact that a message was
161     deleted, even though it was opened before the other instance deleted
162     it. How is it doing that?  [Of course he was using Maildir]
164 - Add TODO notes for those RFCs:
165   RFC 977 -> 3977 - Network News Transfer Protocol
166   RFC 1036 - Standard for USENET Messages
167   RFC 1524 - True support for mailcap files?
168     TODO YES!  We really need to replace the pipe-TYPE/SUBTYPE mechanism
169     with something real.  When we can work on the parsed MAIL DOM.
170   RFC 1939 - Post Office Protocol v3
171   RFC 2017 - URL External-Body Access-Type
172   RFC 2183 - The Content-Disposition Header
173   RFC 2369 - The Use of URLs as Meta-Syntax for Core Mail List Commands
174              and their Transport through Message Header Fields
175              (RFC 2368 - The mailto URL scheme)
176   RFC 2384,1738 - I.e., Much better URL support
177   RFC 2387 - multipart/related  -- yet handled like /alternative
178   RFC 2405 - The format of MIME message bodies.
179   RFC 2406 - Common multimedia types.
180   RFC 2407 - Encoding of non-ASCII text in message headers.
181   RFC 2449 - POP3 Extensions (including SASL)
182   RFC 2595 - TLS for POP3 (among others)
183   RFC 2980 - Common NNTP Extensions
184   RFC 3156 - MIME Security with OpenPGP
185   RFC 3207 - SMTP over TLS
186   RFC 3461, 3464 -
187     Simple Mail Transfer Protocol (SMTP) Service Extension for Delivery
188       Status Notifications (DSNs),
189     An Extensible Message Format for Delivery Status Notifications
190   RFC 3676 - Updates to the text/plain MIME type and extensions for flowed
191     text (format=flowed).   (Martin Neitzel)
192   RFC 4422, 4505 - Simple Authentication and Security layer (SASL)
193             (Tarqi Kazan)
194   RFC 4880 - OpenPGP Message Format
195   RFC 4954 - SMTP Authentication
196   rfc5198.txt Unicode Format for Network Interchange
197   RFC 5246 - Transport Layer Security (TLS)
198   RFC 5321 - Simple Mail Transfer Protocol.
199   RFC 5322 - The basic format of email messages.
200   RFC 5598 - Internet Mail Architecture
201   RFC 5751 - Secure/Multipurpose Internet Mail Extensions (S/MIME)
202     TODO NOTE that our S/MIME support is extremely weak regarding
203     TODO understanding, we should not rely on OpenSSL but instead
204     TODO handle it ourselfs; the RFC says:
205     S/MIME is used to secure MIME entities.  A MIME entity can be a sub-
206        part, sub-parts of a message, or the whole message with all its sub-
207        parts.  A MIME entity that is the whole message includes only the
208        MIME message headers and MIME body, and does not include the RFC-822
209        header.  Note that S/MIME can also be used to secure MIME entities
210        used in applications other than Internet mail.  If protection of the
211        RFC-822 header is required, the use of the message/rfc822 media type
212        is explained later in this section.
213   RFC 6125 - Representation and Verification of Domain-Based Application
214     Service Identity within Internet Public Key Infrastructure Using
215     X.509 (PKIX) Certificates in the Context of Transport Layer Security
216     (TLS)
217   RFC 6152 - SMTP Service Extension for 8-bit MIME Transport
218   RFC 6409 - Message Submission for Mail
219   rfc6530.txt Overview and Framework for Internationalized Email
220   rfc6531.txt SMTP Extension for Internationalized Email
221   rfc6532.txt Internationalized Email Headers
222   rfc6854.txt Update to Internet Message Format to Allow Group Syntax in
223     the "From:" and "Sender:" Header Fields
224   rfc6855.txt IMAP Support for UTF-8
225   rfc6856.txt Post Office Protocol Version 3 (POP3) Support for UTF-8
226   rfc6857.txt Post-Delivery Message Downgrading for Internationalized
227     Email Messages
228   rfc6858.txt Simplified POP and IMAP Downgrading for Internationalized Email
230   draft-ietf-uta-email-tls-certs-01.txt
231    SMTP security via opportunistic DANE TLS draft-ietf-dane-smtp-with-dane-15
232   draft-melnikov-smime-header-signing
233    Considerations for protecting Email header with S/MIME
234   Read https://tools.ietf.org/html/draft-ietf-uta-tls-bcp-07.
235     Can we implement OCSP (see RFC 6066; -> RFC 6960)????
237 - This is how the codebase has to be reworked in respect to signals and
238   jumping:
240   1. We introduce some environment/carrier structs: struct eval_ctx,
241      struct cmd_ctx, (struct send_ctx).  All of these form lists.
242      eval_ctx gets a new instance every time evaluate() is entered; for
243      the interactive mode, commands() instantiates an outermost eval_ctx
244      that "cannot be left".
246      cmd_ctx knows about the eval_ctx in which it is was created; it is
247      created for each command that has an entry in cmd_tab and is passed
248      as the new argument of these kind of functions.
249      (send_ctx is the carrier for the MIME and send layer rewrite.)
250   2. cmd_tab handling becomes more intelligent: add bit fields so that
251      for some arguments (i.e., the first two or three) automatic
252      normalization can be specified, like whitespace trimming, like
253      automatic expansion of variables etc.  For getrawlist.
255       - and: commands that work only in interactive mode, and are
256         _silently_ ignored otherwise (no error).
257         I.e., commands which work on only with true user interaction
258         should not need to take care no more, but simply assume that
259         there will be true user interaction.  And like that.
261      E.g., customhdr header field is always to be WS trimmed, just the
262      same as the body.  shortcut at least should have trimmed name, etc.
263      To do that right, properly parse from left to right, take care
264      about backslash escaping, and (optionally) expand shell variables
265      and backtick substituations.
267      The cmd_ctx needs to carry around the cmd_tab structure so that the
268      commands can themselves print the synopsis in case of errors --
269      alternatively we need a return bit which should cause the command
270      callee to emit the synopsis as an error message, whatever is best.
271      Some (hopefully) duplicate occurrances of such strings can vanish.
272   2.1 We have some commands which offer "show" subcommands.
273       Those should only work in interactive mode OR SO.
274       This could be done with a flag, too.
275   X. Offer a central "`[un]onevent' EVENT MACRO [conditions]" register.
276      Change all hooks to use that one, optimize the case where a single
277      macro is registered for a single event but with different
278      preconditions.
280      E.g., "on_interactive_mode_enter" could then be hooked to call
281      `bind' and set `colour's, for example.  In conjunction with 2.
282      above those commands could simply be (silent, successful) no-ops
283      before we reach that state (and again after
284      on_interactive_mode_leave is processed).
286   X.x We should make the message accessible at least a bit on macro level.
287       I.e., so that message specification checks can be applied on the
288       macro level, as in
289         if `message match-spec '@~t@bank.com'`
290           set smime-sign customhdr='X-BlahBlahBlah:Banks are monsters'
291         endif
292       where `message' (or so) would refer to the currently active
293       message (in compose mode) or the "dot" (otherwise).
294       `message' would gain some keywords.  Something like that.
295   8. The line buffer used in evaluate() that is passed through to
296      commands (thus: in cmd_ctx, then) needs to become `const'.
297      (I tried to do so in the past, but some commands write into it,
298      thus i stopped and iirc even added some changes on my own which
299      take favour of reusing that buffer.)
300      + Macro execution then no longer needs to clone the macro content
301      lines before executing then.
302      + The temporary hack which duplicates the line buffer in order to
303      place the original content in history can be removed again.
304      + The command context also takes preparsed command array if so
305      specified in cmd_tab, and entries are cleaned up (see 2.)
306   9. We should unite all the un*() commands with their non-un*
307      versions, if they have one.  They may take a different argument
308      list etc., but only one entry in the command table for such.
309      - The POSIX standard command abbreviations must remain, so maybe
310        outsource those in a hashtable or whatever that is checked first,
311        but detach command table order from that anyway.
312      - Offer a(n optional, and on/off switchable) Damerau-Levenshtein
313        mode for command completion;
314  10. We MUST switch the entire codebase to use SysV signal handling, don't
315      do the BSDish SA_RESTART, which is why we still suffer the way we
316      do and need jumps.  I can't dig BSD signal handling, and never ever
317      did so myself until i got here.
318  11. Macro execution is potentially recursive.  Meaning that
319      `undefine', etc. can occur while macros are executing.
320      The simplemost approach would be to have some recursion counter for
321      each macro and a delete_later flag that gets honoured when the
322      recursion counter gets zero.  It would be already possible to
323      immediately remove the macro from the hashtable, so that deeper
324      levels wouldn't find it anymore.  To avoid leaks (which *are*) we
325      need to have a jump location for our upcoming signal handler
326      anyway.  (Also to get rid of the temporary_localopts_free() hack.
327      + The same is true for `account's.  Here things are complicated by
328      the global `account_name', i.e., the account could be the current
329      one.
330      + That also is: redefinition of names that have yet-pending
331      deletion requests are possible.
332  12. It is annoying that you cannot `source' your MAILRC multiple times.
333      Defining a macro/account/xy should overwrite the current thing,
334      just as it does anyway for normal variables!
335      This is no different than 11. plus additional re-addition.
336      (Same exception: what if the currently active account is
337      overwritten?  Same answer, plus a message "new settings take effect
338      when account is switched to the next time".)
339  20. The attachment charset selection loop can then be rewritten to
340      check whether an ^C occurred and treat that as end-of-loop
341      condition.  In v14.6.3 this was introduced, but it should act
342      differently depending on whether the interrupt occurred during
343      character set selection or attachment filename input.
344      Also in respect whether the interrupt is "propagated" or not.
345      It's ugly, and documented accordingly.
346  30. Mail protocols and mail messages are accessed through a "VFS".
347      URL should then support file:// and maildir:// etc.  Update manual!
349      . It should be considered to drop many variables in favour of
350        ?SEARCH usage for keys, or key=value pairs, e.g.
351         smtp://exam.ple?starttls=yes;smtp-hostname=;
352        etc.   USER@HOST is neat, but that is possibly preferable?
353        We could then also extend *mta* and drop *smtp* as such, e.g.,
354        mta=smtp://dSDAS, mta=builtin://XZ, mta=bltin://XZ.
355        Question: what is with smtp-hostname and such??
356  31. Flag updates of individual messages must find their way through to
357      the protocol.
358  32. Use deque (on partial views).
359  34. We need a new abstraction: `vie[ws]'.  I.e, viewset, viewclear,
360      view(show|look)?  We will have (possibly readonly) boxes, a summary
361      cache file, which is created when a mailbox is read in, and all
362      that crap that we currently have (setptr(), setmsize(), etc.!) must
363      vanish.  Instead there is another, in-memory abstraction, the view.
364      Some views are builtin and are somehow selectable (the "all" view,
365      for example, and the "new" view).
366      It is possible to make a view persistent by giving it a name, e.g.,
367      'viewset NAME MSG-SPEC' -- 'viewset allnew :n' (and 'viewset XY `'
368      or something must be capable to tag the last a.k.a current).
369      Switching to a named view would thus look over the entire current
370      view (!) for all messages that comply to the message-spec of the
371      view, then create a sorted/threaded display of that subset and
372      create a new anonymous "result" view.  It must be possible to
373      specify that a view is to be applied to the entire mailbox instead
374      of the current view, via a simple easy understandable syntax.
376      Or name it "msgset".
377      We won't extend macros that much because it would require much too
378      much logic for no purpose, instead we'll (hopefully) add some
379      scriptable abstraction, with an optional builtin Lua binding.
380      E.g., it would be too complicated to create a language to access
381      individual message parts (headers etc.), add error handling etc.
382      Better to make it all directly accessible via language binding, and
383      offer commands which relinquish execution to such a binding, maybe
384      even with some arguments, as in "? lua ARG" - it should be possible
385      that ARG is a msgset, then.
387      But what macros should be able to do is iterating over such
388      a msgset / view, as in
389         msgset create NAME :SPEC:
390         msgset add NAME :SPEC:
391       and then either
392         for[-each] NAME
393           normal-cmd SOMEHOW-REFER-TO-ITER
394           if SOMEHOW-ACCESS-LAST-STATUS
395           endif
396         endfor
397       as well as
398         msgset cmd NAME normal-cmd
399       and even
400         normal-cmd NAME
401       in which case NAME should simply be treated as a SPEC, likely that
402       this requires a new trigger, though, e.g. {NAME}, [NAME] or !NAME...
403       I.e., the new namelist (likely a deque) should contain MsgRef
404       objects which point to a Message and a Mailbox (for cross-mailbox
405       msgset's and without the need for a Message to store a pointer to
406       the owning mailbox?  Or make MsgRef a superclass that may have
407       a subclass which offers such cross-refs).
409  50. Support SASL, unite all GSS-API etc. under an abstraction!
410      Maybe even drop direct GSS-API and support only through SASL.
411      That is, we can very well provide our own little SASL-client
412      abstraction with what we have already by simply defining some
413      "readline" abstraction plus struct ccred for use by the
414      authentication layer: the protocols must set it up by passing in
415      a line of authentication mechanisms and a callback mechanism.
416      Possibly the user should be able to permit or forbid automatic
417      selection of GSS-API (to avoid useless round-trips) etc. etc.
418  80. The MIME rewrite: mime_parser <-> mime "DOM" analyzer <->
419      selectively create filter chains per part and do XY.
420  99. Now i'm dreaming some more: with the new object-based approach
421      multiple mailboxes could be in an open state.  And it should be
422      possible to do so for the user (`file' and `folder' are required to
423      quit the current mailbox [first -- this not yet]), which is why we
424      either need new trigger characters or new commands.
425      The absolute sensation would be joinable operations over multiple
426      open mailboxes, e.g., views over multiple such!
427 100. If i say `p 3 2 1' then i mean `3 2 1' not `1 2 3'.
428 1000. Extend macros and provide language bindings.  See item 34.
429      Additionally there was:
430     I want *pipemac* (or *pipe-hookXY*).  This requires v15.0
431     infrastructure (pseudo: evaluate() returns enum eval_retval{OK=0,
432     ERR=1, ISMAC=0x80, MACOK=ISMAC|OK, MACERR=ISMAC|ERR}; new `return'
433     command which only works in an executing macro (care: recursion);
434     macro arguments in pseudo variables $1...$x (works?); `return' can
435     "return" a list (simply keep argument list around); macro execution
436     can then simply check the return value to decide what to do (no
437     jumping); btw.: where is our `clone' command which clones WHATEVER?):
438       define pipemac {
439         clone name=$1 base=$2 ext=$3 ACTION=$4([SEND_]MBOX|DISPLAY|etc)
440         if $name =~ 'README|INSTALL|TODO|COPYING|*.(txt|rc|cfg|conf)$'
441           return 'text/plain'
442         elif $ext =~ 'gz$'
443           return 'application/gzip'
444         elif $ext =~ '*.\.nim$'
445           return 'text/x-nimrod'
446         else
447           varshell i /usr/bin/file --preserve-date $name
448           return $i
449         endif
450       }
451     Also interesting would be the possibility to let a macro BE the
452     (forked+exec, I/O redirected) external handler, "returning the
453     output I/O handle".
454     Inspired by Gavin Troy and Bob Tennent.
456 - Deal with faulty message selection that may occur when selecting threads
457   via & (when at least mixed with other selectors).
459 -- Also (?same problem?) the thread sort doesn't get
461     [A is deleted]
462     B answers A
463       C answers B
464       D answers B
465     E is unrelated
466     F answers A
468   The current sort fails to recognize that F and the thread starting at
469   B are related, which results in a mess.
471 --- Being able to sort the outermost level of threads was a suggestion
472     of Rudolf Sykora, especially being able to sort the outermost level
473     according to the date of the newest message in a thread.
475 - Drop **use-starttls* in favour of something better: support 'auto',
476   'no' and 'yes' and act accordingly.  For the former be smart enough on
477   the protocol side.  (RFC 3207 describes man-in-the-middle attacks due
478   to 'auto' TLS, so explicit 'yes' should be favoured).
480 - NOTE: we do not really support IPv6 sofar in that we are not prepared to
481   deal with IPv6 addresses (as in '[ADDR]:PORT').  Pimp url_parse().
482   And socket I/O.
484 - I had a connection collapse during a POP3 download, and neither was
485   there a chance to get access to the 22 yet downloaded mails (after
486   five minutes of waiting followed by CNTRL-C), nor did the layer
487   recognize this very well (got myriads of `POP3 connection already
488   closed.' messages, btw., the thirty-something messages which were not
489   yet downloaded caused (after CNTRL-C) this: ETC. ETC.
491 - Add a value-duplication command, i.e.,
492     clone _x header
493     unset header
494     ...
495     clone header _x
496     unset _x
498 - I got an email in base64 that obviously used CRNL line endings, and once
499   i've replied the CR where quoted as *control* characters.
500   Get rid of those (kwcrtest.mbox; may be hard to do everywhere for some
501   time, due to how we deal with I/O and Send layer etc).
503 - edit.c doesn't do NEED_BODY (but IMAP won't work anyway).
505 - Stuff
506   .. s-nail </dev/null should work interactively when STDERR_FILENO is
507     a terminal!  (Builtin editor; how do editline and readline work?
508     should this be documented?  What does NetBSD Mail do?  Should we NOT
509     be interactive??  POSIX says for sh(1) (APPLICATION USAGE): 'sh
510     2>FILE' is not interactive, even though it accepts terminal input.)
511   . It would be cool if ghosts, shortcuts, alternates could
512     (optionally?) be tracked via localopts.  And macros.  And inner macros.
513     (Additional entry on xy-local xy somewhere above)
514     And / or local to a macro/account if defined in one.
515     Should be per-carrier copy-on-write environments.
516     Just like TeX with def / gdef ...
517   . Just like the RFC 3676 link above, it would be nice if it would be
518     somehow possible to recognize links in a document; i don't know yet
519     how this could be achieved without loosing formatting information (i
520     mean, we could enable this and inject terminal colour sequences, but
521     one should be able to say 'follow link x', starting an action
522     handler, and the 'x' must come from somwhere - simply injecting
523     '[NUMBER]' references distorts visual).  Anyway, it's just a filter
524     that recognized the usual <SCHEME:/> stuff, and of course we can
525     simply have a buffer which records all such occurrences, so that
526     user can say '? xy NUMBER', but without the context it soon gets
527     hard.
528   . TTY layer: the tc*() family may fail with EINTR, which MUST be
529     handled; setting also generates SIGTTOU when we're not in foreground
530     pgrp, so we better deal with all that and ENSURE WE GET THROUGH when
531     resetting terminal attributes!
532   .. TTY "I guess it would be much better to create our own session via
533      setpgid(2) and then tcsetpgrp(3) any processes we run synchronously,
534      and properly deal with SIGTTOU, but it always has been like that and
535      i won't do that before other things have been changed.
536   .. NOTE: TTY: place (at least run_command()) childs which go over
537      terminal into own group.
538      Introduce global "terminal state" manager which tracks who
539      currently owns the terminal, so that we can gracefully switch it
540      on/off, check in main loop whether restore is necessary.
541      It that can deal with multiple "windows" then we could have open
542      multiple of those, i.e., multiple PAGER instances, and non-PAGER
543      instances (fflush() if there is FILE before switch off).
545      TTY thus: "needsterminal" could be driven gracefully EVEN IF
546      a PAGER is open because the current user action is "print*", since
547      we KNOW that there is a PAGER and can temporarily lay it down to
548      sleep, fflush()ing/adjusting as necessary, and wake it up again
549      afterwards (or, with some work, gracefully shut it down if ^C ^C).
550      This is of course also true for user questions ("really display
551      part XY?", "need decryption password:", etc.!!!)!!
552   . Remove all occurrences of mbtowc() with mbrtowc(); temporarily add (some)
553     global mbstate_t objects until the send / MIME layer rewrite is done and
554     has the carrier.  Use flip states and add aux funs with only update the
555     state+toggle on success -- CURRENTLY MBTOWC FAILURES ARE PRACTICALLY NOT
556     HANDLED!!
557   . Because of laststring() and because the evaluate()d line buffer is
558       not constant history entries sometimes do not 100% reflect what
559       was actually present on the command line, but i refrained from
560       hacking a solution since that buffer must end up as a constant
561       (TODOs or so in the source).
562       P.S.: i have hacked that in in [f1ded4c] (as a temporary user
563       goodie because of inconvenience for v14.7.6).
564   . pop3,mime_cte +++: \r,\n -> \015,\012, to avoid ANY problems..
565     Maybe our passed carrier should pass desired output newline (as
566     opposed to data-embedded newlines)
567   . which_protocol(), *newmail* mechanism, displayname, mailname: all of
568     this <rude>SHIT</rude> must vanish and be replaced by a URL, and
569     a nice "VFS" mailbox object that carries all necessary state so that
570     one can work with it.
572     If not mentioned somewhere else: struct message should be splitted
573     into a tree of objects, with a base class that has as few fields as
574     possible; the global *message should be a deque, only accessible via
575     iterator; it should store pointers to (the actually used subtype of)
576     message structures instead; i.e., for maildir boxes the path is yet
577     allocated separately, then it could be part of the message object,
578     etc.
579     It should contain a ui8_t that tracks the number of contained parts,
580     so that the "fits-onto-the-screen" tests are more useful than today;
581     i think 8-bit is sufficient, with 0xFF meaning more-than-fits-here.
582   . Given how many temporary files we use, it would make sense to
583     support a reusable single temporary file, as in singletmp_take() and
584     singletmp_release(), where singletmp_release() would close and thus
585     drop the file if it excesses a specific (configurable) size, and the
586     mainloop tick would close it (after X (configurable) unused ticks))
587     otherwise.  I guess this would improve performance for searching
588     etc. etc.
589   . Searching code *could* perform a prepass, joining stuff together,
590     dropping useless cases etc.
591     But anyway: if there are multiple search expressions, it shouldn't
592     be an error if at least one of them matches at least one message.
593   . _(), N_(), V_():
594     use GNU tools for extraction etc., and write a simple helper program
595     which converts these files to a serialized hashmap, just like we did
596     for the okeys (and *exactly* so); add a config check whether the ({})
597     extension is supported and finally use that for some ({static char
598     const *tr_res;}) injection optimization, then.  (Think SFSYS)
599   . Searching body/text yet includes headers from attachments and
600     attachment data.  This is shit.  :)
601   . The "nifty" unregister_file()->_compress() mechanism that even
602     shovels '-Sfolder=imaps://user1@localhost -Srecord="+Sent Items"'
603     *records* calls clearerr() on the descriptor before performing it's
604     action anyway.  when we really make it even to the I/O rewrite, it
605     should be possible to dis-/allow such -- it doesn't make sense to
606     add something faulty to whatever was not faulty before!
607   . The message from Andy Switala on nail-devel made me think about some
608     mechanism that invokes a macro after a message has been sent.
609     Unless macros can have args (or do we introduce $*/$@/$1..).
610     Even if the codebase will at some future time be stable and really
611     reliable, sending a message via multiple channels will never be
612     atomic, so that it would make sense for a user to be able to restore
613     *the complete message* in a save place if any of the sends failed,
614     but to remove it from our temporary place otherwise.  A simple
615     version of this would be a matter of five minutes, but since
616     mightrecord() may internally (via _compress()) instantiate
617     a complete IMAP session and try to send incomplete data etc.,
618     and all that may jump, i refrained from doing so.
619   .. Note that mutt also has send-hooks with special triggers etc.,
620      which even allows setting some options which affect the mail to be
621      sent, like choosing a signing certificate dependend on the value in
622      From: and such;
623      That is (v15.0)
624       1. init send carrier enough for allowing
625       2. user compose mode
626       3. fully initialize send carrier according to what is "final"
627       4. run trigger macros WHICH MAY MODIFY THE MESSAGE AGAIN, so
628       5. fully reinitialize the send carrier (as necessary)
629       6. pass the _final_ message down the send/mime chain
630   . `dp' prints EOF at the end of a thread even if unread messages
631     follow
632   . When doing `~w FILE' and FILE cannot be written to (was a directory)
633     then the composed mail is lost completely, it seems we jump to the
634     very main loop!
635   . `resend' doesn't smime-sign.
636   . Really do extend the test already today; test S/MIME
637     signing/encryption/decryption with two pairs of identities, instead
638     of of one.
639   . RFC 5751 describes a message multipart layout that also includes the
640     headers in the signature; it would be nice (for completeness sake)
641     to be able to support that.  Note shutup@ietf.org.
642   . The capability to save a message under the name of a recipient is in
643     the standard etc., but i've never used it.
644     What would be cool, otoh, would be if there would be the possibility
645     to register a regular expression, and if just *any* recipient of
646     a message matches, store the message in the given folder instead.
647     I.e., if i send a message to s-nail-users@ then i most likely want
648     to get a copy to the corresponding box, regardless of whoever the
649     message was sent To: Cc: or Bcc: else..
650   .. Unite
651       defined HAVE_SETLOCALE && defined HAVE_C90AMEND1 && defined HAVE_WCWIDTH
652      into HAVE_NATCH_CHAR, solely keep that.  But improve the name
653   . why not simply sucking in complete MIME messages via -t?  In a way
654     that parses it as a MIME message, that is!
655     (Brezn Stangl, brezn DOT stangl AT yandex DOT com)
656   . mutt list handling (`~') is very powerful
657   . Check what happens if an account switch or a network connection is
658     done while we are loading the resource files...
659   . We have some use of *at() functions, especially anything which
660     temporarily switches cwd.
661   . *newmail* is terrible.  At some later time we need to do somethings
662     with timeouts etc. (for MBOX and Maildir it's not that bad, but for
663     anything over the network, yet the mentioned may come in over NFS).
664     Remove it until we have something better?
665   . The RFC 3798 *disposition-notification-send* mechanism is yet not
666     truly conforming (and works with *from*).  Also, this is only the
667     sender side, there should be support for creating the MDN response.
668     (Maybe ternary option: off (default),
669     create-when-unread-flag-goes-away, ditto-but-also-strip-header)
670   .. Also, there is DSN as a SMTP extension, see the RFCs 3461, 346 (as
671      above) and 6522 (Wikipedia).
672   . The var_* series should return "const char*" not "char*".
673     This should already work today because otherwise we would get SEGV
674     all through the way.
675   .. While here: rename enum okeys to enum internal_variables, and the
676      ok_*() series to iv_().  And see below for env_*() series.
677   . fexpand() the 2nd: it should return structure because we need to
678      check for FEDIT_SYSBOX, which currently only checks whether the first
679      character of a file name is '%', not whether it is '%', '%:FILEPATH'
680      or '%VALIDUSER', because that is impossible to do!
681   . On the long run in-memory password storage should be zeroed after
682     use, possibly even encoded *during* use.  After v15.
683   . We need a `spamcheck' command that is like `spamrate' but updates
684     the mail in-place, i.e., with the headers that the spam engine adds.
685   . __narrow_suffix() is wrong (for stateful encodings that we
686     don't support yet) and should inject a reset sequence if it shortens
687     the string.
688   .. Ditto field_put_bidi_clip() and possibly more.
689   .. THAT IS TO SAY: the entire codebase doesn't really support stateful
690     encodings, including the bidi_ things that i've done (but the MLE
691     does iirc?  what is this??).  We should have a global string that
692     has the multibyte reset sequence plus length available for easy
693     access.
694   . When a user edits a specific header, it should no longer be
695     modified.
696   . Regular expression list resorting is no good; the user should be
697     able to specify a match order weight, as in:
698       mlist 10 a@b.org 8 c@d.org .*@else@org 0 almost@never.com
699     So: optional digit 0-10, where 0-4 are never relinked and always
700     placed at the tail, 6-10 are never relinked and always placed at
701     head (all in decreasing order, head to tail), and 5 is the implicit
702     value, placed in between and automatically resorted just as is the
703     sole algorithm we currently have.
704   .. And maybe we should have an event mechanism with one-shot etc..
705      Then install a resorter function when we actually have lookups and
706      one-shot sort the entire thing once (when the loop ticks).
707      Instead of busy resorting, that is.
708   . Some pieces of cake (e.g. usermap()) don't perform actions on
709     addresse(e)s if the first character is a backslash.  Others do.
710     And do we really support that notion all through the codebase.
711     And, even more: should we support that at all?
712   . We need more hooks: on-leave, on-connect.. whatever
713   . The new internal ~/$ expansion mechanism should possibly get support
714      for POSIX parameter expansions ${[:]-} and ${[:]+} (and ${[:]?}).
715      There is no real way to get the functionality otherwise...
716   . struct ignoretab and handling can be merged with the new generic
717     struct group stuff (with some effort) and localized in nam_a_grp.c,
718     then.  Then -- rename that file to grpignnam.c??  :-)
719   . Make S/MIME an option separate of SSL/TLS, i.e., optional.
720   . With very long input Heirloom mailx(1) / S-nail(1) can produce
721     encoded-words (RFC 2047) with incomplete multibyte sequences (i.e.,
722     non self-contained encoded-words).
723   . Group addresses, especially the undisclosed recipients but also
724     "Bla": addresses; are missing.
725   . It is terrible that -S sets variables twice, at once and after the
726     resource files have been loaded.  Instead we should set a bit
727   . The Base64 decoder must become a filter with its own buffer, so that
728     we can join splitted sequences etc.; yes, that is invalid, but we
729     should be tolerant (tolerant on input, strict on output - right?).
730     mutt(1), e.g., even tolerates characters that are invalid ($,!,?++)
731     and simply ignores them.  This is great on the one and shit on the
732     other hand -- if like that, the error ring should at least mention
733     that the message WAS FAULTY.  E.g., mutt(1) ignores long,long
734     sequences of those bytes, which i don't consider a good thing..
735     And then, should we (really, see mime_enc.c) make a difference in
736     B64_T and B64, ... and regarding this??
737   . Cleanup:  n_ is anything public / external,
738     _n_ is public/e but not really, FILENAME/ABBREV_symbol are statics,
739     FILENAME/ABBREV__symbol are helpers of a single other static
740     (function group) (-> colour.c, lex_input.c: done).
741   . Per-folder (S/MIME) en- and decryption key (Tarqi Kazan): if a xy
742     variable is set (that points to a key) add a transparent en- and
743     decryption layer on top of any per-message operation (for boxes for
744     which the variable is set).
745   . For v15.0: remember private thread with Tarqi Kazan (2015-05) and
746     try to improve situation with *record*, so that only messages enter
747     it which have really been sent.  If we support postponing and have
748     a multi-process layout and add an intermediate *record-queue* we
749     may be able to improve the situation.
750   . I like "SMTP and SUBMISSION Service Extensions For Address Query",
751     for which we need
752       if (!SSL_set_tlsext_host_name(con, servername))
753         error
754   . [Dd]ecrypt should transport decryption errors, not silently be like
755     copy and copy undecrypted content, because this is what it's for?
756     ..We need atomic operations with rollback support in order to make
757       this happen, but i think maybe file truncation (decryption always
758       appends?) is enough provided that files are locked?
759       WE NEED ATOMIC OPERATION SUPPORT for quite some operations.
760       Man, are we far from that.
761   . `pipe' is total shit regarding MIME.  We need some defined and
762      documented method to configure which parts are displayed and/or how
763      they are visually separated.
764   . The new n_err() facility is nice, but we need n_msg() too, maybe
765     more.  Maybe à la Log:: and macro wrappers with priority unrolled,
766     then add user-settable treshold, too.  Btw. C99 adds vararg macros.
767     .. In PARTICULAR we MUST NOT use stdout when in batch mode:
768          ssh X "echo 'move * |cat' | s-nail -#f %" >> download
769        should do the right thing, but can't like that due to unwanted
770        noise in the stdout output!  Best would be if it would be
771        possible to explicitly define a file/dev to be used, but falling
772        back to stderr in batch mode otherwise. (think S-Web42)
773   . Exit status handling is sick.
774   . Especially in interactive mode MIME classification should count
775     (non-NUL) control characters and the number of different thereof,
776     giving users an option to treat something as text nonetheless.
777     E.g., roff files often use controls as separators in conditionals,
778     some shell scripts use controls for $IFS field separation, and that
779     will end up with charset=binary.
782   . rewrite make.rc/mk-conf.sh: features==options should be named
783     OPT_name, path,names,valuesr VAL_name.
784     (Also remember the idea of the automatic inter-dependency tracking
785     via simple text file
787   . We can "steal" features from msmtp(1) that make sense: SOCKS support
788     (primitive) and /etc/aliases ($mta_alias_file).  At least postfix(1)
789     supports file and pipe addressees in the latter...  It also
790     supports include files via :include:/filename but which i think
791     should be supported in a second step.  Ditto caching (timestamp
792     check and a mechanism to support/disable caching.)
794 # s-ts-mode