forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxep0359.ts
38 lines (34 loc) · 1.06 KB
/
xep0359.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// ====================================================================
// XEP-0359: Unique and Stable Stanza IDs
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0359.html
// Version: 0.5.0 (2017-08-23)
// ====================================================================
import { JID } from '../JID';
import { attribute, childAttribute, DefinitionOptions, extendMessage, JIDAttribute } from '../jxt';
import { NS_SID_0 } from '../Namespaces';
declare module './' {
export interface Message {
originId?: string;
stanzaIds?: StanzaId[];
}
}
export interface StanzaId {
id: string;
by: JID;
}
const Protocol: DefinitionOptions[] = [
extendMessage({
originId: childAttribute(NS_SID_0, 'origin-id', 'id')
}),
{
aliases: [{ path: 'message.stanzaIds', multiple: true }],
element: 'stanza-id',
fields: {
by: JIDAttribute('by'),
id: attribute('id')
},
namespace: NS_SID_0
}
];
export default Protocol;