| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2023-09-12 20:03:20 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2023-09-12 20:03:20 UTC |
| parent | cc45204fcde7a9f312263fdba573188de33acb24 |
| xmpp/Client.hx | +9 | -0 |
| xmpp/JID.hx | +4 | -0 |
diff --git a/xmpp/Client.hx b/xmpp/Client.hx index 7ea1947..2c574b8 100644 --- a/xmpp/Client.hx +++ b/xmpp/Client.hx @@ -72,6 +72,15 @@ class Client extends xmpp.EventEmitter { return chat; } + public function findAvailableChats(q:String, callback:(q:String, chatIds:Array<String>) -> Void) { + var jid = JID.parse(q); + if (jid.isValid()) { + callback(q, [jid.asBare().asString()]); + return; + } + callback(q, []); + } + public function chatActivity(chat: Chat) { var idx = chats.indexOf(chat); if (idx > 0) { diff --git a/xmpp/JID.hx b/xmpp/JID.hx index 7241470..aa49777 100644 --- a/xmpp/JID.hx +++ b/xmpp/JID.hx @@ -28,6 +28,10 @@ class JID { return new JID(this.node, this.domain); } + public function isValid():Bool { + return domain.indexOf(".") >= 0; + } + public function equals(rhs:JID):Bool { return ( this.node == rhs.node &&