comparison src/util.h @ 10425:9903182f2aac

[gaim-migrate @ 11677] Added a util function to read an xml file and parse it into an xmlnode tree Changed accounts.xml reading to use xmlnode's committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 26 Dec 2004 22:52:52 +0000
parents 5b7a74d397cc
children f7f06cb69d5e
comparison
equal deleted inserted replaced
10424:108151be77a3 10425:9903182f2aac
29 #define _GAIM_UTIL_H_ 29 #define _GAIM_UTIL_H_
30 30
31 #include <stdio.h> 31 #include <stdio.h>
32 32
33 #include "account.h" 33 #include "account.h"
34 #include "xmlnode.h"
34 35
35 #ifdef __cplusplus 36 #ifdef __cplusplus
36 extern "C" { 37 extern "C" {
37 #endif 38 #endif
38 39
393 */ 394 */
394 gboolean gaim_util_write_data_to_file(const char *filename, const char *data, 395 gboolean gaim_util_write_data_to_file(const char *filename, const char *data,
395 size_t size); 396 size_t size);
396 397
397 /** 398 /**
399 * Read the contents of a given file and parse the results into an
400 * xmlnode tree structure. This is intended to be used to read
401 * Gaim's configuration xml files (prefs.xml, pounces.xml, etc.)
402 *
403 * @param filename The basename of the file to open in the gaim_user_dir.
404 * @param description A very short description of the contents of this
405 * file. This is used in error messages shown to the
406 * user when the file can not be opened. For example,
407 * "preferences," or "buddy pounces."
408 *
409 * @return An xmlnode tree of the contents of the given file. Or NULL, if
410 * the file does not exist or there was an error reading the file.
411 */
412 xmlnode *gaim_util_read_xml_from_file(const char *filename,
413 const char *description);
414
415 /**
398 * Creates a temporary file and returns a file pointer to it. 416 * Creates a temporary file and returns a file pointer to it.
399 * 417 *
400 * This is like mkstemp(), but returns a file pointer and uses a 418 * This is like mkstemp(), but returns a file pointer and uses a
401 * pre-set template. It uses the semantics of tempnam() for the 419 * pre-set template. It uses the semantics of tempnam() for the
402 * directory to use and allocates the space for the file path. 420 * directory to use and allocates the space for the file path.