See ChangeLog (2001-06-26)
Showing
13 changed files
with
52 additions
and
23 deletions
... | @@ -24,9 +24,10 @@ | ... | @@ -24,9 +24,10 @@ |
24 | */ | 24 | */ |
25 | 25 | ||
26 | /* | 26 | /* |
27 | * Shared between mail_copy() and mail_save(). | 27 | * mail_copy0() is shared between mail_copy() and mail_save(). |
28 | * argc, argv -- argument count & vector | ||
29 | * mark -- whether we should mark the message as saved. | ||
28 | */ | 30 | */ |
29 | |||
30 | int | 31 | int |
31 | mail_copy0 (int argc, char **argv, int mark) | 32 | mail_copy0 (int argc, char **argv, int mark) |
32 | { | 33 | { |
... | @@ -36,7 +37,8 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -36,7 +37,8 @@ mail_copy0 (int argc, char **argv, int mark) |
36 | int *msglist = NULL; | 37 | int *msglist = NULL; |
37 | int num = 0, i = 0; | 38 | int num = 0, i = 0; |
38 | int sender = 0; | 39 | int sender = 0; |
39 | 40 | size_t total_size = 0, total_lines = 0, size; | |
41 | |||
40 | if (isupper (argv[0][0])) | 42 | if (isupper (argv[0][0])) |
41 | sender = 1; | 43 | sender = 1; |
42 | else if (argc >= 2) | 44 | else if (argc >= 2) |
... | @@ -63,19 +65,27 @@ mail_copy0 (int argc, char **argv, int mark) | ... | @@ -63,19 +65,27 @@ mail_copy0 (int argc, char **argv, int mark) |
63 | free (msglist); | 65 | free (msglist); |
64 | return 1; | 66 | return 1; |
65 | } | 67 | } |
66 | |||
67 | fprintf (ofile, "%s\n", filename); | ||
68 | 68 | ||
69 | for (i = 0; i < num; i++) | 69 | for (i = 0; i < num; i++) |
70 | { | 70 | { |
71 | mailbox_get_message (mbox, msglist[i], &msg); | 71 | mailbox_get_message (mbox, msglist[i], &msg); |
72 | mailbox_append_message (mbx, msg); | 72 | mailbox_append_message (mbx, msg); |
73 | |||
74 | message_size (msg, &size); | ||
75 | total_size += size; | ||
76 | message_lines (msg, &size); | ||
77 | total_lines += size; | ||
78 | |||
73 | if (mark) | 79 | if (mark) |
74 | { | 80 | { |
75 | /*FIXME: mark as saved */; | 81 | attribute_t attr; |
82 | message_get_attribute (msg, &attr); | ||
83 | attribute_set_userflag (attr, MAIL_ATTRIBUTE_SAVED); | ||
76 | } | 84 | } |
77 | } | 85 | } |
78 | 86 | ||
87 | fprintf (ofile, "\"%s\" %3ld/%-5ld\n", filename, total_lines, total_size); | ||
88 | |||
79 | mailbox_close (mbx); | 89 | mailbox_close (mbx); |
80 | mailbox_destroy (&mbx); | 90 | mailbox_destroy (&mbx); |
81 | 91 | ... | ... |
... | @@ -25,7 +25,7 @@ int | ... | @@ -25,7 +25,7 @@ int |
25 | mail_delete (int argc, char **argv) | 25 | mail_delete (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_delete, argc, argv); | 28 | return util_msglist_command (mail_delete, argc, argv, 0); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | message_t msg; | 31 | message_t msg; | ... | ... |
... | @@ -26,7 +26,7 @@ int | ... | @@ -26,7 +26,7 @@ int |
26 | mail_dp (int argc, char **argv) | 26 | mail_dp (int argc, char **argv) |
27 | { | 27 | { |
28 | if (argc > 1) | 28 | if (argc > 1) |
29 | util_msglist_command (mail_delete, argc, argv); | 29 | util_msglist_command (mail_delete, argc, argv, 0); |
30 | else | 30 | else |
31 | util_do_command ("delete"); | 31 | util_do_command ("delete"); |
32 | util_do_command ("next"); | 32 | util_do_command ("next"); | ... | ... |
... | @@ -25,7 +25,7 @@ int | ... | @@ -25,7 +25,7 @@ int |
25 | mail_edit (int argc, char **argv) | 25 | mail_edit (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_edit, argc, argv); | 28 | return util_msglist_command (mail_edit, argc, argv, 1); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | char *file = tempnam(getenv("TMPDIR"), "mu"); | 31 | char *file = tempnam(getenv("TMPDIR"), "mu"); | ... | ... |
... | @@ -29,7 +29,7 @@ mail_hold (int argc, char **argv) | ... | @@ -29,7 +29,7 @@ mail_hold (int argc, char **argv) |
29 | attribute_t attr; | 29 | attribute_t attr; |
30 | 30 | ||
31 | if (argc > 1) | 31 | if (argc > 1) |
32 | return util_msglist_command (mail_hold, argc, argv); | 32 | return util_msglist_command (mail_hold, argc, argv, 1); |
33 | else | 33 | else |
34 | { | 34 | { |
35 | if (mailbox_get_message (mbox, cursor, &msg)) | 35 | if (mailbox_get_message (mbox, cursor, &msg)) | ... | ... |
... | @@ -51,6 +51,7 @@ | ... | @@ -51,6 +51,7 @@ |
51 | #include <mailutils/list.h> | 51 | #include <mailutils/list.h> |
52 | #include <mailutils/iterator.h> | 52 | #include <mailutils/iterator.h> |
53 | #include <mailutils/address.h> | 53 | #include <mailutils/address.h> |
54 | #include <mailutils/mutil.h> | ||
54 | 55 | ||
55 | #include <argcv.h> | 56 | #include <argcv.h> |
56 | #include <getline.h> | 57 | #include <getline.h> |
... | @@ -141,7 +142,7 @@ int mail_z __P((int argc, char **argv)); | ... | @@ -141,7 +142,7 @@ int mail_z __P((int argc, char **argv)); |
141 | 142 | ||
142 | void mail_mainloop __P((char *(*input) __P((void *, int)), void *closure, int do_history)); | 143 | void mail_mainloop __P((char *(*input) __P((void *, int)), void *closure, int do_history)); |
143 | int mail_copy0 __P((int argc, char **argv, int mark)); | 144 | int mail_copy0 __P((int argc, char **argv, int mark)); |
144 | int mail_send0 __P((char *to, char *cc, char *bcc, char *subj)); | 145 | int mail_send0 __P((char *to, char *cc, char *bcc, char *subj, int save_to)); |
145 | int mail_mbox_commit __P((void)); | 146 | int mail_mbox_commit __P((void)); |
146 | int mail_is_alt_name __P((char *name)); | 147 | int mail_is_alt_name __P((char *name)); |
147 | int mail_header_is_visible __P((char *str)); | 148 | int mail_header_is_visible __P((char *str)); |
... | @@ -155,7 +156,7 @@ int mail_eq __P((int argc, char **argv)); /* command = */ | ... | @@ -155,7 +156,7 @@ int mail_eq __P((int argc, char **argv)); /* command = */ |
155 | 156 | ||
156 | int util_expand_msglist __P((const int argc, char **argv, int **list)); | 157 | int util_expand_msglist __P((const int argc, char **argv, int **list)); |
157 | int util_do_command __P((const char *cmd, ...)); | 158 | int util_do_command __P((const char *cmd, ...)); |
158 | int util_msglist_command __P((function_t *func, int argc, char **argv)); | 159 | int util_msglist_command __P((function_t *func, int argc, char **argv, int set_cursor)); |
159 | function_t* util_command_get __P((char *cmd)); | 160 | function_t* util_command_get __P((char *cmd)); |
160 | char **util_command_completion __P((char *cmd, int start, int end)); | 161 | char **util_command_completion __P((char *cmd, int start, int end)); |
161 | char *util_command_generator __P((char *text, int state)); | 162 | char *util_command_generator __P((char *text, int state)); |
... | @@ -163,6 +164,7 @@ char *util_stripwhite __P((char *string)); | ... | @@ -163,6 +164,7 @@ char *util_stripwhite __P((char *string)); |
163 | struct mail_command_entry util_find_entry __P((char *cmd)); | 164 | struct mail_command_entry util_find_entry __P((char *cmd)); |
164 | int util_getcols __P((void)); | 165 | int util_getcols __P((void)); |
165 | int util_getlines __P((void)); | 166 | int util_getlines __P((void)); |
167 | int util_screen_lines __P((void)); | ||
166 | struct mail_env_entry *util_find_env __P((char *var)); | 168 | struct mail_env_entry *util_find_env __P((char *var)); |
167 | int util_printenv __P((int set)); | 169 | int util_printenv __P((int set)); |
168 | int util_isdeleted __P((int message)); | 170 | int util_isdeleted __P((int message)); |
... | @@ -176,7 +178,9 @@ void util_slist_add __P((list_t *list, char *value)); | ... | @@ -176,7 +178,9 @@ void util_slist_add __P((list_t *list, char *value)); |
176 | void util_slist_destroy __P((list_t *list)); | 178 | void util_slist_destroy __P((list_t *list)); |
177 | char *util_slist_to_string __P((list_t list, char *delim)); | 179 | char *util_slist_to_string __P((list_t list, char *delim)); |
178 | void util_strcat __P((char **dest, char *str)); | 180 | void util_strcat __P((char **dest, char *str)); |
179 | void util_escape_percent (char **str); | 181 | void util_escape_percent __P((char **str)); |
182 | char *util_outfolder_name __P((char *str)); | ||
183 | void util_save_outgoing __P((message_t msg, char *savefile)); | ||
180 | 184 | ||
181 | char *alias_expand __P((char *name)); | 185 | char *alias_expand __P((char *name)); |
182 | void alias_destroy __P((char *name)); | 186 | void alias_destroy __P((char *name)); |
... | @@ -191,6 +195,7 @@ char *readline __P((const char *prompt)); | ... | @@ -191,6 +195,7 @@ char *readline __P((const char *prompt)); |
191 | 195 | ||
192 | /* Message attributes */ | 196 | /* Message attributes */ |
193 | #define MAIL_ATTRIBUTE_MBOXED 0x0001 | 197 | #define MAIL_ATTRIBUTE_MBOXED 0x0001 |
198 | #define MAIL_ATTRIBUTE_SAVED 0x0002 | ||
194 | 199 | ||
195 | #ifdef __cplusplus | 200 | #ifdef __cplusplus |
196 | } | 201 | } | ... | ... |
... | @@ -28,7 +28,7 @@ int | ... | @@ -28,7 +28,7 @@ int |
28 | mail_print (int argc, char **argv) | 28 | mail_print (int argc, char **argv) |
29 | { | 29 | { |
30 | if (argc > 1) | 30 | if (argc > 1) |
31 | return util_msglist_command (mail_print, argc, argv); | 31 | return util_msglist_command (mail_print, argc, argv, 1); |
32 | else | 32 | else |
33 | { | 33 | { |
34 | message_t mesg; | 34 | message_t mesg; |
... | @@ -39,7 +39,8 @@ mail_print (int argc, char **argv) | ... | @@ -39,7 +39,8 @@ mail_print (int argc, char **argv) |
39 | off_t off = 0; | 39 | off_t off = 0; |
40 | size_t n = 0, lines = 0; | 40 | size_t n = 0, lines = 0; |
41 | FILE *out = ofile; | 41 | FILE *out = ofile; |
42 | 42 | attribute_t attr; | |
43 | |||
43 | if (mailbox_get_message (mbox, cursor, &mesg) != 0) | 44 | if (mailbox_get_message (mbox, cursor, &mesg) != 0) |
44 | return 1; | 45 | return 1; |
45 | 46 | ||
... | @@ -87,6 +88,9 @@ mail_print (int argc, char **argv) | ... | @@ -87,6 +88,9 @@ mail_print (int argc, char **argv) |
87 | if (out != ofile) | 88 | if (out != ofile) |
88 | pclose (out); | 89 | pclose (out); |
89 | 90 | ||
91 | message_get_attribute (mesg, &attr); | ||
92 | attribute_set_read (attr); | ||
93 | |||
90 | return 0; | 94 | return 0; |
91 | } | 95 | } |
92 | return 1; | 96 | return 1; | ... | ... |
... | @@ -28,7 +28,7 @@ int | ... | @@ -28,7 +28,7 @@ int |
28 | mail_reply(int argc, char **argv) | 28 | mail_reply(int argc, char **argv) |
29 | { | 29 | { |
30 | if (argc > 1) | 30 | if (argc > 1) |
31 | return util_msglist_command(mail_reply, argc, argv); | 31 | return util_msglist_command(mail_reply, argc, argv, 1); |
32 | else | 32 | else |
33 | { | 33 | { |
34 | message_t msg; | 34 | message_t msg; |
... | @@ -84,7 +84,7 @@ mail_reply(int argc, char **argv) | ... | @@ -84,7 +84,7 @@ mail_reply(int argc, char **argv) |
84 | fprintf(ofile, "Cc: %s\n", cc); | 84 | fprintf(ofile, "Cc: %s\n", cc); |
85 | fprintf(ofile, "Subject: %s\n\n", subj); | 85 | fprintf(ofile, "Subject: %s\n\n", subj); |
86 | 86 | ||
87 | return mail_send0(to, cc, NULL, subj); | 87 | return mail_send0(to, cc, NULL, subj, 0); |
88 | } | 88 | } |
89 | return 1; | 89 | return 1; |
90 | } | 90 | } | ... | ... |
... | @@ -25,7 +25,7 @@ int | ... | @@ -25,7 +25,7 @@ int |
25 | mail_size (int argc, char **argv) | 25 | mail_size (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | util_msglist_command (mail_size, argc, argv); | 28 | util_msglist_command (mail_size, argc, argv, 1); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | unsigned int s = 0; | 31 | unsigned int s = 0; | ... | ... |
... | @@ -35,7 +35,7 @@ const struct mail_command_entry mail_command_table[] = { | ... | @@ -35,7 +35,7 @@ const struct mail_command_entry mail_command_table[] = { |
35 | { "el", "else", 1, mail_else, "el[se]" }, | 35 | { "el", "else", 1, mail_else, "el[se]" }, |
36 | { "en", "endif", 1, mail_endif, "en[dif]" }, | 36 | { "en", "endif", 1, mail_endif, "en[dif]" }, |
37 | { "ex", "exit", 0, mail_exit, "ex[it]" }, | 37 | { "ex", "exit", 0, mail_exit, "ex[it]" }, |
38 | { "F", "Followup", 0, mail_followup, "F[ollowup] [msglist]" }, | 38 | { "F", "Followup", 0, mail_followup,"F[ollowup] [msglist]" }, |
39 | { "fi", "file", 0, mail_file, "fi[le] [file]" }, | 39 | { "fi", "file", 0, mail_file, "fi[le] [file]" }, |
40 | { "fold", "folder", 0, mail_file, "fold[er] [file]" }, | 40 | { "fold", "folder", 0, mail_file, "fold[er] [file]" }, |
41 | { "folders", "folders", 0, mail_folders,"folders" }, | 41 | { "folders", "folders", 0, mail_folders,"folders" }, | ... | ... |
... | @@ -25,7 +25,7 @@ int | ... | @@ -25,7 +25,7 @@ int |
25 | mail_top (int argc, char **argv) | 25 | mail_top (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_top, argc, argv); | 28 | return util_msglist_command (mail_top, argc, argv, 1); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | message_t msg; | 31 | message_t msg; | ... | ... |
... | @@ -25,7 +25,7 @@ int | ... | @@ -25,7 +25,7 @@ int |
25 | mail_undelete (int argc, char **argv) | 25 | mail_undelete (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_undelete, argc, argv); | 28 | return util_msglist_command (mail_undelete, argc, argv, 1); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | message_t msg; | 31 | message_t msg; | ... | ... |
... | @@ -25,14 +25,24 @@ int | ... | @@ -25,14 +25,24 @@ int |
25 | mail_visual (int argc, char **argv) | 25 | mail_visual (int argc, char **argv) |
26 | { | 26 | { |
27 | if (argc > 1) | 27 | if (argc > 1) |
28 | return util_msglist_command (mail_visual, argc, argv); | 28 | return util_msglist_command (mail_visual, argc, argv, 1); |
29 | else | 29 | else |
30 | { | 30 | { |
31 | message_t msg = NULL; | ||
32 | attribute_t attr = NULL; | ||
31 | char *file = tempnam(getenv("TMPDIR"), "mu"); | 33 | char *file = tempnam(getenv("TMPDIR"), "mu"); |
32 | util_do_command ("copy %s", file); | 34 | |
35 | util_do_command ("copy %s", file); /* NOTE: copy does not set flags */ | ||
33 | util_do_command ("shell %s %s", getenv("VISUAL"), file); | 36 | util_do_command ("shell %s %s", getenv("VISUAL"), file); |
37 | |||
34 | remove (file); | 38 | remove (file); |
35 | free (file); | 39 | free (file); |
40 | |||
41 | /* Mark as read */ | ||
42 | mailbox_get_message (mbox, cursor, &msg); | ||
43 | message_get_attribute (msg, &attr); | ||
44 | attribute_set_read (attr); | ||
45 | |||
36 | return 0; | 46 | return 0; |
37 | } | 47 | } |
38 | return 1; | 48 | return 1; | ... | ... |
-
Please register or sign in to post a comment