563 |
* return 1 if a message is deleted |
* return 1 if a message is deleted |
564 |
*/ |
*/ |
565 |
int |
int |
566 |
util_isdeleted (int n) |
util_isdeleted (message_t msg) |
567 |
{ |
{ |
|
message_t msg; |
|
568 |
attribute_t attr; |
attribute_t attr; |
569 |
if (mailbox_get_message (mbox, n, &msg) != 0) |
|
|
return 0; |
|
570 |
message_get_attribute (msg, &attr); |
message_get_attribute (msg, &attr); |
571 |
if (attribute_is_deleted (attr)) |
return attribute_is_deleted (attr); |
|
return 1; |
|
|
return 0; |
|
572 |
} |
} |
573 |
|
|
574 |
char * |
char * |
914 |
off += n; |
off += n; |
915 |
} |
} |
916 |
free (buf); |
free (buf); |
917 |
|
fprintf (outfile, "\n"); |
918 |
} |
} |
919 |
fclose (outfile); |
fclose (outfile); |
920 |
} |
} |
1223 |
|
|
1224 |
return errcnt; |
return errcnt; |
1225 |
} |
} |
1226 |
|
|
1227 |
|
int |
1228 |
|
util_get_message (mailbox_t mbox, size_t msgno, message_t *msg, int delflag) |
1229 |
|
{ |
1230 |
|
int status; |
1231 |
|
|
1232 |
|
if (msgno > total) |
1233 |
|
{ |
1234 |
|
util_error_range (msgno); |
1235 |
|
return ENOENT; |
1236 |
|
} |
1237 |
|
|
1238 |
|
status = mailbox_get_message (mbox, msgno, msg); |
1239 |
|
if (status) |
1240 |
|
{ |
1241 |
|
util_error ("can't get message %lu: %s", |
1242 |
|
(unsigned long) msgno, mu_errstring (status)); |
1243 |
|
return status; |
1244 |
|
} |
1245 |
|
|
1246 |
|
if (delflag && util_isdeleted (*msg)) |
1247 |
|
{ |
1248 |
|
util_error ("%d: Inappropriate message (has been deleted)"); |
1249 |
|
return ENOENT; |
1250 |
|
} |
1251 |
|
return 0; |
1252 |
|
} |
1253 |
|
|
1254 |
|
int |
1255 |
|
util_error_range (size_t msgno) |
1256 |
|
{ |
1257 |
|
util_error ("%d: invalid message number", msgno); |
1258 |
|
return 1; |
1259 |
|
} |