Commit e7a6f1b3 e7a6f1b394927aca592c4183e9ec2b7cd0656555 by Sergey Poznyakoff

Make sure -nodraftfolder cancels Draft-Folder variable, not only -draftfolder option.

1 parent 0c2ca624
...@@ -86,6 +86,11 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -86,6 +86,11 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
86 { 86 {
87 switch (key) 87 switch (key)
88 { 88 {
89 case ARGP_KEY_INIT:
90 wh_env.draftfolder = mh_global_profile_get ("Draft-Folder",
91 mu_folder_directory ());
92 break;
93
89 case ARG_BUILD: 94 case ARG_BUILD:
90 build_only = 1; 95 build_only = 1;
91 break; 96 break;
...@@ -209,10 +214,6 @@ main (int argc, char **argv) ...@@ -209,10 +214,6 @@ main (int argc, char **argv)
209 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 214 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
210 opt_handler, NULL, &index); 215 opt_handler, NULL, &index);
211 216
212 if (!wh_env.draftfolder)
213 wh_env.draftfolder = mh_global_profile_get ("Draft-Folder",
214 mu_folder_directory ());
215
216 wh_env.file = mh_expand_name (wh_env.draftfolder, "comp", 0); 217 wh_env.file = mh_expand_name (wh_env.draftfolder, "comp", 0);
217 if (!wh_env.draftfile) 218 if (!wh_env.draftfile)
218 wh_env.draftfile = mh_expand_name (wh_env.draftfolder, "draft", 0); 219 wh_env.draftfile = mh_expand_name (wh_env.draftfolder, "draft", 0);
......
...@@ -121,6 +121,11 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -121,6 +121,11 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
121 { 121 {
122 switch (key) 122 switch (key)
123 { 123 {
124 case ARGP_KEY_INIT:
125 wh_env.draftfolder = mh_global_profile_get ("Draft-Folder",
126 mu_folder_directory ());
127 break;
128
124 case ARG_ANNOTATE: 129 case ARG_ANNOTATE:
125 annotate = is_true (arg); 130 annotate = is_true (arg);
126 break; 131 break;
...@@ -427,10 +432,6 @@ main (int argc, char **argv) ...@@ -427,10 +432,6 @@ main (int argc, char **argv)
427 mbox = mh_open_folder (current_folder, 0); 432 mbox = mh_open_folder (current_folder, 0);
428 mh_msgset_parse (mbox, &msgset, argc, argv, "cur"); 433 mh_msgset_parse (mbox, &msgset, argc, argv, "cur");
429 434
430 if (!wh_env.draftfolder)
431 wh_env.draftfolder = mh_global_profile_get ("Draft-Folder",
432 mu_folder_directory ());
433
434 wh_env.file = mh_expand_name (wh_env.draftfolder, "forw", 0); 435 wh_env.file = mh_expand_name (wh_env.draftfolder, "forw", 0);
435 if (!wh_env.draftfile) 436 if (!wh_env.draftfile)
436 wh_env.draftfile = mh_expand_name (wh_env.draftfolder, "draft", 0); 437 wh_env.draftfile = mh_expand_name (wh_env.draftfolder, "draft", 0);
......
...@@ -142,6 +142,11 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state) ...@@ -142,6 +142,11 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
142 142
143 switch (key) 143 switch (key)
144 { 144 {
145 case ARGP_KEY_INIT:
146 wh_env.draftfolder = mh_global_profile_get ("Draft-Folder",
147 mu_folder_directory ());
148 break;
149
145 case ARG_ANNOTATE: 150 case ARG_ANNOTATE:
146 annotate = is_true (arg); 151 annotate = is_true (arg);
147 break; 152 break;
...@@ -376,6 +381,7 @@ main (int argc, char **argv) ...@@ -376,6 +381,7 @@ main (int argc, char **argv)
376 mu_init_nls (); 381 mu_init_nls ();
377 382
378 mu_argp_init (program_version, NULL); 383 mu_argp_init (program_version, NULL);
384
379 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc, 385 mh_argp_parse (&argc, &argv, 0, options, mh_option, args_doc, doc,
380 opt_handler, NULL, &index); 386 opt_handler, NULL, &index);
381 if (mh_format_parse (format_str, &format)) 387 if (mh_format_parse (format_str, &format))
...@@ -384,10 +390,6 @@ main (int argc, char **argv) ...@@ -384,10 +390,6 @@ main (int argc, char **argv)
384 exit (1); 390 exit (1);
385 } 391 }
386 392
387 if (!wh_env.draftfolder)
388 wh_env.draftfolder = mh_global_profile_get ("Draft-Folder",
389 mu_folder_directory ());
390
391 mbox = mh_open_folder (current_folder, 0); 393 mbox = mh_open_folder (current_folder, 0);
392 mh_msgset_parse (mbox, &msgset, argc - index, argv + index, "cur"); 394 mh_msgset_parse (mbox, &msgset, argc - index, argv + index, "cur");
393 if (msgset.count != 1) 395 if (msgset.count != 1)
......