The ultimate fix for this was to send /messages the proper kind of
filter, a RoomEventFilter, rather than sending it the kind of filter
that /sync expects. This is legitimately confusing, and there's even
an issue about it:
<https://github.com/matrix-org/matrix-doc/issues/706>.
This commit fixes the problem by using the right kind of filter for
/messages.
Thanks to Michael (@t3chguy) in #matrix-dev:matrix.org, who helped me
identify the problem.
Also thanks to him for clarifying that membership events may be in
both state and timeline events in a room, so calculating a displayname
requires searching both. This commit tries to be more...comprehensive
in doing this (perhaps more than necessary, but tidying that up can be
done later if optimization is needed).
Squashed commit of the following:
commit 1f393d7dde
Author: Adam Porter <adam@alphapapa.net>
Date: Thu Jul 22 10:48:19 2021 -0500
Comment: TODOs
commit 7e039a7b4f
Author: Adam Porter <adam@alphapapa.net>
Date: Thu Jul 22 10:48:08 2021 -0500
WIP: Docstring for handler lambdas
commit 441c23113c
Author: Adam Porter <adam@alphapapa.net>
Date: Thu Jul 22 10:40:58 2021 -0500
WIP: Don't insert reaction events as nodes
This seems to work well. However, the event-processing needs some
refactoring, because the logic is now spread across a few places.
commit 4fdf0ddf37
Author: Adam Porter <adam@alphapapa.net>
Date: Thu Jul 22 10:30:28 2021 -0500
WIP: Key face, and fix help-echo
Remaining issue is that reactions still insert empty events in the
buffer.
commit 5f700ccc16
Author: Adam Porter <adam@alphapapa.net>
Date: Thu Jul 22 09:30:18 2021 -0500
WIP: Fix: Use pushnew to avoid duplicating reactions
commit a40a6e6bc1
Author: Adam Porter <adam@alphapapa.net>
Date: Wed Jul 21 20:17:32 2021 -0500
WIP: And in -retro-callback
A bug now is that, every time a room's buffer is created anew, the
reactions are duplicated.
commit dbfec18e45
Author: Adam Porter <adam@alphapapa.net>
Date: Wed Jul 21 19:49:47 2021 -0500
WIP: Call -room---process-events in -room--buffer
This almost seems to work, in that reactions from old timeline
events are displayed when the buffer is made...or not? It seems to
work in some cases, but not in others, like when retro-loading...
The big issue now is that the reaction events cause blank events to be
inserted into the buffer. Fixing that will require conditionally
inserting events, which probably means moving message event handling
into the defevent macro, which will require some more refactoring...
commit 81757536f2
Author: Adam Porter <adam@alphapapa.net>
Date: Wed Jul 21 17:02:29 2021 -0500
WIP: Add: Reactions
It works for newly received reactions, but after initial sync,
reactions that happened in the past are not displayed. I think it's
because the related events aren't found in the room's timeline, but I
tried to fix that, and it still doesn't work.
I'm guessing there are some assumptions that I'm making wrongly, or
something that I don't understand about how the server sends events.
We may have to save a list of certain types of events and process them
after all other events have been processed. Ugh.
The good news is that EWOC makes it pretty easy and reliable to update
messages in the buffer.
The Widget library is still mysterious to me, but some trial-and-error
helps. This makes the ement-room-membership widget's value the Matrix
event struct, and it uses a :value-create function to insert the
string.
This pattern can probably be used for other widgets in the future,
e.g. for event type-specific widgets.
Squashed commit of the following:
commit 34ad5b4810
Author: Adam Porter <adam@alphapapa.net>
Date: Sat Dec 5 16:23:51 2020 -0600
WIP: Seems to work decently
commit e5edcfc908
Author: Adam Porter <adam@alphapapa.net>
Date: Sat Dec 5 04:18:09 2020 -0600
WIP