Wed, 23 May 2012 05:01:14 +0000
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?
| 17776 | 1 | /* |
| 2 | * purple - Jabber Protocol Plugin | |
| 3 | * | |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28321
diff
changeset
|
4 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28321
diff
changeset
|
5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
28321
diff
changeset
|
6 | * source distribution. |
| 17776 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
17779
773326802e26
Fixed whitespace to match the coding convention used in libpurple
Andreas Monitzer <am@adiumx.com>
parents:
17777
diff
changeset
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17776 | 16 | * GNU General Public License for more details. |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
28321
c8d617c408ab
Update various header copyrights thanks to licensecheck.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 17776 | 21 | * |
| 22 | */ | |
| 23 | ||
|
26703
17f9a4bef2a3
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents:
17784
diff
changeset
|
24 | #ifndef PURPLE_JABBER_USERMOOD_H_ |
|
17f9a4bef2a3
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents:
17784
diff
changeset
|
25 | #define PURPLE_JABBER_USERMOOD_H_ |
| 17776 | 26 | |
| 27 | #include "jabber.h" | |
| 28 | ||
| 29 | /* Implementation of XEP-0107 */ | |
| 30 | ||
| 31 | void jabber_mood_init(void); | |
| 32 | ||
|
32984
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
33 | /** |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
34 | * Sets / unsets the mood for the specified account. The mood passed in |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
35 | * must either be NULL, "", or one of the moods returned by |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
36 | * jabber_get_moods(). |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
37 | * |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
38 | * @param js The JabberStream object. |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
39 | * @param mood The mood to set, NULL, or "" |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
40 | * @param text Optional text that goes along with a mood. Only used when |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
41 | * setting a mood (not when unsetting a mood). |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
42 | * |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
43 | * @return FALSE if an invalid mood was specified, or TRUE otherwise. |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
44 | */ |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
45 | gboolean |
|
de7298a1dbe8
jabber: Validate user moods, and make the /mood cmd behave flexibly.
Paul Aurich <darkrain42@pidgin.im>
parents:
29825
diff
changeset
|
46 | jabber_mood_set(JabberStream *js, const char *mood, const char *text); |
| 17776 | 47 | |
|
29407
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
48 | PurpleMood *jabber_get_moods(PurpleAccount *account); |
|
e4140d21900d
Implemented the get_moods prpl function for XMPP. Enables the generic mood
Marcus Lundblad <malu@pidgin.im>
parents:
28322
diff
changeset
|
49 | |
|
26703
17f9a4bef2a3
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents:
17784
diff
changeset
|
50 | #endif /* PURPLE_JABBER_USERMOOD_H_ */ |