1// Copyright (c) 2017 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#![deny(missing_docs)]
8
9generate_element_enum!(
10 /// Enum representing all of the possible values of the XEP-0107 moods.
11 MoodEnum, "mood", MOOD, {
12 /// Impressed with fear or apprehension; in fear; apprehensive.
13 Afraid => "afraid",
14
15 /// Astonished; confounded with fear, surprise or wonder.
16 Amazed => "amazed",
17
18 /// Inclined to love; having a propensity to love, or to sexual enjoyment; loving, fond, affectionate, passionate, lustful, sexual, etc.
19 Amorous => "amorous",
20
21 /// Displaying or feeling anger, i.e., a strong feeling of displeasure, hostility or antagonism towards someone or something, usually combined with an urge to harm.
22 Angry => "angry",
23
24 /// To be disturbed or irritated, especially by continued or repeated acts.
25 Annoyed => "annoyed",
26
27 /// Full of anxiety or disquietude; greatly concerned or solicitous, esp. respecting something future or unknown; being in painful suspense.
28 Anxious => "anxious",
29
30 /// To be stimulated in one's feelings, especially to be sexually stimulated.
31 Aroused => "aroused",
32
33 /// Feeling shame or guilt.
34 Ashamed => "ashamed",
35
36 /// Suffering from boredom; uninterested, without attention.
37 Bored => "bored",
38
39 /// Strong in the face of fear; courageous.
40 Brave => "brave",
41
42 /// Peaceful, quiet.
43 Calm => "calm",
44
45 /// Taking care or caution; tentative.
46 Cautious => "cautious",
47
48 /// Feeling the sensation of coldness, especially to the point of discomfort.
49 Cold => "cold",
50
51 /// Feeling very sure of or positive about something, especially about one's own capabilities.
52 Confident => "confident",
53
54 /// Chaotic, jumbled or muddled.
55 Confused => "confused",
56
57 /// Feeling introspective or thoughtful.
58 Contemplative => "contemplative",
59
60 /// Pleased at the satisfaction of a want or desire; satisfied.
61 Contented => "contented",
62
63 /// Grouchy, irritable; easily upset.
64 Cranky => "cranky",
65
66 /// Feeling out of control; feeling overly excited or enthusiastic.
67 Crazy => "crazy",
68
69 /// Feeling original, expressive, or imaginative.
70 Creative => "creative",
71
72 /// Inquisitive; tending to ask questions, investigate, or explore.
73 Curious => "curious",
74
75 /// Feeling sad and dispirited.
76 Dejected => "dejected",
77
78 /// Severely despondent and unhappy.
79 Depressed => "depressed",
80
81 /// Defeated of expectation or hope; let down.
82 Disappointed => "disappointed",
83
84 /// Filled with disgust; irritated and out of patience.
85 Disgusted => "disgusted",
86
87 /// Feeling a sudden or complete loss of courage in the face of trouble or danger.
88 Dismayed => "dismayed",
89
90 /// Having one's attention diverted; preoccupied.
91 Distracted => "distracted",
92
93 /// Having a feeling of shameful discomfort.
94 Embarrassed => "embarrassed",
95
96 /// Feeling pain by the excellence or good fortune of another.
97 Envious => "envious",
98
99 /// Having great enthusiasm.
100 Excited => "excited",
101
102 /// In the mood for flirting.
103 Flirtatious => "flirtatious",
104
105 /// Suffering from frustration; dissatisfied, agitated, or discontented because one is unable to perform an action or fulfill a desire.
106 Frustrated => "frustrated",
107
108 /// Feeling appreciation or thanks.
109 Grateful => "grateful",
110
111 /// Feeling very sad about something, especially something lost; mournful; sorrowful.
112 Grieving => "grieving",
113
114 /// Unhappy and irritable.
115 Grumpy => "grumpy",
116
117 /// Feeling responsible for wrongdoing; feeling blameworthy.
118 Guilty => "guilty",
119
120 /// Experiencing the effect of favourable fortune; having the feeling arising from the consciousness of well-being or of enjoyment; enjoying good of any kind, as peace, tranquillity, comfort; contented; joyous.
121 Happy => "happy",
122
123 /// Having a positive feeling, belief, or expectation that something wished for can or will happen.
124 Hopeful => "hopeful",
125
126 /// Feeling the sensation of heat, especially to the point of discomfort.
127 Hot => "hot",
128
129 /// Having or showing a modest or low estimate of one's own importance; feeling lowered in dignity or importance.
130 Humbled => "humbled",
131
132 /// Feeling deprived of dignity or self-respect.
133 Humiliated => "humiliated",
134
135 /// Having a physical need for food.
136 Hungry => "hungry",
137
138 /// Wounded, injured, or pained, whether physically or emotionally.
139 Hurt => "hurt",
140
141 /// Favourably affected by something or someone.
142 Impressed => "impressed",
143
144 /// Feeling amazement at something or someone; or feeling a combination of fear and reverence.
145 InAwe => "in_awe",
146
147 /// Feeling strong affection, care, liking, or attraction..
148 InLove => "in_love",
149
150 /// Showing anger or indignation, especially at something unjust or wrong.
151 Indignant => "indignant",
152
153 /// Showing great attention to something or someone; having or showing interest.
154 Interested => "interested",
155
156 /// Under the influence of alcohol; drunk.
157 Intoxicated => "intoxicated",
158
159 /// Feeling as if one cannot be defeated, overcome or denied.
160 Invincible => "invincible",
161
162 /// Fearful of being replaced in position or affection.
163 Jealous => "jealous",
164
165 /// Feeling isolated, empty, or abandoned.
166 Lonely => "lonely",
167
168 /// Unable to find one's way, either physically or emotionally.
169 Lost => "lost",
170
171 /// Feeling as if one will be favored by luck.
172 Lucky => "lucky",
173
174 /// Causing or intending to cause intentional harm; bearing ill will towards another; cruel; malicious.
175 Mean => "mean",
176
177 /// Given to sudden or frequent changes of mind or feeling; temperamental.
178 Moody => "moody",
179
180 /// Easily agitated or alarmed; apprehensive or anxious.
181 Nervous => "nervous",
182
183 /// Not having a strong mood or emotional state.
184 Neutral => "neutral",
185
186 /// Feeling emotionally hurt, displeased, or insulted.
187 Offended => "offended",
188
189 /// Feeling resentful anger caused by an extremely violent or vicious attack, or by an offensive, immoral, or indecent act.
190 Outraged => "outraged",
191
192 /// Interested in play; fun, recreational, unserious, lighthearted; joking, silly.
193 Playful => "playful",
194
195 /// Feeling a sense of one's own worth or accomplishment.
196 Proud => "proud",
197
198 /// Having an easy-going mood; not stressed; calm.
199 Relaxed => "relaxed",
200
201 /// Feeling uplifted because of the removal of stress or discomfort.
202 Relieved => "relieved",
203
204 /// Feeling regret or sadness for doing something wrong.
205 Remorseful => "remorseful",
206
207 /// Without rest; unable to be still or quiet; uneasy; continually moving.
208 Restless => "restless",
209
210 /// Feeling sorrow; sorrowful, mournful.
211 Sad => "sad",
212
213 /// Mocking and ironical.
214 Sarcastic => "sarcastic",
215
216 /// Pleased at the fulfillment of a need or desire.
217 Satisfied => "satisfied",
218
219 /// Without humor or expression of happiness; grave in manner or disposition; earnest; thoughtful; solemn.
220 Serious => "serious",
221
222 /// Surprised, startled, confused, or taken aback.
223 Shocked => "shocked",
224
225 /// Feeling easily frightened or scared; timid; reserved or coy.
226 Shy => "shy",
227
228 /// Feeling in poor health; ill.
229 Sick => "sick",
230
231 /// Feeling the need for sleep.
232 Sleepy => "sleepy",
233
234 /// Acting without planning; natural; impulsive.
235 Spontaneous => "spontaneous",
236
237 /// Suffering emotional pressure.
238 Stressed => "stressed",
239
240 /// Capable of producing great physical force; or, emotionally forceful, able, determined, unyielding.
241 Strong => "strong",
242
243 /// Experiencing a feeling caused by something unexpected.
244 Surprised => "surprised",
245
246 /// Showing appreciation or gratitude.
247 Thankful => "thankful",
248
249 /// Feeling the need to drink.
250 Thirsty => "thirsty",
251
252 /// In need of rest or sleep.
253 Tired => "tired",
254
255 /// [Feeling any emotion not defined here.]
256 Undefined => "undefined",
257
258 /// Lacking in force or ability, either physical or emotional.
259 Weak => "weak",
260
261 /// Thinking about unpleasant things that have happened or that might happen; feeling afraid and unhappy.
262 Worried => "worried",
263 }
264);
265
266generate_elem_id!(
267 /// Free-form text description of the mood.
268 Text, "text", MOOD
269);
270
271#[cfg(test)]
272mod tests {
273 use super::*;
274 use try_from::TryFrom;
275 use minidom::Element;
276
277 #[test]
278 fn test_simple() {
279 let elem: Element = "<happy xmlns='http://jabber.org/protocol/mood'/>".parse().unwrap();
280 let mood = MoodEnum::try_from(elem).unwrap();
281 assert_eq!(mood, MoodEnum::Happy);
282 }
283
284 #[test]
285 fn test_text() {
286 let elem: Element = "<text xmlns='http://jabber.org/protocol/mood'>Yay!</text>".parse().unwrap();
287 let text = Text::try_from(elem).unwrap();
288 assert_eq!(text.0, String::from("Yay!"));
289 }
290}