diff --git a/src/wxmppd.c b/src/wxmppd.c index c3dd446..cff8860 100644 --- a/src/wxmppd.c +++ b/src/wxmppd.c @@ -1,3 +1,20 @@ +/* wXMPPd - (Trying to be) full featured XMPP daemon + * Copyright (C) 2011 Gergely Polonkai + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + #include #include #include @@ -8,6 +25,8 @@ gchar *config_dir = NULL; gchar *cl_modules_dir = NULL; gchar *cl_keys_file = NULL; +wxmppd_config_t *activeConfig = NULL; + static GOptionEntry optionEntries[] = { { "config-dir", 'c', 0, G_OPTION_ARG_FILENAME, &config_dir, "Directory where configuration files can be found", "DIRECTORY" }, { "module-dir", 'm', 0, G_OPTION_ARG_FILENAME, &cl_modules_dir, "Directory of the module files", "DIRECTORY" }, @@ -47,21 +66,24 @@ main(int argc, char **argv) return 1; } + activeConfig = wxmppd_copyConfig(configObject); + wxmppd_freeConfig(&configObject); + if (cl_modules_dir != NULL) { - if (configObject->modules_dir != NULL) + if (activeConfig->modules_dir != NULL) { - g_free(configObject->modules_dir); + g_free(activeConfig->modules_dir); } - configObject->modules_dir = g_strdup(cl_modules_dir); + activeConfig->modules_dir = g_strdup(cl_modules_dir); } - if (configObject->modules_dir == NULL) + if (activeConfig->modules_dir == NULL) { - configObject->modules_dir = g_strdup_printf("%s/wxmppd", LIBDIR); + activeConfig->modules_dir = g_strdup_printf("%s/wxmppd", LIBDIR); } - printf("%s\n", configObject->modules_dir); + wxmppd_setActiveModules(); xmlCleanupParser(); diff --git a/src/wxmppd.h b/src/wxmppd.h new file mode 100644 index 0000000..7a4f9e5 --- /dev/null +++ b/src/wxmppd.h @@ -0,0 +1,9 @@ +#ifndef __WXMPPD_WXMPPD_H +# define __WXMPPD_WXMPPD_H + +#include "configfiles.h" + +extern wxmppd_config_t *activeConfig; + +#endif /* __WXMPPD_WXMPPD_H */ +