36 |
|
|
37 |
|
|
38 |
/* |
/* |
39 |
|
* Open mailbox in read-only mode. |
40 |
|
*/ |
41 |
|
int examine_mailbox(char *mbox) |
42 |
|
{ |
43 |
|
int r; |
44 |
|
|
45 |
|
imap_examine(mbox); |
46 |
|
r = server_response("EXAMINE"); |
47 |
|
|
48 |
|
if (!r) |
49 |
|
mailbox_status(mbox); |
50 |
|
|
51 |
|
return r; |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
/* |
56 |
* Open mailbox in read-write mode. |
* Open mailbox in read-write mode. |
57 |
*/ |
*/ |
58 |
int select_mailbox(char *mbox) |
int select_mailbox(char *mbox) |
63 |
r = server_response("SELECT"); |
r = server_response("SELECT"); |
64 |
|
|
65 |
if (!r) |
if (!r) |
66 |
mailbox_status(mbox); |
if (mailbox_status(mbox) == -2) |
67 |
|
return -2; /* No messages exist. No filters need to |
68 |
|
be applied. */ |
69 |
|
|
70 |
log_info(LOG_MAILBOX, mbox); |
log_info(LOG_MAILBOX, mbox); |
71 |
|
|
82 |
|
|
83 |
if (!(options & OPTION_DETAILS_QUITE)) { |
if (!(options & OPTION_DETAILS_QUITE)) { |
84 |
imap_status(mbox, "MESSAGES RECENT UNSEEN"); |
imap_status(mbox, "MESSAGES RECENT UNSEEN"); |
|
info ("In mailbox %s,", mbox); |
|
85 |
r = status_response(); |
r = status_response(); |
86 |
|
info("in mailbox %s.\n", mbox); |
87 |
} |
} |
88 |
return r; |
return r; |
89 |
} |
} |
351 |
|
|
352 |
switch (*type) { |
switch (*type) { |
353 |
case FILTER_ACTION_DELETE: |
case FILTER_ACTION_DELETE: |
354 |
info("%d messages deleted.\n", cnt); |
info("%d message%s deleted.\n", cnt, plural(cnt)); |
355 |
action_delete(mesgs, args); |
action_delete(mesgs, args); |
356 |
break; |
break; |
357 |
case FILTER_ACTION_COPY: |
case FILTER_ACTION_COPY: |
358 |
info("%d messages copied to mailbox %s.\n", cnt, destmbox); |
info("%d message%s copied to mailbox %s.\n", cnt, plural(cnt), |
359 |
|
destmbox); |
360 |
action_copy(mesgs, destmbox, args); |
action_copy(mesgs, destmbox, args); |
361 |
break; |
break; |
362 |
case FILTER_ACTION_MOVE: |
case FILTER_ACTION_MOVE: |
363 |
info("%d messages moved to mailbox %s.\n", cnt, destmbox); |
info("%d message%s moved to mailbox %s.\n", cnt, plural(cnt), |
364 |
|
destmbox); |
365 |
action_move(mesgs, destmbox, args); |
action_move(mesgs, destmbox, args); |
366 |
break; |
break; |
367 |
case FILTER_ACTION_LIST: |
case FILTER_ACTION_LIST: |
368 |
info("%d messages listed.\n", cnt); |
info("%d message%s listed.\n", cnt, plural(cnt)); |
369 |
action_list(mesgs, args); |
action_list(mesgs, args); |
370 |
break; |
break; |
371 |
} |
} |
392 |
while ((occur = strchr(acp, ','))) |
while ((occur = strchr(acp, ','))) |
393 |
*occur = ' '; |
*occur = ' '; |
394 |
} |
} |
|
|
|
395 |
while ((tok = strsep(&m, delim))) { |
while ((tok = strsep(&m, delim))) { |
396 |
if (*args) { |
if (*args) { |
397 |
imap_fetch(0, tok, acp); |
imap_fetch(0, tok, acp); |
418 |
char *tok, *mcp, *m, *acp = NULL, *occur; |
char *tok, *mcp, *m, *acp = NULL, *occur; |
419 |
|
|
420 |
m = mcp = xstrdup(mesgs); |
m = mcp = xstrdup(mesgs); |
421 |
|
|
422 |
if (*args) { |
if (*args) { |
423 |
acp = xstrdup(args); |
acp = xstrdup(args); |
424 |
|
|
425 |
while ((occur = strchr(acp, ','))) |
while ((occur = strchr(acp, ','))) |
426 |
*occur = ' '; |
*occur = ' '; |
427 |
} |
} |
|
|
|
428 |
while ((tok = strsep(&m, delim))) { |
while ((tok = strsep(&m, delim))) { |
429 |
if (*args) { |
if (*args) { |
430 |
imap_fetch(1, tok, acp); |
imap_fetch(1, tok, acp); |
441 |
} |
} |
442 |
|
|
443 |
free(mcp); |
free(mcp); |
444 |
|
|
445 |
if (*args) |
if (*args) |
446 |
free(acp); |
free(acp); |
447 |
|
|