aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--matrix/sync.go21
-rw-r--r--ui/view-main.go16
2 files changed, 25 insertions, 12 deletions
diff --git a/matrix/sync.go b/matrix/sync.go
index a21d982..3e1a0c7 100644
--- a/matrix/sync.go
+++ b/matrix/sync.go
@@ -134,5 +134,24 @@ func (s *GomuksSyncer) OnFailedSync(res *gomatrix.RespSync, err error) (time.Dur
// GetFilterJSON returns a filter with a timeline limit of 50.
func (s *GomuksSyncer) GetFilterJSON(userID string) json.RawMessage {
- return json.RawMessage(`{"room":{"timeline":{"limit":50}}}`)
+ return json.RawMessage(`{
+ "room": {
+ "include_leave": true,
+ "state": {
+ "types": ["m.room.member"]
+ },
+ "timeline": {
+ "types": ["m.room.message"],
+ "limit": 50
+ },
+ "ephemeral": {
+ "types": ["m.typing"]
+ },
+ "account_data": {"types": []}
+ },
+ "account_data": {
+ "types": ["m.push_rules"]
+ },
+ "presence": {"types": []}
+ }`)
}
diff --git a/ui/view-main.go b/ui/view-main.go
index 1f14943..5515004 100644
--- a/ui/view-main.go
+++ b/ui/view-main.go
@@ -191,7 +191,7 @@ func (view *MainView) InputKeyHandler(roomView *widget.RoomView, key *tcell.Even
msgView := roomView.MessageView()
if k == tcell.KeyPgUp || k == tcell.KeyUp {
if msgView.IsAtTop() {
- go view.LoadMoreHistory(roomView.Room.ID)
+ go view.LoadHistory(roomView.Room.ID, false)
} else {
msgView.MoveUp(k == tcell.KeyPgUp)
}
@@ -262,7 +262,7 @@ func (view *MainView) addRoom(index int, room string) {
if err != nil {
debug.Printf("Failed to load history of %s: %v", roomView.Room.GetTitle(), err)
} else if count <= 0 {
- go view.LoadInitialHistory(room)
+ go view.LoadHistory(room, true)
}
}
}
@@ -333,14 +333,6 @@ func (view *MainView) AddServiceMessage(roomView *widget.RoomView, text string)
view.parent.Render()
}
-func (view *MainView) LoadMoreHistory(room string) {
- view.LoadHistory(room, false)
-}
-
-func (view *MainView) LoadInitialHistory(room string) {
- view.LoadHistory(room, true)
-}
-
func (view *MainView) LoadHistory(room string, initial bool) {
defer view.gmx.Recover()
roomView := view.rooms[room]
@@ -364,8 +356,10 @@ func (view *MainView) LoadHistory(room string, initial bool) {
if initial {
batch = view.config.Session.NextBatch
+ debug.Print("Loading initial history for", room)
+ } else {
+ debug.Print("Loading more history for", room, "starting from", batch)
}
- debug.Print("Loading history for", room, "starting from", batch, "(initial:", initial, ")")
history, prevBatch, err := view.matrix.GetHistory(roomView.Room.ID, batch, 50)
if err != nil {
view.AddServiceMessage(roomView, "Failed to fetch history")