forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep0131.ts
50 lines (45 loc) · 1.17 KB
/
xep0131.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
39
40
41
42
43
44
45
46
47
48
49
50
// ====================================================================
// XEP-0131: Stanza Headers and Internet Metadata
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0131.html
// Version: 1.2 (2006-07-12)
// ====================================================================
import {
attribute,
DefinitionOptions,
extendMessage,
extendPresence,
splicePath,
text
} from '../jxt';
import { NS_SHIM } from '../Namespaces';
declare module './' {
export interface Message {
headers?: StanzaHeader[];
}
export interface Presence {
headers?: StanzaHeader[];
}
}
export interface StanzaHeader {
name: string;
value?: string;
}
const Protocol: DefinitionOptions[] = [
extendMessage({
headers: splicePath(NS_SHIM, 'headers', 'header', true)
}),
extendPresence({
headers: splicePath(NS_SHIM, 'headers', 'header', true)
}),
{
element: 'header',
fields: {
name: attribute('name'),
value: text()
},
namespace: NS_SHIM,
path: 'header'
}
];
export default Protocol;