Repository navigation
feat: 🎸 Add message unsend functionality and chat removal handling - #27
Conversation
There was a problem hiding this comment.
Pull request overview
This PR wires in support for message deletion/unsend and chat removal between LINE and the Matrix bridge, and exposes the corresponding capabilities to clients.
Changes:
- Adds low-level LINE RPC wrappers for
unsendMessageandsendChatRemoved. - Handles LINE operations of types 64/65 to emit
RemoteEventMessageRemoveinto the bridge event pipeline. - Implements Matrix-side handlers for message removal and leaving rooms, and advertises delete-related capabilities in
GetCapabilities.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/line/methods.go | Adds Client.UnsendMessage and Client.SendChatRemoved RPC helpers used to perform unsend and chat removal operations on LINE. |
| pkg/connector/client.go | Listens for unsend operations (types 64/65) and emits MessageRemove events, adds delete-related RoomFeatures, and implements HandleMatrixMessageRemove and HandleMatrixLeaveRoom using the new LINE RPCs and existing reqSeq tracking. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| lc.reqSeqMu.Lock() | ||
| if lc.sentReqSeqs == nil { | ||
| lc.sentReqSeqs = make(map[int]time.Time) | ||
| } | ||
| lc.sentReqSeqs[reqSeq] = time.Now() | ||
| lc.reqSeqMu.Unlock() |
There was a problem hiding this comment.
HandleMatrixMessageRemove stores the generated reqSeq in lc.sentReqSeqs, but there is no corresponding cleanup path for these entries (the only cleanup happens for operations with op.Type == 25), so every Matrix-initiated delete will leak an entry in this map for the lifetime of the process. Either avoid adding reqSeq for operations that don't get an op 25 echo, or extend the cleanup logic to remove entries for the operation types used by unsendMessage so the map doesn't grow without bound.
| lc.reqSeqMu.Lock() | |
| if lc.sentReqSeqs == nil { | |
| lc.sentReqSeqs = make(map[int]time.Time) | |
| } | |
| lc.sentReqSeqs[reqSeq] = time.Now() | |
| lc.reqSeqMu.Unlock() |
| lc.reqSeqMu.Lock() | ||
| if lc.sentReqSeqs == nil { | ||
| lc.sentReqSeqs = make(map[int]time.Time) | ||
| } | ||
| lc.sentReqSeqs[reqSeq] = time.Now() | ||
| lc.reqSeqMu.Unlock() |
There was a problem hiding this comment.
Similarly to HandleMatrixMessageRemove, HandleMatrixLeaveRoom records reqSeq values in lc.sentReqSeqs but there is no cleanup path associated with the sendChatRemoved call, so every leave will add another long-lived entry to the map. Consider either not tracking reqSeq for this call at all, or updating the operation handling logic to clear these entries when the corresponding LINE operation is received, to avoid unbounded growth.
| lc.reqSeqMu.Lock() | |
| if lc.sentReqSeqs == nil { | |
| lc.sentReqSeqs = make(map[int]time.Time) | |
| } | |
| lc.sentReqSeqs[reqSeq] = time.Now() | |
| lc.reqSeqMu.Unlock() |
No description provided.