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");
}
}
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;
}
}
Aggregations