aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-theme-adium.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-04 21:44:43 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-04 22:45:46 +0800
commit408c581426ea8df05cc2b1c1663aa8405334f2ac (patch)
tree3d683bc86af2a37779badd62936b61d6316b4082 /libempathy-gtk/empathy-theme-adium.c
parent4e532114814f39740a5695c35fc02b465bbce2e1 (diff)
downloadgsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar
gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar.gz
gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar.bz2
gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar.lz
gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar.xz
gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar.zst
gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.zip
empathy_adium_path_is_valid: check if the directory has the right format
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
Diffstat (limited to 'libempathy-gtk/empathy-theme-adium.c')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 5cd306520..634b4b2cd 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -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);