Switch broadcast to MQTT
This commit is contained in:
parent
760fef49b2
commit
1684f8ab39
7
dist/config/bbs.ini
vendored
7
dist/config/bbs.ini
vendored
@ -25,9 +25,10 @@ SSH RSA Key = /home/andrew/MagickaBBS/keys/ssh_host_rsa_key
|
||||
Main AKA = 1:2/3.4
|
||||
QWK Name = MAGICKA
|
||||
QWK Max Messages = 5000
|
||||
Broadcast Enable = false
|
||||
Broadcast Port = 2027
|
||||
Broadcast Address = 192.168.1.255
|
||||
MQTT Enable = false
|
||||
MQTT Port = 2027
|
||||
MQTT Address = localhost
|
||||
MQTT Topic = MagickaBBS
|
||||
IP Guard Enable = true
|
||||
IP Guard Timeout = 120
|
||||
IP Guard Tries = 4
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
## Install Prerequisites
|
||||
|
||||
Ensure you have git, c compiler, libsqlite3-dev, libreadline-dev, libssl-dev, libssh-dev libncurses5-dev, libmicrohttpd-dev, bash, libdbd-sqlite3-perl, gnu sed and gnu make
|
||||
Ensure you have git, c compiler, libsqlite3-dev, libreadline-dev, libssl-dev, libssh-dev libncurses5-dev, libmicrohttpd-dev, libmosquitto-dev, bash, libdbd-sqlite3-perl, gnu sed and gnu make
|
||||
|
||||
sudo apt-get install build-essential libsqlite3-dev libreadline-dev git libssl-dev libssh-dev libncurses5-dev libmicrohttpd-dev libdbd-sqlite3-perl sed
|
||||
sudo apt-get install build-essential libsqlite3-dev libreadline-dev git libssl-dev libssh-dev libncurses5-dev libmicrohttpd-dev libdbd-sqlite3-perl libmosquitto-dev sed
|
||||
|
||||
should work on debian and debian derivatives.
|
||||
|
||||
|
@ -42,7 +42,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${JAMLIB} ${ZMODEM} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv -lmosquitto
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) freebsd
|
||||
|
@ -47,7 +47,7 @@ OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${B64} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv $(MICROHTTPD)
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv -lmosquitto $(MICROHTTPD)
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) freebsd
|
||||
|
@ -42,7 +42,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -lmosquitto
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) linux
|
||||
|
@ -47,7 +47,7 @@ OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${JAMLIB} ${ZMODEM} ${B64} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh $(MICROHTTPD)
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -lmosquitto $(MICROHTTPD)
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) linux
|
||||
|
@ -42,7 +42,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -R/usr/pkg/lib -L/usr/pkg/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -R/usr/pkg/lib -L/usr/pkg/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv -lmosquitto
|
||||
|
||||
magiedit: $(ODOORS)
|
||||
cd ../utils/magiedit && $(MAKE)
|
||||
|
@ -47,7 +47,7 @@ OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${B64} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -R/usr/pkg/lib -L/usr/pkg/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv $(MICROHTTPD)
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -R/usr/pkg/lib -L/usr/pkg/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv -lmosquitto $(MICROHTTPD)
|
||||
|
||||
magiedit: $(ODOORS)
|
||||
cd ../utils/magiedit && $(MAKE)
|
||||
|
@ -42,7 +42,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv -lmosquitto
|
||||
|
||||
magiedit: $(ODOORS)
|
||||
cd ../utils/magiedit && $(MAKE)
|
||||
|
@ -47,7 +47,7 @@ OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${B64} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv $(MICROHTTPD)
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lutil -lm -lssl -lcrypto -lssh -liconv -lmosquitto $(MICROHTTPD)
|
||||
|
||||
magiedit: $(ODOORS)
|
||||
cd ../utils/magiedit && $(MAKE)
|
||||
|
@ -43,7 +43,7 @@ $(UUID):
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/opt/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -liconv
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/opt/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -liconv -lmosquitto
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) linux
|
||||
|
@ -47,7 +47,7 @@ OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${B64} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/opt/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -liconv $(MICROHTTPD)
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/opt/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -liconv -lmosquitto $(MICROHTTPD)
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) linux
|
||||
|
@ -42,7 +42,7 @@ OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lm -ldl -lssl -lcrypto -lssh -lnsl -lsocket
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lm -ldl -lssl -lcrypto -lssh -lmosquitto -lnsl -lsocket
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) freebsd
|
||||
|
@ -47,7 +47,7 @@ OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
magicka: $(OBJ) ${LUA} ${JAMLIB} ${ZMODEM} ${B64} ${JSMN} ${UUID}
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lm -ldl -lssl -lcrypto -lssh $(MICROHTTPD) -lnsl -lsocket
|
||||
$(CC) -o ../magicka $^ $(CFLAGS) -L/usr/local/lib -lsqlite3 -lm -ldl -lssl -lcrypto -lssh -lmosquitto $(MICROHTTPD) -lnsl -lsocket
|
||||
|
||||
magimail: $(JAMLIB)
|
||||
cd ../utils/magimail && $(MAKE) freebsd
|
||||
|
81
src/bbs.c
81
src/bbs.c
@ -15,6 +15,7 @@
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <iconv.h>
|
||||
#include <mosquitto.h>
|
||||
#include "bbs.h"
|
||||
#include "lua/lua.h"
|
||||
#include "lua/lualib.h"
|
||||
@ -34,6 +35,8 @@ int usertimeout;
|
||||
int timeoutpaused;
|
||||
time_t userlaston;
|
||||
|
||||
struct mosquitto *mosq = NULL;
|
||||
|
||||
char *ipaddress = NULL;
|
||||
|
||||
void sigterm_handler2(int s)
|
||||
@ -50,44 +53,14 @@ void sigint_handler(int s)
|
||||
// do nothing...
|
||||
}
|
||||
void broadcast(char *mess, ...) {
|
||||
char json[1024];
|
||||
char buffer[512];
|
||||
struct sockaddr_in s;
|
||||
int bcast_sock;
|
||||
int broadcastEnable=1;
|
||||
int ret;
|
||||
|
||||
|
||||
|
||||
if (conf.broadcast_enable && conf.broadcast_port > 1024 && conf.broadcast_port < 65536 && conf.broadcast_address != NULL) {
|
||||
bcast_sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
ret=setsockopt(bcast_sock, SOL_SOCKET, SO_BROADCAST, &broadcastEnable, sizeof(broadcastEnable));
|
||||
|
||||
if (ret) {
|
||||
dolog("broadcast: Couldn't set socket to broadcast mode");
|
||||
close(bcast_sock);
|
||||
return;
|
||||
}
|
||||
memset(&s, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
s.sin_family=AF_INET;
|
||||
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));
|
||||
|
||||
char buffer[PATH_MAX];
|
||||
if (conf.broadcast_enable && conf.broadcast_port != 0 && conf.broadcast_address != NULL) {
|
||||
va_list ap;
|
||||
va_start(ap, mess);
|
||||
vsnprintf(buffer, 512, mess, ap);
|
||||
va_end(ap);
|
||||
|
||||
snprintf(json, 1024, "{\"System\": \"%s\", \"Program\": \"MagickaBBS\", \"Message\": \"%s\"}", conf.bbs_name, buffer);
|
||||
vsnprintf(buffer, PATH_MAX, mess, ap);
|
||||
va_end(ap);
|
||||
|
||||
ret = sendto(bcast_sock, json, strlen(json) + 1, 0, (struct sockaddr *)&s, sizeof(struct sockaddr_in));
|
||||
|
||||
if (ret < 0) {
|
||||
dolog("broadcast: Couldn't send broadcast");
|
||||
}
|
||||
close(bcast_sock);
|
||||
mosquitto_publish(mosq, NULL, (conf.broadcast_topic == NULL ? "MagickaBBS" : conf.broadcast_topic), strlen(buffer), buffer, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -679,15 +652,25 @@ void s_readpass(char *buffer, int max) {
|
||||
}
|
||||
|
||||
void exit_bbs() {
|
||||
char buffer[1024];
|
||||
snprintf(buffer, 1024, "%s/nodeinuse.%d", conf.bbs_path, mynode);
|
||||
char buffer[PATH_MAX];
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/nodeinuse.%d", conf.bbs_path, mynode);
|
||||
remove(buffer);
|
||||
if (mosq != NULL) {
|
||||
mosquitto_disconnect(mosq);
|
||||
mosquitto_loop_stop(mosq, 0);
|
||||
mosquitto_destroy(mosq);
|
||||
mosquitto_lib_cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
void disconnect(char *calledby) {
|
||||
|
||||
if (gUser != NULL) {
|
||||
broadcast("USER: %s; NODE:%d; STATUS: disconnected.", gUser->loginname, mynode);
|
||||
save_user(gUser);
|
||||
} else {
|
||||
broadcast("USER: unknown; NODE:%d; STATUS: disconnected.", mynode);
|
||||
}
|
||||
dolog("Node %d disconnected (%s)", mynode, calledby);
|
||||
|
||||
@ -899,6 +882,24 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
int tries;
|
||||
int fno;
|
||||
|
||||
// initialize mqtt
|
||||
if (conf.broadcast_enable && conf.broadcast_address != NULL && conf.broadcast_port != 0) {
|
||||
mosquitto_lib_init();
|
||||
mosq = mosquitto_new(NULL, 1, NULL);
|
||||
if (conf.broadcast_user != NULL && conf.broadcast_pass != NULL) {
|
||||
mosquitto_username_pw_set(mosq, conf.broadcast_user, conf.broadcast_pass);
|
||||
}
|
||||
if(mosquitto_connect(mosq, conf.broadcast_address, conf.broadcast_port, 60)){
|
||||
dolog("Unable to connect to MQTT server.");
|
||||
conf.broadcast_enable = 0;
|
||||
} else {
|
||||
if (mosquitto_loop_start(mosq) != MOSQ_ERR_SUCCESS) {
|
||||
dolog("Unable to start MQTT loop.");
|
||||
conf.broadcast_enable = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
atexit(exit_bbs);
|
||||
|
||||
usertimeout = 10;
|
||||
@ -947,7 +948,7 @@ void runbbs_real(int socket, char *ip, int ssh) {
|
||||
} else {
|
||||
sshBBS = 1;
|
||||
}
|
||||
|
||||
broadcast("USER: unknown; NODE:%d; STATUS: Logging in.", mynode);
|
||||
s_printf("Magicka BBS v%d.%d (%s), Loading...\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_STR);
|
||||
|
||||
// find out which node we are
|
||||
@ -1101,7 +1102,7 @@ tryagain:
|
||||
|
||||
// do post-login
|
||||
dolog("%s logged in, on node %d", user->loginname, mynode);
|
||||
broadcast("%s logged in, on node %d", user->loginname, mynode);
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Logged in.", user->loginname, mynode);
|
||||
// check time left
|
||||
now = time(NULL);
|
||||
localtime_r(&now, &thetime);
|
||||
@ -1167,7 +1168,7 @@ tryagain:
|
||||
do_logout();
|
||||
|
||||
dolog("%s is logging out, on node %d", user->loginname, mynode);
|
||||
broadcast("%s is logging out, on node %d", user->loginname, mynode);
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Logging out.", user->loginname, mynode);
|
||||
disconnect("Log out");
|
||||
}
|
||||
|
||||
|
@ -173,6 +173,9 @@ struct bbs_config {
|
||||
int broadcast_enable;
|
||||
int broadcast_port;
|
||||
char *broadcast_address;
|
||||
char *broadcast_topic;
|
||||
char *broadcast_user;
|
||||
char *broadcast_pass;
|
||||
|
||||
int ipguard_enable;
|
||||
int ipguard_timeout;
|
||||
|
15
src/main.c
15
src/main.c
@ -497,16 +497,22 @@ static int handler(void* user, const char* section, const char* name,
|
||||
conf->main_aka = parse_fido_addr(value);
|
||||
} else if (strcasecmp(name, "qwk max messages") == 0) {
|
||||
conf->bwave_max_msgs = atoi(value);
|
||||
} else if (strcasecmp(name, "broadcast enable") == 0) {
|
||||
} else if (strcasecmp(name, "mqtt enable") == 0) {
|
||||
if (strcasecmp(value, "true") == 0) {
|
||||
conf->broadcast_enable = 1;
|
||||
} else {
|
||||
conf->broadcast_enable = 0;
|
||||
}
|
||||
} else if (strcasecmp(name, "broadcast port") == 0) {
|
||||
} else if (strcasecmp(name, "mqtt port") == 0) {
|
||||
conf->broadcast_port = atoi(value);
|
||||
} else if (strcasecmp(name, "broadcast address") == 0) {
|
||||
} else if (strcasecmp(name, "mqtt address") == 0) {
|
||||
conf->broadcast_address = strdup(value);
|
||||
} else if (strcasecmp(name, "mqtt topic") == 0) {
|
||||
conf->broadcast_topic = strdup(value);
|
||||
} else if (strcasecmp(name, "mqtt user") == 0) {
|
||||
conf->broadcast_user = strdup(value);
|
||||
} else if (strcasecmp(name, "mqtt pass") == 0) {
|
||||
conf->broadcast_pass = strdup(value);
|
||||
} else if (strcasecmp(name, "ip guard enable") == 0) {
|
||||
if (strcasecmp(value, "true") == 0) {
|
||||
conf->ipguard_enable = 1;
|
||||
@ -1301,6 +1307,9 @@ int main(int argc, char **argv) {
|
||||
conf.broadcast_enable = 0;
|
||||
conf.broadcast_port = 0;
|
||||
conf.broadcast_address = NULL;
|
||||
conf.broadcast_topic = NULL;
|
||||
conf.broadcast_user = NULL;
|
||||
conf.broadcast_pass = NULL;
|
||||
conf.config_path = NULL;
|
||||
conf.ipguard_enable = 0;
|
||||
conf.ipguard_tries = 4;
|
||||
|
37
src/menus.c
37
src/menus.c
@ -95,6 +95,8 @@ int menu_system(char *menufile) {
|
||||
char *msg;
|
||||
|
||||
dolog("%s is loading menu: %s", gUser->loginname, menufile);
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing menu %s.", gUser->loginname, mynode, menufile);
|
||||
|
||||
|
||||
if (menufile[0] == '/') {
|
||||
snprintf(buffer, PATH_MAX, "%s.mnu", menufile);
|
||||
@ -424,24 +426,31 @@ int menu_system(char *menufile) {
|
||||
free(menu);
|
||||
return 0;
|
||||
case MENU_AUTOMESSAGE:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Viewing/Changing Automessage.", gUser->loginname, mynode);
|
||||
automessage();
|
||||
break;
|
||||
case MENU_TEXTFILES:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing Textfiles.", gUser->loginname, mynode);
|
||||
display_textfiles();
|
||||
break;
|
||||
case MENU_CHATSYSTEM:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: In Chat System.", gUser->loginname, mynode);
|
||||
chat_system(gUser);
|
||||
break;
|
||||
case MENU_BBSLIST:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing BBS List.", gUser->loginname, mynode);
|
||||
bbs_list(gUser);
|
||||
break;
|
||||
case MENU_LISTUSERS:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing User List.", gUser->loginname, mynode);
|
||||
list_users(gUser);
|
||||
break;
|
||||
case MENU_BULLETINS:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Reading Bulletins.", gUser->loginname, mynode);
|
||||
display_bulletins();
|
||||
break;
|
||||
case MENU_LAST10:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Viewing Last 10 Callers.", gUser->loginname, mynode);
|
||||
display_last10_callers(gUser);
|
||||
break;
|
||||
case MENU_SETTINGS:
|
||||
@ -452,6 +461,7 @@ int menu_system(char *menufile) {
|
||||
for (m=0;m<conf.door_count;m++) {
|
||||
if (strcasecmp(menu[i]->data[j], conf.doors[m]->name) == 0) {
|
||||
dolog("%s launched door %s, on node %d", gUser->loginname, conf.doors[m]->name, mynode);
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Executing Door %s.", gUser->loginname, mynode, conf.doors[m]->name);
|
||||
rundoor(gUser, conf.doors[m]->command, conf.doors[m]->stdio, conf.doors[m]->codepage);
|
||||
dolog("%s returned from door %s, on node %d", gUser->loginname, conf.doors[m]->name, mynode);
|
||||
break;
|
||||
@ -460,24 +470,31 @@ int menu_system(char *menufile) {
|
||||
}
|
||||
break;
|
||||
case MENU_MAILSCAN:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Performing Mail Scan.", gUser->loginname, mynode);
|
||||
mail_scan(gUser);
|
||||
break;
|
||||
case MENU_READMAIL:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Reading Mail.", gUser->loginname, mynode);
|
||||
read_mail(gUser);
|
||||
break;
|
||||
case MENU_POSTMESSAGE:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Posting a Message.", gUser->loginname, mynode);
|
||||
post_message(gUser);
|
||||
break;
|
||||
case MENU_CHOOSEMAILCONF:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Choosing Mail Conference.", gUser->loginname, mynode);
|
||||
choose_conference();
|
||||
break;
|
||||
case MENU_CHOOSEMAILAREA:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Choosing Mail Area.", gUser->loginname, mynode);
|
||||
choose_area();
|
||||
break;
|
||||
case MENU_SENDEMAIL:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Sending an Email.", gUser->loginname, mynode);
|
||||
send_email(gUser);
|
||||
break;
|
||||
case MENU_LISTEMAIL:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing their Emails.", gUser->loginname, mynode);
|
||||
list_emails(gUser);
|
||||
break;
|
||||
case MENU_NEXTMAILCONF:
|
||||
@ -493,28 +510,35 @@ int menu_system(char *menufile) {
|
||||
prev_mail_area(gUser);
|
||||
break;
|
||||
case MENU_BLUEWAVEDOWN:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Downloading Bluewave Packet.", gUser->loginname, mynode);
|
||||
bwave_create_packet();
|
||||
break;
|
||||
case MENU_BLUEWAVEUP:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Uploading Bluewave Packet.", gUser->loginname, mynode);
|
||||
bwave_upload_reply();
|
||||
break;
|
||||
case MENU_CHOOSEFILEDIR:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Choosing a file directory.", gUser->loginname, mynode);
|
||||
choose_directory();
|
||||
break;
|
||||
case MENU_CHOOSEFILESUB:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Choosing a file sub-directory.", gUser->loginname, mynode);
|
||||
choose_subdir();
|
||||
break;
|
||||
case MENU_LISTFILES:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Browsing Files.", gUser->loginname, mynode);
|
||||
list_files(gUser);
|
||||
break;
|
||||
case MENU_UPLOAD:
|
||||
if (gUser->sec_level >= conf.file_directories[gUser->cur_file_dir]->file_subs[gUser->cur_file_sub]->upload_sec_level) {
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Uploading a File.", gUser->loginname, mynode);
|
||||
upload(gUser);
|
||||
} else {
|
||||
s_printf(get_string(84));
|
||||
}
|
||||
break;
|
||||
case MENU_DOWNLOAD:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Downloading Files.", gUser->loginname, mynode);
|
||||
download(gUser);
|
||||
break;
|
||||
case MENU_CLEARTAGGEDFILES:
|
||||
@ -536,12 +560,15 @@ int menu_system(char *menufile) {
|
||||
list_messages(gUser);
|
||||
break;
|
||||
case MENU_DOSCRIPT:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Executing a script %s.", gUser->loginname, mynode, menu[i]->data[j]);
|
||||
do_lua_script(menu[i]->data[j]);
|
||||
break;
|
||||
case MENU_SENDNODEMSG:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Sending a node Message.", gUser->loginname, mynode);
|
||||
send_node_msg();
|
||||
break;
|
||||
case MENU_SUBUNSUBCONF:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Subscribing to conferences.", gUser->loginname, mynode);
|
||||
msg_conf_sub_bases();
|
||||
break;
|
||||
case MENU_RESETPOINTERS:
|
||||
@ -577,13 +604,16 @@ int menu_system(char *menufile) {
|
||||
msgbase_reset_all_pointers(m);
|
||||
break;
|
||||
case MENU_FILESCAN:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Doing a filescan.", gUser->loginname, mynode);
|
||||
file_scan();
|
||||
break;
|
||||
case MENU_FULLMAILSCAN:
|
||||
if (menu[i]->data[j] != NULL) {
|
||||
if (strcasecmp(menu[i]->data[j], "PERSONAL") == 0) {
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Scanning for personal mail.", gUser->loginname, mynode);
|
||||
full_mail_scan_personal(gUser);
|
||||
} else {
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Scanning all mail.", gUser->loginname, mynode);
|
||||
full_mail_scan(gUser);
|
||||
}
|
||||
} else {
|
||||
@ -591,15 +621,18 @@ int menu_system(char *menufile) {
|
||||
}
|
||||
break;
|
||||
case MENU_FILESEARCH:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Executing a filesearch.", gUser->loginname, mynode);
|
||||
file_search();
|
||||
break;
|
||||
case MENU_DISPTXTFILE:
|
||||
if (menu[i]->data[j] != NULL) {
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Displaying Text File: %s.", gUser->loginname, mynode, menu[i]->data[j]);
|
||||
s_displayansi_pause(menu[i]->data[j], 0);
|
||||
}
|
||||
break;
|
||||
case MENU_DISPTXTFILEPAUSE:
|
||||
if (menu[i]->data[j] != NULL) {
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Displaying Text File: %s.", gUser->loginname, mynode, menu[i]->data[j]);
|
||||
s_displayansi_pause(menu[i]->data[j], 1);
|
||||
}
|
||||
s_printf(get_string(6));
|
||||
@ -609,12 +642,14 @@ int menu_system(char *menufile) {
|
||||
genurls();
|
||||
break;
|
||||
case MENU_NLBROWSER:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Executing a filesearch.", gUser->loginname, mynode);
|
||||
nl_browser();
|
||||
break;
|
||||
case MENU_SENDFEEDBACK:
|
||||
if (check_user(conf.sysop_name)) {
|
||||
break;
|
||||
}
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Sending feedback to Sysop.", gUser->loginname, mynode);
|
||||
msg = external_editor(gUser, conf.sysop_name, gUser->loginname, NULL, 0, NULL, "Feedback", 1, 0);
|
||||
if (msg != NULL) {
|
||||
commit_email(conf.sysop_name, "Feedback", msg);
|
||||
@ -622,9 +657,11 @@ int menu_system(char *menufile) {
|
||||
}
|
||||
break;
|
||||
case MENU_BLOGDISPLAY:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Displaying Blog.", gUser->loginname, mynode);
|
||||
blog_display();
|
||||
break;
|
||||
case MENU_BLOGWRITE:
|
||||
broadcast("USER: %s; NODE:%d; STATUS: Writing a Blog Entry.", gUser->loginname, mynode);
|
||||
blog_write();
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user