This commit is contained in:
emerson 2021-12-07 11:12:14 -05:00
parent cac2153e40
commit 5b195d4de3
No known key found for this signature in database
GPG key ID: 270669502DA603E3
2 changed files with 27 additions and 4 deletions

View file

@ -23,7 +23,7 @@ That said, it is usable for basic chatting.
| Name | M->I | I->M | Notes |
| ---- | :--: | :--: | ----- |
| text, notice, emote messages | ✅ | ✅ ||
| image, file, audio, video messages | 🟨 | ❌ | Show up as MXC links on IRC |
| image, file, audio, video messages | 🟨 | ❌ | Show up as links on IRC |
| Channel joins | ❌ | ❌ ||
| Channel parts | ❌ | ❌ ||
| Channel kicks | ❌ | ❌ ||

View file

@ -152,9 +152,6 @@ export class Channel {
}
joinMatrixUser(matrixUser: MatrixUser, event: any) {
// During initial sync, all past/present members are returned, so we filter out non-joined members
if (event["content"]["membership"] !== "join" && !this.matrixUsers.has(matrixUser.nick))
return;
this.matrixUsers.set(matrixUser.nick, matrixUser);
const prefix = matrixUser.getMask();
if (event) {
@ -168,6 +165,9 @@ export class Channel {
handleMatrixMember(event: any) {
const thisMatrixUser = this.server.getOrCreateMatrixUser(event["sender"]);
// During initial sync, all past/present members are returned, so we filter out non-joined members
if (event["content"]["membership"] !== "join" && !this.matrixUsers.has(thisMatrixUser.nick))
return;
this.matrixUsers.set(thisMatrixUser.nick, thisMatrixUser);
}
@ -225,4 +225,27 @@ export class Channel {
this.topic.set("text", event["content"]["topic"]);
this.topic.set("timestamp", event["origin_server_ts"].toString())
}
handleMatrixJoinRule(event: any) {
const rule = event["content"]?.["join_rule"];
if (!rule) {
console.log(`Warning: join rule not found in ${event}`);
return;
}
if (rule === "public") {
if (this.modes.has('i')) {
this.modes.delete('i');
this.ircUsers.forEach((user) => {
user.sendToAll(this.server.name, 'MODE', [this.name, '-i'], new Map());
});
}
} else {
if (!this.modes.has('i')) {
this.modes.set('i', '');
this.ircUsers.forEach((user) => {
user.sendToAll(this.server.name, 'MODE', [this.name, '+i'], new Map());
});
}
}
}
}