forked from legastero/stanza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxep0107.ts
46 lines (40 loc) · 1.24 KB
/
xep0107.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
// ====================================================================
// XEP-0107: User Mood
// --------------------------------------------------------------------
// Source: https://xmpp.org/extensions/xep-0107.html
// Version: 1.2.1 (2018-03-13)
// ====================================================================
import { USER_MOODS } from '../Constants';
import {
childAlternateLanguageText,
childEnum,
childText,
DefinitionOptions,
LanguageSet,
pubsubItemContentAliases
} from '../jxt';
import { NS_MOOD } from '../Namespaces';
import { PubsubItemContent } from './';
declare module './' {
export interface Message {
mood?: UserMood;
}
}
export interface UserMood extends PubsubItemContent {
itemType?: typeof NS_MOOD;
value?: string;
text?: string;
alternateLanguageText?: LanguageSet<string>;
}
const Protocol: DefinitionOptions = {
aliases: [{ path: 'message.mood', impliedType: true }, ...pubsubItemContentAliases()],
element: 'mood',
fields: {
alternateLanguageText: childAlternateLanguageText(null, 'text'),
text: childText(null, 'text'),
value: childEnum(null, USER_MOODS)
},
namespace: NS_MOOD,
type: NS_MOOD
};
export default Protocol;