diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-01-11 15:50:13 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-01-11 15:50:13 +0100 |
commit | 44d01d933c0434b0e9b6ce7a1ff888f1b0f2ef3d (patch) | |
tree | 1f0ebdcab4824b53a7f0507d69088efd9456db84 /src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java | |
parent | c76d0968b8874c0e4466b4e315688a7d003d52f6 (diff) | |
parent | cd633f13b8d7327e47994bb5a000f0c0b7089e7f (diff) |
Merge branch 'trz/rename' into trz/rebase
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 + } +} |