Fix broadcast i think

This commit is contained in:
Andrew Pamment 2016-12-08 22:27:06 +10:00
parent e769e5448f
commit 730d60d02c
4 changed files with 7 additions and 1 deletions

3
bbs.c
View File

@ -1,6 +1,7 @@
#include <stdio.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@ -63,7 +64,7 @@ void broadcast(char *mess, ...) {
memset(&s, 0, sizeof(struct sockaddr_in));
s.sin_family=AF_INET;
s.sin_addr.s_addr = htonl(INADDR_ANY);
s.sin_addr.s_addr = inet_addr(conf.broadcast_address);
s.sin_port = htons((unsigned short)conf.broadcast_port);
bind(bcast_sock, (struct sockaddr *)&s, sizeof(struct sockaddr_in));

2
bbs.h
View File

@ -129,6 +129,8 @@ struct bbs_config {
int automsgwritelvl;
int broadcast_enable;
int broadcast_port;
char *broadcast_address;
int mail_conference_count;
struct mail_conference **mail_conferences;
int door_count;

View File

@ -26,6 +26,7 @@ UNZIP Command = unzip -j -o *a -d *d
Archivers = config/archivers.ini
Broadcast Enable = false
Broadcast Port = 2027
Broadcast Address = 192.168.1.255
[paths]
WWW Path = /home/andrew/MagickaBBS/www

2
main.c
View File

@ -387,6 +387,8 @@ static int handler(void* user, const char* section, const char* name,
}
} else if (strcasecmp(name, "broadcast port") == 0) {
conf->broadcast_port = atoi(value);
} else if (strcasecmp(name, "broadcast address") == 0) {
conf->broadcast_address = strdup(value);
}
} else if (strcasecmp(section, "paths") == 0){
if (strcasecmp(name, "ansi path") == 0) {