Prevent too long uid expunge command

pull/194/merge
M66B 3 years ago
parent e8eb733303
commit 4803a1ecbd

@ -4057,6 +4057,7 @@ class Core {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean perform_expunge = prefs.getBoolean("perform_expunge", true); boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
boolean uid_expunge = prefs.getBoolean("uid_expunge", false); boolean uid_expunge = prefs.getBoolean("uid_expunge", false);
int chunk_size = prefs.getInt("chunk_size", DEFAULT_CHUNCK_SIZE);
if (!perform_expunge) if (!perform_expunge)
return false; return false;
@ -4086,7 +4087,8 @@ class Core {
@Override @Override
public Object doCommand(IMAPProtocol protocol) throws ProtocolException { public Object doCommand(IMAPProtocol protocol) throws ProtocolException {
// https://datatracker.ietf.org/doc/html/rfc4315#section-2.1 // https://datatracker.ietf.org/doc/html/rfc4315#section-2.1
protocol.uidexpunge(UIDSet.createUIDSets(Helper.toLongArray(uids))); for (List<Long> list : Helper.chunkList(uids, chunk_size))
protocol.uidexpunge(UIDSet.createUIDSets(Helper.toLongArray(list)));
return null; return null;
} }
}); });

Loading…
Cancel
Save