Browse Source

Folder NOOP

main
M66B 6 years ago
parent
commit
acf3cfadd4
2 changed files with 19 additions and 5 deletions
  1. +1
    -1
      .idea/misc.xml
  2. +18
    -4
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 1
- 1
.idea/misc.xml View File

@ -25,7 +25,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">


+ 18
- 4
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -52,10 +52,12 @@ import android.text.TextUtils;
import android.util.Log;
import com.sun.mail.iap.ConnectionException;
import com.sun.mail.iap.ProtocolException;
import com.sun.mail.imap.AppendUID;
import com.sun.mail.imap.IMAPFolder;
import com.sun.mail.imap.IMAPMessage;
import com.sun.mail.imap.IMAPStore;
import com.sun.mail.imap.protocol.IMAPProtocol;
import com.sun.mail.util.FolderClosedIOException;
import com.sun.mail.util.MailConnectException;
@ -1024,12 +1026,24 @@ public class ServiceSynchronize extends LifecycleService {
if (!istore.isConnected())
throw new StoreClosedException(istore);
for (EntityFolder folder : folders.keySet())
for (final EntityFolder folder : folders.keySet()) {
IMAPFolder ifolder = folders.get(folder);
if (capIdle) {
if (!folders.get(folder).isOpen())
throw new FolderClosedException(folders.get(folder));
try {
ifolder.doCommand(new IMAPFolder.ProtocolCommand() {
public Object doCommand(IMAPProtocol p)
throws ProtocolException {
Log.i(Helper.TAG, folder.name + " do noop");
p.simpleCommand("NOOP", null);
return null;
}
});
} catch (MessagingException ex) {
throw new FolderClosedException(ifolder, "NOOP", ex);
}
} else
synchronizeMessages(account, folder, folders.get(folder), state);
synchronizeMessages(account, folder, ifolder, state);
}
}
}


Loading…
Cancel
Save