Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/MatrixRoomHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ export class MatrixRoomHandler {
if (!this.bridge) {
throw Error("Couldn't handleIncomingIM, bridge was not defined");
}
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
log.debug(`Handling incoming IM from ${data.sender}`);
data.message.body = entityDecode(data.message.body);
// First, find out who the message was intended for.
Expand Down Expand Up @@ -357,6 +358,7 @@ export class MatrixRoomHandler {
if (!this.bridge) {
throw Error("Couldn't handleIncomingChatMsg, bridge was not defined");
}
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
log.debug(`Handling incoming chat from ${data.sender} (${data.conv.name})`);
data.message.body = entityDecode(data.message.body);
const acctId = Util.createRemoteId(data.account.protocol_id, data.account.username);
Expand Down Expand Up @@ -429,6 +431,7 @@ export class MatrixRoomHandler {
}

private async handleChatInvite(data: IChatInvite) {
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
if (!this.bridge) {
throw Error("Couldn't handleChatInvite, bridge was not defined");
}
Expand Down Expand Up @@ -465,6 +468,7 @@ export class MatrixRoomHandler {
}

private async handleRemoteUserState(data: IUserStateChanged) {
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
if (!this.bridge) {
throw Error("Couldn't handleRemoteUserState, bridge was not defined");
}
Expand Down Expand Up @@ -529,6 +533,7 @@ export class MatrixRoomHandler {
}

private async handleTopic(data: IChatTopicState) {
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
if (!this.bridge) {
throw Error("Couldn't handleTopic, bridge was not defined");
}
Expand Down Expand Up @@ -558,6 +563,7 @@ export class MatrixRoomHandler {
}
}
private async handleIMTyping(data: IChatTyping) {
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
if (!this.bridge) {
throw Error("Couldn't handleIMTyping, bridge was not defined");
}
Expand All @@ -579,6 +585,7 @@ export class MatrixRoomHandler {
}

private async handleChatTyping(data: IChatTyping) {
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
if (!this.bridge) {
throw Error("Couldn't handleTyping, bridge was not defined");
}
Expand All @@ -593,6 +600,7 @@ export class MatrixRoomHandler {
}

private async handleReadReceipt(data: IChatReadReceipt) {
data.sender = ProtoHacks.removeJabberResourceInMXID(data.account.protocol_id, data.sender)
if (!this.bridge) {
throw Error("Couldn't handleTyping, bridge was not defined");
}
Expand Down
7 changes: 7 additions & 0 deletions src/ProtoHacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,11 @@ export class ProtoHacks {
}
return senderId;
}

public static removeJabberResourceInMXID(protocolId: string, id: string): string {
if (protocolId === PRPL_XMPP) {
return id.split('/')[0]
}
return id;
}
}