Initial support for internode messages

This commit is contained in:
Andrew Pamment 2017-04-19 15:35:46 +10:00
parent e8777eae69
commit de3fa38085
2 changed files with 23 additions and 1 deletions

4
bbs.c
View File

@ -751,7 +751,11 @@ tryagain:
fputs(user->loginname, nodefile); fputs(user->loginname, nodefile);
fclose(nodefile); fclose(nodefile);
sprintf(buffer, "%s/node%d/nodemsg.txt", cond.bbs_path, mynode);
if (stat(buffer, &s) == 0) {
unlink(buffer);
}
// do post-login // do post-login
dolog("%s logged in, on node %d", user->loginname, mynode); dolog("%s logged in, on node %d", user->loginname, mynode);

20
menus.c
View File

@ -72,6 +72,7 @@ int menu_system(char *menufile) {
int result; int result;
int doquit = 0; int doquit = 0;
char c; char c;
struct stat s;
if (menufile[0] == '/') { if (menufile[0] == '/') {
snprintf(buffer, PATH_MAX, "%s.mnu", menufile); snprintf(buffer, PATH_MAX, "%s.mnu", menufile);
@ -231,8 +232,25 @@ int menu_system(char *menufile) {
} }
} }
while (!doquit) {
while (!doquit) {
snprintf(buffer, PATH_MAX, "%s/node%d/nodemsg.txt", conf.bbs_path, mynode);
if (stat(buffer, &s) == 0) {
fptr = fopen(buffer, "r");
if (fptr) {
fgets(buffer, PATH_MAX, fptr);
while (!feof(fptr)) {
s_printf("%s\r\n", buffer);
}
fclose(fptr);
snprintf(buffer, PATH_MAX, "%s/node%d/nodemsg.txt", conf.bbs_path, mynode);
unlink(buffer);
s_printf(get_string(6));
c = s_getc();
}
}
if (do_lua_menu == 0) { if (do_lua_menu == 0) {
if (ansi_file != NULL) { if (ansi_file != NULL) {
s_displayansi(ansi_file); s_displayansi(ansi_file);