Search in sources :

Example 1 with Privacy

use of org.jivesoftware.smack.packet.Privacy in project ecf by eclipse.

the class PrivacyListManager method declineActiveList.

/**
 * Client declines the use of active lists.
 *
 * @throws XMPPException if an error occurs.
 */
public void declineActiveList() throws XMPPException {
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setDeclineActiveList(true);
    // Send the package to the server
    setRequest(request);
}
Also used : Privacy(org.jivesoftware.smack.packet.Privacy)

Example 2 with Privacy

use of org.jivesoftware.smack.packet.Privacy in project ecf by eclipse.

the class PrivacyListManager method getActiveList.

/**
 * Answer the active privacy list.
 *
 * @return the privacy list of the active list.
 * @throws XMPPException if an error occurs.
 */
public PrivacyList getActiveList() throws XMPPException {
    Privacy privacyAnswer = this.getPrivacyWithListNames();
    String listName = privacyAnswer.getActiveName();
    boolean isDefaultAndActive = privacyAnswer.getActiveName() != null && privacyAnswer.getDefaultName() != null && privacyAnswer.getActiveName().equals(privacyAnswer.getDefaultName());
    return new PrivacyList(true, isDefaultAndActive, listName, getPrivacyListItems(listName));
}
Also used : Privacy(org.jivesoftware.smack.packet.Privacy)

Example 3 with Privacy

use of org.jivesoftware.smack.packet.Privacy in project ecf by eclipse.

the class PrivacyListManager method setDefaultListName.

/**
 * Set or change the default list to listName.
 *
 * @param listName the list name to set as the default one.
 * @exception XMPPException if the request or the answer failed, it raises an exception.
 */
public void setDefaultListName(String listName) throws XMPPException {
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setDefaultName(listName);
    // Send the package to the server
    setRequest(request);
}
Also used : Privacy(org.jivesoftware.smack.packet.Privacy)

Example 4 with Privacy

use of org.jivesoftware.smack.packet.Privacy in project ecf by eclipse.

the class PrivacyListManager method deletePrivacyList.

/**
 * Remove a privacy list.
 *
 * @param listName the list that has changed its content.
 * @throws XMPPException if an error occurs.
 */
public void deletePrivacyList(String listName) throws XMPPException {
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
    // Send the package to the server
    setRequest(request);
}
Also used : Privacy(org.jivesoftware.smack.packet.Privacy) PrivacyItem(org.jivesoftware.smack.packet.PrivacyItem)

Example 5 with Privacy

use of org.jivesoftware.smack.packet.Privacy in project ecf by eclipse.

the class PrivacyListManager method getPrivacyListItems.

/**
 * Answer the privacy list items under listName with the allowed and blocked permissions.
 *
 * @param listName the name of the list to get the allowed and blocked permissions.
 * @return a list of privacy items under the list listName.
 * @throws XMPPException if an error occurs.
 */
private List<PrivacyItem> getPrivacyListItems(String listName) throws XMPPException {
    // The request of the list is an privacy message with an empty list
    Privacy request = new Privacy();
    request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
    // Send the package to the server and get the answer
    Privacy privacyAnswer = getRequest(request);
    return privacyAnswer.getPrivacyList(listName);
}
Also used : Privacy(org.jivesoftware.smack.packet.Privacy) PrivacyItem(org.jivesoftware.smack.packet.PrivacyItem)

Aggregations

Privacy (org.jivesoftware.smack.packet.Privacy)13 PrivacyItem (org.jivesoftware.smack.packet.PrivacyItem)3 DefaultPacketExtension (org.jivesoftware.smack.packet.DefaultPacketExtension)1 IQ (org.jivesoftware.smack.packet.IQ)1 Packet (org.jivesoftware.smack.packet.Packet)1