]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add static C API
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 24 Jul 2022 19:26:53 +0000 (20:26 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sun, 24 Jul 2022 19:26:53 +0000 (20:26 +0100)
src/libserver/rspamd_symcache.h
src/libserver/symcache/symcache_c.cxx

index 8707c631fc073d9aeb25cde1f67eeab03ced3dc0..0510cb1dc27b3906dc06d030d8b868eeb5a1f4f3 100644 (file)
@@ -329,6 +329,24 @@ gboolean rspamd_symcache_disable_symbol (struct rspamd_task *task,
                                                                                 struct rspamd_symcache *cache,
                                                                                 const gchar *symbol);
 
+/**
+ * Disable execution of a symbol or a pattern (a string enclosed in `//`) permanently
+ * @param task
+ * @param cache
+ * @param symbol
+ * @return
+ */
+void rspamd_symcache_disable_symbol_static (struct rspamd_symcache *cache,
+                                                                                               const gchar *symbol);
+/**
+ * Add a symbol or a pattern to the list of explicitly and statically enabled symbols
+ * @param cache
+ * @param symbol
+ * @return
+ */
+void rspamd_symcache_enable_symbol_static (struct rspamd_symcache *cache,
+                                                                                               const gchar *symbol);
+
 /**
  * Process specific function for each cache element (in order they are added)
  * @param cache
index e0d8711f1184ed9474eb9ee6ea8f334fe1817dab..d4ae88e672b0fd4759282e7b7476a1e8032ab05d 100644 (file)
@@ -465,6 +465,23 @@ rspamd_symcache_enable_symbol(struct rspamd_task *task,
        return cache_runtime->enable_symbol(task, *real_cache, symbol);
 }
 
+void
+rspamd_symcache_disable_symbol_static (struct rspamd_symcache *cache,
+                                                                          const gchar *symbol)
+{
+       auto *real_cache = C_API_SYMCACHE(cache);
+
+       real_cache->disable_symbol_delayed(symbol);
+}
+
+void rspamd_symcache_enable_symbol_static (struct rspamd_symcache *cache,
+                                                                                  const gchar *symbol)
+{
+       auto *real_cache = C_API_SYMCACHE(cache);
+
+       real_cache->enable_symbol_delayed(symbol);
+}
+
 gboolean
 rspamd_symcache_is_checked(struct rspamd_task *task,
                                                   struct rspamd_symcache *cache,