summaryrefslogtreecommitdiff
path: root/libsocialweb/sw-cache.c
diff options
context:
space:
mode:
authorRob Bradford <rob@linux.intel.com>2010-07-08 16:03:47 (GMT)
committerRob Bradford <rob@linux.intel.com>2010-07-08 16:03:47 (GMT)
commit52f9e88ec6755485ce7a07956026d78f89068c17 (patch)
tree61bcafca0a5480044b20a6d447a7e766a9d39b86 /libsocialweb/sw-cache.c
parentd3100d97406248e33fc8562cab5a0bf422baf74a (diff)
downloadlibsocialweb-52f9e88ec6755485ce7a07956026d78f89068c17.tar.gz
libsocialweb-52f9e88ec6755485ce7a07956026d78f89068c17.tar.xz
cache: Don't include banned items when reading from the cache
Diffstat (limited to 'libsocialweb/sw-cache.c')
-rw-r--r--libsocialweb/sw-cache.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/libsocialweb/sw-cache.c b/libsocialweb/sw-cache.c
index f5e627d..e5f866a 100644
--- a/libsocialweb/sw-cache.c
+++ b/libsocialweb/sw-cache.c
@@ -223,7 +223,18 @@ load_item_from_keyfile (SwService *service,
}
}
}
+
g_strfreev (keys);
+
+ if (sw_service_is_uid_banned (service,
+ sw_item_get (item,
+ "id")))
+ {
+ g_object_unref (item);
+
+ return NULL;
+ }
+
return item;
}
@@ -261,10 +272,18 @@ sw_cache_load (SwService *service,
gsize i, count;
groups = g_key_file_get_groups (keys, &count);
+
if (count) {
set = sw_item_set_new ();
+
for (i = 0; i < count; i++) {
- sw_set_add (set, (GObject*)load_item_from_keyfile (service, keys, groups[i]));
+ SwItem *item;
+
+ /* May be null if it's banned */
+ item = load_item_from_keyfile (service, keys, groups[i]);
+
+ if (item)
+ sw_set_add (set, (GObject *)item);
}
}