Commit Graph

196 Commits

Author SHA1 Message Date
Steve Holme cbea345f61 imap: Added some missing comments to imap_sendf() 2013-03-10 12:47:28 +00:00
Steve Holme 059647f398 email: Removed hard returns from init functions 2013-03-09 22:25:40 +00:00
Steve Holme 8826435571 imap: Re-factored all perform based functions
Standardised the naming of all perform based functions to be in the form
imap_perform_something().
2013-03-09 18:50:41 +00:00
Steve Holme ca3c0ed3a9 imap: Added description comments to all perform based functions 2013-03-09 14:02:56 +00:00
Steve Holme 6bdd3d4a88 imap: Removed the need for separate custom request functions
Moved the custom request processing into the LIST command as the logic
is the same.
2013-03-09 13:27:16 +00:00
Steve Holme 69eca5c252 imap: Corrected typo in comment 2013-03-09 13:25:15 +00:00
Steve Holme b4c9b515aa imap: Moved imap_logout() to be grouped with the other perform functions 2013-03-09 12:12:20 +00:00
Steve Holme b482417ac4 email: Updated the function descriptions for the logout / quit functions
Updated the function description comments following commit 4838d196fd.
2013-03-09 12:10:01 +00:00
Steve Holme 4838d196fd email: Simplified the logout / quit functions
Moved the blocking state machine to the disconnect functions so that the
logout / quit functions are only responsible for sending the actual
command needed to logout or quit.

