Skip to content

Commit

Permalink
Use trusted bit to control if we should allow subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Nov 27, 2024
1 parent 7350a86 commit d4b04f1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions snikket/Chat.hx
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,7 @@ abstract class Chat {
this.avatarSha1 = sha1;
}

@:allow(snikket)
private function setTrusted(trusted:Bool) {
public function setTrusted(trusted:Bool) {
this.trusted = trusted;
}

Expand Down Expand Up @@ -850,7 +849,7 @@ class DirectChat extends Chat {
(response) -> {
if (response.attr.get("type") == "error") return;
stream.sendStanza(new Stanza("presence", { to: chatId, type: "subscribe", id: ID.short() }));
stream.sendStanza(new Stanza("presence", { to: chatId, type: "subscribed", id: ID.short() }));
if (isTrusted()) stream.sendStanza(new Stanza("presence", { to: chatId, type: "subscribed", id: ID.short() }));
}
);
}
Expand Down

0 comments on commit d4b04f1

Please sign in to comment.