about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorFelix <felix@felix-zauberer.de>2021-07-30 23:17:14 +0200
committerFelix <felix@felix-zauberer.de>2021-07-30 23:17:14 +0200
commit87562d1b20f55503b551d50c7c409e1946db56a6 (patch)
tree5143665240b10dbad7714141445d0a990183cc16 /scripts
parentd8b16f35232b1b881b98685d41e6cdc47323e596 (diff)
downloadphp-xmpp-invitation-87562d1b20f55503b551d50c7c409e1946db56a6.tar.gz
Provide XMPP URI parameters in a hashmap
Diffstat (limited to 'scripts')
-rw-r--r--scripts/main.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/scripts/main.js b/scripts/main.js
index 92b0207..d8e8294 100644
--- a/scripts/main.js
+++ b/scripts/main.js
@@ -54,6 +54,16 @@
 		name = name.charAt(0).toUpperCase() + name.slice(1);
 
 		var xmpp_uri_parts = xmpp_uri.split("?");
+		var xmpp_params = {};
+
+		if (xmpp_uri_parts.length > 1) {
+			let parameter, parameters = xmpp_uri_parts[1].split(";")
+			for (parameter of parameters) {
+				let key_value = parameter.split("=")
+				xmpp_params[key_value[0]] = key_value.length > 1 ? key_value[1] : "";
+			}
+		}
+
 		xmpp_uri_parts[0] = encodeURIComponent(xmpp_uri_parts[0]) // URL-encode the JID only
 		var xmpp_uri_encoded = xmpp_uri_parts.join("?");