Exemple #1
0
// 分析邮件体或 multipart 部分体
static int mime_state_body(MIME_STATE *state, const char *s, int n)
{
	int   finish = 0;

	if (state->curr_node->body == NULL)
		state->curr_node->body = acl_vstring_alloc(1024);

	if (state->curr_bound == NULL) {

		/* 如果没有分隔符,则说明是文本类型,即只有正文内容 */

		APPEND(state->curr_node->body, s, n);
		state->curr_off += n;

		/* 因为 curr_off 指向的是下一个偏移位置,所以 body_end = curr_off - 1 */
		state->curr_node->body_end = state->curr_off - 1;
		state->curr_node->body_data_end = state->curr_node->body_end;  // add by zsx, 2012.5.28
		return (0);
	}

	n  = mime_bound_body(state->curr_bound, state->curr_node, s, n, &finish);
	if (finish)
		state->curr_status = MIME_S_BODY_BOUND_CRLF;

	return (n);
}
Exemple #2
0
// 分析邮件体或 multipart 部分体
static int mime_state_body(MIME_STATE *state, const char *s, int n)
{
	int   finish = 0;

	if (state->curr_bound == NULL) {

		/* 如果没有分隔符,则说明是文本类型,即只有正文内容 */

		state->curr_off += n;

		/* 因为 curr_off 指向下一个偏移位置,所以
		 * body_end = curr_off - 1
		 */
		state->curr_node->body_end = state->curr_off - 1;
		state->curr_node->body_data_end = state->curr_node->body_end;
		return 0;
	}

	n  = mime_bound_body(state, state->curr_bound,
			state->curr_node, s, n, &finish);
	if (finish)
		state->curr_status = MIME_S_BODY_BOUND_CRLF;

	return n;
}