Add call_setup function
parent
6bbfe1e43e
commit
2537bb9d82
|
@ -32,7 +32,7 @@ action *action_new_function(server *srv, const char *name, option *value) {
|
|||
action_func af;
|
||||
server_action *sa;
|
||||
|
||||
if (NULL == (sa = g_hash_table_lookup(srv->actions, name))) {
|
||||
if (NULL == (sa = (server_action*) g_hash_table_lookup(srv->actions, name))) {
|
||||
ERROR(srv, "Action '%s' doesn't exist", name);
|
||||
return NULL;
|
||||
}
|
||||
|
|
16
src/plugin.c
16
src/plugin.c
|
@ -210,3 +210,19 @@ gboolean plugin_register(server *srv, const gchar *name, PluginInit init) {
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean call_setup(server *srv, const char *name, option *opt) {
|
||||
server_setup *ss;
|
||||
|
||||
if (NULL == (ss = (server_setup*) g_hash_table_lookup(srv->actions, name))) {
|
||||
ERROR(srv, "Setup function '%s' doesn't exist", name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!ss->setup(srv, ss->p ? ss->p->data : NULL, opt)) {
|
||||
ERROR(srv, "Setup '%s' failed", name);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,9 @@ struct server_setup {
|
|||
LI_API void plugin_free(server *srv, plugin *p);
|
||||
LI_API gboolean plugin_register(server *srv, const gchar *name, PluginInit init);
|
||||
|
||||
LI_API gboolean parse_option(server *srv, const char *key, option *opt, option_set *mark);
|
||||
LI_API gboolean parse_option(server *srv, const char *name, option *opt, option_set *mark);
|
||||
LI_API void release_option(server *srv, option_set *mark); /**< Does not free the option_set memory */
|
||||
|
||||
LI_API gboolean call_setup(server *srv, const char *name, option *opt);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue