Skip to content

Commit

Permalink
feat: reuse processMessageEvent for handling decrypted RoomMessage ev…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
domw30 committed Oct 18, 2023
1 parent e1814d0 commit b1f7dd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib/chat/matrix-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,6 @@ export class MatrixClient implements IChatClient {
console.log('encryped message: ', event);
}

this.processMessageEvent(event);

if (event.type === EventType.RoomCreate) {
this.roomCreated(event);
}
Expand All @@ -379,6 +377,8 @@ export class MatrixClient implements IChatClient {
if (event.type === EventType.RoomRedaction) {
this.receiveDeleteMessage(event);
}

this.processMessageEvent(event);
});
this.matrix.on(RoomMemberEvent.Membership, async (_event, member) => {
if (member.membership === MembershipStateType.Invite && member.userId === this.userId) {
Expand All @@ -391,7 +391,7 @@ export class MatrixClient implements IChatClient {
this.matrix.on(MatrixEventEvent.Decrypted, async (decryptedEvent: MatrixEvent) => {
const event = decryptedEvent.getEffectiveEvent();
if (event.type === EventType.RoomMessage) {
this.publishMessageEvent(event);
this.processMessageEvent(event);
}
});

Expand Down

0 comments on commit b1f7dd2

Please sign in to comment.