1. 07 Dec, 2011 3 commits
    • * include/mailutils/imap.h (imap_command): New struct.
      (mu_imap_gencom): New function.
      (mu_imap_store,mu_imap_delete)
      (mu_imap_rename,mu_imap_mailbox_close,mu_imap_close)
      (mu_imap_check): New functions.
      (_mu_close_handler): New function.
      * include/mailutils/sys/imap.h (mu_imap_client_state): Add new states.
      * libproto/imap/gencom.c: New file.
      * libproto/imap/close.c: New file.
      * libproto/imap/delete.c: New file.
      * libproto/imap/rename.c: New file.
      * libproto/imap/store.c: New file.
      * libproto/imap/unselect.c: New file.
      * libproto/imap/check.c: New file.
      * libproto/imap/expunge.c: New file.
      * libproto/imap/copy.c: New file.
      * libproto/imap/Makefile.am (libmu_imap_la_SOURCES): Add new files.
      
      * mu/imap.c: Implement new commands.
      * mu/shell.c (execute_line): Treat backslash as escape only before
      another backslash or double-quote.
      Sergey Poznyakoff authored
    • * imap4d/imap4d.h (silent_expunge): New global.
      * imap4d/sync.c (silent_expunge): New variable.
      (action): Suppress EXPUNGE responses if silent_expunge is set.
      * imap4d/close.c (imap4d_close0): Set silent_expunge before calling
      mu_mailbox_flush.
      
      * imap4d/tests/close-expunge.at: New test.
      * imap4d/tests/testsuite.at: Include close-expunge.at.
      * imap4d/tests/Makefile.am (TESTSUITE_AT): Add close-expunge.at.
      
      * imap4d/fetch.c (fetch_thunk): Emit BAD response if failed to parse
      message set.
      * imap4d/store.c (store_thunk): Emit BAD response if failed to parse
      flags.
      Sergey Poznyakoff authored
  2. 06 Dec, 2011 2 commits
    • Sergey Poznyakoff authored
    • * libmailutils/base/date.c (mu_scan_datetime): Handle optional
      blocks (%[ %| %], alternatives %( %| %), "any character"
      wildcards (%?) and strict character matches (%\C).  Return
      MU_ERR_FORMAT on errors in format string.
      Compute tm->tm_yday.
      * libmailutils/diag/errors (MU_ERR_FORMAT): New error code.
      * libmailutils/tests/scantime.c: Print yday.  Print input line with
      diagnostic messages.
      * libmailutils/tests/scantime.at: Add more tests.
      * include/mailutils/util.h (MU_DATETIME_RFC822): Split into two
      formats: MU_DATETIME_FORM_RFC822, for output formatting, and
      MU_DATETIME_SCAN_RFC822 for input scanning.  All uses changed.
      Sergey Poznyakoff authored
  3. 05 Dec, 2011 5 commits
    • * libmu_sieve/runtime.c (_mu_sv_instr_push)
      (_mu_sv_instr_pop): Use mu_list_push and mu_list_pop.
      * mail/alias.c (recursive_alias_expand): Likewise.
      Sergey Poznyakoff authored
    • * include/mailutils/list.h (mu_list_push)
      (mu_list_pop): New functions.
      * libmailutils/list/pop.c: New file.
      * libmailutils/list/push.c: New file.
      * libmailutils/list/Makefile.am (liblist_la_SOURCES): Add new files.
      * libmailutils/tests/list.at: Test LIFO access.
      * libmailutils/tests/listop.c: Implement push & pop.
      Sergey Poznyakoff authored
    • * imap4d/util.c (util_parse_internal_date): Use MU_DATETIME_INTERNALDATE
      format.
      * include/mailutils/util.h (MU_DATETIME_IMAP_SEARCH): Rename to
      MU_DATETIME_INTERNALDATE (previous incorrect definition removed).
      (MU_DATETIME_RFC822): New format.
      * libmailutils/address/address.c: Accessors for local_part and
      domain invalidate email field.
      (validate_email): New static function.
      (mu_address_sget_email): Reconstruct email, if necessary.
      (mu_address_format_string): Likewise.
      * libmailutils/base/date.c (mu_c_streamftime): Allow for %$ specifier
      for compatibility with mu_scan_datetime.
      (mu_scan_datetime): Use %$ to idicate optional end of string.
      * libmailutils/tests/scantime.at: Update.
      * libproto/imap/fetch.c (_fill_response): Use MU_DATETIME_RFC822 format.
      * mu/imap.c (fetch_response_printer): Print subject.
      Sergey Poznyakoff authored
    • * include/mailutils/stream.h (mu_fixed_memory_stream_create): New proto.
      * libmailutils/stream/memory_stream.c
      (mu_fixed_memory_stream_create): New function.
      
      * include/mailutils/util.h (mu_parse_imap_date_time)
      (mu_parse_ctime_date_time): Remove.
      (mu_scan_datetime): New proto.
      (mu_strftime): Remove const from the last arg.
      (MU_DATETIME_FROM,MU_DATETIME_IMAP)
      (MU_DATETIME_IMAP_SEARCH,MU_DATETIME_INTERNALDATE): New defines.
      * libmailutils/base/strftime.c: New file.
      * libmailutils/base/Makefile.am (libbase_la_SOURCES): Add strftime.c.
      * libmailutils/base/date.c (mu_scan_datetime): New function.
      * libmailutils/base/mutil.c (mu_strftime): Remove.
      
      * libmailutils/tests/scantime.at: New file.
      * libmailutils/tests/scantime.c: New file.
      * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add scantime.
      (TESTSUITE_AT): Add scantime.at.
      * libmailutils/tests/strftime.c (main): Call mu_set_program_name.
      * libmailutils/tests/testsuite.at: Include scantime.at
      
      * libmu_sieve/actions.c (mime_create_reason): Use mu_c_streamftime.
      
      * imap4d/fetch.c (_frt_internaldate): Use mu_scan_datetime.
      * imap4d/util.c (util_parse_internal_date): Likewise.
      * libmu_scm/mu_message.c (mu-message-get-envelope-date): Likewise.
      * libproto/imap/fetch.c (_date_mapper): Likewise.
      * mail/from.c (hdr_date): Use mu_scan_datetime.
      Sergey Poznyakoff authored
    • * include/mailutils/util.h (mu_c_streamftime): New prototype.
      * libmailutils/base/date.c (mu_c_streamftime): New function.
      * libmailutils/tests/.gitignore: Update.
      * libmailutils/tests/strftime.at: New test script.
      * libmailutils/tests/strftime.c: New test program.
      * libmailutils/tests/Makefile.am (noinst_PROGRAMS): Add strftime.
      (TESTSUITE_AT): Add strftime.at.
      * libmailutils/tests/testsuite.at: Include strftime.at.
      Sergey Poznyakoff authored
  4. 02 Dec, 2011 1 commit
  5. 01 Dec, 2011 3 commits
    • * mail/mailvar.c (_mailvar_symbol_to_array): Remove.
      (_mailvar_symbol_to_list): New function.
      (mailvar_make_array): Remove.
      (mailvar_list_copy): New function.
      (mailvar_iterator)<varptr,varcnt,pos>: Remove.
      <varlist,varitr>: New members.
      (mailvar_iterate_next): Use subordinate iterator.
      (mailvar_iterate_first): Likewise.
      (mailvar_print): Use mailvar_make_array.
      Sergey Poznyakoff authored
    • * mh/folder.c: Use mu_list_t instead of obstack to keep folder list.
      Sergey Poznyakoff authored
    • * include/mailutils/list.h (mu_list_sort): New proto.
      * libmailutils/list/sort.c: New file.
      * libmailutils/list/Makefile.am (liblist_la_SOURCES): Add sort.c
      * libmailutils/tests/listop.c: Implement the sort command.
      * libmailutils/tests/list.at: Test list sorting.
      Sergey Poznyakoff authored
  6. 30 Nov, 2011 7 commits
    • * include/mailutils/imap.h (mu_imap_fetch_body) <key>: Rename to section.
      <fields>: New member.
      * libproto/imap/fetch.c: Rewrite response item parser.
      * mu/imap.c: Improve fetch_response_printer
      Sergey Poznyakoff authored
    • * include/mailutils/list.h (mu_list_folder_t): New typedef.
      (mu_list_fold, mu_list_rfold): New functions.
      * libmailutils/list/fold.c: New file.
      * libmailutils/list/rfold.c: New file.
      * libmailutils/list/Makefile.am (liblist_la_SOURCES): Add fold.c and
      rfold.c
      * libmailutils/list/gmap.c (mu_list_gmap): Access list elements directly,
      instead of using iterators.
      * libmailutils/tests/list.at: Add test cases for list folding.
      * libmailutils/tests/listop.c: Add fold and rfold commands.
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (mu_imap_state): Rename to struct
      mu_imap_session_state, prefix all values with MU_IMAP_STATE_.
      All uses updated.
      * include/mailutils/sys/imap.h (mu_imap_client_state): Prefix all
      values with MU_IMAP_CLIENT. Rename MU_IMAP_NO_STATE to MU_IMAP_READY.
      All uses updated.
      (_mu_imap)<state>: Rename to client_state, fix data type.
      (imap_state): Rename to imap_state. All uses updated.
      (MU_IMAP_CHECK_EAGAIN): Reset state to MU_IMAP_CLIENT_READY if
      MU_ERR_REPLY or MU_ERR_BADREPLY is reported.
      * include/mailutils/sys/pop3.h (MU_POP3_CHECK_EAGAIN): Reset state
      to MU_POP3_NO_STATE, if MU_ERR_REPLY or MU_ERR_BADREPLY is reported.
      * libproto/imap/fetch.c (_date_mapper): Avoid overwriting resp->type.
      * libproto/imap/select.c (_mu_imap_collect_flags): Initialize *res
      prior to collecting flags into it.
      * mu/imap.c: Install a FETCH callback.
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (mu_imap_fetch): New proto.
      (MU_IMAP_CB_FETCH): New callback code.
      (MU_IMAP_FETCH_BODY,MU_IMAP_FETCH_BODYSTRUCTURE)
      (MU_IMAP_FETCH_ENVELOPE,MU_IMAP_FETCH_FLAGS)
      (MU_IMAP_FETCH_INTERNALDATE,MU_IMAP_FETCH_RFC822_SIZE)
      (MU_IMAP_FETCH_UID): New constants.
      (mu_imap_fetch_body,mu_imap_fetch_bodystructure)
      (mu_imap_fetch_envelope,mu_imap_fetch_flags)
      (mu_imap_fetch_internaldate,mu_imap_fetch_rfc822_size)
      (mu_imap_fetch_uid,mu_imap_fetch_response): New structures.
      * include/mailutils/sys/imap.h (MU_IMAP_SET_XSCRIPT_MASK)
      (MU_IMAP_CLR_XSCRIPT_MASK): New macros.
      (mu_imap_client_state)<MU_IMAP_FETCH_RX>: New state.
      (_mu_imap_list_nth_element_is_string): New proto.
      * libproto/imap/fetch.c: New file.
      * libproto/imap/Makefile.am (libmu_imap_la_SOURCES): Add fetch.c
      * libproto/imap/carrier.c (mu_imap_set_carrier): Update call to
      mu_imapio_create.
      * libproto/imap/resplist.c (_mu_imap_list_nth_element_is_string): New
      function.
      * libproto/imap/resproc.c (_process_unsolicited_response): Handle FETCH
      response.
      * libproto/imap/trace.c (mu_imap_trace_mask): Call mu_imapio_trace_payload
      if needed.
      * mu/imap.c (imap_bad_callback): New function.
      (com_disconnect): Register imap_bad_callback.
      (com_fetch): New function.
      (imap_comtab): Add the "fetch" command.
      * mu/mu.h (mutool_command) <flags>: New member.
      * mu/pop.c (pop_comtab): Update initializers.
      * mu/shell.c (default_comtab): Update initializers.
      (execute_line): Rewrite using incremental wordsplit.  This allows for
      optionally coalescing arguments with indices >= argmax into one argument.
      This is useful for such commands as "prompt" and "fetch".
      Sergey Poznyakoff authored
    • * include/mailutils/address.h (mu_address_create_null): New proto.
      * libmailutils/address/address.c (mu_address_create_null): New function.
      Sergey Poznyakoff authored
    • * include/mailutils/imapio.h (mu_imapio_create): Change signature. All
      uses updated.
      (mu_imapio_trace_payload,mu_imapio_get_trace_payload): New protos.
      * include/mailutils/sys/imapio.h (_mu_imapio) <_imap_server>
      <_imap_trace_payload>: New bits.
      * libmailutils/imapio/create.c (mu_imapio_create): Take three arguments,
      the third one specifying whether the imapio object is intended for server
      or client.
      * libmailutils/imapio/getline.c (initial_parse): In server mode, parse
      everything at once.
      Handle continuation responses in client mode.
      (mu_imapio_getline): Toggle MU_XSCRIPT_PAYLOAD only if requested.
      * libmailutils/imapio/literal.c: Wait for continuation response (in
      client mode).
      * libmailutils/imapio/trace.c (mu_imapio_trace_payload)
      (mu_imapio_get_trace_payload): New functions.
      * libmailutils/tests/imapio.c: New option -server.
      * libmailutils/tests/imapio.at: Update literal tests.
      Sergey Poznyakoff authored
    • * libmailutils/imapio/getline.c (mu_imapio_getline): Fix the call to
      realloc.
      Sergey Poznyakoff authored
  7. 29 Nov, 2011 1 commit
    • * imap4d/fetch.c (fetch_runtime_closure) <msglist>: New member.
      (frt_register_message,frt_unregister_messages): New functions.
      (fetch_get_part_rfc822): Look into encapsulated rfc822 messages.
      (_frt_body_text,_frt_header)
      (_frt_header_fields): Use frt_unregister_messages.
      (imap4d_fetch0): Initialize all fields in struct fetch_runtime_closure.
      Destroy msglist when finished using it.
      * imap4d/tests/fetch.at: Add test cases for nested message/rfc822.
      * testsuite/spool/msg.mbox: Add a message with nested message/rfc822 part.
      Sergey Poznyakoff authored
  8. 28 Nov, 2011 6 commits
    • * scheme/.gitignore: Update
      Sergey Poznyakoff authored
    • * imap4d/io.c (gettok): Fix memory overwrite.
      * imap4d/tests/fetch.at: Add checks for HEADER, HEADER.FIELDS,
      HEADER.FIELDS.NOT, and TEXT applied to message/rfc822 parts.
      * testsuite/spool/msg.mbox: New file.
      * testsuite/spool/DISTFILES: Add msg.mbox.
      Sergey Poznyakoff authored
    • * configure.ac: Update.
      * imap4d/Makefile.am (SUBDIRS): Remove testsuite.
      * imap4d/fetch.c (fetch_thunk): Add a FIXME reference.
      * imap4d/tests/fetch.at: New file.
      * imap4d/tests/Makefile.am (TESTSUITE_AT): Add fetch.at
      * imap4d/tests/testsuite.at: Include fetch.at
      * imap4d/tests/atlocal.in (fixup_tz): New filter.
      * imap4d/tests/Makefile.am (EXTRA_DIST): Remove unexisting file.
      * imap4d/testsuite: Remove
      Sergey Poznyakoff authored
    • Sergey Poznyakoff authored
    • * imap4d/tests/Makefile.am (TESTSUITE_AT): Add append00.at and
      append01.at
      * imap4d/tests/testsuite.at: Include append tests.
      * imap4d/tests/append00.at: New file.
      * imap4d/tests/append01.at: New file.
      Sergey Poznyakoff authored
    • * configure.ac (IMAP_AUTHOBJS): Remove subst variable.  Use conditional
      instead.
      Configure imap4d/tests for testing.
      Build imap4d/tests/Makefile and imap4d/tests/atlocal.
      * imap4d/Makefile.am (SUBDIRS): Add tests.
      [MU_COND_GSASL]: Define AUTH_GSASL
      [MU_COND_GSSAPI]: Define AUTH_GSSAPI
      (imap4d_SOURCES): Include AUTH_GSASL and AUTH_GSSAPI
      (imap4d_LDADD,imap4d_DEPENDENCIES): Remove reference to IMAP_AUTHOBJS.
      (EXTRA_DIST): Remove.
      
      * imap4d/tests/.gitignore: New file.
      * imap4d/tests/IDEF0955.at: New file
      * imap4d/tests/IDEF0956.at: New file
      * imap4d/tests/Makefile.am
      * imap4d/tests/anystate.at: New file
      * imap4d/tests/atlocal.in
      * imap4d/tests/create01.at: New file
      * imap4d/tests/create02.at: New file
      * imap4d/tests/examine.at: New file
      * imap4d/tests/expunge.at: New file
      * imap4d/tests/id.at: New file
      * imap4d/tests/list.at: New file
      * imap4d/tests/search.at: New file
      * imap4d/tests/select.at: New file
      * imap4d/tests/status.at: New file
      * imap4d/tests/testsuite.at: New file
      
      * imap4d/fetch.c (fetch_io): Improve range checking.  If the requested
      number of bytes is greater than maximum, truncate it.
      * imap4d/imap4d.c: New option --test.
      (test_mode): New global variable.
      (imap4d_session_setup0): Fix improperly allocated automatic variable.
      (main): Call GSASL and GSSAPI initializations only if mu_gsasl_enabled()
      returns true.
      * imap4d/imap4d.h (test_mode): New extern.
      * imap4d/preauth.c: Do not complain about failed getpeername in test mode.
      * imap4d/select.c: Fix human-readable response texts.
      
      * include/mailutils/gsasl.h (mu_gsasl_module_data)<enable>: New member.
      (mu_gsasl_enabled): New proto.
      * libmailutils/mailbox/mailbox.c (mu_mailbox_flush):
      (mu_mailbox_append_message,mu_mailbox_sync)
      (mu_mailbox_expunge): Use MU_STREAM_WRITE instead of MU_STREAM_RDWR.
      * libmu_auth/gsasl.c (mu_gsasl_module_data): Fix initialization.
      (mu_gsasl_enabled): New function.
      * libmu_cfg/gsasl.c (mu_gsasl_param): New parameter "enable".
      Sergey Poznyakoff authored
  9. 27 Nov, 2011 1 commit
    • * imap4d/fetch.c (bodystructure): Do not emit CHARSET pair if there is
      none in the Content-Type header.
      (fetch_get_part_rfc822): Use mu_message_unencapsulate
      * libmailutils/mime/attachment.c (mu_message_unencapsulate): Use
      mu_stream_to_message to create destination message.  This ensures that
      the latter can be handled by other MU functions (e.g. mu_header_*
      family).
      Sergey Poznyakoff authored
  10. 26 Nov, 2011 2 commits
    • According to RFC 3501 HEADER, HEADER.FIELDS, and HEADER.FIELDS.NOT part
      specifiers refer to the RFC-2822 header of the message or of an encapsulated
      MESSAGE/RFC822 message.  They return NILs if applied to a MIME part other
      than MESSAGE/RFC822.
      
      * imap4d/fetch.c (fetch_get_part_rfc822): New function.
      (_frt_body): Used only for BODY[]. Consequently, do not try to resolve
      message part, use the message itself instead.
      (_frt_body_n): New function.
      (_frt_mime): New function.
      (_frt_body_text,_frt_header,_frt_header_fields): Use fetch_get_part_rfc822.
      Unref the retrieved message when through.
      (parse_section_text): Use _frt_mime for BODY[<n>.MIME]
      (parse_section): Use _frt_body_n for BODY[<n>].
      * imap4d/testsuite/imap4d/fetch.exp: Remove incorrect tests.
      Sergey Poznyakoff authored
    • The purpose is to avoid using variadic calls in order to let the compiler
      do the necessary argument checking.
      
      * include/mailutils/imap.h (mu_imap_callback_t): Take a pair of size_t
      and void * arguments instead of the single va_list.
      (mu_imap_callback): Likewise.
      * libproto/imap/callback.c: Likewise.
      * libproto/imap/resproc.c: Update callback calls.
      * mu/imap.c: Update callback declarations.
      Sergey Poznyakoff authored
  11. 25 Nov, 2011 3 commits
  12. 24 Nov, 2011 6 commits
    • * include/mailutils/imap.h (mu_imap_noop): New proto.
      * include/mailutils/sys/imap.h (mu_imap_client_state)
      <MU_IMAP_NOOP_RX>: New state.
      * libproto/imap/noop.c: New file.
      * libproto/imap/Makefile.am (libmu_imap_la_SOURCES): Add noop.c
      * mu/imap.c (report_failure): New function.
      (com_login,select_mbox,com_status): Use report_failure for
      error reporting.
      (com_noop): New function.
      (imap_comtab)<noop>: New command.
      Sergey Poznyakoff authored
    • * mu/imap.c: Add missing gettext markers.
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (mu_imap_response_action_t): Move to
      sys/imap.h
      (mu_imap_foreach_response): Remove.
      * include/mailutils/sys/imap.h (_mu_imap)<untagged_resp>: Remove.
      All sources updated.
      (_mu_imap_response): Change sigature.
      (_mu_imap_untagged_response_clear)
      (_mu_imap_untagged_response_add): Remove.
      (_mu_imap_untagged_response_to_list)
      (_mu_imap_process_untagged_response): New protos.
      * libproto/imap/connect.c: Use _mu_imap_untagged_response_to_list
      and _mu_imap_process_untagged_response.
      * libproto/imap/create.c: Update.
      * libproto/imap/destroy.c: Update.
      * libproto/imap/disconnect.c: Update.
      * libproto/imap/capability.c: Update calls to _mu_imap_response
      * libproto/imap/id.c: Likewise.
      * libproto/imap/login.c: Likewise.
      * libproto/imap/logout.c: Likewise.
      * libproto/imap/select.c: Likewise.
      * libproto/imap/status.c: Likewise.
      * libproto/imap/resplist.c (_mu_imap_untagged_response_clear): Remove.
      (_mu_imap_untagged_response_add): Remove.
      (_mu_imap_untagged_response_to_list): New function.
      * libproto/imap/response.c (_mu_imap_response): Take response-processing
      function and its closure as arguments.
      * libproto/imap/resproc.c (_mu_imap_process_untagged_response): New
      function.
      (mu_imap_foreach_response): Remove.
      
      * mu/imap.c: Install a BYE callback.
      Sergey Poznyakoff authored
    • * include/mailutils/imap.h (MU_IMAP_CB_NO)
      (MU_IMAP_CB_BAD,MU_IMAP_CB_BYE)
      (MU_IMAP_CB_PREAUTH): New callbacks.
      (mu_imap_callback_t): Change signature.
      (mu_imap_callback): Change signature.
      * include/mailutils/sys/imap.h (mu_imap_client_state)
      <MU_IMAP_CLOSING>: New state.
      * libproto/imap/callback.c (mu_imap_callback): Change signature.
      Fix boundary check.
      (mu_imap_register_callback_function): Fix boundary check.
      * libproto/imap/connect.c (mu_imap_connect): Use mu_imap_foreach_response
      to parse response.
      * libproto/imap/response.c (_mu_imap_response): Check number of words
      before dereferencing them.
      * libproto/imap/resproc.c: Handle all server responses.
      * mu/imap.c (com_connect): Set POPAUTH callback.
      Set verbosity flags after I/O structure has been created.
      Sergey Poznyakoff authored
    • * include/mailutils/list.h (mu_list_head, mu_list_tail): New prototypes.
      * libmailutils/list/head.c: New file.
      * libmailutils/list/tail.c: New file.
      * libmailutils/list/Makefile.am (liblist_la_SOURCES): Add new files.
      * libmailutils/tests/listop.c (head,tail): New commands.
      * libmailutils/tests/list.at: Test head and tail.
      Sergey Poznyakoff authored
    • * include/mailutils/sys/imap.h (_mu_imap_seterrstrz): New proto.
      * libmailutils/imapio/replstr.c: Update.
      * libproto/imap/err.c (_mu_imap_seterrstrz): New function.
      * libproto/imap/id.c: Remove superfluous calls to _mu_imap_seterrstr.
      * libproto/imap/login.c: Likewise.
      * libproto/imap/select.c: Likewise.
      * libproto/imap/status.c: Likewise.
      * libproto/imap/response.c: Set human-readable text as errstr.
      * libproto/imap/resproc.c (ok_response): Reflect changes to
      mu_imapio_getline.
      Sergey Poznyakoff authored