mirror of
https://git.sr.ht/~emerson/reflectionircd
synced 2025-08-05 16:59:10 +00:00
Fix #21
This commit is contained in:
parent
cac2153e40
commit
5b195d4de3
2 changed files with 27 additions and 4 deletions
|
@ -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 | ❌ | ❌ ||
|
||||
|
|
|
@ -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());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue