forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep0033.ts
63 lines (59 loc) · 1.72 KB
/
xep0033.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
51
52
53
54
55
56
57
58
59
60
61
62
63
// ====================================================================
// XEP-0033: Extended Stanza Addressing
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0033.html
// Version: 1.2.1 (2017-01-11)
// --------------------------------------------------------------------
import { JID } from '../JID';
import {
attribute,
booleanAttribute,
childAlternateLanguageText,
DefinitionOptions,
extendMessage,
extendPresence,
JIDAttribute,
LanguageSet,
splicePath
} from '../jxt';
import { NS_ADDRESS } from '../Namespaces';
declare module './' {
export interface Message {
addresses?: ExtendedAddress[];
}
export interface Presence {
addresses?: ExtendedAddress[];
}
}
export interface ExtendedAddress {
type: string;
jid?: JID;
uri?: string;
node?: string;
description?: string;
alternateLanguageDescriptions?: LanguageSet<string>;
delivered?: boolean;
}
const Protocol: DefinitionOptions[] = [
extendMessage({
addresses: splicePath(NS_ADDRESS, 'addresses', 'extendedAddress', true)
}),
extendPresence({
addresses: splicePath(NS_ADDRESS, 'addresses', 'extendedAddress', true)
}),
{
element: 'address',
fields: {
alternateLanguageDescriptions: childAlternateLanguageText(null, 'desc'),
delivered: booleanAttribute('delivered'),
description: attribute('desc'),
jid: JIDAttribute('jid'),
node: attribute('node'),
type: attribute('type'),
uri: attribute('uri')
},
namespace: NS_ADDRESS,
path: 'extendedAddress'
}
];
export default Protocol;