aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils/AccountUtil.java
blob: 0ea434f70dfcb53ca4ddcf25d293a5fb1c1d4a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
    }
}