commit f8929cb

sewn  ·  2026-07-23 18:22:46 +0000 UTC
parent 28b1907
Show kick reason and sender
3 files changed,  +21, -6
M app.go
M app.go
+6, -2
 1@@ -1903,11 +1903,15 @@ func (app *App) formatEvent(ev irc.Event) ui.Line {
 2 			Foreground: app.cfg.Colors.Status,
 3 		})
 4 		body.WriteString(ev.User)
 5-		if app.cfg.QuitMessages && ev.Message != "" &&
 6+		if ev.Who != "" {
 7+			body.WriteString(" by ")
 8+			body.WriteString(ev.Who)
 9+		}
10+		if ev.Who != "" || (app.cfg.QuitMessages && ev.Message != "" &&
11 			// Few checks for useless messages
12 			ev.Message != "Quit: " && ev.Message != "Client Quit" &&
13 			ev.Message != "connection closed" &&
14-			ev.Message != "Remote host closed the connection" {
15+			ev.Message != "Remote host closed the connection") {
16 			body.WriteString(" (")
17 			body.WriteString(ev.Message)
18 			body.WriteByte(')')
+3, -2
 1@@ -49,13 +49,14 @@ type UserPartEvent struct {
 2 	Channel string
 3 	Time    time.Time
 4 	Message string
 5+	Who     string
 6 }
 7 
 8 type UserQuitEvent struct {
 9 	User     string
10 	Channels []string
11 	Time     time.Time
12-	Message string
13+	Message  string
14 }
15 
16 type UserOnlineEvent struct {
17@@ -77,7 +78,7 @@ type ModeChangeEvent struct {
18 	Channel string
19 	Mode    string
20 	Time    time.Time
21-	Who	string
22+	Who     string
23 }
24 
25 type InviteEvent struct {
+12, -2
 1@@ -1086,8 +1086,15 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
 2 		}
 3 	case "KICK":
 4 		var channel, nick string
 5-		if err := msg.ParseParams(&channel, &nick); err != nil {
 6-			return nil, err
 7+		var partmessage string
 8+		if len(msg.Params) == 3 {
 9+			if err := msg.ParseParams(&channel, &nick, &partmessage); err != nil {
10+				return nil, err
11+			}
12+		} else {
13+			if err := msg.ParseParams(&channel, &nick); err != nil {
14+				return nil, err
15+			}
16 		}
17 
18 		if playback {
19@@ -1095,6 +1102,7 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
20 				User:    nick,
21 				Channel: channel,
22 				Time:    msg.TimeOrNow(),
23+				Message: partmessage,
24 			}, nil
25 		}
26 
27@@ -1120,6 +1128,8 @@ func (s *Session) handleMessageRegistered(msg Message, playback bool) (Event, er
28 					User:    nick,
29 					Channel: c.Name,
30 					Time:    msg.TimeOrNow(),
31+					Message: partmessage,
32+					Who:     msg.Prefix.Name,
33 				}, nil
34 			}
35 		}