summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarun Gupta <tarun1995gupta@gmail.com>2015-07-26 07:47:40 (GMT)
committerTarun Gupta <tarun1995gupta@gmail.com>2015-08-17 13:21:01 (GMT)
commitf56f245c1f7e768caf356a0e7b57f428cf8cc6da (patch)
treef0935ab00c73e86163abe72fc9c20098121fff4f /src/com/isode/stroke/client/BlockList.java
parent2533374644704040ca67aba4e1240a9d6ea450c8 (diff)
downloadstroke-f56f245c1f7e768caf356a0e7b57f428cf8cc6da.zip
stroke-f56f245c1f7e768caf356a0e7b57f428cf8cc6da.tar.bz2
Update Client.
Updates all bits of Client to be in parity with Swiften. Some part of code which depends on Network is commented. License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details. Test-Information: Tests added for: ClientBlockListManager, ClientSession and NickResolver. All tests pass. Change-Id: I5b9b0e5ae5b2df58202e2349ba24e4544d9a4614
Diffstat (limited to 'src/com/isode/stroke/client/BlockList.java')
-rw-r--r--src/com/isode/stroke/client/BlockList.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/isode/stroke/client/BlockList.java b/src/com/isode/stroke/client/BlockList.java
new file mode 100644
index 0000000..bf72f45
--- /dev/null
+++ b/src/com/isode/stroke/client/BlockList.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011-2015 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+/*
+ * Copyright (c) 2015 Tarun Gupta.
+ * Licensed under the simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+package com.isode.stroke.client;
+
+import com.isode.stroke.signals.Signal1;
+import com.isode.stroke.signals.Signal;
+import com.isode.stroke.jid.JID;
+import java.util.Vector;
+
+public abstract class BlockList {
+
+ public enum State {
+ Init,
+ Requesting,
+ Available,
+ Error
+ };
+
+ public final Signal onStateChanged = new Signal();
+ public final Signal1<JID> onItemAdded = new Signal1<JID>();
+ public final Signal1<JID> onItemRemoved = new Signal1<JID>();
+
+ public abstract State getState();
+
+ public abstract Vector<JID> getItems();
+
+ public boolean isBlocked(final JID jid) {
+ final Vector<JID> items = getItems();
+ return (items.contains(jid.toBare()) || items.contains(new JID(jid.getDomain())) || items.contains(jid));
+ }
+} \ No newline at end of file