Skip to content

Commit be9d7de

Browse files
committed
Merge branch 'master' of github.com:legastero/stanza
2 parents 0b1917e + 9b0105e commit be9d7de

8 files changed

Lines changed: 64 additions & 0 deletions

File tree

docs/Supported_XEP_Formats.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,5 @@
102102
| [XEP-0371](https://xmpp.org/extensions/xep-0371.html) | Jingle ICE Transport Method | 0.2 | [Source](../src/protocol/xep0176.ts) | [Test Cases](../test/protocol-cases/xep0371) |
103103
| [XEP-0380](https://xmpp.org/extensions/xep-0380.html) | Explicit Message Encryption | 0.2.0 | [Source](../src/protocol/xep0380.ts) | [Test Cases](../test/protocol-cases/xep0380) |
104104
| [XEP-0384](https://xmpp.org/extensions/xep-0384.html) | OMEMO Encryption | 0.3.0 | [Source](../src/protocol/xep0384.ts) | [Test Cases](../test/protocol-cases/xep0384) |
105+
| [XEP-0421](https://xmpp.org/extensions/xep-0421.html) | Occupant identifiers for semi-anonymous MUCs | 1.0.1 | [Source](../src/protocol/xep0421.ts) | [Test Cases](../test/protocol-cases/xep0421) |
105106
| [XEP-0432](https://xmpp.org/extensions/xep-0432.html) | Simple JSON Messaging | 0.1.0 | [Source](../src/protocol/xep0335.ts) | [Test Cases](../test/protocol-cases/xep0432) |

src/Namespaces.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,9 @@ export const NS_OMEMO_AXOLOTL_BUNDLES = 'eu.siacs.conversations.axolotl.bundles'
378378
export const NS_OMEMO_AXOLOTL_BUNDLE = (deviceId: string): string =>
379379
`${NS_OMEMO_AXOLOTL_BUNDLES}:${deviceId}`;
380380

381+
// XEP-0421
382+
export const NS_OCCUPANT_0 = 'urn:xmpp:occupant-id:0';
383+
381384
// XEP-0432
382385
export const NS_JSON_MESSAGE_0 = 'urn:xmpp:json-msg:0';
383386

src/protocol/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export * from './xep0359';
9898
export * from './xep0363';
9999
export * from './xep0380';
100100
export * from './xep0384';
101+
export * from './xep0421';
101102
export * from './xrd';
102103

103104
import RFC3921 from './rfc3921';
@@ -180,6 +181,7 @@ import XEP0359 from './xep0359';
180181
import XEP0363 from './xep0363';
181182
import XEP0380 from './xep0380';
182183
import XEP0384 from './xep0384';
184+
import XEP0421 from './xep0421';
183185
import XRD from './xrd';
184186

185187
const Protocol: Array<DefinitionOptions | DefinitionOptions[]> = [
@@ -263,6 +265,7 @@ const Protocol: Array<DefinitionOptions | DefinitionOptions[]> = [
263265
XEP0363,
264266
XEP0380,
265267
XEP0384,
268+
XEP0421,
266269
XRD
267270
];
268271

src/protocol/xep0421.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// ====================================================================
2+
// XEP-0421: Occupant identifiers for semi-anonymous MUCs
3+
// --------------------------------------------------------------------
4+
// Source: https://xmpp.org/extensions/xep-0421.html
5+
// Version: 1.0.1 (2025-04-09)
6+
// ====================================================================
7+
8+
import {
9+
childAttribute,
10+
DefinitionOptions,
11+
extendMessage,
12+
extendPresence
13+
} from '../jxt';
14+
15+
import { NS_OCCUPANT_0 } from '../Namespaces';
16+
17+
declare module './' {
18+
export interface Presence {
19+
occupantId?: string;
20+
}
21+
export interface Message {
22+
occupantId?: string;
23+
}
24+
}
25+
26+
const Protocol: DefinitionOptions[] = [
27+
extendPresence({
28+
occupantId: childAttribute(NS_OCCUPANT_0, 'occupant-id', 'id')
29+
}),
30+
extendMessage({
31+
occupantId: childAttribute(NS_OCCUPANT_0, 'occupant-id', 'id')
32+
})
33+
];
34+
export default Protocol;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
"message",
3+
{
4+
"from": "juliet@capulet.com/balcony",
5+
"lang": "",
6+
"occupantId": "dd72603deec90a38ba552f7c68cbcc61bca202cd"
7+
}
8+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<message from='juliet@capulet.com/balcony'>
2+
<occupant-id xmlns='urn:xmpp:occupant-id:0' id='dd72603deec90a38ba552f7c68cbcc61bca202cd' />
3+
</message>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
"presence",
3+
{
4+
"from": "juliet@capulet.com/balcony",
5+
"lang": "",
6+
"priority": 0,
7+
"occupantId": "dd72603deec90a38ba552f7c68cbcc61bca202cd"
8+
}
9+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<presence from='juliet@capulet.com/balcony'>
2+
<occupant-id xmlns='urn:xmpp:occupant-id:0' id='dd72603deec90a38ba552f7c68cbcc61bca202cd' />
3+
</presence>

0 commit comments

Comments
 (0)