]> git.0d.be Git - empathy.git/commitdiff
empathy_adium_path_is_valid: check if the directory has the right format
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 4 Jul 2012 13:44:43 +0000 (15:44 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 4 Jul 2012 14:45:46 +0000 (16:45 +0200)
The Adium spec explicitely says that the root directory of the theme should
end with ".AdiumMessageStyle".

https://bugzilla.gnome.org/show_bug.cgi?id=679332

libempathy-gtk/empathy-theme-adium.c

index 5cd30652008fa43a5025e6e33cb639cacd8cafa9..634b4b2cdc63f0a7e6a1747e107dd90271956bda 100644 (file)
@@ -1752,10 +1752,30 @@ empathy_adium_path_is_valid (const gchar *path)
 {
   gboolean ret;
   gchar *file;
+  gchar **tmp;
+  const gchar *dir;
 
   if (path[0] != '/')
     return FALSE;
 
+  /* The directory has to be *.AdiumMessageStyle per the Adium spec */
+  tmp = g_strsplit (path, "/", 0);
+  if (tmp == NULL)
+    {
+      g_free (tmp);
+      return FALSE;
+    }
+
+  dir = tmp[g_strv_length (tmp) - 1];
+
+  if (!g_str_has_suffix (dir, ".AdiumMessageStyle"))
+    {
+      g_free (tmp);
+      return FALSE;
+    }
+
+  g_free (tmp);
+
   /* The theme is not valid if there is no Info.plist */
   file = g_build_filename (path, "Contents", "Info.plist",
          NULL);