[evolution-data-server/evolution-data-server-3-12] [ownCloud backend] Check color format before using it



commit 546cd59017ef5e8313c22357990fb8a2265e6ff6
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 22 13:12:07 2014 +0200

    [ownCloud backend] Check color format before using it
    
    Calendar-based sources have always overwritten color, to ensure
    the color defined on the server matches the one used in evolution,
    but there was not checked whether the color is of the right format,
    which may eventually cause reset of a user-specified color to
    an invalid one, showing the calendar in an odd color.

 modules/owncloud-backend/module-owncloud-backend.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/modules/owncloud-backend/module-owncloud-backend.c 
b/modules/owncloud-backend/module-owncloud-backend.c
index 38b5888..25b317f 100644
--- a/modules/owncloud-backend/module-owncloud-backend.c
+++ b/modules/owncloud-backend/module-owncloud-backend.c
@@ -175,11 +175,16 @@ owncloud_source_found_cb (ECollectionBackend *collection,
 
        /* these properties are synchronized always */
        if (source) {
+               gint rr, gg, bb;
+
                backend = e_source_get_extension (source, backend_name);
                e_source_backend_set_backend_name (backend, provider);
 
                e_source_set_display_name (source, display_name);
-               if (source_type != OwnCloud_Source_Contacts && color)
+               /* Also check whether the color format is as expected; it cannot
+                  be used gdk_rgba_parse here, because it required gdk/gtk. */
+               if (source_type != OwnCloud_Source_Contacts && color &&
+                   sscanf (color, "#%02x%02x%02x", &rr, &gg, &bb) == 3)
                        e_source_selectable_set_color (E_SOURCE_SELECTABLE (backend), color);
 
                if (is_new)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]