| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-04-16 13:55:31 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2024-04-16 13:55:31 UTC |
| parent | 9c0da799340834a6c3e02469f5a19be419d9c35a |
| snikket/Client.hx | +7 | -3 |
diff --git a/snikket/Client.hx b/snikket/Client.hx index a449382..3342f11 100644 --- a/snikket/Client.hx +++ b/snikket/Client.hx @@ -581,7 +581,6 @@ class Client extends EventEmitter { public function findAvailableChats(q:String, callback:(String, Array<AvailableChat>) -> Void) { var results = []; final query = StringTools.trim(q); - final jid = JID.parse(query); final checkAndAdd = (jid) -> { final discoGet = new DiscoInfoGet(jid.asString()); discoGet.onFinished(() -> { @@ -602,8 +601,13 @@ class Client extends EventEmitter { }); sendQuery(discoGet); }; - if (jid.isValid()) { - checkAndAdd(jid); + if (StringTools.startsWith(query, "xmpp:")) { + checkAndAdd(JID.parse(query.substr(5))); + } else { + final jid = JID.parse(query); + if (jid.isValid()) { + checkAndAdd(jid); + } } for (chat in chats) { if (chat.isTrusted()) {