pidgin/pidgin

Parents 87a902172ff8
Children 58473fc5ee73
Add purple_util_write_data_to_*_file declarations
--- a/libpurple/util.c Sun Sep 25 21:57:30 2016 +0300
+++ b/libpurple/util.c Tue Sep 27 08:13:06 2016 +0300
@@ -90,7 +90,8 @@
}
/* If legacy directory for libpurple exists, move it to location following
-* xdg base dir spec. https://developer.pidgin.im/ticket/10029 */
+ * xdg base dir spec. https://developer.pidgin.im/ticket/10029
+ */
static void
migrate_to_xdg_base_dirs(void)
{
@@ -3062,9 +3063,9 @@
{
gchar *filename_full;
gboolean ret = FALSE;
-
+
g_return_val_if_fail(dir != NULL, FALSE);
-
+
purple_debug_misc("util", "Writing file %s to directory %s",
filename, dir);
@@ -3078,11 +3079,11 @@
return FALSE;
}
}
-
+
filename_full = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", dir, filename);
-
+
ret = purple_util_write_data_to_file_absolute(filename_full, data, size);
-
+
g_free(filename_full);
return ret;
}
--- a/libpurple/util.h Sun Sep 25 21:57:30 2016 +0300
+++ b/libpurple/util.h Tue Sep 27 08:13:06 2016 +0300
@@ -864,6 +864,54 @@
gssize size);
/**
+ * purple_util_write_data_to_cache_file:
+ * @filename: The basename of the file to write in the purple_cache_dir.
+ * @data: A null-terminated string of data to write.
+ * @size: The size of the data to save. If data is
+ * null-terminated you can pass in -1.
+ *
+ * Write a string of data to a file of the given name in the Purple
+ * cache directory ($HOME/.cache/purple by default).
+ *
+ * See purple_util_write_data_to_file()
+ *
+ * Returns: TRUE if the file was written successfully. FALSE otherwise.
+ */
+gboolean purple_util_write_data_to_cache_file(const char *filename, const char *data, gssize size);
+
+/**
+ * purple_util_write_data_to_config_file:
+ * @filename: The basename of the file to write in the purple_config_dir.
+ * @data: A null-terminated string of data to write.
+ * @size: The size of the data to save. If data is
+ * null-terminated you can pass in -1.
+ *
+ * Write a string of data to a file of the given name in the Purple
+ * config directory ($HOME/.config/purple by default).
+ *
+ * See purple_util_write_data_to_file()
+ *
+ * Returns: TRUE if the file was written successfully. FALSE otherwise.
+ */
+gboolean purple_util_write_data_to_config_file(const char *filename, const char *data, gssize size);
+
+/**
+ * purple_util_write_data_to_data_file:
+ * @filename: The basename of the file to write in the purple_data_dir.
+ * @data: A null-terminated string of data to write.
+ * @size: The size of the data to save. If data is
+ * null-terminated you can pass in -1.
+ *
+ * Write a string of data to a file of the given name in the Purple
+ * data directory ($HOME/.local/share/purple by default).
+ *
+ * See purple_util_write_data_to_file()
+ *
+ * Returns: TRUE if the file was written successfully. FALSE otherwise.
+ */
+gboolean purple_util_write_data_to_data_file(const char *filename, const char *data, gssize size);
+
+/**
* purple_util_write_data_to_file_absolute:
* @filename_full: Filename to write to
* @data: A null-terminated string of data to write.