| 109 #define PURPLE_NO_TZ_OFF -500000 |
109 #define PURPLE_NO_TZ_OFF -500000 |
| 110 |
110 |
| 111 /**************************************************************************/ |
111 /**************************************************************************/ |
| 112 /* Path/Filename Functions */ |
112 /* Path/Filename Functions */ |
| 113 /**************************************************************************/ |
113 /**************************************************************************/ |
| 114 /** |
|
| 115 * purple_util_write_data_to_file: |
|
| 116 * @filename: The basename of the file to write in the purple_user_dir. |
|
| 117 * @data: A string of data to write. |
|
| 118 * @size: The size of the data to save. If data is |
|
| 119 * null-terminated you can pass in -1. |
|
| 120 * |
|
| 121 * Write a string of data to a file of the given name in the Purple |
|
| 122 * user directory ($HOME/.purple by default). The data is typically |
|
| 123 * a serialized version of one of Purple's config files, such as |
|
| 124 * prefs.xml, accounts.xml, etc. And the string is typically |
|
| 125 * obtained using purple_xmlnode_to_formatted_str. However, this function |
|
| 126 * should work fine for saving binary files as well. |
|
| 127 * |
|
| 128 * Returns: TRUE if the file was written successfully. FALSE otherwise. |
|
| 129 * |
|
| 130 * Deprecated: Use purple_util_write_data_to_cache_file(), |
|
| 131 * purple_util_write_data_to_config_file() or |
|
| 132 * purple_util_write_data_to_data_file() instead. |
|
| 133 */ |
|
| 134 G_DEPRECATED_FOR(purple_util_write_data_to_cache_file or purple_util_write_data_to_config_file or purple_util_write_data_to_data_file) |
|
| 135 gboolean purple_util_write_data_to_file(const char *filename, const char *data, |
|
| 136 gssize size); |
|
| 137 |
114 |
| 138 /** |
115 /** |
| 139 * purple_util_write_data_to_cache_file: |
116 * purple_util_write_data_to_cache_file: |
| 140 * @filename: The basename of the file to write in the purple_cache_dir. |
117 * @filename: The basename of the file to write in the purple_cache_dir. |
| 141 * @data: A string of data to write. |
118 * @data: A string of data to write. |
| 183 * |
160 * |
| 184 * Returns: TRUE if the file was written successfully. FALSE otherwise. |
161 * Returns: TRUE if the file was written successfully. FALSE otherwise. |
| 185 */ |
162 */ |
| 186 gboolean |
163 gboolean |
| 187 purple_util_write_data_to_data_file(const char *filename, const char *data, gssize size); |
164 purple_util_write_data_to_data_file(const char *filename, const char *data, gssize size); |
| 188 |
|
| 189 /** |
|
| 190 * purple_util_write_data_to_file_absolute: |
|
| 191 * @filename_full: Filename to write to |
|
| 192 * @data: A string of data to write. |
|
| 193 * @size: The size of the data to save. If data is |
|
| 194 * null-terminated you can pass in -1. |
|
| 195 * |
|
| 196 * Write data to a file using the absolute path. |
|
| 197 * |
|
| 198 * This exists for Glib backwards compatibility reasons. |
|
| 199 * |
|
| 200 * See purple_util_write_data_to_file() |
|
| 201 * |
|
| 202 * Returns: TRUE if the file was written successfully. FALSE otherwise. |
|
| 203 * |
|
| 204 * Deprecated: 3.0.0: Use g_file_set_contents() instead. |
|
| 205 */ |
|
| 206 G_DEPRECATED_FOR(g_file_set_contents) |
|
| 207 gboolean |
|
| 208 purple_util_write_data_to_file_absolute(const char *filename_full, const char *data, gssize size); |
|
| 209 |
|
| 210 /** |
|
| 211 * purple_util_read_xml_from_file: |
|
| 212 * @filename: The basename of the file to open in the purple_user_dir. |
|
| 213 * @description: A very short description of the contents of this |
|
| 214 * file. This is used in error messages shown to the |
|
| 215 * user when the file can not be opened. For example, |
|
| 216 * "preferences," or "buddy pounces." |
|
| 217 * |
|
| 218 * Read the contents of a given file and parse the results into an |
|
| 219 * PurpleXmlNode tree structure. This is intended to be used to read |
|
| 220 * Purple's configuration xml files (prefs.xml, pounces.xml, etc.) |
|
| 221 * |
|
| 222 * Returns: An PurpleXmlNode tree of the contents of the given file. Or NULL, if |
|
| 223 * the file does not exist or there was an error reading the file. |
|
| 224 * |
|
| 225 * Deprecated: Use purple_util_read_xml_from_cache_file(), |
|
| 226 * purple_util_read_xml_from_config_file() or |
|
| 227 * purple_util_read_xml_from_data_file() instead. |
|
| 228 */ |
|
| 229 G_DEPRECATED_FOR(purple_util_read_xml_from_cache_file or purple_util_read_xml_from_config_file or purple_util_read_xml_from_data_file) |
|
| 230 PurpleXmlNode *purple_util_read_xml_from_file(const char *filename, |
|
| 231 const char *description); |
|
| 232 |
165 |
| 233 /** |
166 /** |
| 234 * purple_util_read_xml_from_cache_file: |
167 * purple_util_read_xml_from_cache_file: |
| 235 * @filename: The basename of the file to open in the purple_cache_dir. |
168 * @filename: The basename of the file to open in the purple_cache_dir. |
| 236 * @description: A very short description of the contents of this |
169 * @description: A very short description of the contents of this |