*
* You should have received a copy of the GNU Lesser General Public
* License along with this code; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
+#include "empathy-plist.h"
#include <string.h>
-#include <libxml/parser.h>
#include <libxml/tree.h>
-#include <telepathy-glib/util.h>
-#include <telepathy-glib/dbus.h>
-
-#include "empathy-plist.h"
+#include <telepathy-glib/telepathy-glib.h>
static GValue *empathy_plist_parse_node (xmlNode *a_node);
{
char *str_val;
char *end_ptr;
- gfloat double_val;
+ gdouble double_val;
str_val = (char *) xmlNodeGetContent (a_node);
double_val = g_ascii_strtod (str_val, &end_ptr);
}
xmlFree (str_val);
- return tp_g_value_slice_new_double (double_val);}
+ return tp_g_value_slice_new_double (double_val);
+}
static GValue *
empathy_plist_parse_boolean (xmlNode *a_node)
return NULL;
}
- return tp_g_value_slice_new_int (bool_val);
+ return tp_g_value_slice_new_boolean (bool_val);
}
static GValue *
GValue *value;
while (cur_node &&
- (xmlStrcmp(cur_node->name, (xmlChar *) "key") != 0)) {
+ (xmlStrcmp (cur_node->name, (xmlChar *) "key") != 0)) {
cur_node = cur_node->next;
}
if (!cur_node) {
return tp_g_value_slice_new_take_boxed (G_TYPE_HASH_TABLE, dict);
}
-static GValue *
-empathy_plist_parse_array (xmlNode *a_node)
-{
- xmlNode *cur_node = a_node->children;
- GValueArray *array;
-
- array = g_value_array_new (4);
-
- while (cur_node) {
- GValue *cur_value;
-
- cur_value = empathy_plist_parse_node (cur_node);
- if (cur_value) {
- g_value_array_append (array, cur_value);
- tp_g_value_slice_free (cur_value);
- }
-
- /* When an array contains an element enclosed in "unknown" tags (ie
- * non-type ones), we silently skip them since early
- * SysInfoExtended files used to have <key> values enclosed within
- * <array> tags.
- */
- cur_node = cur_node->next;
- }
-
- return tp_g_value_slice_new_take_boxed (G_TYPE_VALUE_ARRAY, array);
-}
-
typedef GValue *(*ParseCallback) (xmlNode *);
struct Parser {
{"false", empathy_plist_parse_boolean},
{"data", empathy_plist_parse_data},
{"dict", empathy_plist_parse_dict},
- {"array", empathy_plist_parse_array},
{NULL, NULL} };
static ParseCallback
parsed_doc = empathy_plist_parse (root_element);
- xmlFreeDoc(doc);
- xmlCleanupParser();
+ xmlFreeDoc (doc);
return parsed_doc;
}
parsed_doc = empathy_plist_parse (root_element);
- xmlFreeDoc(doc);
- xmlCleanupParser();
+ xmlFreeDoc (doc);
return parsed_doc;
}