summaryrefslogtreecommitdiff
path: root/client/channel_window.go
diff options
context:
space:
mode:
Diffstat (limited to 'client/channel_window.go')
-rw-r--r--client/channel_window.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/client/channel_window.go b/client/channel_window.go
index e5b50c3..b516775 100644
--- a/client/channel_window.go
+++ b/client/channel_window.go
@@ -14,9 +14,8 @@ type channelLocation struct {
}
type channelWindow struct {
+ window.DefaultWindow
location channelLocation
- buf buffer.Buffer
- input tui.TextInput
watchedUsers map[string]bool
loadingHistory bool
endOfHistory bool
@@ -66,7 +65,7 @@ func (cw *channelWindow) isGone(uid string) bool {
}
func (cw *channelWindow) put(msg proto.Object) {
- cw.buf.Add(channelMsg {msg, cw})
+ cw.Buf.Add(channelMsg {msg, cw})
}
func (cw *channelWindow) Location() window.Location {
@@ -81,14 +80,10 @@ func (cw *channelWindow) Kill() {
}
func (cw *channelWindow) Buffer() *buffer.Buffer {
- if cw.buf.AtTop() {
+ if cw.Buf.AtTop() {
cw.loadMoreHistory()
}
- return &cw.buf
-}
-
-func (cw *channelWindow) Input() *tui.TextInput {
- return &cw.input
+ return &cw.Buf
}
func (cw *channelWindow) Send(text string) {
@@ -110,7 +105,7 @@ func (cw *channelWindow) Send(text string) {
}
msg := proto.Object {"m", "", map[string]string {"": text}}
globalApp.Request(proto.NewCmd("p", cw.location.id, msg), cb)
- cw.input.SetText("")
+ cw.In.SetText("")
}
func (cw *channelWindow) leaveChannel() {
@@ -139,7 +134,7 @@ func (cw *channelWindow) loadMoreHistory() {
cw.loadingHistory = true
rq := proto.Object {Fields: make(map[string]string)}
- top := cw.buf.Top()
+ top := cw.Buf.Top()
if top != nil {
rq.Kind = "before"
rq.Fields[""] = top.Msg().(channelMsg).Object.Id
@@ -154,7 +149,7 @@ func (cw *channelWindow) loadMoreHistory() {
cw.endOfHistory = true
}
for i := len(response.Args) - 1; i >= 0; i-- {
- cw.buf.AddTop(channelMsg {response.Args[i], cw})
+ cw.Buf.AddTop(channelMsg {response.Args[i], cw})
}
case "fail":
cw.endOfHistory = true