diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-04 21:44:43 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-07-04 22:45:46 +0800 |
commit | 408c581426ea8df05cc2b1c1663aa8405334f2ac (patch) | |
tree | 3d683bc86af2a37779badd62936b61d6316b4082 /libempathy-gtk | |
parent | 4e532114814f39740a5695c35fc02b465bbce2e1 (diff) | |
download | gsoc2013-empathy-408c581426ea8df05cc2b1c1663aa8405334f2ac.tar.gz 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')
-rw-r--r-- | libempathy-gtk/empathy-theme-adium.c | 20 |
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); |