summaryrefslogtreecommitdiffstats
path: root/src/daemon/settings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/daemon/settings.c')
-rw-r--r--src/daemon/settings.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/src/daemon/settings.c b/src/daemon/settings.c
index e5941cc..2b07b98 100644
--- a/src/daemon/settings.c
+++ b/src/daemon/settings.c
@@ -20,13 +20,15 @@
*/
#define _GNU_SOURCE
-#include <stdio.h>
+
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
+#include <errno.h>
#include "settings.h"
#include "settings_private.h"
@@ -39,6 +41,10 @@ void settings_init(void)
unset_flag(flag_daemonize);
settings.port = 6996;
settings.verboselevel = USURP_VERBOSITY;
+ settings.progname = program_invocation_short_name;
+ settings.im_user = "user";
+ settings.im_password = "password";
+ settings.im_proto = "prpl-irc";
#define macro2str(a) _macro2str(a)
#define _macro2str(a) #a
setting_readconf("/" macro2str(SYSCONFDIR) "/usurpation.conf");
@@ -61,8 +67,28 @@ unsigned short int setting_port(void)
return settings.port;
}
+char *setting_progname(void)
+{
+ return strdup(settings.progname);
+}
+
+char *setting_im_user(void)
+{
+ return strdup(settings.im_user);
+}
+
+char *setting_im_password(void)
+{
+ return strdup(settings.im_password);
+}
+
+char *setting_im_proto(void)
+{
+ return strdup(settings.im_proto);
+}
+
/* could be a one-liner, but let's make the logic more obvious */
-int test_flag(unsigned int flag)
+static int test_flag(unsigned int flag)
{
int ret;
@@ -72,12 +98,12 @@ int test_flag(unsigned int flag)
return ret;
}
-void set_flag(unsigned int flag)
+static void set_flag(unsigned int flag)
{
settings.flags |= flag;
}
-void unset_flag(unsigned int flag)
+static void unset_flag(unsigned int flag)
{
settings.flags &= ~flag;
}