sv_mu_save_to() became mailbox/message.c:message_save_to_mailbox()
Showing
2 changed files
with
13 additions
and
64 deletions
... | @@ -213,11 +213,11 @@ sv_fileinto (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -213,11 +213,11 @@ sv_fileinto (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
213 | 213 | ||
214 | if ((m->svflags & SV_FLAG_NO_ACTIONS) == 0) | 214 | if ((m->svflags & SV_FLAG_NO_ACTIONS) == 0) |
215 | { | 215 | { |
216 | *errmsg = "fileinto(delivering)"; | 216 | *errmsg = "fileinto, saving msg"; |
217 | m->rc = sv_mu_save_to (a->mailbox, m->msg, m->ticket, m->debug); | 217 | m->rc = message_save_to_mailbox (m->msg, m->ticket, m->debug, a->mailbox); |
218 | if (!m->rc) | 218 | if (!m->rc) |
219 | { | 219 | { |
220 | *errmsg = "fileinto(deleting)"; | 220 | *errmsg = "fileinto, deleting msg"; |
221 | m->rc = sv_mu_mark_deleted (m->msg, 1); | 221 | m->rc = sv_mu_mark_deleted (m->msg, 1); |
222 | } | 222 | } |
223 | } | 223 | } |
... | @@ -280,6 +280,7 @@ sv_notify (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -280,6 +280,7 @@ sv_notify (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
280 | } | 280 | } |
281 | #endif | 281 | #endif |
282 | 282 | ||
283 | #if 0 | ||
283 | int | 284 | int |
284 | sv_autorespond (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | 285 | sv_autorespond (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
285 | { | 286 | { |
... | @@ -292,7 +293,6 @@ sv_send_response (void *ac, void *ic, void *sc, void *mc, const char **errmsg) | ... | @@ -292,7 +293,6 @@ sv_send_response (void *ac, void *ic, void *sc, void *mc, const char **errmsg) |
292 | return SIEVE_FAIL; | 293 | return SIEVE_FAIL; |
293 | } | 294 | } |
294 | 295 | ||
295 | #if 0 | ||
296 | sieve_vacation_t vacation = { | 296 | sieve_vacation_t vacation = { |
297 | 0, /* min response */ | 297 | 0, /* min response */ |
298 | 0, /* max response */ | 298 | 0, /* max response */ | ... | ... |
1 | /** utility wrappers around mailutils functionality **/ | 1 | /** utility wrappers around mailutils functionality **/ |
2 | 2 | ||
3 | #include <assert.h> | ||
3 | #include <errno.h> | 4 | #include <errno.h> |
4 | #include <string.h> | 5 | #include <string.h> |
5 | 6 | ||
6 | #include "sv.h" | 7 | #include "sv.h" |
7 | 8 | ||
9 | #if 0 | ||
8 | int | 10 | int |
9 | sv_mu_copy_debug_level (const mailbox_t from, mailbox_t to) | 11 | sv_mu_copy_debug_level (const mailbox_t from, mailbox_t to) |
10 | { | 12 | { |
... | @@ -15,73 +17,20 @@ sv_mu_copy_debug_level (const mailbox_t from, mailbox_t to) | ... | @@ -15,73 +17,20 @@ sv_mu_copy_debug_level (const mailbox_t from, mailbox_t to) |
15 | if (!from || !to) | 17 | if (!from || !to) |
16 | return EINVAL; | 18 | return EINVAL; |
17 | 19 | ||
18 | rc = mailbox_get_debug (from, &d); | 20 | if((rc = mailbox_get_debug (from, &d))) |
19 | |||
20 | if (!rc) | ||
21 | mu_debug_get_level (d, &level); | ||
22 | |||
23 | if (!rc) | ||
24 | rc = mailbox_get_debug (to, &d); | ||
25 | |||
26 | if (!rc) | ||
27 | rc = mu_debug_set_level (d, level); | ||
28 | |||
29 | return rc; | 21 | return rc; |
30 | } | ||
31 | |||
32 | int | ||
33 | sv_mu_save_to (const char *toname, message_t msg, | ||
34 | ticket_t ticket, mu_debug_t debug) | ||
35 | { | ||
36 | int rc = 0; | ||
37 | mailbox_t to = 0; | ||
38 | |||
39 | rc = mailbox_create_default (&to, toname); | ||
40 | |||
41 | if (!rc && debug) | ||
42 | { | ||
43 | folder_t folder = 0; | ||
44 | |||
45 | mailbox_set_debug (to, debug); | ||
46 | |||
47 | if (mailbox_get_folder (to, &folder)) | ||
48 | folder_set_debug(folder, debug); | ||
49 | |||
50 | } | ||
51 | 22 | ||
52 | if (!rc && ticket) | 23 | if ((mu_debug_get_level (d, &level))) |
53 | { | 24 | return rc; |
54 | folder_t folder = NULL; | ||
55 | authority_t auth = NULL; | ||
56 | |||
57 | if (!rc) | ||
58 | rc = mailbox_get_folder (to, &folder); | ||
59 | |||
60 | if (!rc) | ||
61 | rc = folder_get_authority (folder, &auth); | ||
62 | |||
63 | /* Authentication-less folders don't have authorities. */ | ||
64 | if (!rc && auth) | ||
65 | rc = authority_set_ticket (auth, ticket); | ||
66 | } | ||
67 | |||
68 | if (!rc) | ||
69 | rc = mailbox_open (to, MU_STREAM_WRITE | MU_STREAM_CREAT); | ||
70 | |||
71 | if (!rc) | ||
72 | rc = mailbox_append_message (to, msg); | ||
73 | 25 | ||
74 | if (!rc) | 26 | if ((rc = mailbox_get_debug (to, &d))) |
75 | rc = mailbox_close (to); | 27 | return rc; |
76 | else | ||
77 | { | ||
78 | mailbox_close (to); | ||
79 | } | ||
80 | 28 | ||
81 | mailbox_destroy (&to); | 29 | rc = mu_debug_set_level (d, level); |
82 | 30 | ||
83 | return rc; | 31 | return rc; |
84 | } | 32 | } |
33 | #endif | ||
85 | 34 | ||
86 | int | 35 | int |
87 | sv_mu_mark_deleted (message_t msg, int deleted) | 36 | sv_mu_mark_deleted (message_t msg, int deleted) | ... | ... |
-
Please register or sign in to post a comment