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