|
@@ -24,7 +24,9 @@ package com.dmdirc.ui.messages;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.DMDircMBassador;
|
26
|
26
|
import com.dmdirc.FrameContainer;
|
|
27
|
+import com.dmdirc.events.DisplayProperty;
|
27
|
28
|
import com.dmdirc.events.DisplayableEvent;
|
|
29
|
+import com.dmdirc.util.EventUtils;
|
28
|
30
|
|
29
|
31
|
import net.engio.mbassy.listener.Handler;
|
30
|
32
|
|
|
@@ -72,19 +74,30 @@ public class BackBuffer {
|
72
|
74
|
*
|
73
|
75
|
* @param event The event to be displayed.
|
74
|
76
|
*/
|
75
|
|
- @Handler
|
76
|
|
- public void handleDisplayableEvent(final DisplayableEvent event) {
|
77
|
|
- if (event.getSource().equals(owner)) {
|
|
77
|
+ @Handler(priority = EventUtils.PRIORITY_DISPLAYABLE_EVENT_HANDLER)
|
|
78
|
+ private void handleDisplayableEvent(final DisplayableEvent event) {
|
|
79
|
+ if (shouldDisplay(event)) {
|
78
|
80
|
formatter.format(event).map(s -> s.split("\n")).ifPresent(
|
79
|
81
|
t -> {
|
80
|
82
|
for (String line : t) {
|
81
|
83
|
document.addText(event.getTimestamp(), event
|
82
|
|
- .getDisplayProperties(), line);
|
|
84
|
+ .getDisplayProperties(), line);
|
83
|
85
|
}
|
84
|
86
|
});
|
85
|
87
|
}
|
86
|
88
|
}
|
87
|
89
|
|
|
90
|
+ /**
|
|
91
|
+ * Determines if the specified event should be displayed in this backbuffer.
|
|
92
|
+ *
|
|
93
|
+ * @param event The event to check
|
|
94
|
+ * @return True if the event should be displayed, false otherwise.
|
|
95
|
+ */
|
|
96
|
+ private boolean shouldDisplay(final DisplayableEvent event) {
|
|
97
|
+ return event.getSource().equals(owner)
|
|
98
|
+ && !event.getDisplayProperty(DisplayProperty.DO_NOT_DISPLAY).isPresent();
|
|
99
|
+ }
|
|
100
|
+
|
88
|
101
|
public IRCDocument getDocument() {
|
89
|
102
|
return document;
|
90
|
103
|
}
|