From 525f1de571b03276bd8b3c92aa2db1d4cf82feba Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Sat, 21 Aug 2010 00:56:50 +0200 Subject: Added some server stuff. --- main.c | 5 +++++ servers.c | 11 ++++++++++- servers.h | 3 ++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 1a7ba2c..6b40e86 100644 --- a/main.c +++ b/main.c @@ -2,6 +2,7 @@ #include "httpd.h" #include "command_service.h" #include "conf.h" +#include "servers.h" #include #include @@ -20,6 +21,8 @@ int main(int argc, char **argv) { conf_load(); + servers_init(); + music_init(); music_scan_root(); @@ -36,6 +39,8 @@ int main(int argc, char **argv) { server_stop(); music_free(); + servers_free(); + conf_free(); return 0; diff --git a/servers.c b/servers.c index 554bfcc..d3d69ee 100644 --- a/servers.c +++ b/servers.c @@ -1,4 +1,5 @@ #include "servers.h" +#include "conf.h" static GSList *servers = NULL; @@ -30,7 +31,15 @@ gboolean server_remove(struct server *server) { return TRUE; } -void server_clear() { +void servers_init() { + gsize length; + gchar **s = conf_get_string_list("audist", "servers", &length); + for(int i = 0; i < length; i++) { + g_debug(" server %d: %s", i, s[i]); + } +} + +void server_free() { for(GSList *node = servers; node; node = g_slist_next(node)) { struct server *s = node->data; g_free(s->host); diff --git a/servers.h b/servers.h index 11dc3af..b6e809b 100644 --- a/servers.h +++ b/servers.h @@ -10,6 +10,7 @@ struct server { gboolean server_add(const gchar *host, const guint16 port); gboolean server_remove(struct server *server); -void server_clear(); +void servers_init(); +void servers_free(); #endif -- cgit v1.2.3