diff options
| author | rebecca <ubq323@ubq323.website> | 2026-02-12 22:12:54 +0000 |
|---|---|---|
| committer | rebecca <ubq323@ubq323.website> | 2026-02-12 22:12:54 +0000 |
| commit | b21ac16d8034685997b2e2a1cc92d7839b42509b (patch) | |
| tree | 00a05067670cad5c8dbd5494b9304fc8540062cf /client | |
| parent | 2ddec8b29c46f57481463abd9b56a39185986918 (diff) | |
add me command and paraphenalia (wip)
Diffstat (limited to 'client')
| -rw-r--r-- | client/channel_window.go | 74 | ||||
| -rw-r--r-- | client/command.go | 7 |
2 files changed, 55 insertions, 26 deletions
diff --git a/client/channel_window.go b/client/channel_window.go index 97e86e8..8ff8368 100644 --- a/client/channel_window.go +++ b/client/channel_window.go @@ -119,7 +119,7 @@ func (cw *channelWindow) Buffer() *buffer.Buffer { return &cw.Buf } -func (cw *channelWindow) Send(text string) { +func (cw *channelWindow) SendFields(fields map[string]string) { if !globalApp.connected || !globalApp.authenticated { return } @@ -131,7 +131,7 @@ func (cw *channelWindow) Send(text string) { } } } - fields := map[string]string {"": text} + if cw.replyingTo != "" { fields["reply"] = cw.replyingTo cw.replyingTo = "" @@ -147,6 +147,11 @@ func (cw *channelWindow) Send(text string) { globalApp.goTo(channelLocation {id: cw.location.id}) } +func (cw *channelWindow) Send(text string) { + fields := map[string]string {"": text} + cw.SendFields(fields) +} + func (cw *channelWindow) markRead() { globalApp.Request(proto.NewCmd("read", cw.location.id), func(response proto.Command) { @@ -572,32 +577,49 @@ func (m channelMsg) Show(odd bool) { 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.Children, Height: 1, Dir: tui.Right}) - m.showName(bg, m.Fields["f"], isReply) - if isReply { - m.showReply(bg, replyTo) - } - tui.Pop() - - tui.Pop() + _, isMe := m.Fields["me"] + if isMe { + tui.Push("", tui.Box {Width: tui.Fill, Height: 1, Dir: tui.Left}) + m.showDate(bg) + tui.Push("", tui.Box{Width:tui.Children,Height:1,Dir:tui.Right}) + tui.Push("",tui.Box{Width:tui.TextSize,Height:tui.TextSize,NoWrap:true}) + tui.Text("* ", &tui.Style {Fg: tui.BrightBlack, Bg: bg}) + tui.Pop() + m.showName(bg, m.Fields["f"], false) + tui.Push("",tui.Box{Width:tui.TextSize,Height:tui.TextSize,NoWrap:true}) + tui.Text(" " + m.Fields[""], nil) + tui.Pop() + tui.Pop() + tui.Pop() + } else { + tui.Push("", tui.Box {Width: tui.Fill, Height: 1, Dir: tui.Left}) + m.showDate(bg) - mouse := tui.Push(m.Id() + ".content", tui.Box { - Width: tui.Fill, Height: tui.TextSize, - Margins: [4]int {1, 0, 0, 0}, - }) - tui.Text(m.Fields[""], nil) - switch { - case tui.MenuOption("copy"): - clipboard.Get().Copy(m.Fields[""]) - case mouse.Button == 0 && mouse.Pressed: - fallthrough - case tui.MenuOption("reply"): - m.window.replyTo(m.Object.Id) + tui.Push("", tui.Box {Width: tui.Children, Height: 1, Dir: tui.Right}) + m.showName(bg, m.Fields["f"], isReply) + if isReply { + m.showReply(bg, replyTo) + } + tui.Pop() + + tui.Pop() + + mouse := tui.Push(m.Id() + ".content", tui.Box { + Width: tui.Fill, Height: tui.TextSize, + Margins: [4]int {1, 0, 0, 0}, + }) + + tui.Text(m.Fields[""], nil) + switch { + case tui.MenuOption("copy"): + clipboard.Get().Copy(m.Fields[""]) + case mouse.Button == 0 && mouse.Pressed: + fallthrough + case tui.MenuOption("reply"): + m.window.replyTo(m.Object.Id) + } + tui.Pop() } - tui.Pop() default: tui.Push("", tui.Box {Width: tui.Fill, Height: tui.TextSize}) tui.Text("[", nil) diff --git a/client/command.go b/client/command.go index 108452c..26abf73 100644 --- a/client/command.go +++ b/client/command.go @@ -187,6 +187,13 @@ func (a *application) doCommand(command string, args []string, text string) { "u", a.uid, map[string]string {"status": text}, }, cb) return + case "me": + win := a.windowCache.Get(a.currentWindow) + switch win.(type) { + case *channelWindow: + fields := map[string]string {"": text, "me": "yes"} + win.(*channelWindow).SendFields(fields) + } case "who": a.lookup(text, "u", func(u *proto.Object, fail *proto.Fail) { if fail != nil { |
