im.pidgin.pidgin.2.2.2: 5e955b9c7baca4634c7900fe07511bbf4102e26a
lschiere at pidgin.im
lschiere at pidgin.im
Fri Oct 19 17:12:03 EDT 2007
-----------------------------------------------------------------
Revision: 5e955b9c7baca4634c7900fe07511bbf4102e26a
Ancestor: 6664bcbd0b8229766b68348d780da8bfc74b8130
Author: lschiere at pidgin.im
Date: 2007-10-19T18:30:30
Branch: im.pidgin.pidgin.2.2.2
Modified files:
libpurple/protocols/jabber/usermood.c libpurple/util.c
libpurple/util.h
ChangeLog:
applied changes from 1095e0c294d15e95c8909d270748c5253226bfe6
through a976c1dbb1135583dc67c67af14aa684fd4e18ee
applied changes from a976c1dbb1135583dc67c67af14aa684fd4e18ee
through 62ac0eb5b2ae2fda530b7230c8a903cc5ecd4513
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/usermood.c 5d8556a2035f4c81ad41dae42e3e04a1a9c4dce9
+++ libpurple/protocols/jabber/usermood.c 3d7f011435230f89499454118f49919bc8ab7937
@@ -26,6 +26,7 @@
#include <string.h>
#include "internal.h"
#include "request.h"
+#include "debug.h"
static const char *moodstrings[] = {
"afraid",
@@ -145,9 +146,26 @@ static void do_mood_set_from_fields(Purp
}
static void do_mood_set_from_fields(PurpleConnection *gc, PurpleRequestFields *fields) {
- JabberStream *js = gc->proto_data;
-
- jabber_mood_set(js, moodstrings[purple_request_fields_get_choice(fields, "mood")], purple_request_fields_get_string(fields, "text"));
+ JabberStream *js;
+ int max_mood_idx;
+ int selected_mood = purple_request_fields_get_choice(fields, "mood");
+
+ if (!PURPLE_CONNECTION_IS_VALID(gc)) {
+ purple_debug_error("jabber", "Unable to set mood; account offline.\n");
+ return;
+ }
+
+ js = gc->proto_data;
+
+ /* This is ugly, but protects us from unexpected values. */
+ for (max_mood_idx = 0; moodstrings[max_mood_idx]; max_mood_idx++);
+
+ if (selected_mood < 0 || selected_mood >= max_mood_idx) {
+ purple_debug_error("jabber", "Invalid mood index (%d) selected.\n", selected_mood);
+ return;
+ }
+
+ jabber_mood_set(js, moodstrings[selected_mood], purple_request_fields_get_string(fields, "text"));
}
static void do_mood_set_mood(PurplePluginAction *action) {
============================================================
--- libpurple/util.c 1d2f06348c95b34a2f103613e81c5c37a1476905
+++ libpurple/util.c 111e245693d8857b91838d187429f2b8603b31dd
@@ -2565,15 +2565,14 @@ purple_util_write_data_to_file(const cha
filename_full = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", user_dir, filename);
- ret = purple_util_write_data_to_file_absolute(filename_full,
- data,size);
+ ret = purple_util_write_data_to_file_absolute(filename_full, data, size);
g_free(filename_full);
return ret;
}
gboolean
-purple_util_write_data_to_file_absolute(const char *filename_full, const char *data, size_t size)
+purple_util_write_data_to_file_absolute(const char *filename_full, const char *data, gssize size)
{
gchar *filename_temp;
FILE *file;
============================================================
--- libpurple/util.h a4c51623a9a6ccdbed65ae17f8cf9d6f73541218
+++ libpurple/util.h b442b1700aeece6f1f6678fde481ea534404557d
@@ -607,7 +607,7 @@ gboolean
*
*/
gboolean
-purple_util_write_data_to_file_absolute(const char *filename_full, const char *data, size_t size);
+purple_util_write_data_to_file_absolute(const char *filename_full, const char *data, gssize size);
/**
* Read the contents of a given file and parse the results into an
More information about the Commits
mailing list