use of org.jivesoftware.smackx.privacy.packet.Privacy in project Smack by igniterealtime.
the class PrivacyListManager method deletePrivacyList.
/**
* Remove a privacy list.
*
* @param listName the list that has changed its content.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public void deletePrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// 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.smackx.privacy.packet.Privacy in project Smack by igniterealtime.
the class PrivacyListManager method setActiveListName.
/**
* Set or change the active list to listName.
*
* @param listName the list name to set as the active one.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public void setActiveListName(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setActiveName(listName);
// Send the package to the server
setRequest(request);
}
use of org.jivesoftware.smackx.privacy.packet.Privacy in project Smack by igniterealtime.
the class PrivacyListManager method getDefaultList.
/**
* Answer the default privacy list. Returns <code>null</code> if there is no default list.
*
* @return the privacy list of the default list.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = this.getPrivacyWithListNames();
String listName = privacyAnswer.getDefaultName();
if (StringUtils.isNullOrEmpty(listName)) {
return null;
}
boolean isDefaultAndActive = listName.equals(privacyAnswer.getActiveName());
return new PrivacyList(isDefaultAndActive, true, listName, getPrivacyListItems(listName));
}
use of org.jivesoftware.smackx.privacy.packet.Privacy in project Smack by igniterealtime.
the class PrivacyListManager method getPrivacyLists.
/**
* Answer every privacy list with the allowed and blocked permissions.
*
* @return an array of privacy lists.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public List<PrivacyList> getPrivacyLists() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = getPrivacyWithListNames();
Set<String> names = privacyAnswer.getPrivacyListNames();
List<PrivacyList> lists = new ArrayList<>(names.size());
for (String listName : names) {
boolean isActiveList = listName.equals(privacyAnswer.getActiveName());
boolean isDefaultList = listName.equals(privacyAnswer.getDefaultName());
lists.add(new PrivacyList(isActiveList, isDefaultList, listName, getPrivacyListItems(listName)));
}
return lists;
}
use of org.jivesoftware.smackx.privacy.packet.Privacy in project Smack by igniterealtime.
the class PrivacyListManager method declineDefaultList.
/**
* Client declines the use of default lists.
* @throws XMPPErrorException
* @throws NoResponseException
* @throws NotConnectedException
* @throws InterruptedException
*/
public void declineDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setDeclineDefaultList(true);
// Send the package to the server
setRequest(request);
}
Aggregations