XMPP invitation landing page, without javascript
URIs: Add Contact Invitation with IBR
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | index.php | 4 | ||||
| -rw-r--r-- | lang/en.json | 6 |
3 files changed, 10 insertions, 1 deletions
@@ -39,6 +39,7 @@ For the JID romeo@xmpp.example, it will create the following page ([live example * [xmpp:name@muc.example.com?join](https://zachdecook.com/chat?xmpp:name@muc.example.com?join) * Registration with pre-defined account name ([XEP-0445](https://xmpp.org/extensions/xep-0445.html#sect-idm46085194296336)): [xmpp:juliet@example.com?register;preauth=TOKEN](https://zachdecook.com/chat?xmpp:juliet@example.com?register;preauth=TOKEN) * Registration on a server ([XEP-0445](https://xmpp.org/extensions/xep-0445.html#sect-idm46085194293584)): [xmpp:example.com?register;preauth=TOKEN](https://zachdecook.com/chat?xmpp:example.com?register;preauth=TOKEN) +* Contact Invitation with IBR ([XEP-0445](https://xmpp.org/extensions/xep-0445.html#sect-idm46085194290992)) [xmpp:romeo@example.com?roster;preauth=TOKEN;ibr=y](https://zachdecook.com/chat?xmpp:romeo@example.com?roster;preauth=TOKEN;ibr=y) ## Design decisions @@ -19,6 +19,7 @@ $uri = "xmpp:" . $uri; } // TODO: Better invitation type detection. + $parsed = parse_url($uri); $action = $lang->chat; if ( str_contains($uri, '?join') ) { $action = $lang->muc; @@ -27,8 +28,9 @@ if ( str_contains($uri, "@") ) { $action = $lang->register_name; } + } elseif ( str_contains($parsed['query'], 'ibr=y') ) { + $action = $lang->ibr; } - $parsed = parse_url($uri); $name = explode("@", $parsed['path'])[0]; $server = explode("@", $parsed['path'])[1] ?? $name; function t($template) { diff --git a/lang/en.json b/lang/en.json index e5e0677..7747caf 100644 --- a/lang/en.json +++ b/lang/en.json @@ -23,6 +23,12 @@ "button": "Register as {{name}}@{{server}}", "":"" }, + "ibr": { + "title": "Invitation from {{Name}}", + "heading": "{{Name}} has invited you to chat", + "button": "Chat with {{Name}} on {{server}}", + "":"" + }, "clients": "You need to install an XMPP client to access the XMPP network.", "recommend": "Here are the most commonly used clients for {{os}}:", "checkfulllist": "See the <a href='https://xmpp.org/software/clients/'>full list</a> of XMPP clients for other platforms and devices.", |