Additionally removed the hard return on failure.
2013-03-09 11:55:48 +00:00
Steve Holme f691f9609c email: Tidied up the *_regular_transfer() functions
Added comments and simplified convoluted dophase_done comparison.
2013-03-08 23:25:04 +00:00
Steve Holme e5bb4e86ac email: Simplified nesting of if statements in *_doing() functions 2013-03-08 23:02:20 +00:00
Steve Holme 1f41772bef imap: Fixed handling of untagged responses for the STORE custom command
Added an exception, for the STORE command, to the untagged response
processor in imap_endofresp() as servers will back respones containing
the FETCH keyword instead.
2013-03-08 21:18:36 +00:00
Steve Holme 170ae51c47 imap: Fixed SELECT not being performed for custom requests 2013-03-07 22:56:19 +00:00
Steve Holme cc890906b1 email: Minor code tidy up following recent changes
Removed unwanted braces and added variable initialisation.
2013-03-07 22:44:10 +00:00
Steve Holme 67b6fa5f95 email: Optimised block_statemach() functions
Optimised the result test in each of the block_statemach() functions.
2013-03-07 18:21:58 +00:00
Steve Holme 5c89413b24 imap: Tidied up the APPEND and final APPEND response functions
Removed unnecessary state changes on failure and setting of result codes
on success.
2013-03-06 20:31:53 +00:00
Steve Holme 37f3fcd631 imap: Tidied up the final FETCH response function
Removed unnecessary state change on failure and setting of result code on
success.
2013-03-06 20:19:46 +00:00
Steve Holme c9f9f601b8 imap: Tidied up the LIST response function
Reworked comments as they referenced custom commands, removed
unnecessary state change on failure and setting of result code on
success.
2013-03-06 20:10:53 +00:00
Steve Holme 24ffceed81 imap: Removed the custom request response function
Removed imap_state_custom_resp() as imap_state_list_resp() provides the
same functionality.
2013-03-06 19:58:34 +00:00
Steve Holme b7f39156d4 imap: Added check for empty UID in FETCH command
As the UID has to be specified by the user for the FETCH command to work
correctly, added a check to imap_fetch(), although strictly speaking it
is protected by the call from imap_perform().
2013-03-06 19:33:49 +00:00
Daniel Stenberg fa9748df11 imap: fix compiler warning
imap.c:694:21: error: unused variable 'imapc' [-Werror=unused-variable]
2013-03-06 08:28:05 +01:00
Steve Holme 198012ee13 imap: Added support for list command 2013-03-05 22:04:03 +00:00
Steve Holme 742544aad0 imap: Added list perform and response handler functions 2013-03-05 21:39:18 +00:00
Steve Holme 041754e3fa imap: Introduced IMAP_LIST state 2013-03-05 21:35:16 +00:00
Steve Holme b960f1e8bd imap: Small tidy up of imap_select() to match imap_append()
Updated the style of imap_select() before adding the LIST command.
2013-03-05 19:59:53 +00:00
Steve Holme c29346613d imap: Moved mailbox check from the imap_do() function
In preparation for the addition of the LIST command, moved the mailbox
check from imap_do() to imap_select() and imap_append().
2013-03-05 19:52:11 +00:00
Steve Holme 298f806d01 imap: Added comments to imap_append() 2013-03-03 16:44:53 +00:00
Jiri Hruska e6b7dae947 imap: Added required mailbox check for FETCH and APPEND commands 2013-03-03 16:39:50 +00:00
Steve Holme b1ebf4bda1 imap: Fixed typo in variable assignment 2013-03-03 13:13:59 +00:00
Jiri Hruska 284ea5f924 imap: Fixed custom request handling in imap_done()
Fixed imap_done() so that neither the FINAL states are not entered when
a custom command has been performed.
2013-03-03 13:10:36 +00:00
Jiri Hruska c03cad3a61 imap: Enabled custom requests in imap_select_resp()
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-03 13:10:34 +00:00
Jiri Hruska ad8b76d094 imap: Enabled custom requests in imap_perform()
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-03 13:10:32 +00:00
Jiri Hruska 226c1c6876 imap: Added custom request perform and response handler functions
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-03 13:10:31 +00:00
Jiri Hruska ee7034800d imap: Added custom request parsing
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-03 11:06:55 +00:00
Jiri Hruska 1d3ccf27ec imap: Introduced custom request parameters
Added custom request parameters to the per-request structure.
2013-03-03 11:03:45 +00:00
Jiri Hruska 51dbaae432 imap: Introduced IMAP_CUSTOM state 2013-03-03 10:13:13 +00:00
Steve Holme dcffd936e1 imap: Minor code tidy up
Minor tidy up of code layout and comments following recent changes.
2013-03-02 21:22:44 +00:00
Steve Holme e94fbcabd7 imap: Simplified the imap_state_append_resp() function
Introduced the result code variable to simplify the state changes and
remove the hard returns.
2013-03-02 20:40:38 +00:00
Steve Holme ec38ac38c7 imap: Changed successful response logic in imap_state_append_resp()
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-02 20:35:03 +00:00
Steve Holme 0f64dd086a imap: Standardised imapcode condition tests
For consistency changed two if(constant != imapcode) tests to be
if(imapcode != constant).
2013-03-02 20:29:27 +00:00
Steve Holme 459e1bffee imap: Moved imap_append() to be with the other perform functions 2013-03-02 20:24:49 +00:00
Jiri Hruska 7b471fb344 imap: Enabled APPEND support in imap_perform()
Added logic in imap_perform() to perform an APPEND rather than SELECT
and FETCH if an upload has been specified.
2013-03-02 20:17:45 +00:00
Jiri Hruska f8c8c76d39 imap: Implemented APPEND final processing
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-02 19:34:25 +00:00
Jiri Hruska 90b7d0ea59 imap: Added APPEND perform and response handler functions
Added imap_append() function to initiate upload and imap_append_resp()
to handle the continuation response and start the transfer.
2013-03-02 19:17:18 +00:00
Jiri Hruska 1383522e3a imap: Introduced IMAP_APPEND and IMAP_APPEND_FINAL states 2013-03-02 19:06:35 +00:00
Jiri Hruska d46d107e0c imap: Updated setting of transfer variables in imap_state_fetch_resp()
Add number of bytes retrieved from the PP cache to req.bytecount and set
req.maxdownload only when starting a proper download.
2013-03-02 18:37:56 +00:00
Jiri Hruska 25884aa197 imap: Improved FETCH response parsing
Added safer parsing of the untagged FETCH response line and the size of
continuation data.
2013-03-02 18:37:54 +00:00
Steve Holme be51a46353 imap: Fixed accidentally lossing the result code
Accidentally lost the result code in imap_state_capability() and
imap_state_login() with commit b06a786226.
2013-02-28 23:09:28 +00:00
Steve Holme 48596f87a9 imap: Another minor comment addition / tidy up 2013-02-28 22:51:32 +00:00
Steve Holme b06a786226 imap: Updated the coding style for state changes after a send operation
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-28 22:46:22 +00:00