2
0
Fork 0

Add call_setup function

personal/stbuehler/wip
Stefan Bühler 2008-07-23 22:33:29 +02:00
parent 6bbfe1e43e
commit 2537bb9d82
3 changed files with 20 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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