use configfile

This commit is contained in:
Olaf Rempel 2007-12-04 16:56:05 +01:00
parent 7a243e8cad
commit ef25dbe436
2 changed files with 22 additions and 16 deletions

View File

@ -9,19 +9,30 @@
#include "logging.h"
#include "sockaddr.h"
#define DEFAULT_CONFIG "irclogbot.conf"
int main(int argc, char *argv[])
{
struct irc_session *session = irc_create_session();
/* parse config file */
if (config_parse(DEFAULT_CONFIG))
exit(1);
parse_sockaddr("83.140.172.211:6667", &session->srv_addr);
session->server_pass = NULL;
session->nickname = "logtest_";
// session->username = "logtest_";
// session->realname = "logtest_";
char *server_str = (char *)config_get_string("global", "server", NULL);
if (server_str == NULL)
exit(1);
struct irc_session *session = irc_create_session();
parse_sockaddr(server_str, &session->srv_addr);
session->server_pass = (char *)config_get_string("global", "server-pass", NULL);
session->nickname = (char *)config_get_string("global", "nickname", "logbot");
session->username = (char *)config_get_string("global", "username", NULL);
session->realname = (char *)config_get_string("global", "realname", NULL);
irc_connect(session);
event_loop();
config_free();
return 0;
}

View File

@ -1,12 +1,7 @@
[global]
server irc.quakenet.org
channel #logtest
server 83.140.172.211:6667
#server-pass test
client 127.0.0.1
client 10.10.250.133
[127.0.0.1]
nickname logtest1
[10.10.250.133]
nickname logtest2
nickname logtest_
#username logtest_
#realname logtest_