21 Commits

Author SHA1 Message Date
Kuroneko
ed08b22dec add-ons/mail_daemon: IMAP: limit UIDs in UID FETCH
Some IMAP servers (such as dovecot) have hard line length limits for
commands.

The way UID FETCH was being scheduled was creating FETCHes longer than
the maximum length.

Limit these to a reasonable number of UIDs per fetch, such that we have
a hope of success when facing monsterous mailboxes.

Change-Id: I8a2184eec1b8fcab6f7914a9b14ad008700b96d1
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
Reviewed-on: https://review.haiku-os.org/c/haiku/+/626

Style fixes by me, and also replaced emplace_back with push_back
for GCC2 compatibility.
2018-11-03 14:45:50 -04:00
Kuroneko
f0d35c6dbf add-ons/mail-daemon: IMAP: fix folder not selected bug on fetch req
As the IMAP connection handler disconnects when idle, it loses the
folder state at that time - however, it wasn't resetting it's internal
folder selected flag.  This is now fixed.

Change-Id: Ib56f55664ab5d7383a13705a8f4a8585b29f2c92
Reviewed-on: https://review.haiku-os.org/627
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2018-10-17 19:25:00 +00:00
Kuroneko
7f8a5c09b8 add-ons/mail_daemon: remove spurious/unused vector in imap worker
Change-Id: Id78ff3ab751fa535362833f30cf62a70f5177975
Reviewed-on: https://review.haiku-os.org/625
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2018-10-12 00:06:54 +00:00
Murai Takashi
5e885c5f1c IMAPConnectionWorker.cpp: fix gcc6 build
Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2016-05-13 15:20:01 -04:00
Axel Dörfler
1870a4b1f9 IMAP: Fixed sync command handling.
* The counter did not take continuation commands into account, so that
  it would never reach zero again.
* Optimized IMAPConnectionWorker::_WaitForCommands() such that it will
  always acquire all available "slots".
2016-02-10 13:55:55 +01:00
Axel Dörfler
aeaf68cf4b IMAP: Extra local messages are now deleted.
* When a message on the server is deleted, it will now be deleted
  locally, too.
2016-01-14 21:03:46 +01:00
Axel Dörfler
8180539313 IMAP: setting flags, and body fetching works now.
* The direct methods in BMailProtocol now forward the request to the
  looper; it's no longer the mail_daemon's responsibility to know
  anything about that protocol.
* It's in desperate need of refactoring, but it doesn't hurt to add
  it to the repository as is.
2016-01-05 20:12:26 +01:00
Jérôme Duval
b9962ceac2 IMAP,POP3,NewMailNotification: fixed x86_64 build.
* Notifier::HeaderFetched(): fixed the method signature (go figure how it could
build on x86).
* POP3: fSizes type is now std::vector<size_t> instead of BList. Please review.
off_t might be a better choice.
* added the mail_daemon add-ons to the Haiku package again.
2015-01-08 22:31:43 +01:00
Axel Dörfler
4601929263 IMAP: let mail retrieval scale better.
* We now also maintain a mail index -> UID array in IMAPMailbox.
* Instead of fetching the message entries by a fixed range of UIDs, we use the
  message count, and get the entries by index.
* Likewise, in FetchHeadersCommand, we now get a list of UIDs rather than a
  range. This makes it possible to only download exactly the headers we want.
* Extended FetchCommand to be able to dynamically build a sequence list from
  a list of UIDs.
* Besides the suboptimal body fetching (one at a time, due to holes in the
  IMAP specification), we should now be able to retrieve the messages with
  pretty much optimal performance, while retaining an acceptable responsiveness
  to user requests.
2015-01-06 15:26:51 +01:00
Axel Dörfler
c1f779e350 IMAP: FetchMessageEntriesCommand now also works without UIDs
* This will be used to solve the TODO in CheckMailboxesCommand::Process()
  when the initial message sizes/flags are retrieved.
