|
|
|
@ -75,8 +75,9 @@ typedef int mailimap_struct_parser_progress(mailstream * fd, MMAPString * buffer
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
static int mailimap_address_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
size_t * indx,
|
|
|
|
@ -475,7 +476,9 @@ static int mailimap_literal_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
@ -564,7 +567,9 @@ mailimap_msg_att_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
@ -590,7 +595,9 @@ mailimap_msg_att_static_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
mailimap_quoted_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
@ -743,7 +750,9 @@ mailimap_response_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
static int mailimap_nstring_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
size_t * indx, char ** result,
|
|
|
|
@ -752,7 +761,9 @@ static int mailimap_nstring_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
mailimap_string_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
@ -762,7 +773,9 @@ mailimap_string_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context);
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context);
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
@ -925,7 +938,9 @@ mailimap_struct_multiple_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
clist * struct_list;
|
|
|
|
|
size_t cur_token;
|
|
|
|
@ -936,7 +951,7 @@ mailimap_struct_multiple_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
cur_token = * indx;
|
|
|
|
|
|
|
|
|
|
r = parser(fd, buffer, &cur_token, &value, progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR) {
|
|
|
|
|
res = r;
|
|
|
|
|
goto err;
|
|
|
|
@ -949,16 +964,18 @@ mailimap_struct_multiple_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
goto err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r = clist_append(struct_list, value);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
destructor(value);
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free_list;
|
|
|
|
|
if (value != NULL) {
|
|
|
|
|
r = clist_append(struct_list, value);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
destructor(value);
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free_list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
|
r = parser(fd, buffer, &cur_token, &value, progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_ERROR_PARSE)
|
|
|
|
|
break;
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR) {
|
|
|
|
@ -966,11 +983,13 @@ mailimap_struct_multiple_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
goto free_list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r = clist_append(struct_list, value);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
destructor(value);
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free_list;
|
|
|
|
|
if (value != NULL) {
|
|
|
|
|
r = clist_append(struct_list, value);
|
|
|
|
|
if (r < 0) {
|
|
|
|
|
destructor(value);
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free_list;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1061,7 +1080,9 @@ mailimap_struct_list_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
clist * struct_list;
|
|
|
|
|
size_t cur_token;
|
|
|
|
@ -1074,7 +1095,7 @@ mailimap_struct_list_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
struct_list = NULL;
|
|
|
|
|
|
|
|
|
|
r = parser(fd, buffer, &cur_token, &value, progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR) {
|
|
|
|
|
res = r;
|
|
|
|
|
goto err;
|
|
|
|
@ -1106,7 +1127,7 @@ mailimap_struct_list_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r = parser(fd, buffer, &cur_token, &value, progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_ERROR_PARSE)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -1240,12 +1261,15 @@ mailimap_struct_spaced_list_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
return mailimap_struct_list_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
' ', parser, destructor,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context,
|
|
|
|
|
msg_att_handler, msg_att_context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -5902,7 +5926,9 @@ static int mailimap_literal_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
uint32_t number;
|
|
|
|
@ -6079,7 +6105,7 @@ static int mailimap_literal_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_literal_parse_progress(fd, buffer, indx, result, result_len,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -7327,7 +7353,9 @@ mailimap_message_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
uint32_t number;
|
|
|
|
@ -7390,7 +7418,7 @@ mailimap_message_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r = mailimap_msg_att_parse_progress(fd, buffer, &cur_token, &msg_att,
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context);
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR) {
|
|
|
|
|
res = r;
|
|
|
|
|
goto err;
|
|
|
|
@ -7435,7 +7463,7 @@ mailimap_message_data_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_message_data_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -7455,7 +7483,9 @@ mailimap_msg_att_item_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
int type;
|
|
|
|
|
struct mailimap_msg_att_dynamic * msg_att_dynamic;
|
|
|
|
@ -7484,7 +7514,7 @@ mailimap_msg_att_item_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
r = mailimap_msg_att_static_parse_progress(fd, buffer, &cur_token,
|
|
|
|
|
&msg_att_static,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_NO_ERROR)
|
|
|
|
|
type = MAILIMAP_MSG_ATT_ITEM_STATIC;
|
|
|
|
|
}
|
|
|
|
@ -7532,7 +7562,7 @@ mailimap_msg_att_item_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_msg_att_item_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -7548,7 +7578,9 @@ mailimap_msg_att_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
clist * list;
|
|
|
|
@ -7572,7 +7604,7 @@ mailimap_msg_att_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
mailimap_msg_att_item_free,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun,
|
|
|
|
|
context);
|
|
|
|
|
context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR) {
|
|
|
|
|
res = r;
|
|
|
|
|
goto err;
|
|
|
|
@ -7610,7 +7642,7 @@ mailimap_msg_att_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_msg_att_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -7791,7 +7823,9 @@ mailimap_msg_att_rfc822_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
char * rfc822_message;
|
|
|
|
@ -7810,7 +7844,7 @@ mailimap_msg_att_rfc822_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = mailimap_nstring_parse_progress(fd, buffer, &cur_token, &rfc822_message, &length,
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context);
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
@ -7831,7 +7865,7 @@ mailimap_msg_att_rfc822_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_msg_att_rfc822_parse_progress(fd, buffer, indx, result, result_len,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -7891,7 +7925,9 @@ mailimap_msg_att_rfc822_text_parse_progress(mailstream * fd, MMAPString * buffer
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
char * rfc822_text;
|
|
|
|
@ -7915,7 +7951,7 @@ mailimap_msg_att_rfc822_text_parse_progress(mailstream * fd, MMAPString * buffer
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
r = mailimap_nstring_parse_progress(fd, buffer, &cur_token, &rfc822_text, &length,
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context);
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR)
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
@ -7936,7 +7972,7 @@ mailimap_msg_att_rfc822_text_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_msg_att_rfc822_text_parse_progress(fd, buffer, indx, result, result_len,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -8065,7 +8101,9 @@ mailimap_msg_att_body_section_parse_progress(mailstream * fd, MMAPString * buffe
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
uint32_t number;
|
|
|
|
@ -8126,7 +8164,7 @@ mailimap_msg_att_body_section_parse_progress(mailstream * fd, MMAPString * buffe
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
r = mailimap_nstring_parse_progress(fd, buffer, &cur_token, &body_part, &length,
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context);
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR) {
|
|
|
|
|
res = r;
|
|
|
|
|
goto free_section;
|
|
|
|
@ -8163,7 +8201,7 @@ mailimap_msg_att_body_section_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_msg_att_body_section_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -8216,7 +8254,9 @@ mailimap_msg_att_static_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
struct mailimap_envelope * env;
|
|
|
|
@ -8268,7 +8308,7 @@ mailimap_msg_att_static_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
r = mailimap_msg_att_rfc822_parse_progress(fd, buffer, &cur_token,
|
|
|
|
|
&rfc822, &length,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_NO_ERROR)
|
|
|
|
|
type = MAILIMAP_MSG_ATT_RFC822;
|
|
|
|
|
}
|
|
|
|
@ -8284,7 +8324,7 @@ mailimap_msg_att_static_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
r = mailimap_msg_att_rfc822_text_parse_progress(fd, buffer, &cur_token,
|
|
|
|
|
&rfc822_text, &length,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_NO_ERROR)
|
|
|
|
|
type = MAILIMAP_MSG_ATT_RFC822_TEXT;
|
|
|
|
|
}
|
|
|
|
@ -8315,7 +8355,7 @@ mailimap_msg_att_static_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
r = mailimap_msg_att_body_section_parse_progress(fd, buffer, &cur_token,
|
|
|
|
|
&body_section,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_NO_ERROR)
|
|
|
|
|
type = MAILIMAP_MSG_ATT_BODY_SECTION;
|
|
|
|
|
}
|
|
|
|
@ -8377,7 +8417,7 @@ mailimap_msg_att_static_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_msg_att_static_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -8401,13 +8441,15 @@ static int mailimap_nstring_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
int r;
|
|
|
|
|
|
|
|
|
|
r = mailimap_string_parse_progress(fd, buffer, indx, result, result_len,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
switch (r) {
|
|
|
|
|
case MAILIMAP_NO_ERROR:
|
|
|
|
|
return MAILIMAP_NO_ERROR;
|
|
|
|
@ -8435,7 +8477,7 @@ int mailimap_nstring_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun)
|
|
|
|
|
{
|
|
|
|
|
return mailimap_nstring_parse_progress(fd, buffer, indx, result, result_len, progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -8732,7 +8774,9 @@ mailimap_cont_req_or_resp_data_parse_progress(mailstream * fd, MMAPString * buff
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
struct mailimap_cont_req_or_resp_data * cont_req_or_resp_data;
|
|
|
|
@ -8770,7 +8814,7 @@ mailimap_cont_req_or_resp_data_parse_progress(mailstream * fd, MMAPString * buff
|
|
|
|
|
r = mailimap_response_data_parse_progress(fd, buffer, &cur_token, &resp_data,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun, items_progr_fun,
|
|
|
|
|
context);
|
|
|
|
|
context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_NO_ERROR)
|
|
|
|
|
type = MAILIMAP_RESP_RESP_DATA;
|
|
|
|
|
}
|
|
|
|
@ -8790,12 +8834,17 @@ mailimap_cont_req_or_resp_data_parse_progress(mailstream * fd, MMAPString * buff
|
|
|
|
|
res = MAILIMAP_ERROR_STREAM;
|
|
|
|
|
goto free;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cont_req_or_resp_data =
|
|
|
|
|
|
|
|
|
|
if ((cont_req == NULL) && (resp_data == NULL)) {
|
|
|
|
|
cont_req_or_resp_data = NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
cont_req_or_resp_data =
|
|
|
|
|
mailimap_cont_req_or_resp_data_new(type, cont_req, resp_data);
|
|
|
|
|
if (cont_req_or_resp_data == NULL) {
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free;
|
|
|
|
|
if (cont_req_or_resp_data == NULL) {
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* result = cont_req_or_resp_data;
|
|
|
|
@ -8823,7 +8872,7 @@ mailimap_cont_req_or_resp_data_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
return mailimap_cont_req_or_resp_data_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate,
|
|
|
|
|
progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -8837,7 +8886,9 @@ mailimap_response_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
clist * cont_req_or_resp_data_list;
|
|
|
|
@ -8859,7 +8910,9 @@ mailimap_response_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
body_progr_fun,
|
|
|
|
|
items_progr_fun,
|
|
|
|
|
context);
|
|
|
|
|
context,
|
|
|
|
|
msg_att_handler,
|
|
|
|
|
msg_att_context);
|
|
|
|
|
|
|
|
|
|
if ((r != MAILIMAP_NO_ERROR) && (r != MAILIMAP_ERROR_PARSE))
|
|
|
|
|
return r;
|
|
|
|
@ -8898,11 +8951,14 @@ mailimap_response_parse_with_context(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
size_t * indx, struct mailimap_response ** result,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
return mailimap_response_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
4096, NULL,
|
|
|
|
|
body_progr_fun, items_progr_fun, context);
|
|
|
|
|
body_progr_fun, items_progr_fun, context,
|
|
|
|
|
msg_att_handler, msg_att_context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
@ -8913,7 +8969,7 @@ mailimap_response_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_response_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -8929,7 +8985,9 @@ mailimap_response_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
struct mailimap_response_data * resp_data;
|
|
|
|
|
size_t cur_token;
|
|
|
|
@ -8942,6 +9000,7 @@ mailimap_response_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
struct mailimap_extension_data * ext_data;
|
|
|
|
|
int r;
|
|
|
|
|
int res;
|
|
|
|
|
int msg_att_handled;
|
|
|
|
|
|
|
|
|
|
cond_state = NULL;
|
|
|
|
|
cond_bye = NULL;
|
|
|
|
@ -8987,7 +9046,7 @@ mailimap_response_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
|
|
|
|
|
if (r == MAILIMAP_ERROR_PARSE) {
|
|
|
|
|
r = mailimap_message_data_parse_progress(fd, buffer, &cur_token, &msg_data,
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context);
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
if (r == MAILIMAP_NO_ERROR)
|
|
|
|
|
type = MAILIMAP_RESP_DATA_TYPE_MESSAGE_DATA;
|
|
|
|
|
}
|
|
|
|
@ -9018,12 +9077,29 @@ mailimap_response_data_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
goto free;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
resp_data = mailimap_response_data_new(type, cond_state,
|
|
|
|
|
cond_bye, mb_data,
|
|
|
|
|
msg_data, cap_data, ext_data);
|
|
|
|
|
if (resp_data == NULL) {
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free;
|
|
|
|
|
msg_att_handled = 0;
|
|
|
|
|
if (msg_data != NULL) {
|
|
|
|
|
if (msg_data->mdt_type == MAILIMAP_MESSAGE_DATA_FETCH) {
|
|
|
|
|
if (msg_att_handler != NULL) {
|
|
|
|
|
msg_att_handler(msg_data->mdt_msg_att, msg_att_context);
|
|
|
|
|
mailimap_message_data_free(msg_data);
|
|
|
|
|
msg_data = NULL;
|
|
|
|
|
msg_att_handled = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (msg_att_handled) {
|
|
|
|
|
resp_data = NULL;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
resp_data = mailimap_response_data_new(type, cond_state,
|
|
|
|
|
cond_bye, mb_data,
|
|
|
|
|
msg_data, cap_data, ext_data);
|
|
|
|
|
if (resp_data == NULL) {
|
|
|
|
|
res = MAILIMAP_ERROR_MEMORY;
|
|
|
|
|
goto free;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
* result = resp_data;
|
|
|
|
@ -9057,7 +9133,7 @@ mailimap_response_data_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_response_data_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -10514,7 +10590,9 @@ mailimap_string_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
progress_function * progr_fun,
|
|
|
|
|
mailprogress_function * body_progr_fun,
|
|
|
|
|
mailprogress_function * items_progr_fun,
|
|
|
|
|
void * context)
|
|
|
|
|
void * context,
|
|
|
|
|
mailimap_msg_att_handler * msg_att_handler,
|
|
|
|
|
void * msg_att_context)
|
|
|
|
|
{
|
|
|
|
|
size_t cur_token;
|
|
|
|
|
char * string;
|
|
|
|
@ -10532,7 +10610,7 @@ mailimap_string_parse_progress(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
len = strlen(string);
|
|
|
|
|
else if (r == MAILIMAP_ERROR_PARSE) {
|
|
|
|
|
r = mailimap_literal_parse_progress(fd, buffer, &cur_token, &string, &len,
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context);
|
|
|
|
|
progr_rate, progr_fun, body_progr_fun, items_progr_fun, context, msg_att_handler, msg_att_context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (r != MAILIMAP_NO_ERROR)
|
|
|
|
@ -10555,7 +10633,7 @@ mailimap_string_parse(mailstream * fd, MMAPString * buffer,
|
|
|
|
|
{
|
|
|
|
|
return mailimap_string_parse_progress(fd, buffer, indx, result,
|
|
|
|
|
result_len, progr_rate, progr_fun,
|
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|