forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxep0231.ts
49 lines (42 loc) · 1.22 KB
/
xep0231.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
// ====================================================================
// XEP-0231: Bits of Binary
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0231.html
// Version: Version 1.0 (2008-09-03)
// ====================================================================
import { attribute, DefinitionOptions, integerAttribute, textBuffer } from '../jxt';
import { NS_BOB } from '../Namespaces';
declare module './' {
export interface Message {
bits?: Bits[];
}
export interface Presence {
bits?: Bits[];
}
export interface IQPayload {
bits?: Bits;
}
}
export interface Bits {
data?: Buffer;
cid: string;
maxAge?: number;
mediaType?: string;
}
const Protocol: DefinitionOptions = {
aliases: [
'iq.bits',
{ path: 'message.bits', multiple: true },
{ path: 'presence.bits', multiple: true },
{ path: 'iq.jingle.bits', multiple: true }
],
element: 'data',
fields: {
cid: attribute('cid'),
data: textBuffer('base64'),
maxAge: integerAttribute('max-age'),
mediaType: attribute('type')
},
namespace: NS_BOB
};
export default Protocol;