Browse Source

Exports for windows, cleanup

pull/2/merge
Hoa V. Dinh 8 years ago
parent
commit
c5103de9ff
12 changed files with 418 additions and 101 deletions
  1. +4
    -0
      src/data-types/mailsem.c
  2. +18
    -0
      src/data-types/mailstream.c
  3. +2
    -0
      src/low-level/imap/mailimap_compress.c
  4. +6
    -0
      src/low-level/imap/mailimap_parser.h
  5. +183
    -29
      src/low-level/imap/mailimap_types.c
  6. +37
    -0
      src/low-level/imap/mailimap_types.h
  7. +84
    -15
      src/low-level/imap/mailimap_types_helper.c
  8. +30
    -57
      src/low-level/imf/mailimf.c
  9. +17
    -0
      src/low-level/imf/mailimf_types.c
  10. +18
    -0
      src/low-level/imf/mailimf_types.h
  11. +8
    -0
      src/low-level/imf/mailimf_write_mem.c
  12. +11
    -0
      src/low-level/smtp/mailsmtp_helper.c

+ 4
- 0
src/data-types/mailsem.c View File

@ -235,6 +235,7 @@ static int mailsem_internal_post(struct mailsem_internal * s)
#endif
LIBETPAN_EXPORT
struct mailsem * mailsem_new(void)
{
struct mailsem * sem;
@ -262,6 +263,7 @@ struct mailsem * mailsem_new(void)
return NULL;
}
LIBETPAN_EXPORT
void mailsem_free(struct mailsem * sem)
{
mailsem_internal_destroy(sem->sem_sem);
@ -269,11 +271,13 @@ void mailsem_free(struct mailsem * sem)
free(sem);
}
LIBETPAN_EXPORT
int mailsem_up(struct mailsem * sem)
{
return mailsem_internal_post(sem->sem_sem);
}
LIBETPAN_EXPORT
int mailsem_down(struct mailsem * sem)
{
return mailsem_internal_wait(sem->sem_sem);


+ 18
- 0
src/data-types/mailstream.c View File

@ -56,6 +56,7 @@
struct timeval mailstream_network_delay =
{ DEFAULT_NETWORK_TIMEOUT, 0 };
LIBETPAN_EXPORT
mailstream * mailstream_new(mailstream_low * low, size_t buffer_size)
{
mailstream * s;
@ -129,6 +130,7 @@ static ssize_t write_direct(mailstream * s, const void * buf, size_t count)
return count;
}
LIBETPAN_EXPORT
ssize_t mailstream_write(mailstream * s, const void * buf, size_t count)
{
int r;
@ -148,6 +150,7 @@ ssize_t mailstream_write(mailstream * s, const void * buf, size_t count)
return write_to_internal_buffer(s, buf, count);
}
LIBETPAN_EXPORT
int mailstream_flush(mailstream * s)
{
char * cur_buf;
@ -222,6 +225,7 @@ static ssize_t read_through_buffer(mailstream * s, void * buf, size_t count)
return count;
}
LIBETPAN_EXPORT
ssize_t mailstream_read(mailstream * s, void * buf, size_t count)
{
ssize_t read_bytes;
@ -275,6 +279,7 @@ ssize_t mailstream_read(mailstream * s, void * buf, size_t count)
return count - left;
}
LIBETPAN_EXPORT
mailstream_low * mailstream_get_low(mailstream * s)
{
return s->low;
@ -289,12 +294,14 @@ static void low_logger(mailstream_low * s, int log_type,
}
}
LIBETPAN_EXPORT
void mailstream_set_low(mailstream * s, mailstream_low * low)
{
s->low = low;
mailstream_low_set_logger(low, low_logger, s);
}
LIBETPAN_EXPORT
int mailstream_close(mailstream * s)
{
if (s->idle != NULL) {
@ -312,6 +319,7 @@ int mailstream_close(mailstream * s)
return 0;
}
LIBETPAN_EXPORT
ssize_t mailstream_feed_read_buffer(mailstream * s)
{
ssize_t read_bytes;
@ -330,6 +338,7 @@ ssize_t mailstream_feed_read_buffer(mailstream * s)
return s->read_buffer_len;
}
LIBETPAN_EXPORT
void mailstream_cancel(mailstream * s)
{
if (s == NULL)
@ -338,21 +347,25 @@ void mailstream_cancel(mailstream * s)
mailstream_low_cancel(s->low);
}
LIBETPAN_EXPORT
void mailstream_log_error(mailstream * s, char * buf, size_t count)
{
mailstream_low_log_error(s->low, buf, count);
}
LIBETPAN_EXPORT
void mailstream_set_privacy(mailstream * s, int can_be_public)
{
mailstream_low_set_privacy(s->low, can_be_public);
}
LIBETPAN_EXPORT
int mailstream_wait_idle(mailstream * s, int max_idle_delay)
{
return mailstream_low_wait_idle(s->low, s->idle, max_idle_delay);
}
LIBETPAN_EXPORT
int mailstream_setup_idle(mailstream * s)
{
int r;
@ -373,6 +386,7 @@ int mailstream_setup_idle(mailstream * s)
return 0;
}
LIBETPAN_EXPORT
void mailstream_interrupt_idle(mailstream * s)
{
int r;
@ -387,6 +401,7 @@ void mailstream_interrupt_idle(mailstream * s)
}
}
LIBETPAN_EXPORT
void mailstream_unsetup_idle(mailstream * s)
{
int r;
@ -404,6 +419,7 @@ void mailstream_unsetup_idle(mailstream * s)
s->idling = 0;
}
LIBETPAN_EXPORT
void mailstream_set_logger(mailstream * s, void (* logger)(mailstream * s, int log_type,
const char * str, size_t size, void * context), void * logger_context)
{
@ -411,11 +427,13 @@ void mailstream_set_logger(mailstream * s, void (* logger)(mailstream * s, int l
s->logger_context = logger_context;
}
LIBETPAN_EXPORT
carray * mailstream_get_certificate_chain(mailstream * s)
{
return mailstream_low_get_certificate_chain(s->low);
}
LIBETPAN_EXPORT
void mailstream_certificate_chain_free(carray * certificate_chain)
{
unsigned int i;


+ 2
- 0
src/low-level/imap/mailimap_compress.c View File

@ -43,6 +43,7 @@
#include <stdio.h>
LIBETPAN_EXPORT
int mailimap_compress(mailimap * session)
{
struct mailimap_response * response;
@ -110,6 +111,7 @@ err:
return res;
}
LIBETPAN_EXPORT
int mailimap_has_compress_deflate(mailimap * session)
{
return mailimap_has_extension(session, "COMPRESS=DEFLATE");


+ 6
- 0
src/low-level/imap/mailimap_parser.h View File

@ -208,6 +208,12 @@ int mailimap_uint64_parse(mailstream * fd, MMAPString * buffer,
int mailimap_set_parse(mailstream * fd,
MMAPString * buffer, size_t * indx, struct mailimap_set ** result);
LIBETPAN_EXPORT
int mailimap_hack_date_time_parse(char * str,
struct mailimap_date_time ** result,
size_t progr_rate,
progress_function * progr_fun);
#ifdef __cplusplus
}
#endif


+ 183
- 29
src/low-level/imap/mailimap_types.c
File diff suppressed because it is too large
View File


+ 37
- 0
src/low-level/imap/mailimap_types.h View File

@ -3176,88 +3176,125 @@ void mailimap_status_att_list_free(struct mailimap_status_att_list *
/* internal use functions */
LIBETPAN_EXPORT
uint32_t * mailimap_number_alloc_new(uint32_t number);
LIBETPAN_EXPORT
void mailimap_number_alloc_free(uint32_t * pnumber);
LIBETPAN_EXPORT
void mailimap_addr_host_free(char * addr_host);
LIBETPAN_EXPORT
void mailimap_addr_mailbox_free(char * addr_mailbox);
LIBETPAN_EXPORT
void mailimap_addr_adl_free(char * addr_adl);
LIBETPAN_EXPORT
void mailimap_addr_name_free(char * addr_name);
LIBETPAN_EXPORT
void mailimap_astring_free(char * astring);
LIBETPAN_EXPORT
void mailimap_atom_free(char * atom);
LIBETPAN_EXPORT
void mailimap_auth_type_free(char * auth_type);
LIBETPAN_EXPORT
void mailimap_base64_free(char * base64);
LIBETPAN_EXPORT
void mailimap_body_fld_desc_free(char * body_fld_desc);
LIBETPAN_EXPORT
void mailimap_body_fld_id_free(char * body_fld_id);
LIBETPAN_EXPORT
void mailimap_body_fld_md5_free(char * body_fld_md5);
LIBETPAN_EXPORT
void mailimap_body_fld_loc_free(char * body_fld_loc);
LIBETPAN_EXPORT
void mailimap_env_date_free(char * date);
LIBETPAN_EXPORT
void mailimap_env_in_reply_to_free(char * in_reply_to);
LIBETPAN_EXPORT
void mailimap_env_message_id_free(char * message_id);
LIBETPAN_EXPORT
void mailimap_env_subject_free(char * subject);
LIBETPAN_EXPORT
void mailimap_flag_extension_free(char * flag_extension);
LIBETPAN_EXPORT
void mailimap_flag_keyword_free(char * flag_keyword);
LIBETPAN_EXPORT
void
mailimap_header_fld_name_free(char * header_fld_name);
LIBETPAN_EXPORT
void mailimap_literal_free(char * literal);
LIBETPAN_EXPORT
void mailimap_mailbox_free(char * mailbox);
LIBETPAN_EXPORT
void
mailimap_mailbox_data_search_free(clist * data_search);
LIBETPAN_EXPORT
void mailimap_media_subtype_free(char * media_subtype);
LIBETPAN_EXPORT
void mailimap_media_text_free(char * media_text);
LIBETPAN_EXPORT
void mailimap_msg_att_envelope_free(struct mailimap_envelope * env);
LIBETPAN_EXPORT
void
mailimap_msg_att_internaldate_free(struct mailimap_date_time * date_time);
LIBETPAN_EXPORT
void
mailimap_msg_att_rfc822_free(char * str);
LIBETPAN_EXPORT
void
mailimap_msg_att_rfc822_header_free(char * str);
LIBETPAN_EXPORT
void
mailimap_msg_att_rfc822_text_free(char * str);
LIBETPAN_EXPORT
void
mailimap_msg_att_body_free(struct mailimap_body * body);
LIBETPAN_EXPORT
void
mailimap_msg_att_bodystructure_free(struct mailimap_body * body);
LIBETPAN_EXPORT
void mailimap_nstring_free(char * str);
LIBETPAN_EXPORT
void
mailimap_string_free(char * str);
LIBETPAN_EXPORT
void mailimap_tag_free(char * tag);
LIBETPAN_EXPORT
void mailimap_text_free(char * text);


+ 84
- 15
src/low-level/imap/mailimap_types_helper.c View File

@ -54,11 +54,13 @@
LIBETPAN_EXPORT
struct mailimap_set_item * mailimap_set_item_new_single(uint32_t indx)
{
return mailimap_set_item_new(indx, indx);
}
LIBETPAN_EXPORT
struct mailimap_set *
mailimap_set_new_single_item(struct mailimap_set_item * item)
{
@ -85,6 +87,7 @@ mailimap_set_new_single_item(struct mailimap_set_item * item)
return set;
}
LIBETPAN_EXPORT
struct mailimap_set * mailimap_set_new_interval(uint32_t first, uint32_t last)
{
struct mailimap_set_item * item;
@ -103,12 +106,14 @@ struct mailimap_set * mailimap_set_new_interval(uint32_t first, uint32_t last)
return set;
}
LIBETPAN_EXPORT
struct mailimap_set * mailimap_set_new_single(uint32_t indx)
{
return mailimap_set_new_interval(indx, indx);
}
LIBETPAN_EXPORT
struct mailimap_set * mailimap_set_new_empty(void)
{
clist * list;
@ -120,6 +125,7 @@ struct mailimap_set * mailimap_set_new_empty(void)
return mailimap_set_new(list);
}
LIBETPAN_EXPORT
int mailimap_set_add(struct mailimap_set * set,
struct mailimap_set_item * set_item)
{
@ -132,6 +138,7 @@ int mailimap_set_add(struct mailimap_set * set,
return MAILIMAP_NO_ERROR;
}
LIBETPAN_EXPORT
int mailimap_set_add_interval(struct mailimap_set * set,
uint32_t first, uint32_t last)
{
@ -151,6 +158,7 @@ int mailimap_set_add_interval(struct mailimap_set * set,
return MAILIMAP_NO_ERROR;
}
LIBETPAN_EXPORT
int mailimap_set_add_single(struct mailimap_set * set,
uint32_t indx)
{
@ -176,21 +184,6 @@ int mailimap_set_add_single(struct mailimap_set * set,
/* section */
#if 0
/* not correct XXX */
struct mailimap_section * mailimap_section_new_empty(void)
{
clist * list;
list = clist_new();
if (list == NULL)
return NULL;
return mailimap_section_new(list);
}
#endif
static struct mailimap_section *
mailimap_section_new_msgtext(struct mailimap_section_msgtext * msgtext)
{
@ -253,6 +246,7 @@ HEADER.FIELDS.NOT fields
TEXT
*/
LIBETPAN_EXPORT
struct mailimap_section * mailimap_section_new_header(void)
{
struct mailimap_section_msgtext * msgtext;
@ -272,6 +266,7 @@ struct mailimap_section * mailimap_section_new_header(void)
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_header_fields(struct mailimap_header_list * header_list)
{
@ -295,6 +290,7 @@ mailimap_section_new_header_fields(struct mailimap_header_list * header_list)
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_header_fields_not(struct mailimap_header_list * header_list)
{
@ -318,6 +314,7 @@ mailimap_section_new_header_fields_not(struct mailimap_header_list * header_list
return section;
}
LIBETPAN_EXPORT
struct mailimap_section * mailimap_section_new_text(void)
{
struct mailimap_section * section;
@ -345,6 +342,7 @@ section-part . HEADER.FIELDS.NOT fields
section-part . TEXT
*/
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_part(struct mailimap_section_part * part)
{
@ -367,6 +365,7 @@ mailimap_section_new_part(struct mailimap_section_part * part)
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_part_mime(struct mailimap_section_part * part)
{
@ -396,6 +395,7 @@ mailimap_section_new_part_mime(struct mailimap_section_part * part)
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_part_header(struct mailimap_section_part * part)
{
@ -416,6 +416,7 @@ mailimap_section_new_part_header(struct mailimap_section_part * part)
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_part_header_fields(struct mailimap_section_part *
part,
@ -442,6 +443,7 @@ mailimap_section_new_part_header_fields(struct mailimap_section_part *
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_part_header_fields_not(struct mailimap_section_part
* part,
@ -468,6 +470,7 @@ mailimap_section_new_part_header_fields_not(struct mailimap_section_part
return section;
}
LIBETPAN_EXPORT
struct mailimap_section *
mailimap_section_new_part_text(struct mailimap_section_part * part)
{
@ -494,78 +497,91 @@ mailimap_section_new_part_text(struct mailimap_section_part * part)
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_envelope(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_ENVELOPE, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_flags(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_FLAGS, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_internaldate(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_INTERNALDATE, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_rfc822(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_RFC822, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_rfc822_header(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_RFC822_HEADER, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_rfc822_size(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_RFC822_SIZE, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_rfc822_text(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_RFC822_TEXT, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_body(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_BODY, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_bodystructure(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_BODYSTRUCTURE, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_uid(void)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_UID, NULL, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_body_section(struct mailimap_section * section)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_BODY_SECTION, section, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_body_peek_section(struct mailimap_section * section)
{
return mailimap_fetch_att_new(MAILIMAP_FETCH_ATT_BODY_PEEK_SECTION, section, 0, 0, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_body_section_partial(struct mailimap_section * section,
uint32_t offset, uint32_t size)
@ -574,6 +590,7 @@ mailimap_fetch_att_new_body_section_partial(struct mailimap_section * section,
offset, size, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_body_peek_section_partial(struct mailimap_section * section,
uint32_t offset, uint32_t size)
@ -582,6 +599,7 @@ mailimap_fetch_att_new_body_peek_section_partial(struct mailimap_section * secti
offset, size, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_att *
mailimap_fetch_att_new_extension(char * ext_keyword)
{
@ -589,30 +607,35 @@ mailimap_fetch_att_new_extension(char * ext_keyword)
}
LIBETPAN_EXPORT
struct mailimap_fetch_type *
mailimap_fetch_type_new_all(void)
{
return mailimap_fetch_type_new(MAILIMAP_FETCH_TYPE_ALL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_type *
mailimap_fetch_type_new_full(void)
{
return mailimap_fetch_type_new(MAILIMAP_FETCH_TYPE_FULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_type *
mailimap_fetch_type_new_fast(void)
{
return mailimap_fetch_type_new(MAILIMAP_FETCH_TYPE_FAST, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_type *
mailimap_fetch_type_new_fetch_att(struct mailimap_fetch_att * fetch_att)
{
return mailimap_fetch_type_new(MAILIMAP_FETCH_TYPE_FETCH_ATT, fetch_att, NULL);
}
LIBETPAN_EXPORT
struct mailimap_fetch_type *
mailimap_fetch_type_new_fetch_att_list(clist * fetch_att_list)
{
@ -620,6 +643,7 @@ mailimap_fetch_type_new_fetch_att_list(clist * fetch_att_list)
NULL, fetch_att_list);
}
LIBETPAN_EXPORT
struct mailimap_fetch_type *
mailimap_fetch_type_new_fetch_att_list_empty(void)
{
@ -633,6 +657,7 @@ mailimap_fetch_type_new_fetch_att_list_empty(void)
NULL, list);
}
LIBETPAN_EXPORT
int
mailimap_fetch_type_new_fetch_att_list_add(struct mailimap_fetch_type *
fetch_type,
@ -652,12 +677,14 @@ mailimap_fetch_type_new_fetch_att_list_add(struct mailimap_fetch_type *
/* STORE */
/* set and store_att_flags */
LIBETPAN_EXPORT
struct mailimap_store_att_flags *
mailimap_store_att_flags_new_set_flags(struct mailimap_flag_list * flags)
{
return mailimap_store_att_flags_new(0, FALSE, flags);
}
LIBETPAN_EXPORT
struct mailimap_store_att_flags *
mailimap_store_att_flags_new_set_flags_silent(struct mailimap_flag_list *
flags)
@ -665,12 +692,14 @@ mailimap_store_att_flags_new_set_flags_silent(struct mailimap_flag_list *
return mailimap_store_att_flags_new(0, TRUE, flags);
}
LIBETPAN_EXPORT
struct mailimap_store_att_flags *
mailimap_store_att_flags_new_add_flags(struct mailimap_flag_list * flags)
{
return mailimap_store_att_flags_new(1, FALSE, flags);
}
LIBETPAN_EXPORT
struct mailimap_store_att_flags *
mailimap_store_att_flags_new_add_flags_silent(struct mailimap_flag_list *
flags)
@ -678,12 +707,14 @@ mailimap_store_att_flags_new_add_flags_silent(struct mailimap_flag_list *
return mailimap_store_att_flags_new(1, TRUE, flags);
}
LIBETPAN_EXPORT
struct mailimap_store_att_flags *
mailimap_store_att_flags_new_remove_flags(struct mailimap_flag_list * flags)
{
return mailimap_store_att_flags_new(-1, FALSE, flags);
}
LIBETPAN_EXPORT
struct mailimap_store_att_flags *
mailimap_store_att_flags_new_remove_flags_silent(struct mailimap_flag_list *
flags)
@ -703,6 +734,7 @@ mailimap_store_att_flags_new_remove_flags_silent(struct mailimap_flag_list *
smaller, uid, set, multiple);
*/
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_all(void)
{
@ -714,6 +746,7 @@ mailimap_search_key_new_all(void)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_bcc(char * sk_bcc)
{
@ -725,6 +758,7 @@ mailimap_search_key_new_bcc(char * sk_bcc)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_before(struct mailimap_date * sk_before)
{
@ -736,6 +770,7 @@ mailimap_search_key_new_before(struct mailimap_date * sk_before)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_body(char * sk_body)
{
@ -747,6 +782,7 @@ mailimap_search_key_new_body(char * sk_body)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_cc(char * sk_cc)
{
@ -758,6 +794,7 @@ mailimap_search_key_new_cc(char * sk_cc)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_from(char * sk_from)
{
@ -769,6 +806,7 @@ mailimap_search_key_new_from(char * sk_from)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_keyword(char * sk_keyword)
{
@ -780,6 +818,7 @@ mailimap_search_key_new_keyword(char * sk_keyword)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_on(struct mailimap_date * sk_on)
{
@ -791,6 +830,7 @@ mailimap_search_key_new_on(struct mailimap_date * sk_on)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_since(struct mailimap_date * sk_since)
{
@ -802,6 +842,7 @@ mailimap_search_key_new_since(struct mailimap_date * sk_since)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_subject(char * sk_subject)
{
@ -813,6 +854,7 @@ mailimap_search_key_new_subject(char * sk_subject)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_text(char * sk_text)
{
@ -824,6 +866,7 @@ mailimap_search_key_new_text(char * sk_text)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_to(char * sk_to)
{
@ -835,6 +878,7 @@ mailimap_search_key_new_to(char * sk_to)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_unkeyword(char * sk_unkeyword)
{
@ -846,6 +890,7 @@ mailimap_search_key_new_unkeyword(char * sk_unkeyword)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_header(char * sk_header_name, char * sk_header_value)
{
@ -857,6 +902,7 @@ mailimap_search_key_new_header(char * sk_header_name, char * sk_header_value)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_larger(uint32_t sk_larger)
{
@ -868,6 +914,7 @@ mailimap_search_key_new_larger(uint32_t sk_larger)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_not(struct mailimap_search_key * sk_not)
{
@ -879,6 +926,7 @@ mailimap_search_key_new_not(struct mailimap_search_key * sk_not)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_or(struct mailimap_search_key * sk_or1,
struct mailimap_search_key * sk_or2)
@ -891,6 +939,7 @@ mailimap_search_key_new_or(struct mailimap_search_key * sk_or1,
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_sentbefore(struct mailimap_date * sk_sentbefore)
{
@ -902,6 +951,7 @@ mailimap_search_key_new_sentbefore(struct mailimap_date * sk_sentbefore)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_senton(struct mailimap_date * sk_senton)
{
@ -913,6 +963,7 @@ mailimap_search_key_new_senton(struct mailimap_date * sk_senton)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_sentsince(struct mailimap_date * sk_sentsince)
{
@ -924,6 +975,7 @@ mailimap_search_key_new_sentsince(struct mailimap_date * sk_sentsince)
0, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_smaller(uint32_t sk_smaller)
{
@ -935,6 +987,7 @@ mailimap_search_key_new_smaller(uint32_t sk_smaller)
sk_smaller, NULL, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_uid(struct mailimap_set * sk_uid)
{
@ -946,6 +999,7 @@ mailimap_search_key_new_uid(struct mailimap_set * sk_uid)
0, sk_uid, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_set(struct mailimap_set * sk_set)
{
@ -957,6 +1011,7 @@ mailimap_search_key_new_set(struct mailimap_set * sk_set)
0, NULL, sk_set, NULL);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_multiple(clist * sk_multiple)
{
@ -968,6 +1023,7 @@ mailimap_search_key_new_multiple(clist * sk_multiple)
0, NULL, NULL, sk_multiple);
}
LIBETPAN_EXPORT
struct mailimap_search_key *
mailimap_search_key_new_multiple_empty(void)
{
@ -980,6 +1036,7 @@ mailimap_search_key_new_multiple_empty(void)
return mailimap_search_key_new_multiple(list);
}
LIBETPAN_EXPORT
int
mailimap_search_key_multiple_add(struct mailimap_search_key * keys,
struct mailimap_search_key * key_item)
@ -1007,6 +1064,7 @@ mailimap_search_key_multiple_add(struct mailimap_search_key * keys,
/* APPEND */
/* gchar flag_list date_time gchar */
LIBETPAN_EXPORT
struct mailimap_flag_list *
mailimap_flag_list_new_empty(void)
{
@ -1019,6 +1077,7 @@ mailimap_flag_list_new_empty(void)
return mailimap_flag_list_new(list);
}
LIBETPAN_EXPORT
int mailimap_flag_list_add(struct mailimap_flag_list * flag_list,
struct mailimap_flag * f)
{
@ -1031,36 +1090,43 @@ int mailimap_flag_list_add(struct mailimap_flag_list * flag_list,
return MAILIMAP_NO_ERROR;
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_answered(void)
{
return mailimap_flag_new(MAILIMAP_FLAG_ANSWERED, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_flagged(void)
{
return mailimap_flag_new(MAILIMAP_FLAG_FLAGGED, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_deleted(void)
{
return mailimap_flag_new(MAILIMAP_FLAG_DELETED, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_seen(void)
{
return mailimap_flag_new(MAILIMAP_FLAG_SEEN, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_draft(void)
{
return mailimap_flag_new(MAILIMAP_FLAG_DRAFT, NULL, NULL);
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_flag_keyword(char * flag_keyword)
{
return mailimap_flag_new(MAILIMAP_FLAG_KEYWORD, flag_keyword, NULL);
}
LIBETPAN_EXPORT
struct mailimap_flag * mailimap_flag_new_flag_extension(char * flag_extension)
{
return mailimap_flag_new(MAILIMAP_FLAG_EXTENSION, NULL, flag_extension);
@ -1093,6 +1159,7 @@ struct mailimap_flag * mailimap_flag_new_flag_extension(char * flag_extension)
/* STATUS */
/* gchar GList of status_att */
LIBETPAN_EXPORT
struct mailimap_status_att_list * mailimap_status_att_list_new_empty(void)
{
clist * list;
@ -1104,6 +1171,7 @@ struct mailimap_status_att_list * mailimap_status_att_list_new_empty(void)
return mailimap_status_att_list_new(list);
}
LIBETPAN_EXPORT
int
mailimap_status_att_list_add(struct mailimap_status_att_list * sa_list,
int status_att)
@ -1245,6 +1313,7 @@ static int recursive_build_path(struct mailimap_body * root_part,
/* return mailimap_section_part from a given mailimap_body */
LIBETPAN_EXPORT
int mailimap_get_section_part_from_body(struct mailimap_body * root_part,
struct mailimap_body * part,
struct mailimap_section_part ** result)


+ 30
- 57
src/low-level/imf/mailimf.c View File

@ -161,26 +161,6 @@ static int mailimf_addr_spec_parse(const char * message, size_t length,
size_t * indx,
char ** address);
#if 0
static int mailimf_local_part_parse(const char * message, size_t length,
size_t * indx,
char ** result);
static int mailimf_domain_parse(const char * message, size_t length,
size_t * indx,
char ** result);
#endif
#if 0
static int mailimf_domain_literal_parse(const char * message, size_t length,
size_t * indx, char ** result);
#endif
#if 0
static int mailimf_dcontent_parse(const char * message, size_t length,
size_t * indx, char * result);
#endif
static int
mailimf_orig_date_parse(const char * message, size_t length,
size_t * indx, struct mailimf_orig_date ** result);
@ -218,33 +198,10 @@ mailimf_in_reply_to_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_in_reply_to ** result);
#if 0
static int mailimf_references_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_references **
result);
#endif
static int mailimf_unstrict_msg_id_parse(const char * message, size_t length,
size_t * indx,
char ** result);
#if 0
static int mailimf_id_left_parse(const char * message, size_t length,
size_t * indx, char ** result);
static int mailimf_id_right_parse(const char * message, size_t length,
size_t * indx, char ** result);
#endif
#if 0
static int mailimf_no_fold_quote_parse(const char * message, size_t length,
size_t * indx, char ** result);
static int mailimf_no_fold_literal_parse(const char * message, size_t length,
size_t * indx, char ** result);
#endif
static int mailimf_subject_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_subject ** result);
@ -353,6 +310,7 @@ static int mailimf_digit_parse(const char * message, size_t length,
return MAILIMF_ERROR_PARSE;
}
LIBETPAN_EXPORT
int
mailimf_number_parse(const char * message, size_t length,
size_t * indx, uint32_t * result)
@ -389,6 +347,7 @@ mailimf_number_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
}
LIBETPAN_EXPORT
int mailimf_char_parse(const char * message, size_t length,
size_t * indx, char token)
{
@ -408,6 +367,7 @@ int mailimf_char_parse(const char * message, size_t length,
return MAILIMF_ERROR_PARSE;
}
LIBETPAN_EXPORT
int mailimf_unstrict_char_parse(const char * message, size_t length,
size_t * indx, char token)
{
@ -429,6 +389,7 @@ int mailimf_unstrict_char_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
}
LIBETPAN_EXPORT
int
mailimf_token_case_insensitive_len_parse(const char * message, size_t length,
size_t * indx, char * token,
@ -510,20 +471,6 @@ static int mailimf_greater_parse(const char * message, size_t length,
return mailimf_unstrict_char_parse(message, length, indx, '>');
}
#if 0
static int mailimf_obracket_parse(const char * message, size_t length,
size_t * indx)
{
return mailimf_unstrict_char_parse(message, length, indx, '[');
}
static int mailimf_cbracket_parse(const char * message, size_t length,
size_t * indx)
{
return mailimf_unstrict_char_parse(message, length, indx, ']');
}
#endif
static int mailimf_at_sign_parse(const char * message, size_t length,
size_t * indx)
{
@ -536,6 +483,7 @@ static int mailimf_point_parse(const char * message, size_t length,
return mailimf_unstrict_char_parse(message, length, indx, '.');
}
LIBETPAN_EXPORT
int
mailimf_custom_string_parse(const char * message, size_t length,
size_t * indx, char ** result,
@ -755,6 +703,7 @@ static inline int mailimf_wsp_parse(const char * message, size_t length,
}
LIBETPAN_EXPORT
int mailimf_crlf_parse(const char * message, size_t length, size_t * indx)
{
size_t cur_token;
@ -869,6 +818,7 @@ FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space
obs-FWS
*/
LIBETPAN_EXPORT
int mailimf_fws_parse(const char * message, size_t length, size_t * indx)
{
size_t cur_token;
@ -1089,6 +1039,7 @@ static inline int mailimf_cfws_fws_comment_parse(const char * message, size_t le
CFWS = *([FWS] comment) (([FWS] comment) / FWS)
*/
LIBETPAN_EXPORT
int mailimf_cfws_parse(const char * message, size_t length,
size_t * indx)
{
@ -1165,6 +1116,7 @@ static inline int is_atext(char ch)
atom = [CFWS] 1*atext [CFWS]
*/
LIBETPAN_EXPORT
int mailimf_atom_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1217,6 +1169,7 @@ int mailimf_atom_parse(const char * message, size_t length,
return res;
}
LIBETPAN_EXPORT
int mailimf_fws_atom_for_word_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1267,6 +1220,7 @@ err:
return res;
}
LIBETPAN_EXPORT
int mailimf_fws_atom_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1413,6 +1367,7 @@ quoted-string = [CFWS]
[CFWS]
*/
LIBETPAN_EXPORT
int mailimf_quoted_string_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1509,6 +1464,7 @@ int mailimf_quoted_string_parse(const char * message, size_t length,
return res;
}
LIBETPAN_EXPORT
int mailimf_fws_quoted_string_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1609,6 +1565,7 @@ int mailimf_fws_quoted_string_parse(const char * message, size_t length,
word = atom / quoted-string
*/
LIBETPAN_EXPORT
int mailimf_word_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1632,6 +1589,7 @@ int mailimf_word_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
}
LIBETPAN_EXPORT
int mailimf_fws_word_parse(const char * message, size_t length,
size_t * indx, char ** result)
{
@ -1943,6 +1901,7 @@ static int mailimf_ignore_unstructured_parse(const char * message, size_t length
}
LIBETPAN_EXPORT
int mailimf_ignore_field_parse(const char * message, size_t length,
size_t * indx)
{
@ -2065,6 +2024,7 @@ int mailimf_ignore_field_parse(const char * message, size_t length,
date-time = [ day-of-week "," ] date FWS time [CFWS]
*/
LIBETPAN_EXPORT
int mailimf_date_time_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_date_time ** result)
@ -2850,6 +2810,7 @@ static int mailimf_zone_parse(const char * message, size_t length,
address = mailbox / group
*/
LIBETPAN_EXPORT
int mailimf_address_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_address ** result)
@ -2909,6 +2870,7 @@ mailbox = name-addr / addr-spec
*/
LIBETPAN_EXPORT
int mailimf_mailbox_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_mailbox ** result)
@ -3125,6 +3087,7 @@ static int mailimf_display_name_parse(const char * message, size_t length,
mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list
*/
LIBETPAN_EXPORT
int
mailimf_mailbox_list_parse(const char * message, size_t length,
size_t * indx,
@ -3172,6 +3135,7 @@ address-list = (address *("," address)) / obs-addr-list
*/
LIBETPAN_EXPORT
int
mailimf_address_list_parse(const char * message, size_t length,
size_t * indx,
@ -3673,6 +3637,7 @@ message = (fields / obs-fields)
[CRLF body]
*/
LIBETPAN_EXPORT
int mailimf_message_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_message ** result)
@ -3727,6 +3692,7 @@ int mailimf_message_parse(const char * message, size_t length,
body = *(*998text CRLF) *998text
*/
LIBETPAN_EXPORT
int mailimf_body_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_body ** result)
@ -4759,6 +4725,7 @@ mailimf_unparsed_fields_parse(const char * message, size_t length,
}
#endif
LIBETPAN_EXPORT
int mailimf_fields_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_fields ** result)
@ -5309,6 +5276,7 @@ static int mailimf_message_id_parse(const char * message, size_t length,
in-reply-to = "In-Reply-To:" 1*msg-id CRLF
*/
LIBETPAN_EXPORT
int mailimf_msg_id_list_parse(const char * message, size_t length,
size_t * indx, clist ** result)
{
@ -5379,6 +5347,7 @@ static int mailimf_in_reply_to_parse(const char * message, size_t length,
references = "References:" 1*msg-id CRLF
*/
LIBETPAN_EXPORT
int mailimf_references_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_references ** result)
@ -5438,6 +5407,7 @@ int mailimf_references_parse(const char * message, size_t length,
msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS]
*/
LIBETPAN_EXPORT
int mailimf_msg_id_parse(const char * message, size_t length,
size_t * indx,
char ** result)
@ -7523,6 +7493,7 @@ static int mailimf_envelope_field_parse(const char * message, size_t length,
return res;
}
LIBETPAN_EXPORT
int mailimf_envelope_fields_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_fields ** result)
@ -7633,6 +7604,7 @@ mailimf_envelope_or_optional_field_parse(const char * message,
}
LIBETPAN_EXPORT
int
mailimf_envelope_and_optional_fields_parse(const char * message, size_t length,
size_t * indx,
@ -7729,6 +7701,7 @@ mailimf_only_optional_field_parse(const char * message,
}
LIBETPAN_EXPORT
int
mailimf_optional_fields_parse(const char * message, size_t length,
size_t * indx,


+ 17
- 0
src/low-level/imf/mailimf_types.c View File

@ -37,36 +37,43 @@
#include "mmapstring.h"
#include <stdlib.h>
LIBETPAN_EXPORT
void mailimf_atom_free(char * atom)
{
free(atom);
}
LIBETPAN_EXPORT
void mailimf_dot_atom_free(char * dot_atom)
{
free(dot_atom);
}
LIBETPAN_EXPORT
void mailimf_dot_atom_text_free(char * dot_atom)
{
free(dot_atom);
}
LIBETPAN_EXPORT
void mailimf_quoted_string_free(char * quoted_string)
{
free(quoted_string);
}
LIBETPAN_EXPORT
void mailimf_word_free(char * word)
{
free(word);
}
LIBETPAN_EXPORT
void mailimf_phrase_free(char * phrase)
{
free(phrase);
}
LIBETPAN_EXPORT
void mailimf_unstructured_free(char * unstructured)
{
free(unstructured);
@ -249,21 +256,25 @@ void mailimf_address_list_free(struct mailimf_address_list * addr_list)
}
LIBETPAN_EXPORT
void mailimf_addr_spec_free(char * addr_spec)
{
free(addr_spec);
}
LIBETPAN_EXPORT
void mailimf_local_part_free(char * local_part)
{
free(local_part);
}
LIBETPAN_EXPORT
void mailimf_domain_free(char * domain)
{
free(domain);
}
LIBETPAN_EXPORT
void mailimf_domain_literal_free(char * domain_literal)
{
free(domain_literal);
@ -745,26 +756,31 @@ void mailimf_references_free(struct mailimf_references * references)
free(references);
}
LIBETPAN_EXPORT
void mailimf_msg_id_free(char * msg_id)
{
free(msg_id);
}
LIBETPAN_EXPORT
void mailimf_id_left_free(char * id_left)
{
free(id_left);
}
LIBETPAN_EXPORT
void mailimf_id_right_free(char * id_right)
{
free(id_right);
}
LIBETPAN_EXPORT
void mailimf_no_fold_quote_free(char * nfq)
{
free(nfq);
}
LIBETPAN_EXPORT
void mailimf_no_fold_literal_free(char * nfl)
{
free(nfl);
@ -902,6 +918,7 @@ void mailimf_optional_field_free(struct mailimf_optional_field * opt_field)
free(opt_field);
}
LIBETPAN_EXPORT
void mailimf_field_name_free(char * field_name)
{
free(field_name);


+ 18
- 0
src/low-level/imf/mailimf_types.h View File

@ -787,43 +787,61 @@ struct mailimf_single_fields {
/* internal use */
LIBETPAN_EXPORT
void mailimf_atom_free(char * atom);
LIBETPAN_EXPORT
void mailimf_dot_atom_free(char * dot_atom);
LIBETPAN_EXPORT
void mailimf_dot_atom_text_free(char * dot_atom);
LIBETPAN_EXPORT
void mailimf_quoted_string_free(char * quoted_string);
LIBETPAN_EXPORT
void mailimf_word_free(char * word);
LIBETPAN_EXPORT
void mailimf_phrase_free(char * phrase);
LIBETPAN_EXPORT
void mailimf_unstructured_free(char * unstructured);
LIBETPAN_EXPORT
void mailimf_angle_addr_free(char * angle_addr);
LIBETPAN_EXPORT
void mailimf_display_name_free(char * display_name);
LIBETPAN_EXPORT
void mailimf_addr_spec_free(char * addr_spec);
LIBETPAN_EXPORT
void mailimf_local_part_free(char * local_part);