aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/util.vala
diff options
context:
space:
mode:
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) {