Minor change in stream API. Improve POP3 client interface.
* include/mailutils/sys/stream.h (_MU_STR_EVENT_SET) (_MU_STR_EVENT_CLR): New defines. (_mu_stream) <event_cb, event_mask>: New members. * mailbox/stream.c (_stream_setflag, _stream_clrflag): New static functions. All functions use these instead of setting/clearing flags directly. (_mu_stream_cleareof, _mu_stream_seteof): New extern functions. (_stream_cleareof): Remove define, use _mu_stream_cleareof instead. (_stream_fill_buffer): Set EOF marker when end of stream is reached. * mailbox/fltstream.c (filter_read): Call _mu_stream_seteof to set EOF flag. * include/mailutils/pop3.h: Get rid of the superfluous "extern" in front of function prototypes. Add new prototypes. Remove extra whitespace. * libproto/pop/pop3_capatst.c: New file. * libproto/pop/pop3_list_cmd.c: New file. * libproto/pop/pop3_listas.c: New file. * libproto/pop/pop3_rdlist.c: New file. * libproto/pop/pop3_uidl_cmd.c: New file. * libproto/pop/pop3_uidlas.c: New file. * libproto/pop/Makefile.am: Add new files. * libproto/pop/pop3_capa.c (_mu_pop3_fill_list): Remove. Use mu_pop3_read_list instead. (capa_comp): New comparator for capa lists. * libproto/pop/pop3_list.c (mu_pop3_list): Fix format specifier. * libproto/pop/pop3_lista.c (mu_pop3_list_all): Rewrite. * libproto/pop/pop3_retr.c (mu_pop3_retr) <MU_POP3_RETR_RX>: do not reset state, this is done by the EOF event callback. * libproto/pop/pop3_top.c (mu_pop3_top) <MU_POP3_TOP_RX>: Likewise. * libproto/pop/pop3_stream.c (pop3_decode_state): New state pds_char. Change semantics of pds_init. (newstate, _pop3_decoder): Handle .\r\n in the initial state. (_pop3_event_cb): New event callback. (mu_pop3_filter_create): Set event callback on the filter stream. * libproto/pop/pop3_uidla.c (mu_pop3_uidl_all): Rewrite. * examples/Makefile.am (pop3client_CPPFLAGS): Add MU_APP_COMMON_INCLUDES. * examples/pop3client.c: Rewrite command parser.
Showing
20 changed files
with
810 additions
and
420 deletions
libproto/pop/pop3_capatst.c
0 → 100644
libproto/pop/pop3_list_cmd.c
0 → 100644
libproto/pop/pop3_listas.c
0 → 100644
libproto/pop/pop3_rdlist.c
0 → 100644
libproto/pop/pop3_uidl_cmd.c
0 → 100644
libproto/pop/pop3_uidlas.c
0 → 100644
-
Please register or sign in to post a comment