*/
#include "config.h"
-
-#include <string.h>
-#include <math.h>
-#include <time.h>
-#include <sys/types.h>
+#include "empathy-utils.h"
#include <glib/gi18n-lib.h>
-
-#include <libxml/uri.h>
-
-#include <folks/folks.h>
-#include <folks/folks-telepathy.h>
-
#include <dbus/dbus-protocol.h>
#include "empathy-client-factory.h"
-#include "empathy-utils.h"
-#include "empathy-individual-manager.h"
#include "empathy-presence-manager.h"
-#include "empathy-request-util.h"
-
-#include <extensions/extensions.h>
+#include "extensions.h"
#define DEBUG_FLAG EMPATHY_DEBUG_OTHER
#include "empathy-debug.h"
}
gboolean
-empathy_xml_validate (xmlDoc *doc,
- const gchar *dtd_filename)
+empathy_xml_validate_from_resource (xmlDoc *doc,
+ const gchar *dtd_resourcename)
{
- gchar *path;
- xmlChar *escaped;
+ GBytes *resourcecontents;
+ gconstpointer resourcedata;
+ gsize resourcesize;
+ xmlParserInputBufferPtr buffer;
xmlValidCtxt cvp;
xmlDtd *dtd;
+ GError *error = NULL;
gboolean ret;
- path = g_build_filename (g_getenv ("EMPATHY_SRCDIR"), "libempathy",
- dtd_filename, NULL);
- if (!g_file_test (path, G_FILE_TEST_EXISTS))
+ DEBUG ("Loading dtd resource %s", dtd_resourcename);
+
+ resourcecontents = g_resources_lookup_data (dtd_resourcename, G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
+ if (error != NULL)
{
- g_free (path);
- path = g_build_filename (DATADIR, "empathy", dtd_filename, NULL);
+ g_warning ("Unable to load dtd resource '%s': %s", dtd_resourcename, error->message);
+ g_error_free (error);
+ return FALSE;
}
-
- DEBUG ("Loading dtd file %s", path);
-
- /* The list of valid chars is taken from libxml. */
- escaped = xmlURIEscapeStr ((const xmlChar *) path,
- (const xmlChar *)":@&=+$,/?;");
- g_free (path);
+ resourcedata = g_bytes_get_data (resourcecontents, &resourcesize);
+ buffer = xmlParserInputBufferCreateStatic (resourcedata, resourcesize, XML_CHAR_ENCODING_UTF8);
memset (&cvp, 0, sizeof (cvp));
- dtd = xmlParseDTD (NULL, escaped);
+ dtd = xmlIOParseDTD (NULL, buffer, XML_CHAR_ENCODING_UTF8);
ret = xmlValidateDtd (&cvp, doc, dtd);
- xmlFree (escaped);
xmlFreeDtd (dtd);
+ g_bytes_unref (resourcecontents);
return ret;
}
personas = GEE_SET (
gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref,
- g_direct_hash, g_direct_equal));
+ NULL, NULL, NULL, NULL, NULL, NULL));
gee_collection_add (GEE_COLLECTION (personas), persona);