<table><tr><td style="">dvratil created this revision.<br />Herald added a project: KDE PIM.<br />Herald added a subscriber: kde-pim.<br />dvratil requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28944">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Client code usually generates the ImapSet by simply passing it a vector of<br />
IDs or just by calling ImapSet::add() in a for loop for individual IDs. This<br />
creates potentially massive amount of intervals. This change ads a method<br />
that will optimize the ImapSet by merging adjacent or overlapping intervals.</p>

<p>I ran into this trying to move about 28'000 emails to Trash in KMail. The IMAP<br />
resource calls ImapSet::add() in a for loop to add each Item to be moved into<br />
the set. This just created 28'000 single-UID intervals and the resulting request<br />
string was so long that my Courier IMAP server just dropped the connection, so<br />
the IMAP resource reconnected and tried to send the same massive request again<br />
and again and again...</p>

<p>By optimizing the set the string size is reduced from nearly 156 kilobytes<br />
down to less than 4 kilobytes.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R177 PIM: KIMAP</div></div></div><br /><div><strong>BRANCH</strong><div><div>master</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28944">https://phabricator.kde.org/D28944</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>autotests/imapsettest.cpp<br />
src/copyjob.cpp<br />
src/fetchjob.cpp<br />
src/imapset.cpp<br />
src/imapset.h<br />
src/movejob.cpp<br />
src/searchjob.cpp<br />
src/storejob.cpp</div></div></div><br /><div><strong>To: </strong>dvratil<br /><strong>Cc: </strong>kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>