Added the activeConfig variable

Signed-off-by: Gergely Polonkai (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Gergely Polonkai (W00d5t0ck) 2011-01-26 17:54:26 +01:00
parent c39c378289
commit 4da2c703dc
2 changed files with 37 additions and 6 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <glib.h>
#include <libxml/parser.h>
@ -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();

9
src/wxmppd.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __WXMPPD_WXMPPD_H
# define __WXMPPD_WXMPPD_H
#include "configfiles.h"
extern wxmppd_config_t *activeConfig;
#endif /* __WXMPPD_WXMPPD_H */