Skip to content

feat: 🎸 Add message unsend functionality and chat removal handling - #27

Merged
highesttt merged 1 commit into
mainfrom
26-feat-add-message-deletion
Jan 21, 2026
Merged

highesttt merged 1 commit into
mainfrom
26-feat-add-message-deletion

Conversation

@highesttt

Copy link
Copy Markdown
Collaborator

No description provided.

@highesttt highesttt linked an issue Jan 21, 2026 that may be closed by this pull request
@highesttt
highesttt requested a review from Copilot January 21, 2026 22:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 unsendMessage and sendChatRemoved.
  • Handles LINE operations of types 64/65 to emit RemoteEventMessageRemove into 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.

Comment thread pkg/connector/client.go
Comment on lines +2269 to +2274
lc.reqSeqMu.Lock()
if lc.sentReqSeqs == nil {
lc.sentReqSeqs = make(map[int]time.Time)
}
lc.sentReqSeqs[reqSeq] = time.Now()
lc.reqSeqMu.Unlock()

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
lc.reqSeqMu.Lock()
if lc.sentReqSeqs == nil {
lc.sentReqSeqs = make(map[int]time.Time)
}
lc.sentReqSeqs[reqSeq] = time.Now()
lc.reqSeqMu.Unlock()

Copilot uses AI. Check for mistakes.
Comment thread pkg/connector/client.go
Comment on lines +2283 to +2288
lc.reqSeqMu.Lock()
if lc.sentReqSeqs == nil {
lc.sentReqSeqs = make(map[int]time.Time)
}
lc.sentReqSeqs[reqSeq] = time.Now()
lc.reqSeqMu.Unlock()

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
lc.reqSeqMu.Lock()
if lc.sentReqSeqs == nil {
lc.sentReqSeqs = make(map[int]time.Time)
}
lc.sentReqSeqs[reqSeq] = time.Now()
lc.reqSeqMu.Unlock()

Copilot uses AI. Check for mistakes.
@highesttt
highesttt merged commit f400c1d into main Jan 21, 2026
14 checks passed
@highesttt
highesttt deleted the 26-feat-add-message-deletion branch August 11, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

feat: ✨ Add message deletion

2 participants