diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2011-11-30 21:16:08 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2011-11-30 21:16:08 +0800 |
commit | 832bea90bf2b29db673a86067f193694a493093a (patch) | |
tree | e486ce3560d7ab8a56dd372452816a23be8650fe /composer | |
parent | 5f9af14a19899dd4350dd32409d43017ccd31f53 (diff) | |
download | gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.tar gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.tar.gz gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.tar.bz2 gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.tar.lz gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.tar.xz gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.tar.zst gsoc2013-evolution-832bea90bf2b29db673a86067f193694a493093a.zip |
Composer: "mailto" blacklist touch ups.
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-msg-composer.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 95ba249bbf..daca277e33 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -4001,23 +4001,28 @@ merge_always_cc_and_bcc (EComposerHeaderTable *table, e_destination_freev (addrv); } -static const gchar *blacklisted_files [] = { ".", "etc", ".." }; +static const gchar *blacklist[] = { ".", "etc", ".." }; static gboolean -check_blacklisted_file (gchar *filename) +file_is_blacklisted (gchar *filename) { gboolean blacklisted = FALSE; - guint ii, jj, length; - gchar **filename_part; - - filename_part = g_strsplit (filename, G_DIR_SEPARATOR_S, -1); - length = g_strv_length (filename_part); - for (ii = 0; !blacklisted && ii < G_N_ELEMENTS (blacklisted_files); ii++) { - for (jj = 0; !blacklisted && jj < length; jj++) - if (g_str_has_prefix (filename_part[jj], blacklisted_files[ii])) + guint ii, jj, n_parts; + gchar **parts; + + parts = g_strsplit (filename, G_DIR_SEPARATOR_S, -1); + n_parts = g_strv_length (parts); + + for (ii = 0; ii < G_N_ELEMENTS (blacklist); ii++) { + for (jj = 0; jj < n_parts; jj++) { + if (g_str_has_prefix (parts[jj], blacklist[ii])) { blacklisted = TRUE; + break; + } + } } - g_strfreev (filename_part); + + g_strfreev (parts); return blacklisted; } @@ -4115,7 +4120,7 @@ handle_mailto (EMsgComposer *composer, EAttachment *attachment; camel_url_decode (content); - if (check_blacklisted_file (content)) + if (file_is_blacklisted (content)) e_alert_submit ( E_ALERT_SINK (composer), "mail:blacklisted-file", |