@@ 590,6 590,13 @@ func processMessageEvent(roomID id.RoomID, evt *event.Event) {
_ = evt.Content.ParseRaw(evt.Type)
}
+// based off DefaultSyncer.processSyncEvent
+func processStateEvent(roomID id.RoomID, evt *event.Event) {
+ evt.RoomID = roomID
+ evt.Type.Class = event.StateEventType
+ _ = evt.Content.ParseRaw(evt.Type)
+}
+
func (app *App) pullRecentMessages() error {
var fid string
{
@@ 597,7 604,7 @@ func (app *App) pullRecentMessages() error {
Room: mautrix.RoomFilter{
Timeline: mautrix.FilterPart{
Limit: 50,
- Types: []event.Type{event.EventMessage},
+ Types: []event.Type{event.EventMessage, event.StateMember},
},
},
})
@@ 622,8 629,13 @@ func (app *App) pullRecentMessages() error {
for rid, room := range resp.Rooms.Join {
for _, ev := range room.Timeline.Events {
- processMessageEvent(rid, ev)
- app.addMessage(normalMessage(ev))
+ if ev.Type == event.EventMessage {
+ processMessageEvent(rid, ev)
+ app.addMessage(normalMessage(ev))
+ } else if ev.Type == event.StateMember {
+ processStateEvent(rid, ev)
+ app.addMessage(eventMessage(ev))
+ }
}
}