imap_cache.c: fix memory leaks
[s-mailx.git] / TODO
blob1e5ad1940f9e09095c654c863a7a92ed9303ccf5
1 TODO reminder.
3 Release S-nail v20 on 2018-03-25, the 40th anniversary of Mail.
4 With a clean, conforming and efficient codebase, then.
6 - Recipients specified on the command line should be added to those
7   specified in the message when the -t option is set.
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 - I.e., it is fine to be silent unless an error occurs, but then please
17   report errors and offer (in interactive mode) the possibility to act at
18   a glance.  (See error ring topic around here.)
20 - POSIX says that, when written to DEAD: "If the file exists, the message
21   shall be written to replace the contents of the file".  This is mentioned
22   for ASYNCHRONOUS EVENTS, but it's the only description of what should be
23   done in which way to DEAD.  savedeadletter() yet appends.  See ZOMBIE ,)
25 - It irritates me that a message with 5 visible lines but 115 header lines
26   goes through the pager, even if i have *crt=*.
28 - We should possibly get away of using command line utilities for
29   compression.  (At least optionally?)  Instead we should link against
30   zlib(3), bz2lib(3) and lzma(3), if found.  Or we may use dlopen(3)
31   instead, if found, to avoid linking (though those libraries don't need
32   much linker work unless actually used afaik, 'should look in detail).
33   We should also drop lzw.c, it is used for the IMAP cache.
35 - We should maybe turn -~ into the meaning "force interactive".
36   We should extend cc-test.sh, then, to test some interactive things.
38 - We need a "void" box that can be jumped to, i.e., a state in which no box
39   at all is active.
41 -- When a MBOX mailbox is removed while it is opened then changing the
42   folder is not possible.  This is an inherent problem of the Berkeley
43   Mail codebase, and we need to have a fully functional intermediate
44   VOID box mechanism plus an object-based mailbox implementation to
45   overcome it.
47 -- Also, when the folder was modified concurrently we should bail, or,
48    in an interactive session, prompt the user what to do.
50 - IDNA decoding.  Needs a complete design change.
52 - Mail-Followup-To:.
54 - mutt(1) quotes all text parts of a message, not only the first one!
55   This should at least be optionally available.
57 - If pipes fail for part viewers then at least the usual PART X.Y should be
58   shown, maybe even including some error message.
59   I had 'set pipe-text/html="lynx -dump -force_html /dev/stdin"' but NetBSD
60   does not have lynx(1), and i thought i've found a S-nail(1) bug.
62 - Offer the possibility to work with certificate fingerprints instead of
63   full certificates, in equal spirit to the current maintainers S-Postman
64   and Mercurial.  S-nail(1) could simply offer something in equal spirit to
65   the formers --fingerprint, so that no other tool is necessary for
66   certificate management (for at least secure transport).
68 - It would be nice if it would be possible to define a format string for
69   *quote*, like 'set quote="format=some formats"'.
70   In general the current approach is somewhat messy IMO.  I.e., it would
71   make more sense to act rather like mutt(1) and as written elsewhere in
72   this document, i.e., have some toggles that act on the display and use it
73   for multiple modes (show/reply/forward etc.)
74   Otherwise introduce commands which include all the headers plus, e.g.,
75   "hreply" or "freply", and then the ditto series, i.e., "hReply" ...
77 -- This would also mean that interactive message editing would work
78   accordingly.  PleasE!
80 - Command line editing should gain possibility of context sensitive tab
81   completion.
83 -- Note that the TTY is sick.  If ^C on input it simply jumps to next
84    input, instead of saying "Interrupted, one more to die hard" or
85    something (talking about ~@ charset selection prompts in particular).
87 - For those who use S-nail(1) only with a MTA it may be desirable to have
88   some "smopts" expansion mechanism in equal spirit to NetBSD mailx(1).
90 - Maybe there should be an additional ZOMBIE directive that is served in
91   equal spirit to DEAD, but that could be a valid MBOX... ?
92   What i want is a *real* resend, best if possible from command line.
93   Meaning, also the possibility to postpone a message.  In general.
95 - POP3 doesn't support "newmail" for real.  If implemented, should it sync?
96   Look at POP3 impl. in general..
98 - Having a newsreader would be a really cool thing.  (RFC 977 and 2980)
100 - There should be a way to ignore the From_ line, as opposed to the From:
101   line, i.e., distinctively.
103 - There should be a variable that controls wether leading and trailing
104   empty lines of parts and/or messages as such should be printed or not.
106 - printhead()/hprf(): support %n newline format (%t tab?).
107   Make it possible to use the *datefield* algorithm for plain From_ derived
108   dates (needs a From_ parser, i.e., strptime()-alike).
109   Once we have that, rename *datefield-markout-older* to
110   *date-markout-older* ??
111   Note that NetBSD's mail(1) has some other nice things.
112   Note also that our code is quite unflexible.
114 -- NetBSD's mail(1) has nice *indentprefix* and *indentpostscript*
115    variables (though prefix and appendix or prefix and suffix, but..).
116    Note that our code is quite unflexible.
118 - The "top" command should honour ignoretab, or there should be a very
119   special "top" ignoretab.  It simply doesn't make sense to "top" 5 lines
120   when all that you get are Received: lines...
122 - In the very end it is not that hard to add (optional) MTA
123   functionality at a most simple level.
124   Use sqlite for aliases (and possibly cache), then.
126 - We should support IMAP compression over the wire.
128 Low-Level
129 ---------
131 - Improve name extraction rules.  And field parsing.  There
132   are structured and unstructured fields.  There are quoted pairs and
133   comments etc.  Rewrite the entire parsing mechanism to comply to RFC
134   5322, and try to merge all those many subparsers around in the codebase,
135   and accordingly.  So much duplicated work ...
136   Name parsing has been improved a bit for v13, but it's still broken.
137   yankword(), *extract(), etc.: RFC 5322 says that comments in address
138   fields SHOULD NOT be used (mutt(1) maps them to full name-addr forms if
139   approbiate, even if that actually changes content!!?), and that full
140   name-addr SHOULD be used.  Our functions are yet quite silly (i.e.,
141   leading comments remain, as in "(bier2) <a2@b2.de>", unless the address
142   doesn't come in angle brackets, trailing go away, as in "<a6@b6.de>
143   (bier6)", that becomes "<a6@b6.de>").
144   Something silly like
145     (co$mm1) abc@däf.de (cö,mm,2)   ('c'o"m"m.3)
146   Should eventually become
147     co$mm1 cö,mm,2 'c'o"m"m.3 <abc@xn--df-via.de>
148   on the display, or, with IDNA decoding (and thus rather unlikely)
149     co$mm1 cö,mm,2 'c'o"m"m.3 <abc@däf.de>
150   It should NOT become this mutt(1)ism:
151     "co$mm1 cö,mm,2 'c'omm.3" <abc@däf.de>
152   Or?
154 -- Think about a name bypass hashmap cache, and whenever we have to skin or
155    nalloc() or whatever, look in there.  Maybe even an additional link for
156    non GFULL(/GSKIN) and fully skinned struct name objects.
157    The amount of duplicated work in this codebase is frustrating, but the
158    real healing would make necessary a complete rewrite of the name handling!
159    Such a cache would work without touching the current code flow ... or
160    allow a smooth transition to a new one anyway.
162 ++  NOTE: 'alternates' tracking happens BEFORE we enter composing, this
163     means that an account switch during message composing will NOT cause
164     reevaluation of all that very very clumy
165     elide/delete_alternates/gexpand/is_myname etc. handling.
167 - The char classification stuff can be improved; currently each character
168   has exactly one classification bit set, even if multiple would apply
169   (e.g., HT=\t == CNTRL|SPACE|ASCII|BLANK).  This would allow better
170   testing using our own classification functions in quite some places.
172 - The quoted-printable Content-Transfer-Encoding: supports soft linebreaks;
173   it happens that a lot of mailers (Apple Mail?, Microsoft Word, Yahoo!
174   Webmail) create HTML parts which solely consist of a single line,
175   created via soft linebreaks.
176   To handle such mess we need to be able to break out of the input-line ==
177   output line relationship that is still fixated in the codebase.
178   I.e., it is not even sufficient to convert "rest" into an array, but best
179   would be if we would be able to sequentially work what we have, and
180   detect when it is safe to "dump that out".
181   This MUST be part of the send/mime layer rewrite in 15.0.
183 -- In v15.0, when we can address attachments of a message individually,
184    it would be nice to provide even more access, just like nmh(1) does
185    (Johan Commelin: Are s-nail and mh related?).
187 - I never used anything but the *datefield* option, and it would really be
188   nice if the date strings would be parsed off into some 16 byte or what
189   storage when about to producing the summary, so that it would be directly
190   available and there would be no need to reread the mail.  Moreover, or
191   even more than that - the m_date field exists and should possibly simply
192   be init, at least in these cases.  (P.S.: this doesn't contradict the
193   statement somewhere else in this file that the structure should be
194   slacked; simply use multiple thereof or so)
196 - All error messages should not go to stderr but instead we should add our
197   own n_warn() family and use that.  In the background we should have
198   a ring of error messages (oldest fall off), and a command that is capable
199   to display the ring.  The command loop should recognize whenever an error
200   happened during the last command, and print something like "XY errors
201   occurred", followed by a (truncated as necessary) error report.
202   It simply doesn't make any sense to print errors on stderr if normal
203   output goes to stdout and scrolls it off the screen.
204   Note that yet some errors messages still go to stdout.
206 - It would be very nice if it would be possible to have
207   account-specific macros that will be lost when a user switches off
208   an account.
210 -- It would also be very nice if we could define macros while defining
211    account, i.e., recursive definition of macros...
213 - At some later time extend the logic behind -# -- it should not have
214   a current folder, but start in VOID mode (...), and unless one is
215   explicitly chosen..  We need a reliable batch mode.
217 - (Support for mailcap files?  As of RFC 1524?  Unlikely.  Though the
218   % expansions would be very helpful, especially once we can address
219   individuals parts as of v15.0!)
221 - After I/O layer rework we should optionally be able to read RSS
222   (Atom?) feeds -- Expat should be available almost everywhere and
223   should be able to parse that?
224   Atom is harder because it may support html+.
225   I mean, yeah, it's stupid, but we could fill in header fields with
226   dummies and still use S-nail to look into the separated feeds as if
227   they were mail messages; anyway i would like to save me from using too
228   many tools -- three seems reasonable.
230 - Add TODO notes for those RFCs:
231   RFC 5322 - The basic format of email messages.
232   MIME (Multimeda) email extensions
233   RFC 2405 - The format of MIME message bodies.
234   RFC 2406 - Common multimedia types.
235   RFC 2017 - URL External-Body Access-Type
236   RFC 3676 - Updates to the text/plain MIME type and extensions for flowed
237     text (format=flowed).   (Martin Neitzel)
238   RFC 2407 - Encoding of non-ASCII text in message headers.
239   RFC 2183 - The Content-Disposition Header
240   RFC 2231 - Encoding of character set and language information in MIME
241     parameter values.
242   SMTP (Simple Mail Transfer Protocol)
243   RFC 5321 - Simple Mail Transfer Protocol.
244   RFC 6409 - Message Submission for Mail
245   RFC 4954 - SMTP Authentication
246   RFC 3207 - SMTP over TLS
247   RFC 6152 - SMTP Service Extension for 8-bit MIME Transport
248   Post Office Protocol (POP)
249   RFC 1939 - Post Office Protocol v3
250   RFC 2449 - POP3 Extensions (including SASL)
251   RFC 2595 - TLS for POP3 (among others)
252   Security
253   RFC 4422, 4505 - Simple Authentication and Security layer (SASL)
254             (Tarqi Kazan)
255   RFC 5246 - Transport Layer Security (TLS)
256   RFC 977 -> 3977 - Network News Transfer Protocol
257   RFC 1036 - Standard for USENET Messages
258   RFC 2980 - Common NNTP Extensions
259   RFC 2387 - multipart/related
260   RFC 2384,1738 - I.e., Much better URL support
261   RFC 5751 - Secure/Multipurpose Internet Mail Extensions (S/MIME)
262   RFC 6125 - Representation and Verification of Domain-Based Application
263     Service Identity within Internet Public Key Infrastructure Using
264     X.509 (PKIX) Certificates in the Context of Transport Layer Security
265     (TLS)
267 - This is how the codebase has to be reworked in respect to signals and
268   jumping:
270   1. We introduce some environment/carrier structs: struct eval_ctx,
271      struct cmd_ctx, (struct send_ctx).  All of these form lists.
272      eval_ctx gets a new instance every time evaluate() is entered; for
273      the interactive mode, commands() instantiates an outermost eval_ctx
274      that "cannot be left".
275      cmd_ctx knows about the eval_ctx in which it is was created; it is
276      created for each command that has an entry in cmd_tab and is passed
277      as the new argument of these kind of functions.
278      (send_ctx is the carrier for the MIME and send layer rewrite.)
279   2. We'll get a signal manager.  This is a global layer which is the
280      sole object-in-charge for signals.  We'll install a complete set of
281      handlers once -- those will only set has-occurred bits.
282      All interested parties have to peek at the signal manager when they
283      are in the position to deal with signals, via a series of
284      "ha(s|ve)_occurred", "needs_action", "would_raise" or whatever, as
285      well as "doact".
286   3. We need a sort of non-local return, everything else would require
287      a totally different way of programming.  Also, non-local returns
288      are not *that* bad, generally speaking.  We'll be easy and add the
289      possibility to define a jump target location in eval_ctx and
290      cmd_ctx, by peeking at the signal manager (for object design
291      reasons, though done by a macro, say), just like saying "i need to
292      have the chance to perform some actions shall a jump be necessary".
293   4. So, somewhere deep down the still recursive codebase, shall the
294      necessity to honour a jump request occur, we peek the signal
295      manager to "unroll" the current cmd_ctx/eval_ctx chain(s), which
296      will result in none-to-multiple jumps to locations which require
297      cleanup actions, ultimately ending in the non-leavable commands()
298      eval_ctx or whatever.
299   6. Hot: we save us from thousands of syscalls, and get rid of the
300      fucking sig* shit.  It rhymes, it rhymes :)
301      Should we even be able to go the non-blocking select(2) way in the
302      end -- that would be fantastic!
303  10. The line buffer used in evaluate() that is passed through to
304      commands (thus: in cmd_ctx, then) needs to become `const'.
305      (I tried to do so in the past, but some commands write into it,
306      thus i stopped and iirc even added some changes on my own which
307      take favour of reusing that buffer.)
308      + Macro execution then no longer needs to clone the macro content
309      lines before executing then.
310  11. Macro execution is potentially recursive.  Meaning that
311      `undefine', etc. can occur while macros are executing.
312      The simplemost approach would be to have some recursion counter for
313      each macro and a delete_later flag that gets honoured when the
314      recursion counter gets zero.  It would be already possible to
315      immediately remove the macro from the hashtable, so that deeper
316      levels wouldn't find it anymore.  To avoid leaks (which *are*) we
317      need to have a jump location for our upcoming signal handler
318      anyway.  (Also to get rid of the temporary_localopts_free() hack.
319      + The same is true for `account's.  Here things are complicated by
320      the global `account_name', i.e., the account could be the current
321      one.
322  12. It is annoying that you cannot `source' your MAILRC multiple times.
323      Defining a macro/account/xy should overwrite the current thing,
324      just as it does anyway for normal variables!
325      This is no different than 11. plus additional re-addition.
326      (Same exception: what if the currently active account is
327      overwritten?  Same answer, plus a message "new settings take effect
328      when account is switched to the next time".)
329  20. The attachment charset selection loop can then be rewritten to
330      check wether an ^C occurred and treat that as end-of-loop
331      condition.  In v14.6.3 this was introduced, but it should act
332      differently depending on wether the interrupt occurred during
333      character set selection or attachment filename input.
334      Also in respect wether the interrupt is "propagated" or not.
335      It's ugly, and documented accordingly.
336  30. Mail protocols and mail messages are accessed through a "VFS".
337  31. Flag updates of individual messages must find their way through to
338      the protocol.
339  32. Use deque (on partial views).
340  33. It must be possible to open individual boxes read-only, new command
341      `cfile' (and `cfolder') as a last resort.
342  34. We need a new abstraction: `vie[ws]'.  I.e, viewset, viewclear,
343      view(show|look)?  We will have (possibly readonly) boxes, a summary
344      cache file, which is created when a mailbox is read in, and all
345      that crap that we currently have (setptr(), setmsize(), etc.!) must
346      vanish.  Instead there is another, in-memory abstraction, the view.
347      Some views are builtin and are somehow selectable (the "all" view,
348      for example, and the "new" view).
349      It is possible to make a view persistent by giving it a name, e.g.,
350      'viewset NAME MSG-SPEC' -- 'viewset allnew :n' (and 'viewset XY `'
351      or something must be capable to tag the last a.k.a current).
352      Switching to a named view would thus look over the entire current
353      view (!) for all messages that comply to the message-spec of the
354      view, then create a sorted/threaded display of that subset and
355      create a new anonymous "result" view.  It must be possible to
356      specify that a view is to be applied to the entire mailbox instead
357      of the current view, via a simple easy understandable syntax.
358  50. Support SASL, unite all GSS-API etc. under an abstraction!
359      Maybe even drop direct GSS-API and support only through SASL.
360      That is, we can very well provide our own little SASL-client
361      abstraction with what we have already by simply defining some
362      "readline" abstraction plus struct ccred for use by the
363      authentication layer: the protocols must set it up by passing in
364      a line of authentication mechanisms and a callback mechanism.
365      Possibly the user should be able to permit or forbid automatic
366      selection of GSS-API (to avoid useless round-trips) etc. etc.
367  99. Now i'm dreaming some more: with the new object-based approach
368      multiple mailboxes could be in an open state.  And it should be
369      possible to do so for the user (`file' and `folder' are required to
370      quit the current mailbox [first -- this not yet]), which is why we
371      either need new trigger characters or new commands (then also in
372      a readonly version, again, it gets lengthy).
373      The absolute sensation would be joinable operations over multiple
374      open mailboxes, e.g., views over multiple such!
376 TODO S-nail 14.7:
377 -----------------
379 - Deal with faulty message selection that may occur when selecting threads
380   via & (when at least mixed with other selectors).
382 -- Also (?same problem?) the thread sort doesn't get
384     [A is deleted]
385     B answers A
386       C answers B
387       D answers B
388     E is unrelated
389     F answers A
391   The current sort fails to recognize that F and the thread starting at
392   B are related, which results in a mess.
394 - Drop **use-starttls* in favour of something better: support 'auto',
395   'no' and 'yes' and act accordingly.  For the former be smart enough on
396   the protocol side.  (RFC 3207 describes man-in-the-middle attacks due
397   to 'auto' TLS, so explicit 'yes' should be favoured).
399 - NOTE: we do not really support IPv6 sofar in that we are not prepared to
400   deal with IPv6 addresses (as in '[ADDR]:PORT').  Pimp url_parse().
401   And socket I/O.
403 - mutt(1) dotlock ..., "mbox" command doesn'T work?
405 - ARGH!  Should `folders' auto-login if *folder* is an IMAP account that is
406   not active?  Why does _expand() use *mailname* to expand `@', not
407   getfold() (care: res may point into cbuf, savestr() or so!).
408   Why does demail() etc. treat *mailname* as a file (more or less), why do
409   we need *mailname* at all;  we should have Folder objects, multiple of
410   which concurrently, one the active; a Folder may not become *folder*
411   unless it has write (store) capabilities).  Maybe then `mbox' works fine
412   if connected to a POP3 server with a *MBOX* on an IMAP account that yet
413   never was connected and needs to read a password on the terminal before
414   the login works ... note the latter situation yet kills us since i think
415   INT is blocked during all that ;-((
417 - I had a connection collapse during a POP3 download, and neither was
418   there a chance to get access to the 22 yet downloaded mails (after
419   five minutes of waiting followed by CNTRL-C), nor did the layer
420   recognize this very well (got myriads of `POP3 connection already
421   closed.' messages, btw., the thirty-something messages which were not
422   yet downloaded caused (after CNTRL-C) this: ETC. ETC.
424 - Add a value-duplication command, i.e.,
425     clone _x header
426     unset header
427     ...
428     clone header _x
429     unset _x
431 - Add a boolify() function, so that things like `localopts' and yorn()
432   may be less strict on user input
434 - Ensure that `.' and EOF on a line works with all TTY modes (*ignoreeof*
435   relationship, too)!  EOF conditions in general!
437 -- NCL / current expand-on-tab: fexpand() should take additional size_t* to
438    store the number of the results OR should "return char** array", so that
439    individual results can be addressed.
440    Then we could simply print "\nALL-RESULTS\n" and NOT expand the current
441    line if the result is ambiguous, i.e., we have more than one possible
442    expansion.
443    However, we would then need something to print the results page-wise,
444    in case we have so many of them that they don't fit on the screen.
445    ...  Etc. ...
447 - IMAP: if i `d' a message then this is a local change (in the meanwhile);
448   yet, when i `u' it, that will go through the server, needlessly.
450 - I got an email in base64 that obviously used CRNL line endings, and once
451   i've replied the CR where quoted as *control* characters.
452   Get rid of those (kwcrtest.mbox; may be hard to do everywhere for some
453   time, due to how we deal with I/O and Send layer etc).
455 - edit.c doesn't do NEED_BODY (but IMAP won't work anyway).
457 - Stuff
458   .. s-nail </dev/null should work interactively when STDERR_FILENO is
459     a terminal!  (Builtin editor; how do editline and readline work?
460     should this be documented?  What does NetBSD Mail do?  Should we NOT
461     be interactive??  POSIX says for sh(1) (APPLICATION USAGE): 'sh
462     2>FILE' is not interactive, even though it accepts terminal input.)
463   . Automatically track message attachments when switching off the
464     folder.
465     NOTE: 'alternates' tracking happens BEFORE we enter composing, this
466     means that an account switch during message composing will NOT cause
467     reevaluation of all that very very clumy
468     elide/delete_alternates/gexpand/is_myname etc. handling.
469     We REALLY need an object based rework of all that.
470   . It would be cool if ghosts, shortcuts, alternates could
471     (optionally?) be tracked via localopts.
472     (Additional entry on xy-local xy somewhere above)
473   . The spam* series (spam.c:_spam_action()) should abort if the command
474     execution failed, instead of iterating the entire list.  Look into
475     that.
476   . DESTDIR= should not be taken into account when deciding wether
477     a rebuild is necessary (not wrong to give that to Gaetan Bisson).
478   . Just like the RFC 3676 link above, it would be nice if it would be
479     somehow possible to recognize links in a document; i don't know yet
480     how this could be achieved without loosing formatting information (i
481     mean, we could enable this and inject terminal colour sequences, but
482     one should be able to say 'follow link x', starting an action
483     handler, and the 'x' must come from somwhere - simply injecting
484     '[NUMBER]' references distorts visual).  Anyway, it's just a filter
485     that recognized the usual <SCHEME:/> stuff, and of course we can
486     simply have a buffer which records all such occurrences, so that
487     user can say '? xy NUMBER', but without the context it soon gets
488     hard.
489   . TTY layer: the tc*() family may fail with EINTR, which MUST be
490     handled; setting also generates SIGTTOU when we're not in foreground
491     pgrp, so we better deal with all that and ENSURE WE GET THROUGH when
492     resetting terminal attributes!
493   . Remove all occurrences of mbtowc() with mbrtowc(); temporarily add (some)
494     global mbstate_t objects until the send / MIME layer rewrite is done and
495     has the carrier.  Use flip states and add aux funs with only update the
496     state+toggle on success -- CURRENTLY MBTOWC FAILURES ARE PRACTICALLY NOT
497     HANDLED!!
498   . Ypnose (linuxien AT legtux DOT org) pointed out that for the IMAP
499     cache we have some kind of UID validity check -- couldn't that be
500     used to perform some kind of automatic reconnection when we get that
501     much-too-frequent connection breaks in IMAP mode??
502     Also, and also for POP3, don't let the ALARM based (ugh!  I'm
503     starting to dream wet from select(2), almost truly) timer blindly
504     tick, but restart it with a full interval when we did regular
505     conversation with a server.  Don't forget the SSL timeouts (300
506     seconds) and their interaction with normal (user) keepalives.
507     Add a global *keepalive*, add *keepalive-USER@HOST*.  (Add and use
508     a generic, single function to get the value for either protocol.)
509   . HAVE_HISTORY plus: for WANT_EDITLINE and WANT_READLINE the
510     mk-conf.sh yet always tests anything, i.e., we could fail due to
511     history related stuff even though the user doesn't WANT_HISTORY.
512   .. We should in fact convert our NCL history to a shared history
513      implementation, and only hook editline(3) and readline(3) so that
514      ^R and Cursor-(Up|Down) work as expected everywhere.
515      Like that we would have duplicate elimination for readline(3), too.
516   .. tty_addhist() should take a struct str.  Anyway, evaluate() should
517      enter a history entry if the caller allows so, and it should trim
518      also trailing whitespace; also, the expanded command should be
519      stored, not the abbreviation, so that 'sst' and 'sstats' will no
520      longer produce two separate entries.
521   . getprompt() is not multibyte safe in that it should mbrtowc() before
522     calling expand_shell_escape() (i.e., only call that if ASCII,
523     otherwise pass through if fits as such).
524   . Make S/MIME an option separate of SSL/TLS
525   . pop3,mime_cte +++: \r,\n -> \015,\012, to avoid ANY problems..
526   . send.c:_print_part_info(): the filename is truncated to a maximum of
527     25 characters, which of course may mess up multibyte encodings!
528     We need a multibyte safe clamp function, even if this means that
529     an already encoded string is again parsed...  We can take advantage
530     of UTF-8 here, however.
531     FURTHERMORE: don't go and separate ISO C90 Amend. 1 and wcwidth(3);
532     only support wide and multibyte stuff if we have them all.
533     Alternatively we could support ONLY UTF-8 locales via ISO C90 and
534     implement our own wcwidth(3) IFF it's only the latter is missing.
535     Though that sounds crappy.
537     v14.7 MUST use only mbrtowc() and have solved all these multibyte
538     problems (that i've introduced, mostly, and mostly for new
539     features).  It has to last for well over a year!
540   . which_protocol(), *newmail* mechanism, displayname, mailname: all of
541     this <rude>SHIT</rude> must be rewritten completely and can be
542     overcome by an object-based mailbox implementation that carries all
543     the necessary state (user given path, expanded realpath(3),
544     abbreviated display path, box-protocol, etc.).  Once we have this,
545     we may as well also re-introduce automatic detection of compressed
546     file-based folders based upon .gz/.bz2/.xz extension.
548     If not mentioned somehwere else: struct message should be splitted
549     into a tree of objects, with a base class that has as few fields as
550     possible; the global *message should be a deque, only accessible via
551     iterator; it should store pointers to (the actually used subtype of)
552     message structures instead; i.e., for maildir boxes the path is yet
553     allocated separately, then it could be part of the message object,
554     etc.
555     It should contain a ui8_t that tracks the number of contained parts,
556     so that the "fits-onto-the-screen" tests are more useful than today;
557     i think 8-bit is sufficient, with 0xFF meaning more-than-fits-here.
558   . Given how many temporary files we use, it would make sense to
559     support a reusable single temporary file, as in singletmp_take() and
560     singletmp_release(), where singletmp_release() would close and thus
561     drop the file if it excesses a specific (configurable) size, and the
562     mainloop tick would close it (after X (configurable) ticks))
563     otherwise.  I guess this would improve performance for searching
564     etc. etc.
565   . Searching code *could* perform a prepass, joining stuff together,
566     dropping useless cases etc.
567     But anyway: if there are multiple search expressions, it shouldn't
568     be an error if at least one of them matches at least one message.
569   . catset(3) is plain shit, and ever was.  Remove IDs from all tr()s,
570     use GNU tools for extraction etc., and write a simple helper program
571     which converts these files to a serialized hashmap, just like we did
572     for the okeys (and *exactly* so); add a config check wether the ({})
573     extension is supported and finally use that for some ({static char
574     const *tr_res;}) injection optimization, then.  (Think SFSYS)
575   . Searching body/text yet includes headers from attachments and
576     attachment data.  This is shit.  :)
577   . Btw.: (with IMAP) when opening a folder the hook gets executed after
578     the flags but before the headers are loaded, but for `newmail' it is
579     *after* the headers have been loaded.
580   .      /* TODO *batch-exit-on-error*: sourcing and loading MUST BE FLAGS!
581           * TODO the current behaviour is suboptimal AT BEST! */
582   . There MUST be a way to specify that a single SPECIFIC box has to be
583     opened readonly.  only the global -R flag is NOT ENOUGH!
584   . The "nifty" unregister_file()->_compress() mechanism that even
585     shovels '-Sfolder=imaps://user1@localhost -Srecord="+Sent Items"'
586     *records* calls clearerr() on the descriptor before performing it's
587     action anyway.  when we really make it even to the I/O rewrite, it
588     should be possible to dis-/allow such -- it doesn't make sense to
589     add something faulty to whatever was not faulty before!
590   . The message from Andy Switala on nail-devel made me think about some
591     mechanism that invokes a macro after a message has been sent.
592     Unless macros can have args (or do we introduce $*/$@/$1..).
593     Even if the codebase will at some future time be stable and really
594     reliable, sending a message via multiple channels will never be
595     atomic, so that it would make sense for a user to be able to restore
596     *the complete message* in a save place if any of the sends failed,
597     but to remove it from our temporary place otherwise.  A simple
598     version of this would be a matter of five minutes, but since
599     mightrecord() may internally (via _compress()) instantiate
600     a complete IMAP session and try to send incomplete data etc.,
601     and all that may jump, i refrained from doing so.
602   . SMTPS never became a standard and :465 was already reassigned
603     (thanks, carriers), but if a user says SMTPS and doesn't specify
604     a port also then we could simply assume :465 because except NetBSD
605     noone has SMTPS in their /etc/services?
606     Or at least automatically restart a failed getaddrinfo() in the
607     SMPTS case (if EAI_SERVICE)?
608     (Ooops - i think this should go to Gianluca Ramunno!)
609   . `dp' prints EOF at the end of a thread even if unread messages
610     follow
611   . [-- #2 : 41/2761, text/plain, 0001-Israel-DST-transitio --]
612     If not fit, it should do `...'
613     It is not multibyte safe anyway, implement a generic function (or
614     two, one that takes an iconv_t) to trim a string into a buffer
615   . When doing `~w FILE' and FILE cannot be written to (was a directory)
616     then the composed mail is lost completely, it seems we jump to the
617     very main loop!
618   . `resend' doesn't smime-sign.
619   . Really do extend the test already today; test S/MIME
620     signing/encryption/decryption with two pairs of identities, instead
621     of of one.
622   . RFC 5751 describes a message multipart layout that also includes the
623     headers in the signature; it would be nice (for completeness sake)
624     to be able to support that.
625   . The capability to save a message under the name of a recipient is in
626     the standard etc., but i've never used it.
627     What would be cool, otoh, would be if there would be the possibility
628     to register a regular expression, and if just *any* recipient of
629     a message matches, store the message in the given folder instead.
630     I.e., if i send a message to s-nail-users@ then i most likely want
631     to get a copy to the corresponding box, regardless of whoever the
632     message was sent To: Cc: or Bcc: else..
633   . In my ~xother with *nohold* if at the begin i have many large
634     messages i ended up with a truncated *mbox*? what was that?
635   . We should support ~/.netrc for account / password storage!
636   . Things like colalign(), makeprint(), colour*, as well as
637     possibly even cmd1.c:(__hprf|putindent)(), etc. belong into a cui.c,
638     display.c or the like, but not into auxlily.c etc. for sure.
639     Also writing a range of headers should be done through an
640     iterator-thing with setup/finalize init/destroy life cycle, which
641     would encapsulate the entire cmd1.c:_print_head() in the single
642     iterator setup function!
643   . Using -t should still optionally offer an option to enter editing.
644     Also we should support command line arguments on top.
645     Add a -T flag for that.  Drop -q, let -T mean the same if no header
646     fields are given (i.e., header fields are not mandatory as with -t).
647     ANYWAY: -t and -q are mutual, enforce that (yet done?)
648   . Add manual section for URL and the (*v15-compat*) proto, user and
649     password chains, just as done in the s-nail-users mail.
650   . mutt list handling (`~') is very powerful
651   . Check what happens if an account switch or a network connection is
652     done while we are loading the resource files...
654 vim:set fenc=utf-8:s-ts-mode