2 * Copyright notice from original mutt:
3 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
4 * Copyright (C) 2000 Thomas Roessler <roessler@does-not-exist.org>
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
15 #include <lib-lib/mem.h>
16 #include <lib-lib/file.h>
17 #include <lib-lib/macros.h>
18 #include <lib-lib/ascii.h>
22 #include "recvattach.h"
23 #include "mutt_curses.h"
24 #include "mutt_menu.h"
30 #include "mutt_crypt.h"
31 #include "mutt_idna.h"
33 #include <sys/types.h>
45 #include "lib/debug.h"
53 #include <sys/types.h>
56 /* The folder the user last saved to. Used by ci_save_message() */
57 static char LastSaveFolder[_POSIX_PATH_MAX] = "";
59 int mutt_display_message (HEADER * cur)
61 char tempfile[_POSIX_PATH_MAX], buf[LONG_STRING];
62 int rc = 0, builtin = 0;
63 int cmflags = M_CM_DECODE | M_CM_DISPLAY | M_CM_CHARCONV;
65 FILE *fpfilterout = NULL;
70 snprintf (buf, sizeof (buf), "%s/%s", TYPE (cur->content),
71 cur->content->subtype);
73 mutt_parse_mime_message (Context, cur);
74 mutt_message_hook (Context, cur, M_MESSAGEHOOK);
76 mutt_mktemp (tempfile);
77 if ((fpout = safe_fopen (tempfile, "w")) == NULL) {
78 mutt_error _("Could not create temporary file!");
83 if (DisplayFilter && *DisplayFilter) {
86 /* mutt_endwin (NULL); */
87 filterpid = mutt_create_filter_fd (DisplayFilter, &fpout, NULL, NULL,
88 -1, fileno (fpfilterout), -1);
90 mutt_error (_("Cannot create display filter"));
91 safe_fclose (&fpfilterout);
97 if (!Pager || m_strcmp(Pager, "builtin") == 0)
100 mutt_make_string (buf, sizeof (buf), NONULL (PagerFmt), Context, cur);
102 fputs ("\n\n", fpout);
105 msg = mx_open_message (Context, cur->msgno);
106 if (msg == NULL) res = -1;
109 /* see if crytpo is needed for this message. if so, we should exit curses */
110 if (WithCrypto && cur->security) {
111 if (cur->security & ENCRYPT) {
112 if (cur->security & APPLICATION_SMIME)
113 crypt_smime_getkeys (cur->env);
114 if (!crypt_valid_passphrase (cur->security))
117 cmflags |= M_CM_VERIFY;
119 else if (cur->security & SIGN) {
120 /* find out whether or not the verify signature */
121 if (query_quadoption (OPT_VERIFYSIG, _("Verify PGP signature?")) ==
123 cmflags |= M_CM_VERIFY;
128 if (cmflags & M_CM_VERIFY || cur->security & ENCRYPT) {
129 if (cur->security & APPLICATION_PGP) {
131 crypt_pgp_invoke_getkeys (cur->env->from);
133 crypt_invoke_message (APPLICATION_PGP);
136 if (cur->security & APPLICATION_SMIME)
137 crypt_invoke_message (APPLICATION_SMIME);
140 res = _mutt_copy_message (fpout, msg->fp, cur, cur->content, cmflags,
141 (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) |
142 CH_DECODE | CH_FROM);
143 if (res == 0 && (ferror(fpout) || feof(fpout))) {
144 debug_print (1, ("_mutt_copy_message failed to detect EOF!\n"));
148 mx_close_message (&msg);
151 if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res == -1) {
152 mutt_error (_("Could not copy message"));
153 if (fpfilterout != NULL) {
154 mutt_wait_filter (filterpid);
155 safe_fclose (&fpfilterout);
158 /* this is maybe just plain wrong but it makes the pager display
159 * what we have; i.e. for the crypto stuff we only get
160 * 'Could not copy message' for invalid passphrases, no PGP output
161 * not nothing; so just display what we have...
164 mutt_unlink (tempfile);
169 if (fpfilterout != NULL && mutt_wait_filter (filterpid) != 0)
170 mutt_any_key_to_continue (NULL);
172 safe_fclose (&fpfilterout); /* XXX - check result? */
176 /* update crypto information for this message */
177 cur->security &= ~(GOODSIGN|BADSIGN);
178 cur->security |= crypt_query (cur->content);
180 /* Remove color cache for this message, in case there
181 are color patterns for both ~g and ~V */
189 && (cur->security & APPLICATION_SMIME) && (cmflags & M_CM_VERIFY)) {
190 if (cur->security & GOODSIGN) {
191 if (!crypt_smime_verify_sender (cur))
192 mutt_message (_("S/MIME signature successfully verified."));
194 mutt_error (_("S/MIME certificate owner does not match sender."));
196 else if (cur->security & PARTSIGN)
198 ("Warning: Part of this message has not been signed."));
199 else if (cur->security & SIGN || cur->security & BADSIGN)
200 mutt_error (_("S/MIME signature could NOT be verified."));
204 && (cur->security & APPLICATION_PGP) && (cmflags & M_CM_VERIFY)) {
205 if (cur->security & GOODSIGN)
206 mutt_message (_("PGP signature successfully verified."));
207 else if (cur->security & PARTSIGN)
209 ("Warning: Part of this message has not been signed."));
210 else if (cur->security & SIGN)
211 mutt_message (_("PGP signature could NOT be verified."));
214 /* Invoke the builtin pager */
218 rc = mutt_pager (NULL, tempfile, M_PAGER_MESSAGE, &info);
224 snprintf (buf, sizeof (buf), "%s %s", NONULL (Pager), tempfile);
225 if ((r = mutt_system (buf)) == -1)
226 mutt_error (_("Error running \"%s\"!"), buf);
228 keypad (stdscr, TRUE);
230 mutt_set_flag (Context, cur, M_READ, 1);
231 if (r != -1 && option (OPTPROMPTAFTER)) {
232 mutt_ungetch (mutt_any_key_to_continue _("Command: "), 0);
233 rc = km_dokey (MENU_PAGER);
242 void ci_bounce_message (HEADER * h, int *redraw)
244 char prompt[SHORT_STRING];
245 char buf[HUGE_STRING] = { 0 };
251 m_strcpy(prompt, sizeof(prompt), _("Bounce message to: "));
253 m_strcpy(prompt, sizeof(prompt), _("Bounce tagged messages to: "));
255 rc = mutt_get_field (prompt, buf, sizeof (buf), M_ALIAS);
257 if (option (OPTNEEDREDRAW)) {
258 unset_option (OPTNEEDREDRAW);
259 *redraw = REDRAW_FULL;
265 if (!(adr = rfc822_parse_adrlist (adr, buf))) {
266 mutt_error _("Error parsing address!");
271 adr = mutt_expand_aliases (adr);
273 if (mutt_addrlist_to_idna (adr, &err) < 0) {
274 mutt_error (_("Bad IDN: '%s'"), err);
276 rfc822_free_address (&adr);
281 rfc822_write_address (buf, sizeof (buf), adr, 1);
283 #define extra_space (15 + 7 + 2)
284 snprintf (prompt, sizeof (prompt),
285 (h ? _("Bounce message to %s") : _("Bounce messages to %s")),
288 if (mutt_strwidth (prompt) > COLS - extra_space) {
289 mutt_format_string(prompt, sizeof(prompt), 0, COLS - extra_space, 0, 0,
290 prompt, sizeof(prompt), 0);
291 m_strcat(prompt, sizeof(prompt), "...?");
293 m_strcat(prompt, sizeof(prompt), "?");
296 if (query_quadoption (OPT_BOUNCE, prompt) != M_YES) {
297 rfc822_free_address (&adr);
298 CLEARLINE (LINES - 1);
299 mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
303 CLEARLINE (LINES - 1);
305 rc = mutt_bounce_message (NULL, h, adr);
306 rfc822_free_address (&adr);
307 /* If no error, or background, display message. */
308 if ((rc == 0) || (rc == S_BKG))
309 mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
312 static void pipe_set_flags (int decode, int print, int *cmflags, int *chflags)
315 *cmflags |= M_CM_DECODE | M_CM_CHARCONV;
316 *chflags |= CH_DECODE | CH_REORDER;
318 if (option (OPTWEED)) {
320 *cmflags |= M_CM_WEED;
325 *cmflags |= M_CM_PRINTING;
329 static void pipe_msg (HEADER * h, FILE * fp, int decode, int print)
332 int chflags = CH_FROM;
334 pipe_set_flags (decode, print, &cmflags, &chflags);
336 if (WithCrypto && decode && h->security & ENCRYPT) {
337 if (!crypt_valid_passphrase (h->security))
343 mutt_parse_mime_message (Context, h);
345 mutt_copy_message (fp, Context, h, cmflags, chflags);
349 /* the following code is shared between printing and piping */
351 static int _mutt_pipe_message(HEADER * h, char *cmd, int decode, int print,
352 int split, const char *sep)
359 /* mutt_endwin (NULL);
361 is this really needed here ?
362 it makes the screen flicker on pgp and s/mime messages,
363 before asking for a passphrase...
367 mutt_message_hook (Context, h, M_MESSAGEHOOK);
369 if (WithCrypto && decode) {
370 mutt_parse_mime_message (Context, h);
371 if (h->security & ENCRYPT && !crypt_valid_passphrase (h->security))
376 if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0) {
377 mutt_perror (_("Can't create filter process"));
382 pipe_msg (h, fpout, decode, print);
384 rc = mutt_wait_filter (thepid);
386 else { /* handle tagged messages */
388 if (WithCrypto && decode) {
389 for (i = 0; i < Context->vcount; i++)
390 if (Context->hdrs[Context->v2r[i]]->tagged) {
391 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]],
393 mutt_parse_mime_message (Context, Context->hdrs[Context->v2r[i]]);
394 if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT &&
395 !crypt_valid_passphrase (Context->hdrs[Context->v2r[i]]->
402 for (i = 0; i < Context->vcount; i++) {
403 if (Context->hdrs[Context->v2r[i]]->tagged) {
404 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]],
407 if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0) {
408 mutt_perror (_("Can't create filter process"));
412 pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
413 /* add the message separator */
416 safe_fclose (&fpout);
417 if (mutt_wait_filter (thepid) != 0)
424 if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0) {
425 mutt_perror (_("Can't create filter process"));
429 for (i = 0; i < Context->vcount; i++) {
430 if (Context->hdrs[Context->v2r[i]]->tagged) {
431 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]],
433 pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
434 /* add the message separator */
439 safe_fclose (&fpout);
440 if (mutt_wait_filter (thepid) != 0)
445 if (rc || option (OPTWAITKEY))
446 mutt_any_key_to_continue (NULL);
450 void mutt_pipe_message (HEADER * h)
452 char buffer[LONG_STRING];
455 if (mutt_get_field (_("Pipe to command: "), buffer, sizeof (buffer), M_CMD)
459 mutt_expand_path (buffer, sizeof (buffer));
460 _mutt_pipe_message (h, buffer,
461 option (OPTPIPEDECODE),
462 0, option (OPTPIPESPLIT), PipeSep);
465 void mutt_print_message (HEADER * h)
468 if (quadoption (OPT_PRINT) && (!PrintCmd || !*PrintCmd)) {
469 mutt_message (_("No printing command has been defined."));
473 if (query_quadoption (OPT_PRINT,
474 h ? _("Print message?") : _("Print tagged messages?"))
478 if (_mutt_pipe_message (h, PrintCmd,
479 option (OPTPRINTDECODE),
480 1, option (OPTPRINTSPLIT), "\f") == 0)
481 mutt_message (h ? _("Message printed") : _("Messages printed"));
483 mutt_message (h ? _("Message could not be printed") :
484 _("Messages could not be printed"));
488 int mutt_select_sort (int reverse)
490 int method = Sort; /* save the current method in case of abort */
492 switch (mutt_multi_choice (reverse ?
494 ("Rev-Sort (d)ate/(f)rm/(r)ecv/(s)ubj/t(o)/(t)hread/(u)nsort/si(z)e/s(c)ore/s(p)am?: ")
497 ("Sort (d)ate/(f)rm/(r)ecv/(s)ubj/t(o)/(t)hread/(u)nsort/si(z)e/s(c)ore/s(p)am?: "),
499 case -1: /* abort - don't resort */
511 Sort = SORT_RECEIVED;
522 case 6: /* (t)hread */
526 case 7: /* (u)nsort */
534 case 9: /* s(c)ore */
538 case 10: /* s(p)am */
543 Sort |= SORT_REVERSE;
545 return (Sort != method ? 0 : -1); /* no need to resort if it's the same */
548 /* invoke a command in a subshell */
549 void mutt_shell_escape (void)
551 char buf[LONG_STRING];
554 if (mutt_get_field (_("Shell command: "), buf, sizeof (buf), M_CMD) == 0) {
555 if (!buf[0] && Shell)
556 m_strcpy(buf, sizeof(buf), Shell);
558 CLEARLINE (LINES - 1);
561 if (mutt_system (buf) != 0 || option (OPTWAITKEY))
562 mutt_any_key_to_continue (NULL);
567 /* enter a mutt command */
568 void mutt_enter_command (void)
571 char buffer[LONG_STRING], errbuf[SHORT_STRING];
575 if (mutt_get_field (":", buffer, sizeof (buffer), M_COMMAND) != 0
579 err.dsize = sizeof (errbuf);
581 r = mutt_parse_rc_line (buffer, &token, &err);
582 p_delete(&token.data);
584 /* since errbuf could potentially contain printf() sequences in it,
585 we must call mutt_error() in this fashion so that vsprintf()
586 doesn't expect more arguments that we passed */
588 mutt_message ("%s", errbuf);
590 mutt_error ("%s", errbuf);
594 void mutt_display_address (ENVELOPE * env)
596 const char *pfx = NULL;
597 char buf[SHORT_STRING];
600 adr = mutt_get_address(env, &pfx);
606 * Note: We don't convert IDNA to local representation this time.
607 * That is intentional, so the user has an opportunity to copy &
608 * paste the on-the-wire form of the address to other, IDN-unable
613 rfc822_write_address (buf, sizeof (buf), adr, 0);
614 mutt_message ("%s: %s", pfx, buf);
617 static void set_copy_flags (HEADER * hdr, int decode, int decrypt,
618 int *cmflags, int *chflags)
621 *chflags = CH_UPDATE_LEN;
623 if (WithCrypto && !decode && decrypt && (hdr->security & ENCRYPT)) {
624 if ((WithCrypto & APPLICATION_PGP)
625 && mutt_is_multipart_encrypted (hdr->content)) {
626 *chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
627 *cmflags = M_CM_DECODE_PGP;
629 else if ((WithCrypto & APPLICATION_PGP)
630 && mutt_is_application_pgp (hdr->content) & ENCRYPT)
632 else if ((WithCrypto & APPLICATION_SMIME)
633 && mutt_is_application_smime (hdr->content) & ENCRYPT) {
634 *chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
635 *cmflags = M_CM_DECODE_SMIME;
640 *chflags = CH_XMIT | CH_MIME | CH_TXTPLAIN;
641 *cmflags = M_CM_DECODE | M_CM_CHARCONV;
643 if (!decrypt) { /* If decode doesn't kick in for decrypt, */
644 *chflags |= CH_DECODE; /* then decode RFC 2047 headers, */
646 if (option (OPTWEED)) {
647 *chflags |= CH_WEED; /* and respect $weed. */
648 *cmflags |= M_CM_WEED;
654 int _mutt_save_message (HEADER * h, CONTEXT * ctx, int delete, int decode,
656 int cmflags, chflags;
659 set_copy_flags (h, decode, decrypt, &cmflags, &chflags);
661 if (decode || decrypt)
662 mutt_parse_mime_message (Context, h);
664 if ((rc = mutt_append_message (ctx, Context, h, cmflags, chflags)) != 0)
668 mutt_set_flag (Context, h, M_DELETE, 1);
669 if (option (OPTDELETEUNTAG))
670 mutt_set_flag (Context, h, M_TAG, 0);
671 mutt_set_flag (Context, h, M_APPENDED, 1);
676 /* returns 0 if the copy/save was successful, or -1 on error/abort */
677 int mutt_save_message (HEADER * h, int delete,
678 int decode, int decrypt, int *redraw) {
679 int i, need_buffy_cleanup;
680 int need_passphrase = 0, app = 0;
681 char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX];
694 snprintf (prompt, sizeof (prompt),
695 decode ? (delete ? _("Decode-save%s to mailbox") :
696 _("Decode-copy%s to mailbox")) :
697 (decrypt ? (delete ? _("Decrypt-save%s to mailbox") :
698 _("Decrypt-copy%s to mailbox")) :
699 (delete ? _("Save%s to mailbox") : _("Copy%s to mailbox"))),
700 h ? "" : _(" tagged"));
705 need_passphrase = h->security & ENCRYPT;
708 mutt_message_hook (Context, h, M_MESSAGEHOOK);
709 mutt_default_save (buf, sizeof (buf), h);
712 /* look for the first tagged message */
714 for (i = 0; i < Context->vcount; i++) {
715 if (Context->hdrs[Context->v2r[i]]->tagged) {
716 h = Context->hdrs[Context->v2r[i]];
723 mutt_message_hook (Context, h, M_MESSAGEHOOK);
724 mutt_default_save (buf, sizeof (buf), h);
726 need_passphrase = h->security & ENCRYPT;
733 mutt_pretty_mailbox (buf);
734 if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
737 if (*redraw != REDRAW_FULL) {
739 *redraw = REDRAW_INDEX | REDRAW_STATUS;
741 *redraw = REDRAW_STATUS;
747 /* This is an undocumented feature of ELM pointed out to me by Felix von
748 * Leitner <leitner@prz.fu-berlin.de>
750 if (m_strcmp(buf, ".") == 0)
751 m_strcpy(buf, sizeof(buf), LastSaveFolder);
753 m_strcpy(LastSaveFolder, sizeof(LastSaveFolder), buf);
755 mutt_expand_path (buf, sizeof (buf));
757 /* check to make sure that this file is really the one the user wants */
758 if (mutt_save_confirm (buf, &st) != 0)
761 if (WithCrypto && need_passphrase && (decode || decrypt)
762 && !crypt_valid_passphrase (app))
765 mutt_message (_("Copying to %s..."), buf);
768 if (Context->magic == M_IMAP && !(decode || decrypt) && mx_get_magic (buf) == M_IMAP) {
769 switch (imap_copy_messages (Context, h, buf, delete)) {
774 /* non-fatal error: fall through to fetch/append */
777 /* fatal error, abort */
784 if (mx_open_mailbox (buf, M_APPEND, &ctx) != NULL) {
786 if (_mutt_save_message (h, &ctx, delete, decode, decrypt) != 0) {
787 mx_close_mailbox (&ctx, NULL);
791 for (i = 0; i < Context->vcount; i++) {
792 if (Context->hdrs[Context->v2r[i]]->tagged) {
793 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]],
795 if (_mutt_save_message (Context->hdrs[Context->v2r[i]], &ctx, delete,
796 decode, decrypt) != 0) {
797 mx_close_mailbox (&ctx, NULL);
804 need_buffy_cleanup = (ctx.magic == M_MBOX || ctx.magic == M_MMDF);
806 mx_close_mailbox (&ctx, NULL);
808 if (need_buffy_cleanup) {
810 tmp = buffy_find_mailbox (buf);
811 if (tmp && tmp->new <= 0)
812 buffy_update_mailbox (tmp);
814 /* fix up the times so buffy won't get confused */
815 if (st.st_mtime > st.st_atime) {
816 ut.actime = st.st_atime;
817 ut.modtime = time (NULL);
832 void mutt_version (void)
834 mutt_message (mutt_make_version (1));
837 void mutt_edit_content_type (HEADER * h, BODY * b, FILE * fp)
839 char buf[LONG_STRING];
840 char obuf[LONG_STRING];
844 char charset[STRING];
847 short charset_changed = 0;
848 short type_changed = 0;
850 cp = mutt_get_parameter ("charset", b->parameter);
851 m_strcpy(charset, sizeof(charset), NONULL(cp));
853 snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
854 m_strcpy(obuf, sizeof(obuf), buf);
858 for (p = b->parameter; p; p = p->next) {
861 rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
862 snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
866 if (mutt_get_field ("Content-Type: ", buf, sizeof (buf), 0) != 0 ||
870 /* clean up previous junk */
871 mutt_free_parameter (&b->parameter);
872 p_delete(&b->subtype);
874 mutt_parse_content_type (buf, b);
877 snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
878 type_changed = ascii_strcasecmp (tmp, obuf);
880 ascii_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter));
882 /* if in send mode, check for conversion - current setting is default. */
884 if (!h && b->type == TYPETEXT && charset_changed) {
887 snprintf (tmp, sizeof (tmp), _("Convert to %s upon sending?"),
888 mutt_get_parameter ("charset", b->parameter));
889 if ((r = mutt_yesorno (tmp, !b->noconv)) != -1)
890 b->noconv = (r == M_NO);
893 /* inform the user */
895 snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
897 mutt_message (_("Content-Type changed to %s."), tmp);
898 if (b->type == TYPETEXT && charset_changed) {
901 mutt_message (_("Character set changed to %s; %s."),
902 mutt_get_parameter ("charset", b->parameter),
903 b->noconv ? _("not converting") : _("converting"));
906 b->force_charset |= charset_changed ? 1 : 0;
908 if (!is_multipart (b) && b->parts)
909 mutt_free_body (&b->parts);
910 if (!mutt_is_message_type (b->type, b->subtype) && b->hdr) {
911 b->hdr->content = NULL;
912 mutt_free_header (&b->hdr);
915 if (fp && (is_multipart (b) || mutt_is_message_type (b->type, b->subtype)))
916 mutt_parse_part (fp, b);
918 if (WithCrypto && h) {
922 h->security |= crypt_query (b);
927 static int _mutt_check_traditional_pgp (HEADER * h, int *redraw)
932 h->security |= PGP_TRADITIONAL_CHECKED;
934 mutt_parse_mime_message (Context, h);
935 if ((msg = mx_open_message (Context, h->msgno)) == NULL)
937 if (crypt_pgp_check_traditional (msg->fp, h->content, 0)) {
938 h->security = crypt_query (h->content);
939 *redraw |= REDRAW_FULL;
943 h->security |= PGP_TRADITIONAL_CHECKED;
944 mx_close_message (&msg);
948 int mutt_check_traditional_pgp (HEADER * h, int *redraw)
953 if (h && !(h->security & PGP_TRADITIONAL_CHECKED))
954 rv = _mutt_check_traditional_pgp (h, redraw);
956 for (i = 0; i < Context->vcount; i++)
957 if (Context->hdrs[Context->v2r[i]]->tagged &&
958 !(Context->hdrs[Context->v2r[i]]->
959 security & PGP_TRADITIONAL_CHECKED))
961 _mutt_check_traditional_pgp (Context->hdrs[Context->v2r[i]], redraw)