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