forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxep0048.ts
65 lines (59 loc) · 1.71 KB
/
xep0048.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
64
65
// ====================================================================
// XEP-0048: Bookmarks
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0048.html
// Version: 1.1 (2007-11-07)
// ====================================================================
import { JID } from '../JID';
import {
attribute,
booleanAttribute,
childText,
DefinitionOptions,
JIDAttribute,
pubsubItemContentAliases
} from '../jxt';
import { NS_BOOKMARKS } from '../Namespaces';
import { PubsubItemContent } from './';
declare module './' {
export interface PrivateStorage {
bookmarks?: BookmarkStorage;
}
}
export interface BookmarkStorage extends PubsubItemContent {
itemType?: typeof NS_BOOKMARKS;
rooms?: MUCBookmark[];
}
export interface MUCBookmark {
jid: JID;
name?: string;
nick?: string;
autoJoin?: boolean;
password?: string;
}
const Protocol: DefinitionOptions[] = [
{
aliases: [
{ path: 'bookmarkStorage', impliedType: true },
{ path: 'iq.privateStorage.bookmarks', impliedType: true },
...pubsubItemContentAliases()
],
element: 'storage',
namespace: NS_BOOKMARKS,
type: NS_BOOKMARKS,
typeField: 'itemType'
},
{
aliases: [{ path: 'bookmarkStorage.rooms', multiple: true }],
element: 'conference',
fields: {
autoJoin: booleanAttribute('autojoin'),
jid: JIDAttribute('jid'),
name: attribute('name'),
nick: childText(null, 'nick'),
password: childText(null, 'password')
},
namespace: NS_BOOKMARKS
}
];
export default Protocol;