summaryrefslogtreecommitdiff
path: root/libmailutils
AgeCommit message (Collapse)AuthorFiles
2010-12-08Test line info facilitySergey Poznyakoff3
* libmailutils/tests/inline-comment.at: Add line info tests. * libmailutils/tests/linecon.at: Likewise. * libmailutils/filter/linecon.c (LINECON_CONTINUATION): New flag. (linecon_newline): Remove. (_linecon_decoder): Correctly determine the end of continuation in case when the last line contained standalone escapes.
2010-12-08Implement line number output in linecon and inline-comment filters.Sergey Poznyakoff3
* libmailutils/filter/inline-comment.c: Implement line number info facility. * libmailutils/filter/linecon.c: Likewise. * libmailutils/stream/logstream.c (_log_done, _log_close): Always close/destroy the underlying transport stream. * comsat/action.c: Rewrite using a table-driven parser. Use line-info facility of the linecon filter.
2010-12-07Rewrite prog stream support.Sergey Poznyakoff3
Two interfaces are provided: mu_prog_stream_create offers full control over the program execution environment (i.e. running privileges, cwd, resource limits) via a set of hints. A simpler interface, mu_command_stream_create, runs the command in the current environment. mu_filter_prog_stream_create is removed, because its functionality can be achieved by a correspondingly crafted set of hints to mu_prog_stream_create. * include/mailutils/prog.h: New file. * include/mailutils/mailutils.h: Include mailutils/prog.h * include/mailutils/Makefile.am (pkginclude_HEADERS): Add prog.h * include/mailutils/stream.h (mu_prog_stream_create) (mu_filter_prog_stream_create): Remove prototypes. * include/mailutils/sys/prog_stream.h (_mu_prog_stream): Change structure. (_mu_prog_limit_codes, _mu_prog_limit_flags): New externs. * include/mailutils/util.h (mu_set_user_privileges) (mu_switch_to_privs): New prototypes. * lib/userprivs.c: Move to libmailutils/base. * lib/Makefile.am (libmuaux_a_SOURCES): Remove userprivs.c * libmailutils/base/Makefile.am (libbase_la_SOURCES): Add userprivs.c * libmailutils/base/userprivs.c (mu_set_user_privileges): New function. (mu_switch_to_privs): Rewrite as another entry point to mu_set_user_privileges. * libmailutils/stream/prog_stream.c (_mu_prog_limit_flags) (_mu_prog_limit_codes): New global variables. (start_program_filter): Use hints to control execution environment. (_prog_stream_create): Save hints. (mu_prog_stream_create): Change signature. (mu_command_stream_create): New function (corresponds to the prior mu_prog_stream_create). (mu_filter_prog_stream_create): Remove function. * comsat/action.c (action_exec): Use new mu_prog_stream_create calling convention. * examples/murun.c: Rewrite. * mh/mhn.c (show_internal): Use new mu_prog_stream_create calling convention. * mh/tests/mhn.at: Reflect changes to mhn. * imap4d/preauth.c: Use mu_command_stream_create. * libmu_sieve/extensions/pipe.c * mail/decode.c * mail/pipe.c * mail/send.c * mh/mhl.c * mu/shell.c * mail/mail.h: Include mailutils/prog.h * mh/mh.h * po/POTFILES.in: Add libmailutils/base/userprivs.c.
2010-12-07file_stream: BugfixesSergey Poznyakoff2
* libmailutils/stream/file_stream.c (fd_open): Remove file state checks: it is the responsibility of the caller. Set autoclose on the *stream* flags (bugfix, previously the underlying fd was never closed). Clear MU_STREAM_SEEK flag if seek fails. (_mu_file_stream_create): Remove assignment to stream.error_string * include/mailutils/stream.h (MU_STREAM_ALLOW_LINKS): Remove flag. * libmailutils/base/amd.c (amd_message_stream_open): Initialize flags to 0.
2010-12-07comsat: minor changesSergey Poznyakoff1
* libmailutils/mailbox/mailbox.c (mu_mailbox_open): Fix error checking condition. * comsat/action.c (act_getline): Remove. (open_rc): Return mu_stream_t. Use linecon filter.
2010-12-07Implement a "line continuation" filter.Sergey Poznyakoff6
Line continuation filter removes from its input any sequence of '\\\n' (a backslash followed by a newline). It is useful for reading various UNIX configuration files. * include/mailutils/filter.h (mu_linecon_filter): New extern. * libmailutils/filter/linecon.c: New file. * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add linecon.c * libmailutils/filter/filter.c (mu_filter_get_list): Register mu_linecon_filter. * libmailutils/tests/linecon.at: New test. * libmailutils/tests/Makefile.am (TESTSUITE_AT): Add linecon.at * libmailutils/tests/testsuite.at: Include linecon.at
2010-12-06Revise stream ioctl support.Sergey Poznyakoff21
The mu_stream_ioctl function gets two argument that identify the ioctl in question: "family", which identifies a family of ioctls in question, and "opcode", which indicates the requested operation within that family. * include/mailutils/stream.h: Define ioctl families and opcodes. (mu_stream_ioctl): Change signature. * include/mailutils/sys/stream.h (_mu_stream)<ctl>: Change signature. * include/mailutils/log.h (mu_severity_from_string) (mu_severity_to_string): New protos. * libmailutils/stream/stream.c (mu_stream_ioctl): Change signature. * libmailutils/filter/filter_iconv.c: Rewrite ioctl support. * libmailutils/stream/file_stream.c: Likewise. * libmailutils/stream/fltstream.c: Likewise. * libmailutils/stream/iostream.c: Likewise. * libmailutils/stream/logstream.c: Likewise. * libmailutils/stream/mapfile_stream.c: Likewise. * libmailutils/stream/memory_stream.c: Likewise. * libmailutils/stream/nullstream.c: Likewise. * libmailutils/stream/prog_stream.c: Likewise. * libmailutils/stream/rdcache_stream.c: Likewise. * libmailutils/stream/streamref.c: Likewise. * libmailutils/stream/syslogstream.c: Likewise. * libmailutils/stream/tcp.c: Likewise. * libmailutils/stream/xscript-stream.c: Likewise. * libmu_auth/tls.c: Likewise. * comsat/action.c: Change calls to mu_stream_ioctl. * imap4d/auth_gsasl.c: Likewise. * imap4d/io.c: Likewise. * imap4d/util.c: Likewise. * libmailutils/base/getpass.c: Likewise. * libmailutils/cfg/parser.y: Likewise. * libmailutils/mailbox/body.c: Likewise. * libmailutils/mime/mime.c: Likewise. * libmailutils/stdstream/dbgstream.c: Likewise. * libmailutils/stdstream/strerr.c: Likewise. * libmu_sieve/runtime.c: Likewise. * libmu_sieve/sieve.y: Likewise. * libmu_sieve/util.c: Likewise. * libproto/imap/trace.c: Likewise. * libproto/mailer/smtp_data.c: Likewise. * libproto/mailer/smtp_starttls.c: Likewise. * libproto/mailer/smtp_trace.c: Likewise. * libproto/pop/pop3_stls.c: Likewise. * libproto/pop/pop3_stream.c: Likewise. * libproto/pop/pop3_trace.c: Likewise. * maidag/lmtp.c: Likewise. * mail/source.c: Likewise. * mu/logger.c: Likewise. * pop3d/extra.c: Likewise. * pop3d/retr.c: Likewise. * TODO: Update. * doc/texinfo/nullstream.texi: Update.
2010-12-06Implement severity suppression in log streams; other minor fixes.Sergey Poznyakoff4
* include/mailutils/stream.h (MU_LOGSTREAM_ADVANCE_LOCUS_LINE) (MU_LOGSTREAM_ADVANCE_LOCUS_COL): Rename to MU_IOCTL_.*. All uses updated. (MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY) (MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY_NAME): New ioctls. * include/mailutils/sys/logstream.h (_mu_log_stream)<threshold>: New member. * include/mailutils/syslog.h (mu_log_severity_threshold): New extern. * libmailutils/cfg/parser.y (_cfg_default_printer): Remove leftover static function. * libmailutils/stream/logstream.c (mu_severity_from_string) (mu_severity_to_string): New functions. (_log_write): Fix double free. Implement severity suppression. (_log_ioctl): Handle MU_IOCTL_LOGSTREAM_SUPPRESS_SEVERITY. * libmu_cfg/common.c (mu_logging_param): New parameter "severity".
2010-12-06Rewrite debugging and logging support.Sergey Poznyakoff33
The mu_debug_t object and associated functions have been removed. New debugging functions are based on the logstream interface. * include/mailutils/debug.hm4: Remove. * include/mailutils/debug.h: New file. * include/mailutils/Makefile.am (BUILT_SOURCES,EXTRA_DIST): Remove debug.h, debug.hm4. * mu-aux/debugdef.m4: Remove. * mu-aux/debcat.awk: New file. * mu-aux/Makefile.am (EXTRA_DIST): Replace debugdef.m4 with debcat.awk. * include/mailutils/sys/dbgstream.h: Remove. * include/mailutils/sys/debug.h: Remove. * include/mailutils/sys/Makefile.am (sysinclude_HEADERS): Remove debug.h and dbgstream.h, add debcat.h * include/mailutils/sys/.gitignore: Add debcat.h. * libmailutils/diag/dbgstderr.c: Remove. * libmailutils/diag/dbgsyslog.c: Remove. * libmailutils/diag/gdebug.c: Remove. * libmailutils/diag/debcat: New file. * libmailutils/diag/Makefile.am (libdiag_la_SOURCES): Remove these sources. * libmailutils/diag/debug.c: Rewrite from scratch. * libmailutils/diag/diag.c: Rewrite from scratch. * libmailutils/diag/syslog.c (mu_diag_syslog_printer): Remove function. (mu_log_syslog, mu_log_print_severity): New variables. * libmailutils/stream/dbgstream.c: Remove. * libmailutils/stream/Makefile.am (libstream_la_SOURCES): Remove dbgstream.c.. * libmailutils/stdstream/Makefile.am (libstdstream_la_SOURCES): Add dbgstream.c. * libmailutils/stream/logstream.c (_mu_severity_str): Change strings to lower case. (_log_write): Improve handling of unrecognized escapes. (_log_ctl): Handle MU_LOGSTREAM_ADVANCE_LOCUS_LINE and MU_LOGSTREAM_ADVANCE_LOCUS_COL. * libmailutils/mailbox/folder.c (mu_folder_has_debug) (mu_folder_get_debug, mu_folder_set_debug): Remove functions. * mu-aux/debcat.awk: New file. * libmailutils/stdstream/dbgstream.c: New file. * comsat/action.c: Use new debug/log functions. * comsat/comsat.c: Likewise. * examples/aclck.c: Likewise. * examples/echosrv.c: Likewise. * examples/msg-send.c: Likewise. * examples/nntpclient.c: Likewise. * examples/numaddr.c: Likewise. * frm/common.c: Likewise. * imap4d/imap4d.c: Likewise. * imap4d/io.c: Likewise. * imap4d/util.c: Likewise. * libmailutils/auth/mu_auth.c: Likewise. * libmailutils/base/amd.c: Likewise. * libmailutils/cfg/driver.c: Likewise. * libmailutils/cfg/format.c: Likewise. * libmailutils/cfg/lexer.l: Likewise. * libmailutils/cfg/parser.y: Likewise. * libmailutils/mailbox/mailbox.c: Likewise. * libmailutils/mailbox/mbx_default.c: Likewise. * libmailutils/mailer/mailer.c: Likewise. * libmailutils/mailer/progmailer.c: Likewise. * libmailutils/server/acl.c: Likewise. * libmailutils/server/ipsrv.c: Likewise. * libmailutils/server/msrv.c: Likewise. * libmailutils/tests/wicket.c: Likewise. * libmu_argp/auth.c: Likewise. * libmu_argp/cmdline.c: Likewise. * libmu_argp/common.c: Likewise. * libmu_auth/ldap.c: Likewise. * libmu_cfg/acl.c: Likewise. * libmu_cfg/auth.c: Likewise. * libmu_cfg/common.c: Likewise. * libmu_cfg/ldap.c: Likewise. * libmu_cfg/sieve.c: Likewise. * libmu_cfg/sql.c: Likewise. * libmu_scm/mu_message.c: Likewise. * libmu_sieve/prog.c: Likewise. * libmu_sieve/runtime.c: Likewise. * libproto/imap/trace.c: Likewise. * libproto/mailer/mbox.c: Likewise. * libproto/mailer/prog.c: Likewise. * libproto/mailer/sendmail.c: Likewise. * libproto/mailer/smtp.c: Likewise. * libproto/mailer/smtp_trace.c: Likewise. * libproto/mbox/folder.c: Likewise. * libproto/mbox/mbox.c: Likewise. * libproto/nntp/folder.c: Likewise. * libproto/nntp/nntp_debug.c: Likewise. * libproto/pop/mbox.c: Likewise. * libproto/pop/pop3_trace.c: Likewise. * maidag/guile.c: Likewise. * maidag/lmtp.c: Likewise. * maidag/maidag.c: Likewise. * maidag/util.c: Likewise. * mail/mail.c: Likewise. * mail/mailvar.c: Likewise. * mail/send.c: Likewise. * mail/source.c: Likewise. * mh/mh_argp.c: Likewise. * mh/send.c: Likewise. * mimeview/mimeview.c: Likewise. * movemail/movemail.c: Likewise. * mu/wicket.c: Likewise. * pop3d/extra.c: Likewise. * pop3d/pop3d.c: Likewise. * readmsg/readmsg.c: Likewise. * sieve/sieve.c: Likewise. * testsuite/mimetest.c: Likewise. * libmu_sieve/sieve-priv.h (mu_sieve_machine) <parse_error_printer> <error_printer, debug_printer, debug>: Remove. <errstream>: New member. (mu_sv_compile_error, mu_sv_print_value_list) (mu_sv_print_tag_list): Change prototypes. * libmu_sieve/actions.c: Use new sieve debug functions. * libmu_sieve/extensions/list.c: Likewise. * libmu_sieve/extensions/moderator.c: Likewise. * libmu_sieve/extensions/pipe.c: Likewise. * libmu_sieve/extensions/spamd.c: Likewise. * libmu_sieve/extensions/timestamp.c: Likewise. * libmu_sieve/extensions/vacation.c: Likewise. * libmu_sieve/sieve.y : Likewise. * libmu_sieve/sieve.l: Likewise. * libmu_sieve/tests.c: Likewise. * libmu_sieve/util.c: Rewrite diagnostic support. * /maidag/sieve.c: Use new debug/log and sieve diagnostic functions. * mu/mu.c (main): Remove call to mu_stdstream_setup. It is called by mu_app_init now. * libmailutils/base/wicket.c (mu_wicket_stream_match_url): Change signature. * libmailutils/cfg/gocs.c (mu_gocs_logging_init): Rewrite. * libmailutils/mailbox/message.c (mu_message_save_to_mailbox): Remove mu_debug_t argument. * libmailutils/stdstream/basestr.c (mu_stdstream_setup): Minor fixes. * libmailutils/stdstream/strerr.c (mu_stdstream_strerr_create): Do not install filter stream if tag is NULL. (mu_stdstream_strerr_setup): New function. * libmu_argp/muinit.c (mu_app_init): Set mu_log_tag. Call mu_stdstream_setup. * libmu_scm/mu_dbgport.c: Rewrite port support. * include/mailutils/acl.h (mu_acl_get_debug) (mu_acl_set_debug): Remove prototypes. * include/mailutils/auth.h (mu_wicket_stream_match_url): Change signature. * include/mailutils/cfg.h (mu_cfg_locus_t): Remove typedef, use struct mu_locus instead. (mu_cfg_locus): Remove declaration. (mu_cfg_node)<locus>: Change type. (mu_cfg_node)<debug>: Remove. (mu_cfg_vperror,mu_cfg_perror) (mu_cfg_parse_error,mu_cfg_format_error): Remove prototypes. (mu_cfg_callback_t): Change signature. All uses updated. (mu_cfg_get_debug): Remove prototype. (mu_cfg_assert_value_type, mu_cfg_string_value_cb): Change signature. (mu_cfg_tree_set_debug): Remove prototype. (mu_cfg_tree_create_node): Change signature. * include/mailutils/diag.h (MU_DIAG_): Redefine via MU_LOG_ constants. (mu_diag_get_debug,mu_diag_set_debug): Remove. (mu_diag_cont_vprintf, mu_diag_cont_printf) (mu_diag_at_locus): New functions. * include/mailutils/folder.h (mu_folder_has_debug) (mu_folder_get_debug, mu_folder_set_debug): Remove prototypes. * include/mailutils/gocs.h (mu_gocs_logging): Remove structure. (mu_gocs_debug)<errpfx>: Remove. * include/mailutils/guile.h (mu_scm_make_debug_port): Change prototype. * include/mailutils/mailbox.h (mu_mailbox_has_debug) (mu_mailbox_get_debug,mu_mailbox_set_debug): Remove. * include/mailutils/mailer.h (mu_mailer_get_debug) (mu_mailer_set_debug): Remove. * include/mailutils/message.h (mu_message_save_to_mailbox): Change signature. * include/mailutils/mu_auth.h (mu_auth_set_debug): Remove proto. * include/mailutils/nntp.h (mu_nntp_set_debug): Remove. * include/mailutils/progmailer.h (mu_progmailer_set_debug): Remove proto. * include/mailutils/server.h (mu_ip_server_set_debug) (mu_ip_server_get_debug): Remove proto. * include/mailutils/sieve.h (mu_sieve_locus_t): Remove. Use struct mu_locus instead. (mu_sieve_printf_t, mu_sieve_parse_error_t): Remove. (mu_sieve_action_log_t): Change signature. (mu_sieve_machine_init): Change signature. (mu_sieve_machine_init_ex): New function. (mu_sieve_get_diag_stream) (mu_sieve_set_diag_stream): New functions. (mu_sieve_set_data): New function. (mu_sieve_get_locus): Change signature. (mu_sieve_set_error,mu_sieve_set_parse_error) (mu_sieve_set_debug,mu_sieve_set_debug_object): Remove protos. * include/mailutils/stdstream.h (mu_stdstream_strerr_setup): New proto. * include/mailutils/stream.h (MU_LOGSTREAM_ADVANCE_LOCUS_LINE) (MU_LOGSTREAM_ADVANCE_LOCUS_COL): New ioctls. (mu_dbgstream_create): Change signature. * include/mailutils/sys/folder.h (_mu_folder) <debug>: Remove. * include/mailutils/sys/mailbox.h (_mu_mailbox) <debug>: Remove. * include/mailutils/sys/mailer.h (_mu_mailer) <debug>: Remove. * include/mailutils/sys/nntp.h (_mu_nntp) <debug>: Remove. * include/mailutils/syslog.h (mu_log_syslog) (mu_log_print_severity): New externs. * include/mailutils/types.hin (_mu_debug, mu_debug_t): Remove. * lib/tcpwrap.h: Remove unused prototypes. * imap4d/imap4d.h: Include mailutils/stdstream.h * mail/mail.h: Likewise. * pop3d/pop3d.h: Likewise. * mh/comp.c (main): Bugfix. * po/POTFILES.in: Update. * TODO: Update.
2010-12-04Remove deprecated interfaces.Sergey Poznyakoff3
* include/mailutils/error.h (mu_error_pfn_t, mu_default_error_printer) (mu_syslog_error_printer): Remove deprecated interfaces. * libmailutils/diag/muerror.c: Likewise. * libmailutils/stream/logstream.c (_log_write): Send MU_IOCTL_LOGSTREAM_SET_SEVERITY to the transport stream. * libmailutils/stream/syslogstream.c (_syslog_ctl): Translate MU severity to syslog priority level and vice versa. * mu/logger.c (mutool_logger): Bugfix.
2010-12-04mu: use stdstream functions.Sergey Poznyakoff2
* include/mailutils/stdstream.h (mu_printf): New prototype. * include/mailutils/version.h: Include mailutils/types.h instead of stdio.h (mu_fprint_options, mu_fprint_conf_option): Remove protos. (mu_format_options, mu_format_conf_option): New protos. * libmailutils/base/version.c (mu_fprint_options): Replace with mu_format_options, which outputs formatted data to a mu_stream_t. (mu_fprint_conf_option): Ditto. Replaced by mu_format_conf_option. (mu_print_options): Update accordingly. * libmailutils/stdstream/basestr.c (mu_printf): New function. * mu/acl.c: Replace stdio calls with stdstream ones. * mu/cflags.c: Likewise. * mu/filter.c: Likewise. * mu/flt2047.c: Likewise. * mu/imap.c: Likewise. * mu/info.c: Likewise. * mu/ldflags.c: Likewise. * mu/logger.c: Likewise. * mu/mu.c: Likewise. * mu/mu.h: Likewise. * mu/pop.c: Likewise. * mu/query.c: Likewise. * mu/shell.c: Likewise. * mu/verbose.c: Likewise. * mu/wicket.c: Likewise.
2010-12-04Introduce stdstream module; move deprecated functions to libmu_compat.Sergey Poznyakoff13
* include/mailutils/log.h: New file. * include/mailutils/stdstream.h: New file. * include/mailutils/Makefile.am (pkginclude_HEADERS): Add stdstream.h and log.h. * include/mailutils/argcv.h: Include mailutils/types.h * include/mailutils/mailutils.h: Include stdstream.h Remove vartab.h * include/mailutils/types.hin (MU_DEPRECATED): New define. * include/mailutils/vartab.h: Mark this header and all prototypes it defines as deprecated. * libmailutils/stdstream/Makefile.am: New file. * libmailutils/stdstream/basestr.c: New file. * libmailutils/stdstream/strerr.c: New file. * libmu_compat/Makefile.am: New file. * libmu_compat/tests/.gitignore: New file. * libmu_compat/tests/Makefile.am: New file. * libmu_compat/tests/atlocal.in: New file. * libmu_compat/tests/testsuite.at: New file. * libmailutils/base/Makefile.am (noinst_LTLIBRARIES): Remove argcv.c and vartab.c. * libmailutils/Makefile.am (SUBDIRS): Add stdstream. (libmailutils_la_LIBADD): Add stdstream/libstdstream.la. * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Remove argcv (TESTSUITE_AT): Remove argcv.at * libmailutils/tests/testsuite.at: Do not include argcv.at. * libmailutils/base/argcv.c: Move to libmu_compat/argcv.c * libmailutils/tests/argcv.at: Move to libmu_compat/tests/argcv.at * libmailutils/tests/argcv.c: Move to libmu_compat/tests/argcv.c * libmailutils/base/vartab.c: Move to libmu_compat/vartab.c * Makefile.am (SUBDIRS): Add libmu_compat. * configure.ac: Add libmu_compat/tests, libmu_compat/tests/Makefile, libmu_compat/tests/atlocal, libmu_compat/Makefile and libmailutils/stdstream/Makefile to config file list. * mu/ldflags.c (lib_descr): Add mu_compat. * mu/logger.c (logger_parse_opt): -t does not imply --syslog. (mutool_logger): Use inline-comment filter to insert "tag: " prefix. Flush and destroy both streams before returning. * po/POTFILES.in: Add libmailutils/stream/logstream.c, libmailutils/stdstream/baseio.c, libmailutils/stdstream/strerr.c and mu/logger.c.
2010-12-03Initial implementation of log streams.Sergey Poznyakoff4
* include/mailutils/mailutils.h: Include mailutils/log.h. * include/mailutils/stream.h (MU_IOCTL_LOGSTREAM_GET_SEVERITY) (MU_IOCTL_LOGSTREAM_SET_SEVERITY) (MU_IOCTL_LOGSTREAM_GET_LOCUS,MU_IOCTL_LOGSTREAM_SET_LOCUS) (MU_IOCTL_LOGSTREAM_GET_MODE,MU_IOCTL_LOGSTREAM_SET_MODE): New ioctls. * include/mailutils/sys/logstream.h: New file. * include/mailutils/sys/syslogstream.h: New file. * include/mailutils/sys/Makefile.am (sysinclude_HEADERS): Add logstream.h and syslogstream.h * include/mailutils/types.hin (mu_locus): New struct. * libmailutils/stream/Makefile.am (libstream_la_SOURCES): Add logstream.c and syslogstream.c. * mu/logger.c: New file. * mu/template.c: New file. * mu/Makefile.am (MODULES): Add logger.c (EXTRA_DIST): Add template.c.
2010-12-03streams: introduce setbuf hooks.Sergey Poznyakoff1
* include/mailutils/sys/stream.h (_mu_stream) <setbuf_hook>: New member. * libmailutils/stream/stream.c (mu_stream_set_buffer): Use setbuf_hook to decide whether the operation is allowed.
2010-12-02Improve the inline-comment filter.Sergey Poznyakoff2
* libmailutils/filter/inline-comment.c: Recognize multi-char comment sequences. Implement encode mode. * libmailutils/tests/inline-comment.at: Test the new modes. * mail/escape.c (quote0): Re-implement using inline-comment encode mode. * mail/mailvar.c (mailvar_tab): Fix a typo.
2010-12-02Minor change.Sergey Poznyakoff1
* configure.ac: Remove checks for strtok_r, strchrnul, strndup, asprintf, vasprintf: none of these is used any more. * maidag/lmtp.c (lmtp_reply): Use mu_vasnprintf. * mh/mh.h (strchrnul): Remove proto. * mh/mh_list.c (want_header): Rewrite. (print): Use strcspn.
2010-12-02Avoid using strtok(_r)Sergey Poznyakoff7
* TODO: Update. * gnulib.modules: Remove strtok_r * imap4d/auth_gsasl.c (auth_gsasl_capa_init): Use mu_wordsplit instead of strtok. * imap4d/imap4d.h (strtok_r): Remove declaration. * lib/mailcap.c (mime_context) <no_ask_str>: Remove. All uses updated. (mime_context_fill): Use mu_wordsplit instead of strtok. (mime_context_write_input): Tolerate ENOSYS return from mu_stream_seek. (display_stream_mailcap): Use mu_wordsplit instead of strtok. * libmailutils/diag/gdebug.c (mu_debug_level_from_string) (mu_global_debug_from_string): Use mu_wordsplit instead of strtok. * libmu_cfg/sieve.c (_add_path): Likewise. * libmu_sieve/extensions/list.c: Likewise. * mail/escape.c (quote0): Likewise. * mail/util.c (util_header_expand): Likewise. (util_rfc2047_decode): Use mu_parse_lc_all. * mh/mh_init.c (mh_charset): Use mu_parse_lc_all. * frm/common.c (get_charset): Use mu_parse_lc_all. * libmailutils/base/lcall.c: New file. * libmailutils/base/Makefile.am (libbase_la_SOURCES): Add lcall.c * libmailutils/string/strlst.c: New file. * libmailutils/string/Makefile.am (libstring_la_SOURCES): Add strlst.c. * include/mailutils/cstr.h: Include mailutils/types.h (mu_string_split): New proto. * include/mailutils/nls.h (MU_LC_LANG, MU_LC_TERR) (MU_LC_CSET,MU_LC_MOD): New flags. (mu_lc_all): New struct. (mu_parse_lc_all, mu_lc_all_free): New protos. (mu_charset_lookup): New proto (from util.h). * include/mailutils/util.h (mu_charset_lookup): Move to nls.h * libmailutils/base/tempfile.c (mu_tempname): Shut up compiler warning.
2010-12-02Fixes in message_stream.Sergey Poznyakoff1
* libmailutils/mailbox/message.c (_message_stream_seek): Fix ESPIPE conditional. (_message_stream_read): Keep running until buffer is full or _mss_eof state is reached. (_message_stream_readdelim): Keep running until buffer is full, _mss_eof state is reached or delimiter is found.
2010-11-30Bugfix in libstreamSergey Poznyakoff1
* libmailutils/stream/message_stream.c (_message_open): Don't clobber len.
2010-11-30Minor fix in libstringSergey Poznyakoff1
* libmailutils/string/mkfilename.c (mu_make_file_name_suf): Don't add leading / if dir=="".
2010-11-30mime creation: bugfixes.Sergey Poznyakoff1
* libmailutils/mime/mime.c (_mime_append_part): All numeric args are of type size_t. (_mime_part_size): Fix calculations. (mu_mime_get_part): Avoid coredump if stream is NULL.
2010-11-29streams: fix mu_stream_wait operation for buffered streamsSergey Poznyakoff1
* libmailutils/stream/stream.c (mu_stream_wait): Fix condition to determine if the buffer contains some data. Avoid passing empty flags to the wait method.
2010-11-25Remove obsolete function.Sergey Poznyakoff2
* include/mailutils/body.h (mu_body_get_filename): Remove proto. * include/mailutils/sys/body.h (_mu_body) <filename>: Remove. * libmailutils/mailbox/body.c (mu_body_get_filename): Remove obsolete function. (_body_get_stream): Use mu_temp_file_stream_create. * libmailutils/stream/temp_file_stream.c (mu_temp_file_stream_create): Return EINVAL if flags is set, but hints is NULL. * libmu_scm/mu_body.c (mu_scm_body_print): Don't use mu_body_get_filename.
2010-11-25temp_file_stream: Use mu_tempfile_hints to control how the file name is created.Sergey Poznyakoff2
* include/mailutils/stream.h (mu_temp_file_stream_create): Change signature. * include/mailutils/sys/Makefile.am (sysinclude_HEADERS): Add temp_file_stream.h * include/mailutils/util.h (mu_tempfile_hints): Remove const qualifiers. * libmailutils/stream/temp_file_stream.c: Include sys/temp_file_stream.h. (fd_temp_open): Use data from struct _mu_temp_file_stream. (fd_temp_done): New function. (mu_temp_file_stream_create): Take hints and flags as arguments. * examples/mta.c: Update calls to mu_temp_file_stream_create. * libproto/mbox/mbox.c: Likewise. * libproto/pop/mbox.c: Likewise. * maidag/deliver.c: Likewise. * maidag/lmtp.c: Likewise. * mh/burst.c: Likewise. * mh/prompter.c: Likewise.
2010-11-25Rewrite temporary file handling.Sergey Poznyakoff8
* include/mailutils/util.h (mu_make_file_name_suf): New proto. (mu_make_file_name): Replace with a macro. (MU_TEMPFILE_TMPDIR,MU_TEMPFILE_SUFFIX) (MU_TEMPFILE_MKDIR): New flags. (mu_tempfile_hints): New struct. (mu_tempfile): Change signature. * libmailutils/base/tempfile.c (mu_create_temp_file): New function. (mu_tempfile): Rewrite from scratch. Change signature. All callers changed. * libmailutils/string/mkfilename.c (mu_make_file_name): Remove. (mu_make_file_name_suf): New function. * libmailutils/stream/streamcpy.c (mu_stream_copy): Don't return EIO on EOF. * libmailutils/stream/file_stream.c (mu_fd_stream_create): If MU_STREAM_SEEK is set, position fd to 0. * guimb/collect.c: Update calls to mu_tempfile. * lib/mailcap.c: Likewise. * libmailutils/base/amd.c (_amd_tempfile): Rewrite using mu_tempfile. * libmailutils/tests/tempfile.c: New file. * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add tempfile.
2010-11-24wordsplit: fix whitespace trimming.Sergey Poznyakoff2
* libmailutils/string/wordsplit.c (mu_wordsplit_trimws): Do not touch quoted nodes. * libmailutils/tests/wordsplit.at: Test the above change.
2010-11-24New type of stream: static memory stream.Sergey Poznyakoff3
Static memory stream is a read-only stream whose transport is an arbitrary area of memory. Such streams allow the programmer to access C strings using streams interface. * include/mailutils/stream.h (mu_static_memory_stream_create): New proto. * libmailutils/stream/memory_stream.c (mu_static_memory_stream_create): New function. * imap4d/append.c (imap4d_append0): Use static memory stream to create a temporary message. * imap4d/preauth.c (decode64_buf): Use static memory stream. * libmailutils/base/rfc2047.c (mu_rfc2047_decode): Likewise. * libmailutils/mime/mimehdr.c (mu_mimehdr_decode_param): Likewise. * libmu_auth/ldap.c (chk_md5, chk_sha, chk_ssha): Likewise. * libmu_sieve/extensions/vacation.c (build_mime): Likewise.
2010-11-24Fix body start calculation in message_stream. Fix compose parser in mhn.Sergey Poznyakoff1
* libmailutils/stream/message_stream.c (scan_stream): Merge with _message_open. * mh/mhn.c (edit_forw): Do not set ws_delim. Fix message addressing. (mhn_edit): Remove the trailing newline.
2010-11-24mh: implement rmmproc.Sergey Poznyakoff1
* include/mailutils/sys/amd.h (_amd_data) <delete_msg>: New method. * libmailutils/base/amd.c (amd_expunge): If delete_msg is defined, use it. * libproto/mh/mbox.c (_mh_msg_delete): New method. (_mailbox_mh_init): Set delete_msg if "rmmproc" component is defined. * mh/tests/movemsg: New file. * mh/tests/Makefile.am (EXTRA_DIST): Add movemsg. * mh/tests/rmm.at: Test rmmproc effects. * mh/tests/rmf.at (MH_KEYWORDS): Fix copy-n-paste error. * doc/texinfo/mu-mh.texi: Document rmmproc. * mh/TODO: Update.
2010-11-22Provide a library function for translating message UIDs to numbers and vice ↵Sergey Poznyakoff2
versa. * include/mailutils/mailbox.h (MU_MAILBOX_UID_TO_MSGNO) (MU_MAILBOX_MSGNO_TO_UID): New defines. (mu_mailbox_translate): New proto. * include/mailutils/sys/mailbox.h (_mu_mailbox) <_translate>: New method. * libmailutils/mailbox/mailbox.c (mu_mailbox_translate): New function. * libproto/mh/mbox.c (mh_translate): New function. Implements the _translate method. * mh/mh_msgset.c (mh_uid_to_msgno, mh_msgno_to_uid): Remove. All callers updated to use mu_mailbox_translate instead. (mh_search_message): Remove. (mh_get_message): Rewrite using mu_mailbox_translate. * mh/comp.c (copy_message): Check return from mu_mailbox_get_message. * mh/mh_init.c (mh_draft_message): Rewrite using mu_url_sget_path. * mh/tests/comp.at: Test draftfolder functionality.
2010-11-22mh: fix msgset parser and some more comp compatibility issues; provide ↵Sergey Poznyakoff1
testsuite for comp. * mh/Makefile.am (bin_PROGRAMS): Add mhseq. * mh/comp.c (main): Rewrite to fix compatibility issues. * mh/mh.h (MH_MSGSET_UID): New define. (mh_msgset_t) <flags,size>: New members. * mh/mh_init.c (mh_draft_message): Bugfix: convert msgset to UIDs. * mh/mh_msgset.c: Rewrite from scratch. * mh/tests/comp.at: New file. * mh/tests/mhseq.at: New file. * mh/tests/Makefile.am (TESTSUITE_AT): Add comp.at, mhseq.at. * mh/tests/testsuite.at: Include comp.at and mhseq.at. * libmailutils/property/mhprop.c (_mh_prop_read_stream): Minor fix. Do remove empty lines. * mh/mh_whatnow.c (_whatnow): Detect EOF. (call_send): Quit after successful send.
2010-11-21mh: improve component reading (profile, context and whom).Sergey Poznyakoff11
* libmailutils/filter/header.c: New file. * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add header.c. * libmailutils/filter/filter.c (mu_filter_get_list): Register mu_header_filter. * libmailutils/filter/inline-comment.c: (ilcmt_ws) (ilcmt_rollback): New states. (ILCMT_REMOVE_EMPTY_LINES,ILCMT_SQUEEZE_WS): New flags. (ilcmt_data)<buf,size,level,replay>: New members. (ilcmt_action): New enum (new_ilcmt_state): Return enum ilcmt_action. (_ilcmt_decoder): Optionally remove empty lines and squeeze leading white space. * libmailutils/property/mhprop.c (_mh_prop_read_stream): Remove empty lines from the input. * libmailutils/tests/Makefile.am (TESTSUITE_AT): Add hdrflt.at and inline-comment.at. * libmailutils/tests/testsuite.at: Include hdrflt.at and inline-comment.at. * libmailutils/tests/fltst.c: Pass optional arguments to the filter creation procedure. * mh/mh_whom.c (read_header): New function. (mh_whom): Rewrite using headers. * include/mailutils/filter.h: Fix a typo. * libmailutils/stream/fltstream.c: Likewise. * libmu_auth/gsasl.c: Likewise.
2010-11-20Re-implement MH sequences via mailbox properties.Sergey Poznyakoff10
* libmailutils/mailbox/header.c (mu_header_clear): New function. (mu_header_sget_value_n): Tolerate pval == NULL. * libmailutils/property/assocprop.c (_assoc_prop_setval): Bugfix. (_assoc_prop_clear): New method. (mu_assoc_property_init): Reference the stream. (mu_assoc_property_init): Initialize _prop_clear. * libmailutils/property/create.c (_mu_property_init): Now extern. * libmailutils/property/propset.c (mu_property_set_value): Null value means unset. * libmailutils/tests/prop.at: Test property clear and invalidate. * libmailutils/tests/prop.c: New commands: 0 for property clear and ! for invalidate. * libmailutils/property/mhprop.c: New file. * libmailutils/property/propclr.c: New file. * libmailutils/property/propinv.c: New file. * libmailutils/property/Makefile.am (noinst_LTLIBRARIES): Add new files. * include/mailutils/header.h (mu_header_clear): New proto. * include/mailutils/property.h (mu_property_clear) (mu_property_invalidate): New protos. (mu_mh_prop): New struct. (mu_mh_property_init): New proto. * include/mailutils/sys/property.h (_mu_property) <_prop_clear>: New member. (_mu_property_init): New proto. * include/mailutils/mh.h: New file. * include/mailutils/Makefile.am (pkginclude_HEADERS): Add mh.h * libproto/mh/profile.c: New file. * libproto/mh/Makefile.am (libmu_mh_la_SOURCES): Add new files. * libproto/mh/mbox.c (mh_get_property): New static function. (_mailbox_mh_init): Set _get_property. * mh/mh_global.c (current_message, sequences): Remove. Use mbox properties instead. (mh_global_sequences_get) (mh_global_sequences_set) (mh_global_sequences_iterate) (mh_global_sequences_drop): Take mbox as first argument. All callers updated. * mh/mh_init.c (mh_init2): Remove call to mh_global_sequences_get. * mh/mh_msgset.c (msgset_cur): Use mh_mailbox_get_cur. * mh/mh_sequence.c (mh_seq_read, write_sequence) (delete_sequence, mh_seq_add, mh_seq_delete): Take mbox as first argument. All callers updated. * mh/mh.h: Include mailutils/property.h. (current_message): Remove. (mh_mailbox_cur_default): New extern. (mh_global_sequences_get) (mh_global_sequences_set) (mh_global_sequences_iterate) (mh_global_sequences_drop): Take mbox as first argument. All callers updated. * mh/mh_format.c (builtin_cur): Rewrite using mh_message_number. * mh/mboxprop.c: New file. * mh/Makefile.am (libmh_a_SOURCES): Add new file. * mh/folder.c: Update calls to sequence management functions. * mh/mark.c: Likewise. * mh/pick.c: Likewise. * mh/inc.c (main): Set mh_mailbox_cur_default to 1. Invalidate properties if changecur is not set. * mh/prompter.c (main): Destroy the iterator. * mh/rmf.c: Rewrite using mu_mailbox_remove. * mh/scan.c: Always close the mailbox. * mh/tests/folder.at: Update. * mh/tests/inc.at: Update. Inc now sets cur to 1 if it was not originally set. This is what others MHs do.
2010-11-18Rewrite property support.Sergey Poznyakoff19
* configure.ac: Add libmailutils/property/Makefile to config files. * include/mailutils/property.h (mu_property_create) (mu_property_destroy): Change signature. (mu_property_get_owner): Remove. (mu_property_create_init) (mu_property_set_init, mu_property_set_init_data) (mu_property_ref, mu_property_unref) (mu_property_save): New protos. (mu_property_get_iterator) (mu_assoc_property_init): New protos. * include/mailutils/sys/property.h (property_item): Remove definition. (MU_PROP_INIT, MU_PROP_FILL, MU_PROP_MODIFIED): New flags. (_mu_property): Rewrite from scratch. (_mu_property_check): New proto. * libmailutils/property/Makefile.am: New file. * libmailutils/property/assocprop.c: New file. * libmailutils/property/create.c: New file. * libmailutils/property/propget.c: New file. * libmailutils/property/propitr.c: New file. * libmailutils/property/propset.c: New file. * libmailutils/Makefile.am (SUBDIRS): Add property. (libmailutils_la_LIBADD): Add property/libproperty.la. * libmailutils/base/property.c: Remove. * libmailutils/base/Makefile.am (libbase_la_SOURCES): Remove property.c * libmailutils/base/assoc.c (first): Avoid coredumping on empty hash table. * include/mailutils/folder.h (mu_folder_set_property) (mu_folder_get_property): New protos. * include/mailutils/sys/folder.h (_mu_folder) <property> <_get_property>: New members. * libmailutils/mailbox/folder.c (mu_folder_destroy): Destroy the property. (mu_folder_get_property) (mu_folder_set_property): New functions. * include/mailutils/mailbox.h (mu_mailbox_set_property): New proto. * libmailutils/mailbox/mailbox.c (mu_mailbox_set_property): New function. (mu_mailbox_get_property): Use _get_property method. * include/mailutils/mailer.h (mu_mailer_set_property): New proto. * include/mailutils/sys/mailer.h (_mu_mailer) <_get_property>: New member. * libmailutils/mailer/mailer.c (mu_mailer_set_property): New function. (mu_mailer_get_property): Use _get_property method. * include/mailutils/iterator.h (mu_iterator_set_dataptr): New proto. * include/mailutils/sys/iterator.h (_mu_iterator) <dataptr>: New method. * libmailutils/base/iterator.c (mu_iterator_set_dataptr): New function. (mu_iterator_current): Rewrite as a wrapper around mu_iterator_current_kv. (mu_iterator_current_kv): Use dataptr method (if defined) to extract the data pointer. * libmailutils/tests/prop.c: New file. * libmailutils/tests/prop.at: New file. * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add prop. (TESTSUITE_AT): Add prop.at. * libmailutils/tests/testsuite.at: Include prop.at.
2010-11-17Implement "inline-comment" filter.Sergey Poznyakoff7
* include/mailutils/filter.h (mu_filter_xcode_t): Change signature. (mu_filter_create_args): New proto. (mu_inline_comment_filter): New extern. * libmailutils/filter/inline-comment.c: New file. * libmailutils/filter/Makefile.am (libfilter_la_SOURCES): Add inline-comment.c. * libmailutils/filter/crlfdot.c (alloc_state): Update declaration. * libmailutils/filter/crlfflt.c: Likewise. * libmailutils/filter/dot.c: Likewise. * libmailutils/filter/fromflt.c (_from_alloc_state): Likewise. * libmailutils/filter/filter.c (mu_filter_create_args): New function. (mu_filter_create): Rewrite via mu_filter_create_args. mh: inline comments are allowed for use in components and forwcomp files. * mh/compcommon.c (mh_comp_draft): Fix erroneous conditional. * mh/components: Add comments. * mh/mh_init.c (mh_file_copy): Rewrite using new API. mu filter: new option to list supported filters. * mu/filter.c (filter_options): New option --list (-L). (filter_parse_opt): Handle the -L option. (filter_printer, list_filters): New functions. (main): Print a list of filters if --list was given.
2010-11-15message_stream: BugfixSergey Poznyakoff1
* libmailutils/stream/message_stream.c (copy_trimmed_value): Fix memory allocation.
2010-11-11mhl: Improve backward compatibility. Provide a test case.Sergey Poznyakoff2
Mhl now accepts the traditional use of "ignores=", i.e. as a single statement on a line and without double-quotes around the argument. Additional quotes around variable values are not needed in most cases. The name of a component is not printed if that component is not present. The offset variable works as in MH and nmh. * mh/mh_list.c (parse_variable): Accept traditional use of "ignores=", as a single statement on a line, without double-quotes around the argument. (mhl_format_compile): Use mu_streams instead of FILE. Fix line counting. (header_is_printed, want_header): Last argument is const char *. (ovf_print): Move to the specified offset no matter what the value of prefix is. (print_component_name): New function. (eval_component): Call print_component_name and newline, if necessary (eval_body): Likewise. (eval_extras): Likewise. (eval_comp): Do not print component name, leave that to the called function. Ditto for the trailing newline. * mh/mhl.c: Ignore empty moreproc value. * mh/mhl.format: Remove extra double-quotes. * mh/tests/mhl.at: New testcase. * mh/tests/Makefile.am (TESTSUITE_AT): Add mhl.at * mh/tests/testsuite.at: Include mhl.at * libmailutils/string/wordsplit.c (scan_qstring): Force _WSNF_EMPTYOK. (mu_wordsplit_len): Make sure the tail element is not joinable * libmailutils/tests/wordsplit.at: Test these changes. * doc/texinfo/mu-mh.texi: Update the description of mhl.
2010-11-11Add MH testsuite.Sergey Poznyakoff1
* configure.ac (mh/tests): New testdir * mh/Makefile.am (SUBDIRS): Add tests * tests/Makefile.am: New file. * mh/tests/Makefile.am: New file. * mh/tests/atlocal.in: New file. * mh/tests/folder.at: New file. * mh/tests/inc.at: New file. * mh/tests/mark.at: New file. * mh/tests/mhparam.at: New file. * mh/tests/mhpath.at: New file. * mh/tests/refile.at: New file. * mh/tests/rmf.at: New file. * mh/tests/rmm.at: New file. * mh/tests/scan.at: New file. * mh/tests/testsuite.at: New file. * mh/tests/.gitignore: New file. * testsuite/testsuite.inc (MUT_MBCOPY): Work correctly if DST is a directory name (for MH and maildir formats). * mh/folder.c (action_list): Treat empty value as equal to no value. * mh/install-mh.c (main): Honor MH environment variable. * mh/mh_ctx.c (mh_context_read, mh_context_write): Use MU streams instead of stdio FILE. (mh_context_iterate): Add error checking. Do not coredump on NULL header. * mh/mh_global.c (_mh_init_global_sequences): Destroy sequences. * mh/TODO: Update. * libmailutils/stream/message_stream.c (copy_trimmed_value): New static function. (scan_stream): Strip final newline from the saved envelope values. * mu/Makefile.am (BUILD_SOURCES, EXTRA_DIST): Add mu-setup.c and mu-setup.h.
2010-11-10Improve stream statistics interface. Introduce "null stream".Sergey Poznyakoff5
* include/mailutils/stream.h (MU_IOCTL_NULLSTREAM_SET_PATTERN) (MU_IOCTL_NULLSTREAM_SET_PATCLASS) (MU_IOCTL_NULLSTREAM_SETSIZE) (MU_IOCTL_NULLSTREAM_CLRSIZE): New ioctl opcodes. (mu_nullstream_pattern): New struct. (MU_STREAM_STAT_IN,MU_STREAM_STAT_OUT) (MU_STREAM_STAT_READS,MU_STREAM_STAT_WRITES) (MU_STREAM_STAT_SEEKS,_MU_STREAM_STAT_MAX): New defines. (MU_STREAM_STAT_MASK): New macro. (MU_STREAM_STAT_MASK_ALL): New define. (mu_stream_stat_buffer): New typedef. (mu_stream_set_stat, mu_stream_get_stat) (mu_nullstream_create): New protos. (mu_stream_bytes_in, mu_stream_bytes_out): Remove protos. * include/mailutils/sys/nullstream.h: New file. * include/mailutils/sys/stream.h (_mu_stream) <bytes_in>, <bytes_out>: Remove. <statmask,statbuf>: New members. * include/mailutils/sys/Makefile.am (sysinclude_HEADERS): Add nullstream.h. * libmailutils/stream/nullstream.c: New file. * libmailutils/stream/stream.c (_stream_read, _stream_write) (_stream_seek, _stream_stat_incr): New macros. (_stream_fill_buffer, mu_stream_seek) (_stream_read_unbuffered) (_stream_write_unbuffered): Use _stream_read, _stream_write and _stream_seek instead of calling the corresponding methods directly. (mu_stream_bytes_in, mu_stream_bytes_out): Remove. (mu_stream_unref): Clear statbuf, if provided. (mu_stream_set_stat, mu_stream_get_stat): New functions. * libmailutils/stream/Makefile.am (libstream_la_SOURCES): Add nullstream.c. * libmailutils/stream/fltstream.c (filter_wr_close): Check for fs->eof. * examples/base64.c (c_copy): Use new statistics interface. * libmailutils/tests/fltst.c: Likewise.
2010-11-10attachment.c: redesign/simplify using the new API.Sergey Poznyakoff1
* libmailutils/mime/attachment.c (BUF_SIZE): Remove. (_mu_mime_io_buffer)<buf, bufsize>: Remove members. (MSG_HDR): Remove. (mu_message_create_attachment): Use mu_asprintf instead of manually crafting the string. (mu_mime_io_buffer_set_size) (mu_mime_io_buffer_get_size): Remove. (mu_message_save_attachment) (mu_message_encapsulate) (mu_message_unencapsulate): Use mu_header_sget to avoid unnecessary memory allocations. Use mu_stream_copy instead of (ineffective) loops. * include/mailutils/message.h (mu_mime_io_buffer_set_size) (mu_mime_io_buffer_get_size): Remove prototypes. * include/mailutils/header.h (MU_HEADER_RESENT_SENDER) (MU_HEADER_CONTENT_TRANSFER_ENCODING) (MU_HEADER_DELIVERY_DATE) (MU_HEADER_ENVELOPE_TO): Normalize spelling.
2010-11-09filter subsystem: bugfixes.Sergey Poznyakoff4
* include/mailutils/sys/filter.h (_mu_filter_stream)<eof>: New member. * libmailutils/filter/binflt.c (_bit8_filter): Change name initializer to "8bit". (_bit7_filter): Change name initializer to "7bit". * libmailutils/filter/filter.c (mu_filter_create): Limit line length for encoding streams only. * libmailutils/stream/fltstream.c (filter_read): Use fs->eof instead of the regular stream EOF marker. * libmailutils/stream/stream.c (mu_stream_eof): Bugfix: take into account eventual buffered data. (_stream_read_unbuffered): Call mu_stream_eof instead of checking the _MU_STR_EOF bit.
2010-11-09imap client: implement login and id commands.Sergey Poznyakoff1
* libproto/imap/id.c: New file. * libproto/imap/login.c: New file. * libproto/imap/Makefile.am: Add new files. * libproto/imap/capability.c (mu_imap_capability): Clear MU_IMAP_RESP before reading response. Add MU_WRDSF_QUOTE to mu_wordsplit flags. * libproto/imap/err.c (_mu_imap_seterrstr): Bugfix: initialize imap->errstr. * libproto/imap/logout.c (mu_imap_logout): Clear MU_IMAP_RESP before reading response. * libproto/imap/response.c (_mu_imap_response): Set error string. * mu/imap.c (com_login, com_id): New functions. (imap_comtab) <login, id>: New keywords.
2010-11-09Make sure stream->offset points to the position in stream corresponding to ↵Sergey Poznyakoff1
the start of the buffer. * libmailutils/stream/stream.c (_stream_fill_buffer): Keep track of the current offset. (mu_stream_seek): avoid unnecessary seeks. (_stream_skip_input_bytes): Call _stream_flush_buffer before _stream_fill_buffer. (_stream_write_unbuffered): Do not modify current offset. (mu_stream_read,mu_stream_write): For unbuffered streams, modify current offset after invoking the corresponding I/O call. (_stream_scandelim): Call _stream_flush_buffer before _stream_fill_buffer.
2010-11-08Begin imap client implementation.Sergey Poznyakoff1
* include/mailutils/imap.h: New file. * include/mailutils/Makefile.am (pkginclude_HEADERS): Add imap.h * libproto/imap/capability.c: New file. * libproto/imap/capatst.c: New file. * libproto/imap/carrier.c: New file. * libproto/imap/connect.c: New file. * libproto/imap/create.c: New file. * libproto/imap/destroy.c: New file. * libproto/imap/disconnect.c: New file. * libproto/imap/err.c: New file. * libproto/imap/fake-folder.c: New file. * libproto/imap/logout.c: New file. * libproto/imap/response.c: New file. * libproto/imap/state.c: New file. * libproto/imap/tag.c: New file. * libproto/imap/trace.c: New file. * libproto/imap/Makefile.am (libmu_imap_la_SOURCES): Temporarly remove folder.c, mbox.c and url.c. Add new files. * mu/getarg.c: New file. * mu/imap.c: New file. * mu/verbose.c: New file. * mu/Makefile.am (IDLE_MODULES): New variable. (IMAP_C): New variable. (MODULES): Add $(IMAP_C). (mu_SOURCES): Add getarg.c and verbose.c (mu-setup.h, mu-setup.c): Add IDLE_MODULES both to the dependencies and to the mu-setup.awk command line. * mu/mu-setup.awk: New keyword mu-cond. * mu/pop.c: Add mu-cond keyword. * include/mailutils/sys/imap.h: Rewrite. * include/mailutils/sys/pop3.h (MU_POP3_CHECK_EAGAIN): Take into account MU_ERR_REPLY and MU_ERR_BADREPLY, which are recoverable errors. * libmailutils/base/list.c (mu_list_clear): Return immediately if list is NULL. * libmu_auth/sql.c (sql_escape_string): Remove unused variable. * libproto/pop/pop3_carrier.c (mu_pop3_get_carrier): Increase refcount on the returned stream. * libproto/pop/pop3_response.c (mu_pop3_response): Check POP3 reply code.
2010-11-02Remove the --license option.Sergey Poznyakoff2
It is not needed because the --version option shows a terse info about the license, as well as a link to its full text.
2010-11-02Use full buffering for streamrefs.Sergey Poznyakoff1
* libmailutils/stream/streamref.c (mu_streamref_create_abridged): Set full buffering by default.
2010-10-30Remove all uses of vartab, replacing them with wordsplit.Sergey Poznyakoff3
* libmailutils/string/wordsplit.c (mu_wordsplit_init): Call mu_wordsplit_free_words to reclaim the memory. (mu_wordsplit_free_words): New function. (mu_wordsplit_free): Use mu_wordsplit_free_words. * imap4d/imap4d.c (imap4d_session_setup0): Use wordsplit instead of vartab. * imap4d/imap4d.h