aboutsummaryrefslogtreecommitdiff
path: root/lib/imap.c
AgeCommit message (Collapse)Author
2013-03-05imap: Small tidy up of imap_select() to match imap_append()Steve Holme
Updated the style of imap_select() before adding the LIST command.
2013-03-05imap: Moved mailbox check from the imap_do() functionSteve Holme
In preparation for the addition of the LIST command, moved the mailbox check from imap_do() to imap_select() and imap_append().
2013-03-03imap: Added comments to imap_append()Steve Holme
2013-03-03imap: Added required mailbox check for FETCH and APPEND commandsJiri Hruska
2013-03-03imap: Fixed typo in variable assignmentSteve Holme
2013-03-03imap: Fixed custom request handling in imap_done()Jiri Hruska
Fixed imap_done() so that neither the FINAL states are not entered when a custom command has been performed.
2013-03-03imap: Enabled custom requests in imap_select_resp()Jiri Hruska
Changed imap_select_resp() to invoke imap_custom() instead of imap_fetch() after the mailbox has been selected if a custom command has been set.
2013-03-03imap: Enabled custom requests in imap_perform()Jiri Hruska
Modified imap_perform() to start with the custom command instead of SELECT when a custom command is to be performed and no mailbox has been given.
2013-03-03imap: Added custom request perform and response handler functionsJiri Hruska
Added imap_custom(), which initiates the custom command processing, and an associated response handler imap_state_custom_resp(), which handles any responses by sending them to the client as body data. All untagged responses with the same name as the first word of the custom request string are accepted, with the exception of SELECT and EXAMINE which have responses that cannot be easily identified. An extra check has been provided for them so that any untagged responses are accepted for them.
2013-03-03imap: Added custom request parsingJiri Hruska
Added imap_parse_custom_request() for parsing the CURLOPT_CUSTOMREQUEST parameter which URL decodes the value and separates the request from any parameters - This makes it easier to filter untagged responses by the request command.
2013-03-03imap: Introduced custom request parametersJiri Hruska
Added custom request parameters to the per-request structure.
2013-03-03imap: Introduced IMAP_CUSTOM stateJiri Hruska
2013-03-02imap: Minor code tidy upSteve Holme
Minor tidy up of code layout and comments following recent changes.
2013-03-02imap: Simplified the imap_state_append_resp() functionSteve Holme
Introduced the result code variable to simplify the state changes and remove the hard returns.
2013-03-02imap: Changed successful response logic in imap_state_append_resp()Steve Holme
For consistency changed the logic of the imap_state_append_resp() function to test for an unsucessful continuation response rather than a succesful one.
2013-03-02imap: Standardised imapcode condition testsSteve Holme
For consistency changed two if(constant != imapcode) tests to be if(imapcode != constant).
2013-03-02imap: Moved imap_append() to be with the other perform functionsSteve Holme
2013-03-02imap: Enabled APPEND support in imap_perform()Jiri Hruska
Added logic in imap_perform() to perform an APPEND rather than SELECT and FETCH if an upload has been specified.
2013-03-02imap: Implemented APPEND final processingJiri Hruska
The APPEND operation needs to be performed in several steps: 1) We send "<tag> APPEND <mailbox> <flags> {<size>}\r\n" 2) Server responds with continuation respose "+ ...\r\n" 3) We start the transfer and send <size> bytes of data 4) Only now we end the request command line by sending "\r\n" 5) Server responds with "<tag> OK ...\r\n" This commit performs steps 4 and 5, in the DONE phase, as more processing is required after the transfer.
2013-03-02imap: Added APPEND perform and response handler functionsJiri Hruska
Added imap_append() function to initiate upload and imap_append_resp() to handle the continuation response and start the transfer.
2013-03-02imap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL statesJiri Hruska
2013-03-02imap: Updated setting of transfer variables in imap_state_fetch_resp()Jiri Hruska
Add number of bytes retrieved from the PP cache to req.bytecount and set req.maxdownload only when starting a proper download.
2013-03-02imap: Improved FETCH response parsingJiri Hruska
Added safer parsing of the untagged FETCH response line and the size of continuation data.
2013-02-28imap: Fixed accidentally lossing the result codeSteve Holme
Accidentally lost the result code in imap_state_capability() and imap_state_login() with commit b06a78622609.
2013-02-28imap: Another minor comment addition / tidy upSteve Holme
2013-02-28imap: Updated the coding style for state changes after a send operationSteve Holme
Some state changes would be performed after a failure test that performed a hard return, whilst others would be performed within a test for success. Updated the code, for consistency, so all instances are performed within a success test.
2013-02-28imap: FETCH response handler cleanup before further changesJiri Hruska
Removed superfluous NULL assignment after Curl_safefree() and rewrote some comments and logging messages.
2013-02-28imap: Small tidy up of function argumentsSteve Holme
2013-02-28imap: Corrected debug message for IMAP_AUTHENTICATE_FINAL constantSteve Holme
Following commit 13006f3de9ec corrected the debug message in state() from AUTHENTICATE to AUTHENTICATE_FINAL.
2013-02-28imap: Fixed error code returned for invalid FETCH responseJiri Hruska
If the FETCH command does not result in an untagged response the the UID is probably invalid. As such do not return CURLE_OK.
2013-02-28imap: Added processing of the final FETCH responsesJiri Hruska
Not processing the final FETCH responses was not optimal, not only because the response code would be ignored but it would also leave data unread on the socket which would prohibit connection reuse.
2013-02-28imap: Introduced FETCH_FINAL state for processing final fetch responsesJiri Hruska
A typical FETCH response can be broken down into four parts: 1) "* <uid> FETCH (<what> {<size>}\r\n", using continuation syntax 2) <size> bytes of the actual message 3) ")\r\n", finishing the untagged response 4) "<tag> OK ...", finishing the command Part 1 is read in imap_fetch_resp(), part 2 is consumed in the PERFORM phase by the transfer subsystem, parts 3 and 4 are currently ignored.
2013-02-28imap: fix autobuild warningSteve Holme
Removed whitespace from imap_perform()
2013-02-28imap: fix compiler warningSteve Holme
error: declaration of 'imap' shadows a previous local
2013-02-27imap: Re-factored final IMAP_AUTHENTICATE constantSteve Holme
Changed the final IMAP_AUTHENTICATE constant to IMAP_AUTHENTICATE_FINAL for consistency with the response function.
2013-02-27imap: Updated the coding style of imap_state_servergreet_resp()Steve Holme
Updated the coding style, in this function, to be consistant with other response functions rather then performing a hard return on failure.
2013-02-27imap: Reversed the logic of the (un)successful tagged SELECT responseSteve Holme
Reversed the logic of the unsuccessful vs successful tagged SELECT response in imap_state_select_resp() to be more logical to read.
2013-02-27imap: Reversed the logic of the (un)successful tagged CAPABILITY responseSteve Holme
Reversed the logic of the unsuccessful vs successful tagged CAPABILITY response in imap_state_capability_resp() to be more logical to read.
2013-02-27imap: Corrected char* references with char *Steve Holme
Corrected char* references made in commit: 709b3506cd9b.
2013-02-27imap: Added processing of more than one response when sent in same packetJiri Hruska
Added a loop to imap_statemach_act() in which Curl_pp_readresp() is called until the cache is drained. Without this multiple responses received in a single packet could result in a hang or delay.
2013-02-27imap: Added skipping of SELECT command if already in the same mailboxJiri Hruska
Added storage and checking of the last mailbox userd to prevent unnecessary switching.
2013-02-27imap: Introduced the mailbox variableJiri Hruska
Added the mailbox variable to the per-connection structure in preparation for checking for an already selected mailbox.
2013-02-26imap: Added verification of UIDVALIDITY mailbox attributeJiri Hruska
Added support for checking the UIDVALIDITY, and aborting the request, if it has been specified in the URL and the server response is different.
2013-02-26imap: Added support for parsing the UIDVALIDITY propertyJiri Hruska
Added support for parsing the UIDVALIDITY property from the SELECT response and storing it in the per-connection structure.
2013-02-26imap: Introduced the mailbox_uidvalidity variableJiri Hruska
Added the mailbox_uidvalidity variable to the per-connection structure in preparation for checking the UIDVALIDITY mailbox attribute.
2013-02-26imap: Corrected comment in imap_endofresp()Steve Holme
2013-02-26imap: Corrected whitespaceSteve Holme
2013-02-26imap: Added filtering of CAPABILITY and FETCH untagged responsesJiri Hruska
Only responses that contain "CAPABILITY" and "FETCH", respectively, will be sent to their response handler.
2013-02-26imap: Added a helper function for upcoming untagged response filteringJiri Hruska
RFC 3501 states that "the client MUST be prepared to accept any response at all times" yet we assume anything received with "* " at the beginning is the untagged response we want. Introduced a helper function that checks whether the input looks like a response to specified command, so that we may filter the ones we are interested in according to the current state.
2013-02-26imap: Moved CAPABILITY response handling to imap_state_capability_resp()Jiri Hruska
Introduced similar handling to the FETCH responses, where even the untagged data responses are handled by the response handler of the individual state.