Search in sources :

Example 6 with PrivateDataManager

use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project Spark by igniterealtime.

the class TransportUtils method setAutoJoin.

public static void setAutoJoin(String serviceName, boolean autoJoin) {
    if (gatewayPreferences != null) {
        gatewayPreferences.addService(serviceName, autoJoin);
        PrivateDataManager pdm = SparkManager.getSessionManager().getPersonalDataManager();
        try {
            pdm.setPrivateData(gatewayPreferences);
        } catch (XMPPException | SmackException e) {
            Log.error(e);
        }
    } else {
        Log.warning("Cannot set privacy data as gatewayPreferences is NULL");
    }
}
Also used : PrivateDataManager(org.jivesoftware.smackx.iqprivate.PrivateDataManager)

Example 7 with PrivateDataManager

use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project xabber-android by redsolution.

the class PrivateStorageManager method getPrivateData.

@Nullable
private PrivateData getPrivateData(AccountJid accountJid, String namespace, String elementName) {
    AccountItem accountItem = AccountManager.getInstance().getAccount(accountJid);
    if (accountItem == null || !accountItem.isEnabled())
        return null;
    XMPPTCPConnection connection = accountItem.getConnection();
    PrivateDataManager privateDataManager = PrivateDataManager.getInstanceFor(connection);
    try {
        if (!privateDataManager.isSupported())
            return null;
        return privateDataManager.getPrivateData(elementName, namespace);
    } catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException | IllegalArgumentException e) {
        e.printStackTrace();
        return null;
    }
}
Also used : XMPPTCPConnection(com.xabber.xmpp.smack.XMPPTCPConnection) AccountItem(com.xabber.android.data.account.AccountItem) PrivateDataManager(org.jivesoftware.smackx.iqprivate.PrivateDataManager) Nullable(androidx.annotation.Nullable)

Aggregations

PrivateDataManager (org.jivesoftware.smackx.iqprivate.PrivateDataManager)7 SmackException (org.jivesoftware.smack.SmackException)4 XMPPException (org.jivesoftware.smack.XMPPException)4 AccountItem (com.xabber.android.data.account.AccountItem)2 XMPPTCPConnection (com.xabber.xmpp.smack.XMPPTCPConnection)2 Nullable (androidx.annotation.Nullable)1