Commit 241f12dd authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Removed Roster instance variable. (cluster reasons)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8152 b35dd754-fafc-0310-a699-88a17e54d16e
parent 750b4c24
...@@ -75,7 +75,6 @@ public class PrivacyList implements Cacheable, Externalizable { ...@@ -75,7 +75,6 @@ public class PrivacyList implements Cacheable, Externalizable {
private String name; private String name;
private boolean isDefault; private boolean isDefault;
private List<PrivacyItem> items = new ArrayList<PrivacyItem>(); private List<PrivacyItem> items = new ArrayList<PrivacyItem>();
private Roster roster;
/** /**
* Constructor added for Externalizable. Do not use this constructor. * Constructor added for Externalizable. Do not use this constructor.
...@@ -146,6 +145,7 @@ public class PrivacyList implements Cacheable, Externalizable { ...@@ -146,6 +145,7 @@ public class PrivacyList implements Cacheable, Externalizable {
return false; return false;
} }
// Iterate over the rules and check each rule condition // Iterate over the rules and check each rule condition
Roster roster = getRoster();
for (PrivacyItem item : items) { for (PrivacyItem item : items) {
if (item.matchesCondition(packet, roster, userJID)) { if (item.matchesCondition(packet, roster, userJID)) {
if (item.isAllow()) { if (item.isAllow()) {
...@@ -205,13 +205,10 @@ public class PrivacyList implements Cacheable, Externalizable { ...@@ -205,13 +205,10 @@ public class PrivacyList implements Cacheable, Externalizable {
items.add(newItem); items.add(newItem);
// If the user's roster is required to evaluation whether a packet must be blocked // If the user's roster is required to evaluation whether a packet must be blocked
// then ensure that the roster is available // then ensure that the roster is available
if (roster == null && newItem.isRosterRequired()) { if (newItem.isRosterRequired()) {
try { Roster roster = getRoster();
roster = XMPPServer.getInstance().getRosterManager().getRoster(userJID.getNode()); if (roster == null) {
} Log.warn("Privacy item removed since roster of user was not found: " + userJID.getNode());
catch (UserNotFoundException e) {
Log.warn("Privacy item removed since roster of user was not found: " +
userJID.getNode());
items.remove(newItem); items.remove(newItem);
} }
} }
...@@ -224,6 +221,15 @@ public class PrivacyList implements Cacheable, Externalizable { ...@@ -224,6 +221,15 @@ public class PrivacyList implements Cacheable, Externalizable {
} }
} }
private Roster getRoster() {
try {
return XMPPServer.getInstance().getRosterManager().getRoster(userJID.getNode());
} catch (UserNotFoundException e) {
Log.warn("Roster not found for user: " + userJID);
}
return null;
}
public int getCachedSize() { public int getCachedSize() {
// Approximate the size of the object in bytes by calculating the size // Approximate the size of the object in bytes by calculating the size
// of each field. // of each field.
...@@ -233,9 +239,6 @@ public class PrivacyList implements Cacheable, Externalizable { ...@@ -233,9 +239,6 @@ public class PrivacyList implements Cacheable, Externalizable {
size += CacheSizes.sizeOfString(name); // name size += CacheSizes.sizeOfString(name); // name
size += CacheSizes.sizeOfBoolean(); // isDefault size += CacheSizes.sizeOfBoolean(); // isDefault
size += CacheSizes.sizeOfCollection(items); // items of the list size += CacheSizes.sizeOfCollection(items); // items of the list
if (roster != null) {
size += roster.getCachedSize(); // add size of roster
}
return size; return size;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment