Disable initial history fetch (comes with initial sync)
This commit is contained in:
parent
28c6527544
commit
9ccceb48b9
@ -276,7 +276,7 @@ func (c *Container) processOwnMembershipChange(evt *gomatrix.Event) {
|
|||||||
if evt.Unsigned.PrevContent != nil {
|
if evt.Unsigned.PrevContent != nil {
|
||||||
prevMembership, _ = evt.Unsigned.PrevContent["membership"].(string)
|
prevMembership, _ = evt.Unsigned.PrevContent["membership"].(string)
|
||||||
}
|
}
|
||||||
debug.Printf("Processing own membership change: %s->%s in %s", membership, prevMembership, evt.RoomID)
|
debug.Printf("Processing own membership change: %s->%s in %s", prevMembership, membership, evt.RoomID)
|
||||||
if membership == prevMembership {
|
if membership == prevMembership {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ func (view *MainView) KeyEventHandler(roomView *RoomView, key *tcell.EventKey) *
|
|||||||
msgView := roomView.MessageView()
|
msgView := roomView.MessageView()
|
||||||
|
|
||||||
if msgView.IsAtTop() && (k == tcell.KeyPgUp || k == tcell.KeyUp) {
|
if msgView.IsAtTop() && (k == tcell.KeyPgUp || k == tcell.KeyUp) {
|
||||||
go view.LoadHistory(roomView.Room.ID, false)
|
go view.LoadHistory(roomView.Room.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch k {
|
switch k {
|
||||||
@ -215,7 +215,7 @@ func (view *MainView) MouseEventHandler(roomView *RoomView, event *tcell.EventMo
|
|||||||
switch event.Buttons() {
|
switch event.Buttons() {
|
||||||
case tcell.WheelUp:
|
case tcell.WheelUp:
|
||||||
if msgView.IsAtTop() {
|
if msgView.IsAtTop() {
|
||||||
go view.LoadHistory(roomView.Room.ID, false)
|
go view.LoadHistory(roomView.Room.ID)
|
||||||
} else {
|
} else {
|
||||||
msgView.AddScrollOffset(WheelScrollOffsetDiff)
|
msgView.AddScrollOffset(WheelScrollOffsetDiff)
|
||||||
|
|
||||||
@ -293,11 +293,9 @@ func (view *MainView) addRoomPage(room *rooms.Room) {
|
|||||||
view.roomView.AddPage(room.ID, roomView, true, false)
|
view.roomView.AddPage(room.ID, roomView, true, false)
|
||||||
roomView.UpdateUserList()
|
roomView.UpdateUserList()
|
||||||
|
|
||||||
count, err := roomView.LoadHistory(view.matrix, view.config.HistoryDir)
|
_, err := roomView.LoadHistory(view.matrix, view.config.HistoryDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
debug.Printf("Failed to load history of %s: %v", roomView.Room.GetTitle(), err)
|
debug.Printf("Failed to load history of %s: %v", roomView.Room.GetTitle(), err)
|
||||||
} else if count <= 0 {
|
|
||||||
go view.LoadHistory(room.ID, true)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -314,8 +312,10 @@ func (view *MainView) GetRoom(roomID string) ifc.RoomView {
|
|||||||
|
|
||||||
func (view *MainView) AddRoom(roomID string) {
|
func (view *MainView) AddRoom(roomID string) {
|
||||||
if view.roomList.Contains(roomID) {
|
if view.roomList.Contains(roomID) {
|
||||||
|
debug.Print("Add aborted", roomID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
debug.Print("Adding", roomID)
|
||||||
room := view.matrix.GetRoom(roomID)
|
room := view.matrix.GetRoom(roomID)
|
||||||
view.roomList.Add(room)
|
view.roomList.Add(room)
|
||||||
view.addRoomPage(room)
|
view.addRoomPage(room)
|
||||||
@ -324,8 +324,10 @@ func (view *MainView) AddRoom(roomID string) {
|
|||||||
func (view *MainView) RemoveRoom(roomID string) {
|
func (view *MainView) RemoveRoom(roomID string) {
|
||||||
roomView := view.GetRoom(roomID)
|
roomView := view.GetRoom(roomID)
|
||||||
if roomView == nil {
|
if roomView == nil {
|
||||||
|
debug.Print("Remove aborted", roomID)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
debug.Print("Removing", roomID)
|
||||||
|
|
||||||
view.roomList.Remove(roomView.MxRoom())
|
view.roomList.Remove(roomView.MxRoom())
|
||||||
view.SwitchRoom(view.roomList.Selected())
|
view.SwitchRoom(view.roomList.Selected())
|
||||||
@ -424,7 +426,7 @@ func (view *MainView) NotifyMessage(room *rooms.Room, message ifc.Message, shoul
|
|||||||
view.roomList.Bump(room)
|
view.roomList.Bump(room)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (view *MainView) LoadHistory(room string, initial bool) {
|
func (view *MainView) LoadHistory(room string) {
|
||||||
defer debug.Recover()
|
defer debug.Recover()
|
||||||
roomView := view.rooms[room]
|
roomView := view.rooms[room]
|
||||||
|
|
||||||
@ -445,12 +447,7 @@ func (view *MainView) LoadHistory(room string, initial bool) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if initial {
|
debug.Print("Fetching history for", room, "starting from", batch)
|
||||||
batch = view.config.Session.NextBatch
|
|
||||||
debug.Print("Loading initial history for", room)
|
|
||||||
} else {
|
|
||||||
debug.Print("Loading more history for", room, "starting from", batch)
|
|
||||||
}
|
|
||||||
history, prevBatch, err := view.matrix.GetHistory(roomView.Room.ID, batch, 50)
|
history, prevBatch, err := view.matrix.GetHistory(roomView.Room.ID, batch, 50)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
roomView.AddServiceMessage("Failed to fetch history")
|
roomView.AddServiceMessage("Failed to fetch history")
|
||||||
|
Loading…
Reference in New Issue
Block a user