git » sdk » commit b5377e3

Allow finding chat by vcard

author Stephen Paul Weber
2025-11-06 04:45:11 UTC
committer Stephen Paul Weber
2025-11-06 04:45:11 UTC
parent c34e4886c391f5bb0d23af52035111807b4adab9

Allow finding chat by vcard

Using IMPP field

borogove/Client.hx +4 -0

diff --git a/borogove/Client.hx b/borogove/Client.hx
index c750fd3..bb9c56f 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -904,9 +904,13 @@ class Client extends EventEmitter {
 			});
 			sendQuery(discoGet);
 		};
+		final vcard_regex = ~/\nIMPP[^:]*:xmpp:(.+)\n/;
 		final jid = if (StringTools.startsWith(query, "xmpp:")) {
 			final parts = query.substr(5).split("?");
 			JID.parse(StringTools.urlDecode(parts[0]));
+		} else if (StringTools.startsWith(query, "BEGIN:VCARD") && vcard_regex.match(query)) {
+			final parts = vcard_regex.matched(1).split("?");
+			JID.parse(StringTools.urlDecode(parts[0]));
 		} else {
 			JID.parse(query);
 		}