forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep0280.ts
63 lines (56 loc) · 1.52 KB
/
xep0280.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-0280: Message Carbons
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0280.html
// Version: 0.12.0 (2017-02-16)
// ====================================================================
import { addAlias, DefinitionOptions } from '../jxt';
import { NS_CARBONS_2, NS_FORWARD_0 } from '../Namespaces';
import { Forward } from './';
declare module './' {
export interface Message {
carbon?: CarbonMessage;
}
export interface IQPayload {
carbons?: CarbonControl;
}
}
export interface CarbonControl {
action: 'enable' | 'disable';
}
export interface CarbonMessage {
type: 'sent' | 'received';
forward: Forward;
}
const Protocol: DefinitionOptions[] = [
addAlias(NS_FORWARD_0, 'forwarded', ['message.carbon.forward']),
{
element: 'enable',
namespace: NS_CARBONS_2,
path: 'iq.carbons',
type: 'enable',
typeField: 'action'
},
{
element: 'disable',
namespace: NS_CARBONS_2,
path: 'iq.carbons',
type: 'disable',
typeField: 'action'
},
{
element: 'sent',
namespace: NS_CARBONS_2,
path: 'message.carbon',
type: 'sent',
typeField: 'type'
},
{
element: 'received',
namespace: NS_CARBONS_2,
path: 'message.carbon',
type: 'received',
typeField: 'type'
}
];
export default Protocol;