Java Code Examples for org.jivesoftware.smackx.iqprivate.PrivateDataManager#addPrivateDataProvider()

The following examples show how to use org.jivesoftware.smackx.iqprivate.PrivateDataManager#addPrivateDataProvider() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrivateNotes.java    From Spark with Apache License 2.0 6 votes vote down vote up
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 | InterruptedException e) {
        Log.error(e);
    }

    if(notes.getNotes() != null )
    	{
    		String note=notes.getNotes().replaceAll("&","&");
    		notes.setMyNotes(note);
    	}
    
    return notes;
}
 
Example 2
Source File: Tasks.java    From Spark with Apache License 2.0 5 votes vote down vote up
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 | InterruptedException e) {
        Log.error(e);
    }
}
 
Example 3
Source File: PrivateNotes.java    From Spark with Apache License 2.0 5 votes vote down vote up
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 | InterruptedException e) {
        Log.error(e);
    }
}
 
Example 4
Source File: UserSettings.java    From Spark with Apache License 2.0 5 votes vote down vote up
private UserSettings() {
    privateDataManager = PrivateDataManager.getInstanceFor(SparkManager.getConnection());
    PrivateDataManager.addPrivateDataProvider("personal_settings", "jive:user:settings", new SettingsDataProvider());

    try {
        settingsData = (SettingsData)privateDataManager.getPrivateData("personal_settings", "jive:user:settings");
    }
    catch (XMPPException | SmackException | InterruptedException e) {
        Log.error("Error in User Settings", e);
    }
}