|
@@ -22,9 +22,10 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.messages;
|
24
|
24
|
|
|
25
|
+import com.dmdirc.DMDircMBassador;
|
25
|
26
|
import com.dmdirc.FrameContainer;
|
|
27
|
+import com.dmdirc.events.UserErrorEvent;
|
26
|
28
|
import com.dmdirc.logger.ErrorLevel;
|
27
|
|
-import com.dmdirc.logger.Logger;
|
28
|
29
|
|
29
|
30
|
import java.util.ArrayList;
|
30
|
31
|
import java.util.Date;
|
|
@@ -42,6 +43,12 @@ public class MessageSinkManager {
|
42
|
43
|
public static final String DEFAULT_SINK = "self";
|
43
|
44
|
/** A list of known sinks. */
|
44
|
45
|
private final List<MessageSink> sinks = new ArrayList<>();
|
|
46
|
+ /** Event bus to post errors to. */
|
|
47
|
+ private final DMDircMBassador eventBus;
|
|
48
|
+
|
|
49
|
+ public MessageSinkManager(final DMDircMBassador eventBus) {
|
|
50
|
+ this.eventBus = eventBus;
|
|
51
|
+ }
|
45
|
52
|
|
46
|
53
|
/**
|
47
|
54
|
* Adds a new sink to the list of known sinks.
|
|
@@ -109,8 +116,8 @@ public class MessageSinkManager {
|
109
|
116
|
}
|
110
|
117
|
|
111
|
118
|
// None of the sinks matched :(
|
112
|
|
- Logger.userError(ErrorLevel.MEDIUM, "Invalid target message sink for type "
|
113
|
|
- + messageType + ": " + targetSink);
|
|
119
|
+ eventBus.publishAsync(new UserErrorEvent(ErrorLevel.MEDIUM, null,
|
|
120
|
+ "Invalid target message sink for type " + messageType + ": " + targetSink, ""));
|
114
|
121
|
|
115
|
122
|
if (!DEFAULT_SINK.equals(targetSink)) {
|
116
|
123
|
dispatchMessage(source, date, messageType, DEFAULT_SINK, args);
|