Be able to fetch mails from very big folders

#### Issue

Open a folder with lots of emails (a few thousands) triggers an imap request like `UID FETCH 1,2,3,4...` too long to be processed by the server (at least for dovecot).

#### Solution

Split the request into several ones and merge the results.


#### Monkeypatch vs real patch

This monkeypatch will require maintenance when we update sope packages, I think this approach is better because:
* I've changed only 1 function which has not been changed since long time ago (>2years).
* Maintenance and building of sope (with this patch) will require more maintenance time than this monkeypatch.

The best solution will be to send the patch upstream but I've only tested with dovecot as imap server so not completely confident whether will be accepted or not.