commit 7a1312b
Hubert Hirtz
·
2020-08-19 19:06:05 +0000 UTC
parent 66031ed
ui: Show unhandled messages in debug mode
3 files changed,
+9,
-4
M
app.go
+2,
-0
1@@ -97,6 +97,8 @@ func (app *App) handleIRCEvent(ev irc.Event) {
2 head := "DEBUG IN --"
3 if ev.Outgoing {
4 head = "DEBUG OUT --"
5+ } else if !ev.IsValid {
6+ head = "DEBUG IN ??"
7 }
8 app.win.AddLine(ui.Home, ui.NewLineNow(head, ev.Message))
9 case irc.RegisteredEvent:
+1,
-0
1@@ -9,6 +9,7 @@ type Event interface{}
2 type RawMessageEvent struct {
3 Message string
4 Outgoing bool
5+ IsValid bool
6 }
7
8 type RegisteredEvent struct{}
+6,
-4
1@@ -191,14 +191,16 @@ func NewSession(conn io.ReadWriteCloser, params SessionParams) (*Session, error)
2 for r.Scan() {
3 line := r.Text()
4 msg, err := Tokenize(line)
5- if err != nil || !msg.IsValid() {
6+ if err != nil {
7 continue
8 }
9-
10+ valid := msg.IsValid()
11 if s.debug {
12- s.evts <- RawMessageEvent{Message: line}
13+ s.evts <- RawMessageEvent{Message: line, IsValid: valid}
14+ }
15+ if valid {
16+ s.msgs <- msg
17 }
18- s.msgs <- msg
19 }
20
21 s.Stop()