2 * Copyright (C) 1996-2000 Michael R. Elkins <me@mutt.org>
3 * Copyright (C) 2000 Thomas Roessler <roessler@does-not-exist.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 #include "mutt_curses.h"
26 #include "mutt_menu.h"
33 #include "mutt_crypt.h"
34 #include "mutt_idna.h"
35 #include <sys/types.h>
51 #include <sys/types.h>
54 static const char *ExtPagerProgress = "all";
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;
69 snprintf (buf, sizeof (buf), "%s/%s", TYPE (cur->content),
70 cur->content->subtype);
72 mutt_parse_mime_message (Context, cur);
73 mutt_message_hook (Context, cur, M_MESSAGEHOOK);
75 /* see if crytpo is needed for this message. if so, we should exit curses */
76 if (WithCrypto && cur->security)
78 if (cur->security & ENCRYPT)
80 if (cur->security & APPLICATION_SMIME)
81 crypt_smime_getkeys (cur->env);
82 if(!crypt_valid_passphrase(cur->security))
85 cmflags |= M_CM_VERIFY;
87 else if (cur->security & SIGN)
89 /* find out whether or not the verify signature */
90 if (query_quadoption (OPT_VERIFYSIG, _("Verify PGP signature?")) == M_YES)
92 cmflags |= M_CM_VERIFY;
97 if (cmflags & M_CM_VERIFY || cur->security & ENCRYPT)
99 if (cur->security & APPLICATION_PGP)
102 crypt_pgp_invoke_getkeys (cur->env->from);
104 crypt_invoke_message (APPLICATION_PGP);
107 if (cur->security & APPLICATION_SMIME)
108 crypt_invoke_message (APPLICATION_SMIME);
112 mutt_mktemp (tempfile);
113 if ((fpout = safe_fopen (tempfile, "w")) == NULL)
115 mutt_error _("Could not create temporary file!");
119 if (DisplayFilter && *DisplayFilter)
123 /* mutt_endwin (NULL); */
124 filterpid = mutt_create_filter_fd (DisplayFilter, &fpout, NULL, NULL,
125 -1, fileno(fpfilterout), -1);
128 mutt_error (_("Cannot create display filter"));
129 safe_fclose (&fpfilterout);
135 if (!Pager || mutt_strcmp (Pager, "builtin") == 0)
139 struct hdr_format_info hfi;
141 hfi.pager_progress = ExtPagerProgress;
143 mutt_make_string_info (buf, sizeof (buf), NONULL(PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
145 fputs ("\n\n", fpout);
148 res = mutt_copy_message (fpout, Context, cur, cmflags,
149 (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM);
150 if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res == -1)
152 mutt_error (_("Could not copy message"));
153 if (fpfilterout != NULL)
155 mutt_wait_filter (filterpid);
156 safe_fclose (&fpfilterout);
158 mutt_unlink (tempfile);
162 if (fpfilterout != NULL && mutt_wait_filter (filterpid) != 0)
163 mutt_any_key_to_continue (NULL);
165 safe_fclose (&fpfilterout); /* XXX - check result? */
170 /* update crypto information for this message */
171 cur->security &= ~(GOODSIGN|BADSIGN);
172 cur->security |= crypt_query (cur->content);
174 /* Remove color cache for this message, in case there
175 are color patterns for both ~g and ~V */
184 && (cur->security & APPLICATION_SMIME) && (cmflags & M_CM_VERIFY))
186 if (cur->security & GOODSIGN)
188 if (!crypt_smime_verify_sender(cur))
189 mutt_message ( _("S/MIME signature successfully verified."));
191 mutt_error ( _("S/MIME certificate owner does not match sender."));
193 else if (cur->security & PARTSIGN)
194 mutt_message (_("Warning: Part of this message has not been signed."));
195 else if (cur->security & SIGN || cur->security & BADSIGN)
196 mutt_error ( _("S/MIME signature could NOT be verified."));
200 && (cur->security & APPLICATION_PGP) && (cmflags & M_CM_VERIFY))
202 if (cur->security & GOODSIGN)
203 mutt_message (_("PGP signature successfully verified."));
204 else if (cur->security & PARTSIGN)
205 mutt_message (_("Warning: Part of this message has not been signed."));
206 else if (cur->security & SIGN)
207 mutt_message (_("PGP signature could NOT be verified."));
210 /* Invoke the builtin pager */
211 memset (&info, 0, sizeof (pager_t));
214 rc = mutt_pager (NULL, tempfile, M_PAGER_MESSAGE, &info);
221 snprintf (buf, sizeof (buf), "%s %s", NONULL(Pager), tempfile);
222 if ((r = mutt_system (buf)) == -1)
223 mutt_error (_("Error running \"%s\"!"), buf);
225 keypad (stdscr, TRUE);
227 mutt_set_flag (Context, cur, M_READ, 1);
228 if (r != -1 && option (OPTPROMPTAFTER))
230 mutt_ungetch (mutt_any_key_to_continue _("Command: "), 0);
231 rc = km_dokey (MENU_PAGER);
240 void ci_bounce_message (HEADER *h, int *redraw)
242 char prompt[SHORT_STRING];
243 char scratch[SHORT_STRING];
244 char buf[HUGE_STRING] = { 0 };
250 strfcpy(prompt, _("Bounce message to: "), sizeof(prompt));
252 strfcpy(prompt, _("Bounce tagged messages to: "), sizeof(prompt));
254 rc = mutt_get_field (prompt, buf, sizeof (buf), M_ALIAS);
256 if (option (OPTNEEDREDRAW))
258 unset_option (OPTNEEDREDRAW);
259 *redraw = REDRAW_FULL;
265 if (!(adr = rfc822_parse_adrlist (adr, buf)))
267 mutt_error _("Error parsing address!");
271 adr = mutt_expand_aliases (adr);
273 if (mutt_addrlist_to_idna (adr, &err) < 0)
275 mutt_error (_("Bad IDN: '%s'"), err);
277 rfc822_free_address (&adr);
282 rfc822_write_address (buf, sizeof (buf), adr, 1);
284 #define extra_space (15 + 7 + 2)
285 snprintf (scratch, sizeof (scratch),
286 (h ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
288 if (mutt_strwidth (prompt) > COLS - extra_space)
290 mutt_format_string (prompt, sizeof (prompt),
291 0, COLS-extra_space, FMT_LEFT, 0,
292 scratch, sizeof (scratch), 0);
293 safe_strcat (prompt, sizeof (prompt), "...?");
296 snprintf (prompt, sizeof (prompt), "%s?", scratch);
298 if (query_quadoption (OPT_BOUNCE, prompt) != M_YES)
300 rfc822_free_address (&adr);
301 CLEARLINE (LINES - 1);
302 mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
306 CLEARLINE (LINES - 1);
308 rc = mutt_bounce_message (NULL, h, adr);
309 rfc822_free_address (&adr);
310 /* If no error, or background, display message. */
311 if ((rc == 0) || (rc == S_BKG))
312 mutt_message (h ? _("Message bounced.") : _("Messages bounced."));
315 static void pipe_set_flags (int decode, int print, int *cmflags, int *chflags)
319 *cmflags |= M_CM_DECODE | M_CM_CHARCONV;
320 *chflags |= CH_DECODE | CH_REORDER;
322 if (option (OPTWEED))
325 *cmflags |= M_CM_WEED;
330 *cmflags |= M_CM_PRINTING;
334 static void pipe_msg (HEADER *h, FILE *fp, int decode, int print)
337 int chflags = CH_FROM;
339 pipe_set_flags (decode, print, &cmflags, &chflags);
341 if (WithCrypto && decode && h->security & ENCRYPT)
343 if(!crypt_valid_passphrase(h->security))
349 mutt_parse_mime_message (Context, h);
351 mutt_copy_message (fp, Context, h, cmflags, chflags);
355 /* the following code is shared between printing and piping */
357 static int _mutt_pipe_message (HEADER *h, char *cmd,
368 /* mutt_endwin (NULL);
370 is this really needed here ?
371 it makes the screen flicker on pgp and s/mime messages,
372 before asking for a passphrase...
377 mutt_message_hook (Context, h, M_MESSAGEHOOK);
379 if (WithCrypto && decode)
381 mutt_parse_mime_message (Context, h);
382 if(h->security & ENCRYPT && !crypt_valid_passphrase(h->security))
387 if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0)
389 mutt_perror _("Can't create filter process");
393 pipe_msg (h, fpout, decode, print);
395 rc = mutt_wait_filter (thepid);
398 { /* handle tagged messages */
400 if (WithCrypto && decode)
402 for (i = 0; i < Context->vcount; i++)
403 if(Context->hdrs[Context->v2r[i]]->tagged)
405 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]], M_MESSAGEHOOK);
406 mutt_parse_mime_message(Context, Context->hdrs[Context->v2r[i]]);
407 if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT &&
408 !crypt_valid_passphrase(Context->hdrs[Context->v2r[i]]->security))
415 for (i = 0; i < Context->vcount; i++)
417 if (Context->hdrs[Context->v2r[i]]->tagged)
419 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]], M_MESSAGEHOOK);
421 if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0)
423 mutt_perror _("Can't create filter process");
426 pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
427 /* add the message separator */
428 if (sep) fputs (sep, fpout);
429 safe_fclose (&fpout);
430 if (mutt_wait_filter (thepid) != 0)
438 if ((thepid = mutt_create_filter (cmd, &fpout, NULL, NULL)) < 0)
440 mutt_perror _("Can't create filter process");
443 for (i = 0; i < Context->vcount; i++)
445 if (Context->hdrs[Context->v2r[i]]->tagged)
447 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]], M_MESSAGEHOOK);
448 pipe_msg (Context->hdrs[Context->v2r[i]], fpout, decode, print);
449 /* add the message separator */
450 if (sep) fputs (sep, fpout);
453 safe_fclose (&fpout);
454 if (mutt_wait_filter (thepid) != 0)
459 if (rc || option (OPTWAITKEY))
460 mutt_any_key_to_continue (NULL);
464 void mutt_pipe_message (HEADER *h)
466 char buffer[LONG_STRING];
469 if (mutt_get_field (_("Pipe to command: "), buffer, sizeof (buffer), M_CMD)
473 mutt_expand_path (buffer, sizeof (buffer));
474 _mutt_pipe_message (h, buffer,
475 option (OPTPIPEDECODE),
477 option (OPTPIPESPLIT),
481 void mutt_print_message (HEADER *h)
484 if (quadoption (OPT_PRINT) && (!PrintCmd || !*PrintCmd))
486 mutt_message (_("No printing command has been defined."));
490 if (query_quadoption (OPT_PRINT,
491 h ? _("Print message?") : _("Print tagged messages?"))
495 if (_mutt_pipe_message (h, PrintCmd,
496 option (OPTPRINTDECODE),
498 option (OPTPRINTSPLIT),
500 mutt_message (h ? _("Message printed") : _("Messages printed"));
502 mutt_message (h ? _("Message could not be printed") :
503 _("Messages could not be printed"));
507 int mutt_select_sort (int reverse)
509 int method = Sort; /* save the current method in case of abort */
511 switch (mutt_multi_choice (reverse ?
512 _("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?: ") :
513 _("Sort (d)ate/(f)rm/(r)ecv/(s)ubj/t(o)/(t)hread/(u)nsort/si(z)e/s(c)ore/s(p)am?: "),
516 case -1: /* abort - don't resort */
528 Sort = SORT_RECEIVED;
539 case 6: /* (t)hread */
543 case 7: /* (u)nsort */
551 case 9: /* s(c)ore */
555 case 10: /* s(p)am */
560 Sort |= SORT_REVERSE;
562 return (Sort != method ? 0 : -1); /* no need to resort if it's the same */
565 /* invoke a command in a subshell */
566 void mutt_shell_escape (void)
568 char buf[LONG_STRING];
571 if (mutt_get_field (_("Shell command: "), buf, sizeof (buf), M_CMD) == 0)
573 if (!buf[0] && Shell)
574 strfcpy (buf, Shell, sizeof (buf));
580 if (mutt_system (buf) != 0 || option (OPTWAITKEY))
581 mutt_any_key_to_continue (NULL);
586 /* enter a mutt command */
587 void mutt_enter_command (void)
590 char buffer[LONG_STRING], errbuf[LONG_STRING];
594 if (mutt_get_field (":", buffer, sizeof (buffer), M_COMMAND) != 0 || !buffer[0])
597 err.dsize = sizeof (errbuf);
598 memset (&token, 0, sizeof (token));
599 r = mutt_parse_rc_line (buffer, &token, &err);
603 /* since errbuf could potentially contain printf() sequences in it,
604 we must call mutt_error() in this fashion so that vsprintf()
605 doesn't expect more arguments that we passed */
607 mutt_message ("%s", errbuf);
609 mutt_error ("%s", errbuf);
613 void mutt_display_address (ENVELOPE *env)
616 char buf[SHORT_STRING];
619 adr = mutt_get_address (env, &pfx);
624 * Note: We don't convert IDNA to local representation this time.
625 * That is intentional, so the user has an opportunity to copy &
626 * paste the on-the-wire form of the address to other, IDN-unable
631 rfc822_write_address (buf, sizeof (buf), adr, 0);
632 mutt_message ("%s: %s", pfx, buf);
635 static void set_copy_flags (HEADER *hdr, int decode, int decrypt, int *cmflags, int *chflags)
638 *chflags = CH_UPDATE_LEN;
640 if (WithCrypto && !decode && decrypt && (hdr->security & ENCRYPT))
642 if ((WithCrypto & APPLICATION_PGP)
643 && mutt_is_multipart_encrypted(hdr->content))
645 *chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
646 *cmflags = M_CM_DECODE_PGP;
648 else if ((WithCrypto & APPLICATION_PGP)
649 && mutt_is_application_pgp (hdr->content) & ENCRYPT)
651 else if ((WithCrypto & APPLICATION_SMIME)
652 && mutt_is_application_smime(hdr->content) & ENCRYPT)
654 *chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
655 *cmflags = M_CM_DECODE_SMIME;
661 *chflags = CH_XMIT | CH_MIME | CH_TXTPLAIN;
662 *cmflags = M_CM_DECODE | M_CM_CHARCONV;
664 if (!decrypt) /* If decode doesn't kick in for decrypt, */
666 *chflags |= CH_DECODE; /* then decode RFC 2047 headers, */
668 if (option (OPTWEED))
670 *chflags |= CH_WEED; /* and respect $weed. */
671 *cmflags |= M_CM_WEED;
677 int _mutt_save_message (HEADER *h, CONTEXT *ctx, int delete, int decode, int decrypt)
679 int cmflags, chflags;
682 set_copy_flags (h, decode, decrypt, &cmflags, &chflags);
684 if (decode || decrypt)
685 mutt_parse_mime_message (Context, h);
687 if ((rc = mutt_append_message (ctx, Context, h, cmflags, chflags)) != 0)
692 mutt_set_flag (Context, h, M_DELETE, 1);
693 if (option (OPTDELETEUNTAG))
694 mutt_set_flag (Context, h, M_TAG, 0);
700 /* returns 0 if the copy/save was successful, or -1 on error/abort */
701 int mutt_save_message (HEADER *h, int delete,
702 int decode, int decrypt, int *redraw)
704 int i, need_buffy_cleanup;
705 int need_passphrase = 0, app=0;
706 char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX];
715 snprintf (prompt, sizeof (prompt),
716 decode ? (delete ? _("Decode-save%s to mailbox") :
717 _("Decode-copy%s to mailbox")) :
718 (decrypt ? (delete ? _("Decrypt-save%s to mailbox") :
719 _("Decrypt-copy%s to mailbox")) :
720 (delete ? _("Save%s to mailbox") : _("Copy%s to mailbox"))),
721 h ? "" : _(" tagged"));
728 need_passphrase = h->security & ENCRYPT;
731 mutt_message_hook (Context, h, M_MESSAGEHOOK);
732 mutt_default_save (buf, sizeof (buf), h);
736 /* look for the first tagged message */
738 for (i = 0; i < Context->vcount; i++)
740 if (Context->hdrs[Context->v2r[i]]->tagged)
742 h = Context->hdrs[Context->v2r[i]];
750 mutt_message_hook (Context, h, M_MESSAGEHOOK);
751 mutt_default_save (buf, sizeof (buf), h);
754 need_passphrase = h->security & ENCRYPT;
761 mutt_pretty_mailbox (buf);
762 if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1)
765 if (*redraw != REDRAW_FULL)
768 *redraw = REDRAW_INDEX | REDRAW_STATUS;
770 *redraw = REDRAW_STATUS;
776 /* This is an undocumented feature of ELM pointed out to me by Felix von
777 * Leitner <leitner@prz.fu-berlin.de>
779 if (mutt_strcmp (buf, ".") == 0)
780 strfcpy (buf, LastSaveFolder, sizeof (buf));
782 strfcpy (LastSaveFolder, buf, sizeof (LastSaveFolder));
784 mutt_expand_path (buf, sizeof (buf));
786 /* check to make sure that this file is really the one the user wants */
787 if (mutt_save_confirm (buf, &st) != 0)
790 if (WithCrypto && need_passphrase && (decode || decrypt)
791 && !crypt_valid_passphrase(app))
794 mutt_message (_("Copying to %s..."), buf);
797 if (Context->magic == M_IMAP &&
798 !(decode || decrypt) && mx_is_imap (buf))
800 switch (imap_copy_messages (Context, h, buf, delete))
803 case 0: mutt_clear_error (); return 0;
804 /* non-fatal error: fall through to fetch/append */
806 /* fatal error, abort */
812 if (mx_open_mailbox (buf, M_APPEND, &ctx) != NULL)
816 if (_mutt_save_message(h, &ctx, delete, decode, decrypt) != 0)
818 mx_close_mailbox (&ctx, NULL);
824 for (i = 0; i < Context->vcount; i++)
826 if (Context->hdrs[Context->v2r[i]]->tagged)
828 mutt_message_hook (Context, Context->hdrs[Context->v2r[i]], M_MESSAGEHOOK);
829 if (_mutt_save_message(Context->hdrs[Context->v2r[i]],
830 &ctx, delete, decode, decrypt) != 0)
832 mx_close_mailbox (&ctx, NULL);
839 need_buffy_cleanup = (ctx.magic == M_MBOX || ctx.magic == M_MMDF);
841 mx_close_mailbox (&ctx, NULL);
843 if (need_buffy_cleanup)
845 if (option(OPTCHECKMBOXSIZE))
847 tmp = mutt_find_mailbox (buf);
848 if (tmp && !tmp->new)
849 mutt_update_mailbox (tmp);
853 /* fix up the times so buffy won't get confused */
854 if (st.st_mtime > st.st_atime)
856 ut.actime = st.st_atime;
857 ut.modtime = time (NULL);
873 void mutt_version (void)
875 mutt_message ("Mutt %s (%s)", MUTT_VERSION, ReleaseDate);
878 void mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp)
880 char buf[LONG_STRING];
881 char obuf[LONG_STRING];
885 char charset[STRING];
888 short charset_changed = 0;
889 short type_changed = 0;
891 cp = mutt_get_parameter ("charset", b->parameter);
892 strfcpy (charset, NONULL (cp), sizeof (charset));
894 snprintf (buf, sizeof (buf), "%s/%s", TYPE (b), b->subtype);
895 strfcpy (obuf, buf, sizeof (obuf));
900 for (p = b->parameter; p; p = p->next)
904 rfc822_cat (tmp, sizeof (tmp), p->value, MimeSpecials);
905 snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp);
909 if (mutt_get_field ("Content-Type: ", buf, sizeof (buf), 0) != 0 ||
913 /* clean up previous junk */
914 mutt_free_parameter (&b->parameter);
917 mutt_parse_content_type (buf, b);
920 snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
921 type_changed = ascii_strcasecmp (tmp, obuf);
922 charset_changed = ascii_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter));
924 /* if in send mode, check for conversion - current setting is default. */
926 if (!h && b->type == TYPETEXT && charset_changed)
929 snprintf (tmp, sizeof (tmp), _("Convert to %s upon sending?"),
930 mutt_get_parameter ("charset", b->parameter));
931 if ((r = mutt_yesorno (tmp, !b->noconv)) != -1)
932 b->noconv = (r == M_NO);
935 /* inform the user */
937 snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype));
939 mutt_message (_("Content-Type changed to %s."), tmp);
940 if (b->type == TYPETEXT && charset_changed)
944 mutt_message (_("Character set changed to %s; %s."),
945 mutt_get_parameter ("charset", b->parameter),
946 b->noconv ? _("not converting") : _("converting"));
949 b->force_charset |= charset_changed ? 1 : 0;
951 if (!is_multipart (b) && b->parts)
952 mutt_free_body (&b->parts);
953 if (!mutt_is_message_type (b->type, b->subtype) && b->hdr)
955 b->hdr->content = NULL;
956 mutt_free_header (&b->hdr);
959 if (fp && (is_multipart (b) || mutt_is_message_type (b->type, b->subtype)))
960 mutt_parse_part (fp, b);
967 h->security |= crypt_query (b);
972 static int _mutt_check_traditional_pgp (HEADER *h, int *redraw)
977 h->security |= PGP_TRADITIONAL_CHECKED;
979 mutt_parse_mime_message (Context, h);
980 if ((msg = mx_open_message (Context, h->msgno)) == NULL)
982 if (crypt_pgp_check_traditional (msg->fp, h->content, 0))
984 h->security = crypt_query (h->content);
985 *redraw |= REDRAW_FULL;
989 h->security |= PGP_TRADITIONAL_CHECKED;
990 mx_close_message (&msg);
994 int mutt_check_traditional_pgp (HEADER *h, int *redraw)
998 if (h && !(h->security & PGP_TRADITIONAL_CHECKED))
999 rv = _mutt_check_traditional_pgp (h, redraw);
1002 for (i = 0; i < Context->vcount; i++)
1003 if (Context->hdrs[Context->v2r[i]]->tagged &&
1004 !(Context->hdrs[Context->v2r[i]]->security & PGP_TRADITIONAL_CHECKED))
1005 rv = _mutt_check_traditional_pgp (Context->hdrs[Context->v2r[i]], redraw)