summaryrefslogtreecommitdiff
path: root/client/channel_window.go
diff options
context:
space:
mode:
authorcitrons <citrons@mondecitronne.com>2025-06-02 09:19:23 -0500
committercitrons <citrons@mondecitronne.com>2025-06-02 09:19:23 -0500
commitcd33ad54372bd53842fd6e04dbb2859f9ab59f51 (patch)
tree459410c9215a22df29f63de33ad7ec2b373db172 /client/channel_window.go
parentf14c0aa7a0ad19065d87424b3abc0fdabd9fe9bb (diff)
refactor join/leave messages`
Diffstat (limited to 'client/channel_window.go')
-rw-r--r--client/channel_window.go56
1 files changed, 28 insertions, 28 deletions
diff --git a/client/channel_window.go b/client/channel_window.go
index d003ce8..e5b50c3 100644
--- a/client/channel_window.go
+++ b/client/channel_window.go
@@ -238,7 +238,7 @@ func (cw *channelWindow) ShowStatusLine() {
}
func (m channelMsg) Id() string {
- return m.Object.Id
+ return "buffer." + m.Object.Id
}
func (m channelMsg) showDate(bg int32) {
@@ -251,49 +251,49 @@ func (m channelMsg) showDate(bg int32) {
tui.Pop()
}
+func (m channelMsg) showName(bg int32) {
+ nameStyle := tui.Style {Bg: bg, Fg: tui.White}
+ if m.Fields["f"] == globalApp.uid {
+ nameStyle.Fg = tui.Cyan
+ }
+ if m.window.isGone(m.Fields["f"]) {
+ nameStyle.Italic = true
+ } else {
+ nameStyle.Bold = true
+ }
+ tui.Push(m.Id() + ".name", tui.Box {
+ Width: tui.TextSize, Height: 1, NoWrap: true,
+ })
+ tui.Text(m.window.username(m.Fields["f"]), &nameStyle)
+ tui.Pop()
+}
+
func (m channelMsg) Show(odd bool) {
var bg int32 = colorDefault[odd]
+
switch m.Kind {
- case "join":
+ case "join", "leave":
tui.Push("", tui.Box {
Width: tui.Fill, Height: tui.Children, Dir: tui.Left,
})
m.showDate(bg)
- tui.Push("", tui.Box {Width: tui.TextSize, Height: tui.TextSize})
- tui.Text("-> ", &tui.Style {Fg: tui.BrightBlack, Bg: bg})
- tui.Text("join", &tui.Style {Fg: tui.Blue, Bg: bg, Bold: true})
- tui.Text(": ", &tui.Style {Fg: tui.BrightBlack, Bg: bg})
- tui.Text(m.window.username(m.Fields[""]), nil)
- tui.Pop()
- tui.Pop()
- case "leave":
+
+ tui.Push("", tui.Box {Width: tui.Children, Height: 1, Dir: tui.Right})
tui.Push("", tui.Box {
- Width: tui.Fill, Height: tui.Children, Dir: tui.Left,
+ Width: tui.TextSize, Height: tui.TextSize, NoWrap: true,
})
- m.showDate(bg)
- tui.Push("", tui.Box {Width: tui.TextSize, Height: tui.TextSize})
tui.Text("<- ", &tui.Style {Fg: tui.BrightBlack, Bg: bg})
- tui.Text("leave", &tui.Style {Fg: tui.Blue, Bg: bg, Bold: true})
+ tui.Text(m.Kind, &tui.Style {Fg: tui.Blue, Bg: bg})
tui.Text(": ", &tui.Style {Fg: tui.BrightBlack, Bg: bg})
- tui.Text(m.window.username(m.Fields[""]), nil)
tui.Pop()
+ m.showName(bg)
tui.Pop()
- case "m":
- nameStyle := tui.Style {Bg: bg, Fg: tui.White}
- if m.Fields["f"] == globalApp.uid {
- nameStyle.Fg = tui.Cyan
- }
- if m.window.isGone(m.Fields["f"]) {
- nameStyle.Italic = true
- } else {
- nameStyle.Bold = true
- }
+ tui.Pop()
+ case "m":
tui.Push("", tui.Box {Width: tui.Fill, Height: 1, Dir: tui.Left})
m.showDate(bg)
- tui.Push("", tui.Box {Width: tui.TextSize, Height: 1, NoWrap: true})
- tui.Text(m.window.username(m.Fields["f"]), &nameStyle)
- tui.Pop()
+ m.showName(bg)
tui.Pop()
tui.Push("", tui.Box {