Explorar el Código

Merge pull request #687 from csmith/master

Fix counting of events.
pull/691/head
Greg Holmes hace 8 años
padre
commit
3836da6618
Se han modificado 1 ficheros con 11 adiciones y 5 borrados
  1. 11
    5
      src/com/dmdirc/ui/messages/UnreadStatusManager.java

+ 11
- 5
src/com/dmdirc/ui/messages/UnreadStatusManager.java Ver fichero

@@ -27,6 +27,7 @@ import com.dmdirc.config.ConfigBinding;
27 27
 import com.dmdirc.events.BaseChannelTextEvent;
28 28
 import com.dmdirc.events.BaseQueryTextEvent;
29 29
 import com.dmdirc.events.ChannelHighlightEvent;
30
+import com.dmdirc.events.DisplayProperty;
30 31
 import com.dmdirc.events.DisplayableEvent;
31 32
 import com.dmdirc.events.QueryHighlightEvent;
32 33
 import com.dmdirc.events.UnreadStatusChangedEvent;
@@ -61,39 +62,44 @@ public class UnreadStatusManager {
61 62
 
62 63
     @Handler
63 64
     public void handleDisplayableEvent(final DisplayableEvent event) {
64
-        if (event.getSource().equals(container)) {
65
+        if (includeEvent(event)) {
65 66
             updateStatus(miscellaneousColour, unreadLines + 1);
66 67
         }
67 68
     }
68 69
 
69 70
     @Handler
70 71
     public void handleChannelTextEvent(final BaseChannelTextEvent event) {
71
-        if (event.getSource().equals(container)) {
72
+        if (includeEvent(event)) {
72 73
             updateStatus(messageColour);
73 74
         }
74 75
     }
75 76
 
76 77
     @Handler
77 78
     public void handleQueryTextEvent(final BaseQueryTextEvent event) {
78
-        if (event.getSource().equals(container)) {
79
+        if (includeEvent(event)) {
79 80
             updateStatus(messageColour);
80 81
         }
81 82
     }
82 83
 
83 84
     @Handler
84 85
     public void handleChannelHighlightEvent(final ChannelHighlightEvent event) {
85
-        if (event.getChannel().equals(container)) {
86
+        if (includeEvent(event)) {
86 87
             updateStatus(highlightColour);
87 88
         }
88 89
     }
89 90
 
90 91
     @Handler
91 92
     public void handleQueryHighlightEvent(final QueryHighlightEvent event) {
92
-        if (event.getQuery().equals(container)) {
93
+        if (includeEvent(event)) {
93 94
             updateStatus(highlightColour);
94 95
         }
95 96
     }
96 97
 
98
+    private boolean includeEvent(final DisplayableEvent event) {
99
+        return event.getSource().equals(container)
100
+                && !event.getDisplayProperty(DisplayProperty.DO_NOT_DISPLAY).orElse(false);
101
+    }
102
+
97 103
     public int getUnreadLines() {
98 104
         return unreadLines;
99 105
     }

Loading…
Cancelar
Guardar