-
Notifications
You must be signed in to change notification settings - Fork 251
/
xep0261.ts
48 lines (44 loc) · 1.49 KB
/
xep0261.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
// ====================================================================
// XEP-0261: Jingle In-Band Bytestreams Transport Method
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0047.html
// Version: 1.0 (2011-09-23)
// ====================================================================
import {
attribute,
DefinitionOptions,
integerAttribute,
TranslationContext,
XMLElement
} from '../jxt';
import { NS_JINGLE_IBB_1 } from '../Namespaces';
import { JingleTransport } from './';
export interface JingleIBB extends JingleTransport {
transportType: typeof NS_JINGLE_IBB_1;
sid: string;
blockSize?: number;
ack?: boolean;
}
const Protocol: DefinitionOptions = {
element: 'transport',
fields: {
ack: {
importer(xml: XMLElement, context: TranslationContext): boolean {
const stanza = attribute('stanza', 'iq').importer(xml, context);
return stanza !== 'message';
},
exporter(xml: XMLElement, data: boolean, context: TranslationContext) {
if (data === false) {
attribute('stanza').exporter(xml, 'message', context);
}
}
},
blockSize: integerAttribute('block-size'),
sid: attribute('sid')
},
namespace: NS_JINGLE_IBB_1,
path: 'iq.jingle.contents.transport',
type: NS_JINGLE_IBB_1,
typeField: 'transportType'
};
export default Protocol;