From de3fa380858d20b9291673bba70949f13865f6a8 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Wed, 19 Apr 2017 15:35:46 +1000 Subject: [PATCH] Initial support for internode messages --- bbs.c | 4 ++++ menus.c | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bbs.c b/bbs.c index facc804..5a865e7 100644 --- a/bbs.c +++ b/bbs.c @@ -751,7 +751,11 @@ tryagain: fputs(user->loginname, nodefile); fclose(nodefile); + sprintf(buffer, "%s/node%d/nodemsg.txt", cond.bbs_path, mynode); + if (stat(buffer, &s) == 0) { + unlink(buffer); + } // do post-login dolog("%s logged in, on node %d", user->loginname, mynode); diff --git a/menus.c b/menus.c index a8ef1ce..c5d0e02 100644 --- a/menus.c +++ b/menus.c @@ -72,6 +72,7 @@ int menu_system(char *menufile) { int result; int doquit = 0; char c; + struct stat s; if (menufile[0] == '/') { 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 (ansi_file != NULL) { s_displayansi(ansi_file);