static int getbody(void *mc, const char **content_types, sieve_bodypart_t ***parts) { sieve_test_message_t *msg = (sieve_test_message_t *)mc; int r = 0; if (!msg->content.body) { /* parse the message body if we haven't already */ FILE *fp = fopen(msg->filename, "r"); CU_ASSERT_PTR_NOT_NULL(fp); r = message_parse_file(fp, &msg->content.base, &msg->content.len, &msg->content.body); CU_ASSERT_EQUAL(r, 0); fclose(fp); } /* XXX currently struct bodypart as defined in message.h is the same as sieve_bodypart_t as defined in sieve_interface.h, so we can typecast */ if (!r) message_fetch_part(&msg->content, content_types, (struct bodypart ***) parts); if (r) return SIEVE_FAIL; return SIEVE_OK; }
static int getbody(void *mc, const char **content_types, sieve_bodypart_t ***parts) { message_data_t *m = (message_data_t *) mc; int r = 0; if (!m->content.body) { /* parse the message body if we haven't already */ r = message_parse_file(m->data, &m->content.base, &m->content.len, &m->content.body); } /* XXX currently struct bodypart as defined in message.h is the same as sieve_bodypart_t as defined in sieve_interface.h, so we can typecast */ if (!r) message_fetch_part(&m->content, content_types, (struct bodypart ***) parts); return (!r ? SIEVE_OK : SIEVE_FAIL); }