aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java34
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java3
2 files changed, 34 insertions, 3 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
+ }
+}
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java b/src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java
index 35adf6ec..80718dec 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/Xmlns.java
@@ -1,11 +1,8 @@
package de.thedevstack.conversationsplus.utils;
-import de.thedevstack.conversationsplus.Config;
-
public final class Xmlns {
public static final String BLOCKING = "urn:xmpp:blocking";
public static final String ROSTER = "jabber:iq:roster";
public static final String REGISTER = "jabber:iq:register";
public static final String BYTE_STREAMS = "http://jabber.org/protocol/bytestreams";
- public static final String HTTP_UPLOAD = "urn:xmpp:http:upload";
}