From c10b4f2fdb1e55b1c9dbb996ecee4a306d1481b0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sat, 16 Mar 2013 18:55:00 +0100 Subject: [PATCH] Send event when source is changed. --- .../java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java index 3c3dc7a..704324d 100644 --- a/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java +++ b/src/main/java/net/pterodactylus/sonitus/data/filter/MultiSourceFilter.java @@ -34,6 +34,7 @@ import net.pterodactylus.sonitus.data.Filter; import net.pterodactylus.sonitus.data.Format; import net.pterodactylus.sonitus.data.ReusableSink; import net.pterodactylus.sonitus.data.Source; +import net.pterodactylus.sonitus.data.event.SourceFinishedEvent; import com.google.common.eventbus.EventBus; import com.google.inject.Inject; @@ -133,6 +134,9 @@ public class MultiSourceFilter implements Filter, ReusableSink { */ public Connection source(Source source) throws IOException { synchronized (syncObject) { + if (this.source != null) { + eventBus.post(new SourceFinishedEvent(this.source)); + } this.source = source; pipedInputStream = new PipedInputStream(); pipedOutputStream = new PipedOutputStream(pipedInputStream); -- 2.7.4