Add helper method for checking client/server compatibility.

This commit is contained in:
akwizgran
2022-08-16 15:11:53 +01:00
parent de76986ee4
commit 079ef5b3c0
2 changed files with 14 additions and 5 deletions

View File

@@ -35,4 +35,13 @@ public class MailboxHelper {
return API_SERVER_TOO_OLD;
}
/**
* Returns true if a client and server with the given API versions can
* communicate with each other (ie, have any major API versions in common).
*/
public static boolean isClientCompatibleWithServer(
List<MailboxVersion> client, List<MailboxVersion> server) {
int common = getHighestCommonMajorVersion(client, server);
return common != API_CLIENT_TOO_OLD && common != API_SERVER_TOO_OLD;
}
}