1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 17:19:39 +02:00

Smack 4.1.4

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQF8BAABCgBmBQJV9nAlXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
 ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQxMzU3QjAxODY1QjI1MDNDMTg0NTNEMjA4
 Q0FDMkE5Njc4NTQ4RTM1AAoJEIysKpZ4VI41sFEIAJlfRspk6S5ymNc4w7u/FT1w
 MpHT/cxqIQIBU9J5dYqeW6Y8O6VuUeknCmZBEv7dIVHroTmvfosMauAyRZJXWeeL
 FQQTBqDJszYdM88x/d5X6d25lCEBdQkdDh2a5s9AIy9RH0iXE74AypuikbroK+VC
 zI3wRPUFq7WnARtmiP2NalSgSNv5ToeicBO+JSniQ+O52ZAlP2FSDfi4uzPPigdP
 Ip/V3eF4Bp0YZimcxAnWdnMU+ciVLClRYKgD3+qTEoic7dx3dzeTyrk1NoLRgQl9
 mfcNXBgUScHZAoSIkR0QiUx9ktPCJ950qa+XtW3B8NtDOZkXegUL/a8ukQAuz+k=
 =qMsC
 -----END PGP SIGNATURE-----

Merge tag '4.1.4'

Smack 4.1.4
This commit is contained in:
Florian Schmaus 2015-09-14 09:05:24 +02:00
commit 04a0004035
10 changed files with 96 additions and 12 deletions

View file

@ -192,7 +192,7 @@ public class MultiUserChat {
Presence oldPresence = occupantsMap.put(from, presence);
if (oldPresence != null) {
// Get the previous occupant's affiliation & role
MUCUser mucExtension = MUCUser.from(packet);
MUCUser mucExtension = MUCUser.from(oldPresence);
MUCAffiliation oldAffiliation = mucExtension.getItem().getAffiliation();
MUCRole oldRole = mucExtension.getItem().getRole();
// Get the new occupant's affiliation & role

View file

@ -41,6 +41,7 @@ import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler;
import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.StringUtils;
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import org.jivesoftware.smackx.privacy.filter.SetActiveListFilter;
import org.jivesoftware.smackx.privacy.filter.SetDefaultListFilter;
@ -270,7 +271,7 @@ public final class PrivacyListManager extends Manager {
}
/**
* Answer the active privacy list.
* Answer the active privacy list. Returns <code>null</code> if there is no active list.
*
* @return the privacy list of the active list.
* @throws XMPPErrorException
@ -281,6 +282,9 @@ public final class PrivacyListManager extends Manager {
public PrivacyList getActiveList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = this.getPrivacyWithListNames();
String listName = privacyAnswer.getActiveName();
if (StringUtils.isNullOrEmpty(listName)) {
return null;
}
boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getDefaultName());
return new PrivacyList(true, isDefaultAndActive, listName, getPrivacyListItems(listName));
}
@ -303,7 +307,7 @@ public final class PrivacyListManager extends Manager {
}
/**
* Answer the default privacy list.
* 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
@ -314,7 +318,10 @@ public final class PrivacyListManager extends Manager {
public PrivacyList getDefaultList() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
Privacy privacyAnswer = this.getPrivacyWithListNames();
String listName = privacyAnswer.getDefaultName();
boolean isDefaultAndActive = listName != null && listName.equals(privacyAnswer.getActiveName());
if (StringUtils.isNullOrEmpty(listName)) {
return null;
}
boolean isDefaultAndActive = listName.equals(privacyAnswer.getActiveName());
return new PrivacyList(isDefaultAndActive, true, listName, getPrivacyListItems(listName));
}
@ -368,6 +375,7 @@ public final class PrivacyListManager extends Manager {
* @throws InterruptedException
*/
private List<PrivacyItem> getPrivacyListItems(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
assert StringUtils.isNotEmpty(listName);
// The request of the list is an privacy message with an empty list
Privacy request = new Privacy();
request.setPrivacyList(listName, new ArrayList<PrivacyItem>());
@ -389,6 +397,7 @@ public final class PrivacyListManager extends Manager {
* @throws InterruptedException
*/
public PrivacyList getPrivacyList(String listName) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
listName = StringUtils.requireNotNullOrEmpty(listName, "List name must not be null");
return new PrivacyList(false, false, listName, getPrivacyListItems(listName));
}