Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 575db829 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

HOOK: The only given argument is the server database

parent 003717f5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!116Hooks
Ce commit fait partie de la requête de fusion !116. Les commentaires créés ici seront créés dans le contexte de cette requête de fusion.
......@@ -46,7 +46,6 @@ void config_default_file(char *dest, size_t len);
#define env_get getenv
/* Handle everything for a hook */
void config_handle_hook(volatile sqlite3 *db, const char *hook_name, int arg_count, ...);
#define HANDLE_HOOK(db, n, ...) config_handle_hook(db, n, GET_VA_COUNT(__VA_ARGS__), __VA_ARGS__)
void config_handle_hook(volatile sqlite3 *db, const char *hook_name);
#endif /* __LKT_CONFIG_H__ */
......@@ -164,7 +164,7 @@ command_next(struct lkt_state *srv, char __attribute__((unused)) *args[LKT_MESSA
if (MOD_CALL(srv->window_mod, "load", filepath))
return false;
else {
config_handle_hook(srv->db, "kara_load", 0);
config_handle_hook(srv->db, "kara_load");
return true;
}
}
......@@ -188,7 +188,7 @@ command_previous(struct lkt_state *srv, char __attribute__((unused)) *args[LKT_M
if (MOD_CALL(srv->window_mod, "load", filepath))
return false;
else {
config_handle_hook(srv->db, "kara_load", 0);
config_handle_hook(srv->db, "kara_load");
return true;
}
}
......@@ -223,8 +223,8 @@ command_play(struct lkt_state *srv, char __attribute__((unused)) *args[LKT_MESSA
/* Hooks */
if (__play_that_file(srv, pos)) {
config_handle_hook(srv->db, "queue_begin", 0);
config_handle_hook(srv->db, "kara_load", 0);
config_handle_hook(srv->db, "queue_begin");
config_handle_hook(srv->db, "kara_load");
return true;
} else
return false;
......@@ -258,8 +258,8 @@ command_playid(struct lkt_state *srv, char *args[LKT_MESSAGE_ARGS_MAX])
/* Hooks */
if (__play_that_file(srv, pos)) {
config_handle_hook(srv->db, "queue_begin", 0);
config_handle_hook(srv->db, "kara_load", 0);
config_handle_hook(srv->db, "queue_begin");
config_handle_hook(srv->db, "kara_load");
return true;
} else
return false;
......
......@@ -298,7 +298,7 @@ error:
}
void
config_handle_hook(volatile sqlite3 *db, const char *hook_name, int arg_count, ...)
config_handle_hook(volatile sqlite3 *db, const char *hook_name)
{
char hook_handlers[LKT_LINE_MAX];
if (!database_config_get_text_nospace(db, "hook", hook_name, hook_handlers, LKT_LINE_MAX)) {
......@@ -306,9 +306,6 @@ config_handle_hook(volatile sqlite3 *db, const char *hook_name, int arg_count, .
return;
}
va_list va;
va_start(va, arg_count);
size_t save = 0;
char name[LKT_LINE_MAX];
int code;
......@@ -318,11 +315,9 @@ config_handle_hook(volatile sqlite3 *db, const char *hook_name, int arg_count, .
while (0 == (code = iter_string(hook_handlers, ",", name, LKT_LINE_MAX, &save))) {
if (STR_MATCH("none", name))
continue;
reg_call(server_reg, name, 1, va);
reg_call(server_reg, name, 1, db);
}
if (code == -1)
LOG_ERROR("HOOK", "Failed to parse the handle list for hook '%s'", hook_name);
va_end(va);
}
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter