<table><tr><td style="">nowicki created this revision.<br />nowicki added a reviewer: KDE PIM.<br />nowicki added a project: KDE PIM.<br />Herald added a subscriber: kde-pim.<br />nowicki 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/D15975">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This is to prevent attempts to delete them again.</p>

<p>Fixes the testCountBasedLeaveRule, which exercises the following scenario:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">initial state: 3 messages known</li>
<li class="remarkup-list-item">two new messages are added on server</li>
<li class="remarkup-list-item">LIST returns 5 messages</li>
<li class="remarkup-list-item">UIDL returns 5 UIDs, 2 of them new</li>
<li class="remarkup-list-item">download of 2 messages starts</li>
<li class="remarkup-list-item">fetch of first message is completed</li>
<li class="remarkup-list-item">item create for first message is completed</li>
<li class="remarkup-list-item">item create completion triggers cleanup of unwanted server messages</li>
<li class="remarkup-list-item">messages 1 and 3 are deleted as they are the oldest</li>
<li class="remarkup-list-item">fetch of second message is completed</li>
<li class="remarkup-list-item">item create for second message is completed</li>
<li class="remarkup-list-item">item create completion triggers cleanup of unwanted server messages</li>
<li class="remarkup-list-item">messages 1 and 3 are deleted again - this causes the test to fail</li>
</ul>

<p>Removing those identifiers causes the second search for items to delete to return an empty set and no further delete attempts are made.</p>

<p>To be honest I have mixed feelings about this as having looked deeper at the code I think this should be fixed in a different way:</p>

<ol class="remarkup-list">
<li class="remarkup-list-item">POP3Resource::shouldDeleteId() should be modified so that when it receives a concrete id (i.e. != -1) it should only return either this id as the one to be deleted or return an empty set. Today when "leave on server" is set it always consider all messages and return a full list of messages to be deleted.</li>
<li class="remarkup-list-item">After the item creation step is completed (Download & Save states) the CheckRemovingMessage should be triggered to clean-up all unwanted messages from the server.</li>
</ol>

<p>Implementing #1 is simple, however doing it causes unwanted messages never to be deleted from the server. Implementing #2 is beyond my knowledge of the POP3 resource as it involves changes to the state machine.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Run pop3test</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R44 KDE PIM Runtime</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D15975">https://phabricator.kde.org/D15975</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>resources/pop3/pop3resource.cpp</div></div></div><br /><div><strong>To: </strong>nowicki, KDE PIM<br /><strong>Cc: </strong>kde-pim, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil<br /></div>