aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java34
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..0ea434f7
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java
@@ -0,0 +1,34 @@
+package de.thedevstack.conversationsplus.utils;
+
+import de.thedevstack.conversationsplus.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
+ }
+}