aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-11-21 23:27:27 +0100
committerfiaxh <git@mx.ax.lt>2017-11-22 00:40:41 +0100
commitde133218dab0ac1729dbfc32177979133c15f53b (patch)
tree1cecc41b9f54841dd44cc348a564d9fd7f999f9e /xmpp-vala/src/module/util.vala
parentf3063f56b7e2ccfef255256d5bf527988fcf2957 (diff)
downloaddino-de133218dab0ac1729dbfc32177979133c15f53b.tar.gz
dino-de133218dab0ac1729dbfc32177979133c15f53b.zip
Disconnect stanza listeners from pipeline
Diffstat (limited to 'xmpp-vala/src/module/util.vala')
-rw-r--r--xmpp-vala/src/module/util.vala9
1 files changed, 7 insertions, 2 deletions
diff --git a/xmpp-vala/src/module/util.vala b/xmpp-vala/src/module/util.vala
index e6626049..812b09ad 100644
--- a/xmpp-vala/src/module/util.vala
+++ b/xmpp-vala/src/module/util.vala
@@ -30,13 +30,18 @@ public abstract class StanzaListener<T> : Object {
}
public class StanzaListenerHolder<T> : Object {
- private Gee.List<StanzaListener<T>> listeners = new ArrayList<StanzaListener<T>>();
+ private ArrayList<StanzaListener<T>> listeners = new ArrayList<StanzaListener<T>>();
public new void connect(StanzaListener<T> listener) {
listeners.add(listener);
resort_list();
}
+ public new void disconnect(StanzaListener<T> listener) {
+ listeners.remove(listener);
+ resort_list();
+ }
+
public async void run(Core.XmppStream stream, T stanza) {
foreach (StanzaListener<T> l in listeners) {
yield l.run(stream, stanza);
@@ -63,7 +68,7 @@ public class StanzaListenerHolder<T> : Object {
}
private void resort_list() {
- Gee.List<StanzaListener<T>> new_list = new ArrayList<StanzaListener<T>>();
+ ArrayList<StanzaListener<T>> new_list = new ArrayList<StanzaListener<T>>();
while (listeners.size > new_list.size) {
bool changed = false;
foreach (StanzaListener<T> l in listeners) {