void PluginManager_register_role_hook(PluginManager* pm, dstring rolename, PluginRoleHook hook) { PluginRoleHookList* node = mem_alloc(sizeof(*node)); node->role = dstring_dup(rolename); node->hook = hook; node->next = pm->role_hook_list; pm->role_hook_list = node; }
dstring PluginManager_apply_contents_hooks(PluginManager* pm, dstring contents, DB* db, Post* post) { PluginContentsHookList* contents_plugin = pm->contents_hook_list; if (!contents_plugin) return NULL; contents = dstring_dup(contents); while (contents_plugin) { dstring new_contents = contents_plugin->hook(contents, db, post); dstring_free(contents); contents = new_contents; contents_plugin = contents_plugin->next; } return contents; }
void* ht_dup_dstring(const void* dstr) { return dstring_dup((const dstring) dstr); }