summaryrefslogtreecommitdiff
path: root/blabouncer.c
diff options
context:
space:
mode:
Diffstat (limited to 'blabouncer.c')
-rw-r--r--blabouncer.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 5da18e0..a370d71 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -103,10 +103,10 @@ struct settings {
char ircnick[MAXNICKLENGTH]; // In both settings and ircdstrings as settings is from our file whereas server may change ircdstrings copy
char ircusername[MAXUSERNAMELEN]; // (Is this also true for the username? Can the server change that?)
char ircrealname[MAXREALNAMELEN];
+ char ircserver[HOST_NAME_MAX];
+ char ircserverport[MAXPORTLEN];
};
-int debugmode = 0;
-
// Return index of requested client FD within arr_clients
// This is used because at least arr_clients, arr_authed, and ssl share the same element order.
// TODO - Use this wherever we are calculating the position (various places) instead of
@@ -1268,18 +1268,6 @@ void dochat(int *serversockfd, int *clientsockfd, struct settings *settings) {
}
int main(int argc, char *argv[]) {
- if (argc < 3) {
- fprintf(stderr,"usage: %s hostname port [-d]\n", argv[0]);
- exit(1);
- }
-
- if (argc == 4) {
- if (!strcmp(argv[3], "-d")) {
- debugmode = 1;
- debug("debug mode enabled\n");
- }
- }
-
// Structure of our various settings which are to either be read from the configuration file or set at runtime
struct settings settings;
@@ -1289,25 +1277,37 @@ int main(int argc, char *argv[]) {
settings.replayseconds = getconfint("replayseconds", CONFFILE);
// What port should the bouncer listen on
if (!getconfstr("clientport", CONFFILE, settings.clientport)) {
- printf("main(): error getting clientport from configuration file.\n");
+ printf("main(): error getting 'clientport' from configuration file.\n");
exit(1);
}
// What is the configured nick?
if (!getconfstr("nick", CONFFILE, settings.ircnick)) {
- printf("main(): error getting nick from configuration file.\n");
+ printf("main(): error getting 'nick' from configuration file.\n");
exit(1);
}
// What is the configured username?
if (!getconfstr("username", CONFFILE, settings.ircusername)) {
- printf("main(): error getting username from configuration file.\n");
+ printf("main(): error getting 'username' from configuration file.\n");
exit(1);
}
// What is the configured real name?
if (!getconfstr("realname", CONFFILE, settings.ircrealname)) {
- printf("main(): error getting real name from configuration file.\n");
+ printf("main(): error getting 'realname' from configuration file.\n");
+ exit(1);
+ }
+
+ // What is the real IRC server address?
+ if (!getconfstr("ircserver", CONFFILE, settings.ircserver)) {
+ printf("main(): error getting 'ircserver' from configuration file.\n");
+ exit(1);
+ }
+
+ // What is the real IRC server port?
+ if (!getconfstr("ircserverport", CONFFILE, settings.ircserverport)) {
+ printf("main(): error getting 'ircserverport' from configuration file.\n");
exit(1);
}
@@ -1320,7 +1320,7 @@ int main(int argc, char *argv[]) {
// BOUNCER-TO-SERVER socket things
// Create server socket
- int serversockfd = createserversocket(argv[1], argv[2]);
+ int serversockfd = createserversocket(settings.ircserver, settings.ircserverport);
// Create client socket (after server so we can use its fd number later as fdmax)
int clientsockfd = createclientsocket(settings.clientport);