* Also fixed imap_tester build.
2015-01-06 15:26:33 +01:00
Axel Dörfler
1052525dc5 IMAP: work in progress of downloading the mail body.
* Most things are in place now, we just try to download the body to the
  wrong file, as the final location is currently unknown.
* Added local only kPartialMessage flag for mails, but it's not being
  used yet.
2015-01-06 15:26:28 +01:00
Axel Dörfler
dcb85ffa51 IMAP: if connecting fails, try again a few times.
* Also documented SyncCommand.
2015-01-06 15:26:24 +01:00
Axel Dörfler
29e5da6f20 IMAP: allow only one sync at a time, divided header fetching.
* CheckMailboxesCommand, and FetchHeadersCommand now inherit from SyncCommand
  which will prevent new CheckMailboxesCommand to be enqueued.
* FetchHeadersCommand now only retrieves up to kMaxFetchEntries headers at
  once. This gets the same TODO about scaling as the limit in
  CheckMailboxesCommand when fetching the flags/UIDs. Since we already read
  all new UIDs at that point, we could easily do better there, though.
2015-01-06 15:26:10 +01:00
Axel Dörfler
47b68f5806 IMAP: IMAPFolder now stores the last UID.
* So mails are no longer downloaded every time.
2015-01-06 15:25:56 +01:00
Axel Dörfler
eba458b940 imap: Fetching headers is now working.
* No state is stored yet, though, so that all messages will be downloaded
  over and over again.
2015-01-06 15:25:47 +01:00
Axel Dörfler
3302df142e imap: WIP of getting fetching headers to work.
* Changed the FetchListener mechanism quite a bit.
* Doesn't seem to work correctly yet, although most pieces are in
  place now.
2015-01-06 15:25:33 +01:00
Axel Dörfler
229c777323 imap: Testing for new messages is now working.
* There is now a CheckSubscribedFoldersCommand that is issued on the main
  connection that triggers everything.
* The new CheckMailboxesCommand divides the new mail check into several
  portions, and requeues itself until the next step, ie. the
  FetchHeadersCommand.
* The headers of the new mails are downloaded, but nothing is done with
  them yet.
* The actual check for the new mails doesn't scale that well yet, not sure
  how to properly do this without having to rely on the mail indices. Might
  be sensible to solve this via some simple heuristic.
2015-01-06 15:25:24 +01:00
Axel Dörfler
7993ddfaba imap: Fleshed out command processing.
* Still doesn't do anything useful, though.
2015-01-06 15:25:14 +01:00
Axel Dörfler
a4bdd26d61 imap: Work in progress of connection setup.
* SelectCommand now correctly encodes the mailbox name again.
* Hierarchy separators from the LIST/LSUB commands are now properly parsed,
  and taken into account.
* Folders in the file system are now created for mailboxes on the server,
  supporting hierarchical mailbox names.
* A connection worker now has an IMAPFolder that handles the local side of the
  mailbox, and an IMAPMailbox that handles the server side.
* Connection workers are now created/deleted, and setup correctly. They will
  now also wait in case they don't have a mailbox until they get some.
2015-01-06 15:25:10 +01:00
Axel Dörfler
adbe8fc944 IMAP: The connection workers are now started.
* On SyncMessages(), the main connection worker is started if it is not already
  running (it may only run already in idle mode).
* This will then list the subscribed folders, and create as many more connection
  workers as allowed and make sense.
* Finally, it will distribute the folders to the workers which don't do anything
  further yet.
2015-01-06 15:25:05 +01:00
Axel Dörfler
9192d4dcf3 Started working on the IMAP add-on itself.
* Renamed imap_config.cpp to ConfigView.cpp, IMAPFolderConfig.(h|cpp)
  to FolderConfigWindow.(h|cpp).
* Got the latter to build.
* Added Settings class to simplify and unify the BMessage based
  settings access.
* Removed the InboundProtocol[Thread] implementation from the build for now.
2015-01-06 15:20:35 +01:00