Skip to content

Commit

Permalink
Strophe doesn't signal auth failure, so imply it
Browse files Browse the repository at this point in the history
  • Loading branch information
singpolyma committed Jul 24, 2024
1 parent 49b5c55 commit b06a46f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion snikket/Client.hx
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ class Client extends EventEmitter {

stream.on("auth/password-needed", (data) -> {
fastMechanism = data.mechanisms?.find((mech) -> mech.canFast)?.name;
if (token == null || fastMechanism == null) {
if (token == null || (fastMechanism == null && data.mechanimsms != null)) {
this.trigger("auth/password-needed", { accountId: accountId() });
} else {
this.stream.trigger("auth/password", { password: token, mechanism: fastMechanism, fastCount: fastCount });
Expand Down
9 changes: 8 additions & 1 deletion snikket/streams/XmppStropheStream.hx
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,16 @@ class XmppStropheStream extends GenericStream {
stream.trigger("status/online", {});
}
if (event == untyped __cpp__("XMPP_CONN_DISCONNECT")) {
stream.trigger("status/offline", {});
if (!stream.ready) {
// Never connected, auth failure
stream.trigger("auth/fail", {});
} else {
stream.ready = false;
stream.trigger("status/offline", {});
}
}
if (event == untyped __cpp__("XMPP_CONN_FAIL")) {
stream.ready = false;
stream.trigger("status/offline", {});
}
}
Expand Down

0 comments on commit b06a46f

Please sign in to comment.