summaryrefslogtreecommitdiff
path: root/client/channel_list.go
diff options
context:
space:
mode:
authorraven <citrons@mondecitronne.com>2026-02-10 17:22:58 -0600
committerraven <citrons@mondecitronne.com>2026-02-10 17:22:58 -0600
commit8024722bd5db50bc3ec602b807819a87bd65035e (patch)
tree0aa9585878c5f4a3fa8f16ec059314661aa1578d /client/channel_list.go
parent159773c277a4067f42037d1cbac31659de776382 (diff)
channel read status
Diffstat (limited to 'client/channel_list.go')
-rw-r--r--client/channel_list.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/client/channel_list.go b/client/channel_list.go
index bc89dba..c202d39 100644
--- a/client/channel_list.go
+++ b/client/channel_list.go
@@ -13,6 +13,7 @@ type channelListEntry struct {
name string
location channelLocation
clicked bool
+ unread bool
}
func (cl *channelList) Len() int {
@@ -33,7 +34,8 @@ func (cl *channelList) setChannels(cs []proto.Object) {
*cl = nil
for _, c := range cs {
*cl = append(*cl, channelListEntry {
- c.Fields[""], channelLocation {id: c.Id}, false,
+ name: c.Fields[""], location: channelLocation {id: c.Id},
+ unread: c.Fields["unread"] == "yes",
})
}
sort.Sort(cl)
@@ -48,6 +50,14 @@ func (cl *channelList) contains(location channelLocation) bool {
return false
}
+func (cl *channelList) setUnread(location channelLocation, unread bool) {
+ for i := 0; i < len(*cl); i++ {
+ if (*cl)[i].location == location {
+ (*cl)[i].unread = unread
+ }
+ }
+}
+
func (cl *channelList) findName(name string) channelLocation {
for i := 0; i < len(*cl); i++ {
if validate.Fold((*cl)[i].name) == validate.Fold(name) {
@@ -97,7 +107,7 @@ func (cl *channelList) traverse(direction int) int {
func (cl *channelList) add(name string, location channelLocation) {
cl.remove(location)
- entry := channelListEntry {name, location, false}
+ entry := channelListEntry {name: name, location: location}
*cl = append([]channelListEntry {entry}, *cl...)
}
@@ -107,12 +117,13 @@ func (cl *channelList) show(scroll *tui.ScrollState) {
})
scroll.ByMouse(mouse, false)
for i, entry := range *cl {
- var style *tui.Style
+ var style *tui.Style = &tui.Style {Fg: tui.White, Bg: tui.Black}
if entry.location == globalApp.currentWindow {
style = &tui.Style {Fg: tui.Black, Bg: tui.White}
} else if entry.clicked {
style = &tui.Style {Fg: tui.Black, Bg: tui.BrightBlack}
}
+ style.Bold = entry.unread
mouse := tui.Push("channel list." + entry.location.id, tui.Box {
Width: tui.Fill, Height: 1, NoWrap: true, Style: style,