use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project Spark by igniterealtime.
the class PrivateNotes method savePrivateNotes.
public static void savePrivateNotes(PrivateNotes notes) {
PrivateDataManager manager = PrivateDataManager.getInstanceFor(SparkManager.getConnection());
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:notes", new PrivateNotes.Provider());
try {
manager.setPrivateData(notes);
} catch (XMPPException | SmackException e) {
Log.error(e);
}
}
use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project Spark by igniterealtime.
the class Tasks method saveTasks.
public static void saveTasks(Tasks tasks, XMPPConnection con) {
PrivateDataManager manager = PrivateDataManager.getInstanceFor(con);
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:tasks", new Tasks.Provider());
try {
manager.setPrivateData(tasks);
} catch (XMPPException | SmackException e) {
Log.error(e);
}
}
use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project xabber-android by redsolution.
the class PrivateStorageManager method setPrivateData.
private void setPrivateData(AccountJid accountJid, PrivateData privateData) {
AccountItem accountItem = AccountManager.getInstance().getAccount(accountJid);
if (accountItem == null || !accountItem.isEnabled())
return;
XMPPTCPConnection connection = accountItem.getConnection();
PrivateDataManager privateDataManager = PrivateDataManager.getInstanceFor(connection);
try {
if (!privateDataManager.isSupported())
return;
privateDataManager.setPrivateData(privateData);
} catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException | IllegalArgumentException e) {
e.printStackTrace();
}
}
use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project Spark by igniterealtime.
the class PrivateNotes method getPrivateNotes.
public static PrivateNotes getPrivateNotes() {
PrivateDataManager manager = PrivateDataManager.getInstanceFor(SparkManager.getConnection());
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:notes", new PrivateNotes.Provider());
PrivateNotes notes = null;
try {
notes = (PrivateNotes) manager.getPrivateData("scratchpad", "scratchpad:notes");
} catch (XMPPException | SmackException e) {
Log.error(e);
}
if (notes.getNotes() != null) {
String note = notes.getNotes().replaceAll("&", "&");
notes.setMyNotes(note);
}
return notes;
}
use of org.jivesoftware.smackx.iqprivate.PrivateDataManager in project Spark by igniterealtime.
the class Tasks method getTaskList.
public static Tasks getTaskList(XMPPConnection con) {
PrivateDataManager manager = PrivateDataManager.getInstanceFor(con);
PrivateDataManager.addPrivateDataProvider("scratchpad", "scratchpad:tasks", new Tasks.Provider());
Tasks tasks = null;
try {
tasks = (Tasks) manager.getPrivateData("scratchpad", "scratchpad:tasks");
} catch (XMPPException | SmackException e) {
Log.error(e);
}
return tasks;
}
Aggregations