diff options
author | Alex Clayton <alex.clayton@isode.com> | 2016-03-10 10:46:58 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2016-03-10 10:50:34 (GMT) |
commit | dcc9d6b81d73f42db35c6e26a91e029a117289e1 (patch) | |
tree | d7d9ceb34c98b016b9c0030f2ff160115c201cda /src/com/isode | |
parent | 8f112a856705b800d1a8797bec5d9396a9c00b34 (diff) | |
download | stroke-dcc9d6b81d73f42db35c6e26a91e029a117289e1.zip stroke-dcc9d6b81d73f42db35c6e26a91e029a117289e1.tar.bz2 |
Fix BlockListImpl logic and add unit test.
As per swiften patch 'Fix notification logic for signals in BlockListImpl'
(4455c20085834098f6d9aa872db3115d466e7004). Fix the logic in the BlockListImpl
class and add a unit test for it.
Test-information: Unit tests pass ok.
Change-Id: I739d1febb2cf728ff00c132a00adb2f7f144b739
Diffstat (limited to 'src/com/isode')
-rw-r--r-- | src/com/isode/stroke/client/BlockListImpl.java | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/com/isode/stroke/client/BlockListImpl.java b/src/com/isode/stroke/client/BlockListImpl.java index a85f86c..e8a4619 100644 --- a/src/com/isode/stroke/client/BlockListImpl.java +++ b/src/com/isode/stroke/client/BlockListImpl.java @@ -39,19 +39,19 @@ public class BlockListImpl extends BlockList { return items; } - public void setItems(final Vector<JID> items) { - for (final JID jid : this.items) { - if(items.contains(jid)) { - onItemRemoved.emit(jid); - } - } + public void setItems(final Vector<JID> newItems) { + for (final JID jid : items) { + if(!newItems.contains(jid)) { + onItemRemoved.emit(jid); + } + } - for (final JID jid : items) { - if(this.items.contains(jid)) { - onItemAdded.emit(jid); - } - } - this.items = items; + for (final JID jid : newItems) { + if(!this.items.contains(jid)) { + onItemAdded.emit(jid); + } + } + this.items = newItems; } public void addItem(final JID item) { |