Mercurial > pidgin
annotate libpurple/protocols/jabber/usermood.h @ 32777:3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
A user in Pidgin running "/mood ?" or "/mood -" would result in invalid
XML being sent to the server (similar to #14342, except '<-/>' or '<?/>').
Prevent this by ensuring the user is specifying something from the list.
The /mood command will also now try to treat its entire arguments as
a single string, and set that as the mood -- I figure this is what a
user would expect?
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 23 May 2012 05:01:14 +0000 |
parents | 5e7ff3ed7ad0 |
children |
rev | line source |
---|---|
17842
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
1 /* |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
2 * purple - Jabber Protocol Plugin |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
3 * |
28048
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28047
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28047
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
28047
diff
changeset
|
6 * source distribution. |
17842
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
7 * |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
11 * (at your option) any later version. |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
12 * |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17845
2e0799b916b9
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <pidgin@monitzer.com>
parents:
17843
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17842
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
17 * |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
28047
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26481
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
17842
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
21 * |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
22 */ |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
23 |
26481
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
17850
diff
changeset
|
24 #ifndef PURPLE_JABBER_USERMOOD_H_ |
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
17850
diff
changeset
|
25 #define PURPLE_JABBER_USERMOOD_H_ |
17842
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
26 |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
27 #include "jabber.h" |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
28 |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
29 /* Implementation of XEP-0107 */ |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
30 |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
31 void jabber_mood_init(void); |
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
32 |
32777
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
33 /** |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
34 * Sets / unsets the mood for the specified account. The mood passed in |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
35 * must either be NULL, "", or one of the moods returned by |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
36 * jabber_get_moods(). |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
37 * |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
38 * @param js The JabberStream object. |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
39 * @param mood The mood to set, NULL, or "" |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
40 * @param text Optional text that goes along with a mood. Only used when |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
41 * setting a mood (not when unsetting a mood). |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
42 * |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
43 * @return FALSE if an invalid mood was specified, or TRUE otherwise. |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
44 */ |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
45 gboolean |
3b1070cb4f29
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <paul@darkrain42.org>
parents:
29545
diff
changeset
|
46 jabber_mood_set(JabberStream *js, const char *mood, const char *text); |
17842
a0cd74d7b51e
forgot to add usermood.[hc]
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
47 |
29463
f3654983e1da
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
48 PurpleMood *jabber_get_moods(PurpleAccount *account); |
f3654983e1da
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <ml@update.uu.se>
parents:
28048
diff
changeset
|
49 |
26481
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
17850
diff
changeset
|
50 #endif /* PURPLE_JABBER_USERMOOD_H_ */ |