diff options
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java')
-rw-r--r-- | src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java b/src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java new file mode 100644 index 00000000..06c6b6ab --- /dev/null +++ b/src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java @@ -0,0 +1,34 @@ +package de.thedevstack.conversationsplus.utils; + +import eu.siacs.conversations.entities.Account; + +/** + * Utility class to work with accounts. + */ +public final class AccountUtil { + + public static boolean isHttpUploadAvailable(Account account, long filesize) { + return null != account + && null != account.getXmppConnection() + && null != account.getXmppConnection().getFeatures() + && account.getXmppConnection().getFeatures().httpUpload(filesize); + } + + public static boolean isHttpUploadAvailable(Account account) { + return null != account + && null != account.getXmppConnection() + && null != account.getXmppConnection().getFeatures() + && account.getXmppConnection().getFeatures().httpUpload(0); + } + + public static boolean isFileTransferHttpAvailable(Account account) { + return null != account + && null != account.getXmppConnection() + && null != account.getXmppConnection().getFeatures() + && account.getXmppConnection().getFeatures().hasFeatureFileTransferHttp(0); + } + + private AccountUtil() { + // avoid instantiation of utility class + } +} |