diff --git a/.gitignore b/.gitignore
index f15af53..f08cf15 100644
--- a/.gitignore
+++ b/.gitignore
@@ -80,3 +80,6 @@ core
docs/site
utils/reset_pass/reset_pass
.vscode
+last10v2.dat
+utils/filecenter/filecenter
+utils/dosbox_shim/shim
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7582e2a
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,8 @@
+image: gcc
+
+before_script:
+ - apt-get update -qq && apt-get install -y -qq build-essential libsqlite3-dev libreadline-dev git libssh-dev libssl1.0-dev libncurses5-dev libmicrohttpd-dev libdbd-sqlite3-perl sed
+
+magicka:
+ script:
+ - make www
\ No newline at end of file
diff --git a/STRINGS.CHANGES b/STRINGS.CHANGES
index fff2b32..63ba386 100644
--- a/STRINGS.CHANGES
+++ b/STRINGS.CHANGES
@@ -4,6 +4,88 @@ If you are using your own custom strings file, you will need
to add / modify the new string on the line specified. Be sure
to remove the start and end quotation marks.
+Changes from v0.9-alpha -> v0.10-alpha
+--------------------------------------------------------------
+
+LINE: 275 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\r\n\e[1;31mError executing archiver.\r\n\e[0m"
+
+LINE: 276 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\r\n\r\n\e[1;37m(\e[1;32mV\e[1;37m)iew or \e[1;37m(\e[1;32mU\e[1;37m)pdate Automessage or \e[1;37m(\e[1;31mQ\e[1;37m)uit: \e[0m"
+
+LINE: 204 MODIFIED
+OLDSTRING: "\e[1;31mUser not found! Assuming new user...\e[0m\r\n\r\n"
+NEWSTRING: "\r\n\e[1;31mUser not found!\e[0m\r\n\r\n"
+
+LINE: 277 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\r\nScan for new personal mail? (Y/N/S): "
+
+LINE: 278 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[1;32mConference: \e[1;37m%d. %s\e[0m\r\n"
+
+LINE: 279 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[1;32m Area: \e[1;37m%d. %s \e[1;33m(%d New Messages)\e[0m\r\n\r\n"
+
+LINE: 280 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "Read Now ? (Y / N): "
+
+LINE: 5 MODIFIED
+OLDSTRING: "\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%02d:%02d %02d-%02d-%02d\e[0m\r\n"
+NEWSTRING: "\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%02d:%02d %02d-%02d-%02d \e[1;33m%c\e[0m\r\n"
+
+LINE: 281 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[1;33mSystem Blog\e[0m\r\n"
+
+LINE: 282 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n"
+
+LINE: 283 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[0mNo Entries...\r\n"
+
+LINE: 284 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[1;37m%s (by \e[1;36m%s\e[1;37m)\r\n"
+
+LINE: 285 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\e[1;35m%d:%02d%s %s, %s %d %d\r\n"
+
+LINE: 286 NEW
+OLDSTRING: (NONE)
+NEWSTRING: "\r\n\r\n\e[1;37mEnter a title:\e[0m "
+
+LINE 128 MODIFIED
+OLDSTRING: "\e[1;30m[\e[1;34m%4d\e[1;30m]\e[1;32m*\e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+NEWSTRING: "\e[1;30m[\e[1;34m%5d\e[1;30m]\e[1;32m*\e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+
+LINE 129 MODIFIED
+OLDSTRING: "\e[1;30m[\e[1;34m%4d\e[1;30m] \e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+NEWSTRING: "\e[1;30m[\e[1;34m%5d\e[1;30m] \e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+
+LINE 189 MODIFIED
+OLDSTRING: "\e[1;30m[\e[1;34;44m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+NEWSTRING: "\e[1;30m[\e[1;34;44m%5d\e[1;30;40m]\e[1;32m*\e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+
+LINE 190 MODIFIED
+OLDSTRING: "\e[1;30m[\e[1;34;44m%4d\e[1;30;40m] \e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+NEWSTRING: "\e[1;30m[\e[1;34;44m%5d\e[1;30;40m] \e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n"
+
+LINE 115 MODIFIED
+OLDSTRING: "\r\n\r\nReplying to: %s\r\n"
+NEWSTRING: "\r\n\r\n\e[1;32m To: \e[0m"
+
+LINE 116 MODIFIED
+OLDSTRING: "Change Subject? (Y/N) "
+NEWSTRING: "\r\n\e[1;32mSubject: \e[0m"
Changes from v0.8-alpha -> v0.9-alpha
--------------------------------------------------------------
diff --git a/deps/aha/aha.c b/deps/aha/aha.c
index faa53de..bac96b0 100644
--- a/deps/aha/aha.c
+++ b/deps/aha/aha.c
@@ -572,6 +572,6 @@ char * aha(char *input)
//Footer
if ((fc!=-1) || (bc!=-1) || (ul!=0) || (bo!=0) || (bl!=0))
append_output(&output, "\n", &size, &outat);
-
+ free(unmangle_out);
return output;
}
diff --git a/deps/lua/Makefile b/deps/lua/Makefile
index 89cf618..8faa179 100644
--- a/deps/lua/Makefile
+++ b/deps/lua/Makefile
@@ -49,7 +49,7 @@ ALL_A= $(LUA_A)
# Targets start here.
default: $(PLAT)
-all: $(ALL_T)
+all: $(ALL_A)
o: $(ALL_O)
diff --git a/dist/ansis/bulletin1.ans b/dist/ansis/bulletin1.ans
index 04be840..8769136 100644
Binary files a/dist/ansis/bulletin1.ans and b/dist/ansis/bulletin1.ans differ
diff --git a/dist/ansis/mainmenu.ans b/dist/ansis/mainmenu.ans
index 8d0f1a4..7bf2e1f 100644
Binary files a/dist/ansis/mainmenu.ans and b/dist/ansis/mainmenu.ans differ
diff --git a/dist/config/bbs.ini b/dist/config/bbs.ini
index 1e0c3e0..0da2382 100644
--- a/dist/config/bbs.ini
+++ b/dist/config/bbs.ini
@@ -14,6 +14,7 @@ External Editor stdio = true
External Editor Codepage = CP437
Automessage Write Level = 10
Fork = false
+Run As User = USERNAME
Enable WWW = false
WWW Port = 8080
WWW URL = http://127.0.0.1:8080/
diff --git a/dist/config/filesgen.ini b/dist/config/filesgen.ini
index 8d210f1..ec292da 100644
--- a/dist/config/filesgen.ini
+++ b/dist/config/filesgen.ini
@@ -1,5 +1,6 @@
[main]
Visible Sec Level = 10
+Visible on Web = false
[Misc]
Database = files_misc
diff --git a/dist/magicka.strings b/dist/magicka.strings
index 5b7b778..6c653cf 100644
--- a/dist/magicka.strings
+++ b/dist/magicka.strings
@@ -2,7 +2,7 @@
\r\n\r\nTimeout waiting for input..\r\n
\r\n\e[1;37mLast 10 callers:\r\n
\e[1;30m-------------------------------------------------------------------------------\r\n
-\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%02d:%02d %02d-%02d-%02d\e[0m\r\n
+\e[1;37m%-16s \e[1;36m%-32s \e[1;32m%02d:%02d %02d-%02d-%02d \e[1;33m%c\e[0m\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\e[1;37mPress any key to continue...\e[0m\r\n
\r\n\r\n\e[1;37mSystem Information\r\n
@@ -112,8 +112,8 @@ Quoting Cancelled\r\n
\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
\r\n\e[1;37mPress \e[1;36mR \e[1;37mto reply, \e[1;36mQ \e[1;37mto quit, \e[1;36mB \e[1;37mto go Back, \e[1;36mSPACE \e[1;37mfor Next Mesage...
\r\nSorry, you are not allowed to post in this area\r\n
-\r\n\r\nReplying to: %s\r\n
-Change Subject? (Y/N)
+\r\n\r\n\e[1;32m To: \e[0m
+\r\n\e[1;32mSubject: \e[0m
\r\nNew subject:
\r\nOk, not changing the subject line...
\r\n\r\nNo more messages\r\n
@@ -125,8 +125,8 @@ Read message [1-%d] or N for New:
\r\nMailing to @%d\r\n
Start at message [1-%d] or N for New?
\e[2J\e[1;1H\e[1;37;44m[MSG#] Subject From To Date \r\n\e[0m
-\e[1;30m[\e[1;34m%4d\e[1;30m]\e[1;32m*\e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
-\e[1;30m[\e[1;34m%4d\e[1;30m] \e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
+\e[1;30m[\e[1;34m%5d\e[1;30m]\e[1;32m*\e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
+\e[1;30m[\e[1;34m%5d\e[1;30m] \e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
(#) Read Message # (Q) Quit (ENTER) Continue\r\n
\r\nThere is no mail in this area\r\n
\r\n\r\nMail Conferences:\r\n\r\n
@@ -186,8 +186,8 @@ Is this Correct? (Y/N)
\e[1;37mPress any key to continue...\e[0m
\e[24;1H\e[1;32mUp / Down \e[1;37mto Scroll, \e[1;32mLeft / Right \e[1;37mChange Message, \e[1;32mR \e[1;37mReply, \e[1;32mQ \e[1;37mQuit\e[K\e[0m
\e[23;1H\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
-\e[1;30m[\e[1;34;44m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
-\e[1;30m[\e[1;34;44m%4d\e[1;30;40m] \e[1;37m%-25.25s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
+\e[1;30m[\e[1;34;44m%5d\e[1;30;40m]\e[1;32m*\e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
+\e[1;30m[\e[1;34;44m%5d\e[1;30;40m] \e[1;37m%-24.24s \e[1;32m%-15.15s \e[1;33m%-15.15s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
\e[24;1H\e[1;37;44mUp/Down to Scroll, Enter to read, Q to quit\e[K\e[0m
\e[24;1H\e[1;32mUp / Down \e[1;37mto Scroll, \e[1;32mLeft / Right \e[1;37mto Change Message, \e[1;32mR \e[1;37mreply, \e[1;32mD \e[1;37mDelete, \e[1;32mQ \e[1;37mquit\e[K\e[0m
\e[1;30m[\e[1;34;44m%4d\e[1;30;40m]\e[1;32m*\e[1;37m%-39.39s \e[1;32m%-16.16s \e[1;35m%02d:%02d %02d-%02d-%02d\e[K\e[0m\r\n
@@ -201,7 +201,7 @@ Is this Correct? (Y/N)
\r\nPlease enter a description:\r\n
...Found!\r\n\r\n
\e[1;32mUpload Successful!\e[0m\r\n
-\e[1;31mUser not found! Assuming new user...\e[0m\r\n\r\n
+\r\n\e[1;31mUser not found!\e[0m\r\n\r\n
\e[1;32mSuccesfully processed \e[1;37m%d \e[1;32mmessages!\r\n\e[0m
\e[0;36mA. \e[1;37mDefault Archiver (\e[1;33m%s\e[1;37m)\r\n
\r\n\e[1;32mSelect an archiver...\e[0m\r\n\r\n
@@ -272,3 +272,15 @@ File exists!\r\n
\e[24;1H\e[1;37;44mUp / Down to Select, A to Add, D to Delete, Q to Quit\e[K
\e[8;28H\e[1;31;40mNo BBSes in the list!
\e[10;22H\e[1;37mPress \e[1;33mA \e[1;37m to Add yours or \e[1;33mQ \e[1;37mto Quit\e[0m
+\r\n\e[1;31mError executing archiver.\r\n\e[0m
+\r\n\r\n\e[1;37m(\e[1;32mV\e[1;37m)iew or \e[1;37m(\e[1;32mU\e[1;37m)pdate Automessage or \e[1;37m(\e[1;31mQ\e[1;37m)uit: \e[0m
+\r\nScan for new personal mail? (Y/N/S):
+\e[1;32mConference: \e[1;37m%d. %s\e[0m\r\n
+\e[1;32m Area: \e[1;37m%d. %s \e[1;33m(%d New Messages)\e[0m\r\n\r\n
+Read Now ? (Y / N):
+\e[1;33mSystem Blog\e[0m\r\n
+\e[1;30m-------------------------------------------------------------------------------\e[0m\r\n
+\e[0mNo Entries...\r\n
+\e[1;37m%s (by \e[1;36m%s\e[1;37m)\r\n
+\e[1;35m%d:%02d%s %s, %s %d %d\r\n
+\r\n\r\n\e[1;37mEnter a title:\e[0m
diff --git a/dist/menus/main.mnu b/dist/menus/main.mnu
index dd47711..8061a8d 100644
--- a/dist/menus/main.mnu
+++ b/dist/menus/main.mnu
@@ -2,7 +2,7 @@ LUASCRIPT mainmenu
ANSIFILE mainmenu
HOTKEY O
-COMMAND AUTOMESSAGE_WRITE
+COMMAND AUTOMESSAGE
HOTKEY A
COMMAND TEXTFILES
diff --git a/dist/scripts/login_stanza.lua b/dist/scripts/login_stanza.lua
index 99ef565..153cff8 100644
--- a/dist/scripts/login_stanza.lua
+++ b/dist/scripts/login_stanza.lua
@@ -30,6 +30,9 @@ while(true) do
i = i + 1;
end
+-- Display Blog
+bbs_display_blog();
+
-- Display Info
local bbsname;
local sysopname;
@@ -60,9 +63,13 @@ bbs_write_string("\r\n\r\n\027[1;37mLast 10 callers:\r\n");
bbs_write_string("\027[1;30m-------------------------------------------------------------------------------\r\n");
while (i < 10) do
- user, location, ltime = bbs_read_last10(i);
+ user, location, ltime, calls = bbs_read_last10(i);
if (user ~= nil) then
- bbs_write_string(string.format("\027[1;37m%-16s \027[1;36m%-32s \027[1;32m%s\r\n", user, location, os.date("%H:%M %d-%m-%y" ,ltime)));
+ if calls == 1 then
+ bbs_write_string(string.format("\027[1;37m%-16s \027[1;36m%-32s \027[1;32m%s \027[1;33mN\r\n", user, location, os.date("%H:%M %d-%m-%y" ,ltime)));
+ else
+ bbs_write_string(string.format("\027[1;37m%-16s \027[1;36m%-32s \027[1;32m%s\r\n", user, location, os.date("%H:%M %d-%m-%y" ,ltime)));
+ end
end
i = i + 1;
@@ -83,6 +90,8 @@ end
bbs_mail_scan();
+bbs_personal_mail_scan();
+
bbs_file_scan();
-- Display Auto Message
diff --git a/dist/www-bootstrap/header.tpl b/dist/www-bootstrap/header.tpl
index a2db158..a3c86d4 100644
--- a/dist/www-bootstrap/header.tpl
+++ b/dist/www-bootstrap/header.tpl
@@ -65,6 +65,9 @@
Home
+
+ News
+
Last 10 Callers
@@ -74,6 +77,9 @@
Conferences
+
+ File Areas
+
diff --git a/dist/www-bootstrap/static/newuser.png b/dist/www-bootstrap/static/newuser.png
new file mode 100644
index 0000000..5950e99
Binary files /dev/null and b/dist/www-bootstrap/static/newuser.png differ
diff --git a/dist/www-bootstrap/static/style-mobile.css b/dist/www-bootstrap/static/style-mobile.css
index c2388a1..d7a6f6c 100644
--- a/dist/www-bootstrap/static/style-mobile.css
+++ b/dist/www-bootstrap/static/style-mobile.css
@@ -341,6 +341,37 @@
max-width: 100%;
}
+.last10-new {
+ position: relative;
+ width: 100%;
+ min-height: 1px;
+ padding-right: 15px;
+ padding-left: 15px;
+
+ -webkit-box-flex: 0;
+ -ms-flex: 100%;
+ flex: 0 0 100%;
+ max-width: 100%;
+}
+
+.blog-header {
+ border: 1px solid #666666;
+ background-color: #eee;
+ padding: 5px;
+}
+
+.blog-date {
+ font-size: small;
+}
+
+.blog-author {
+ font-size: small;
+}
+
+.blog-entry {
+ padding: 25px;
+}
+
#msgbody {
background-color: black;
color: gray;
@@ -363,4 +394,40 @@ textarea {
padding: 0px;
max-width: 100%;
overflow-x: none;
+}
+
+.filedesc {
+ background-color: black;
+ color: gray;
+ font-family: 'pxplus_ibm_vga8regular';
+ line-height: 1;
+ padding: 5px;
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+thead {
+ color: #eee;
+ background-color: #666666;
+}
+
+thead th:nth-child(1) {
+ width: 5%;
+}
+
+thead th:nth-child(2) {
+ width: 5%;
+}
+
+thead th:nth-child(3) {
+ width: 90%;
+}
+
+th, td {
+ vertical-align: top;
+ padding: 20px;
+ border-top: 1px solid #666;
}
\ No newline at end of file
diff --git a/dist/www-bootstrap/static/style.css b/dist/www-bootstrap/static/style.css
index 1b8ee14..367919b 100644
--- a/dist/www-bootstrap/static/style.css
+++ b/dist/www-bootstrap/static/style.css
@@ -288,6 +288,25 @@
background-color: #111111;
}
+.blog-header {
+ border: 1px solid #666666;
+ background-color: #eee;
+ padding: 5px;
+}
+
+.blog-date {
+ float: right;
+ font-size: small;
+}
+
+.blog-author {
+ font-size: small;
+}
+
+.blog-entry {
+ padding: 25px;
+}
+
.last10-row {
background-color: #eee;
display: -webkit-box;
@@ -331,9 +350,22 @@
padding-left: 15px;
-webkit-box-flex: 0;
- -ms-flex: 0 0 33.333333%;
- flex: 0 0 33.333333%;
- max-width: 33.333333%;
+ -ms-flex: 0 0 23.333333%;
+ flex: 0 0 23.333333%;
+ max-width: 23.333333%;
+}
+
+.last10-new {
+ position: relative;
+ width: 100%;
+ min-height: 1px;
+ padding-right: 15px;
+ padding-left: 15px;
+
+ -webkit-box-flex: 0;
+ -ms-flex: 0 0 10%;
+ flex: 0 0 10%;
+ max-width: 10%;
}
#msgbody {
@@ -343,3 +375,39 @@
line-height: 1;
padding: 5px;
}
+
+.filedesc {
+ background-color: black;
+ color: gray;
+ font-family: 'pxplus_ibm_vga8regular';
+ line-height: 1;
+ padding: 5px;
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+}
+
+thead {
+ color: #eee;
+ background-color: #666666;
+}
+
+thead th:nth-child(1) {
+ width: 30%;
+}
+
+thead th:nth-child(2) {
+ width: 10%;
+}
+
+thead th:nth-child(3) {
+ width: 60%;
+}
+
+th, td {
+ vertical-align: top;
+ padding: 20px;
+ border-top: 1px solid #666;
+}
\ No newline at end of file
diff --git a/docs/docs/guide/doors/dosbox.md b/docs/docs/guide/doors/dosbox.md
index 68aa66f..feee069 100644
--- a/docs/docs/guide/doors/dosbox.md
+++ b/docs/docs/guide/doors/dosbox.md
@@ -38,47 +38,54 @@ These commands will compile and install DosBox into /usr/local/bin.
## Create Configuration File
-Next you will need to create a config file which enables the serial port for socket inheritance, and also mounts drives so that DosBox can access both your doors and your BBS drop files.
+Next you will need to create a config file which enables the serial port, and also mounts drives so that DosBox can access both your doors and your BBS drop files.
-An example setup is here: [dosbox.conf](https://gist.github.com/apamment/98e42db83c452105b3e21a8bc062c5c3)
+An example setup is here: [dosbox.conf](https://gist.github.com/apamment/2e5b00eda2f304f2bc7d298a0487bd9b)
In this example, drive C: is the location where my doors are stored, dropfiles will be copied to the door directory.
+Be sure to change the port for each door. In this example the port is 9999.
+
## Create Shell Script to Invoke DosBox
The shell script you need will vary from system to system, but basically, you want to:
- * ensure no one else is using the door before you start it
* Copy the dropfile to the door directory
* make DosBox not use an X11 window,
- * ensure that the dropfiles have DOS line endings
* launch DosBox with the command to start the batch file in the next section.
Here is an example script I use for Freshwater Fishing:
#!/bin/bash
export SDL_VIDEODRIVER="dummy"
- NODE=$1
- SOCKET=$2
+ NODE=$2
+ PORT=$1
trap '' 2
- if [ ! -e /home/pi/MagickaBBS/doors/ffs.inuse ]; then
- touch /home/pi/MagickaBBS/doors/ffs.inuse
- cp /home/pi/MagickaBBS/node${NODE}/door.sys /home/pi/MagickaBBS/doors/ffs/
- /usr/local/bin/dosbox -socket $SOCKET -c "C:\ffs\ffs.bat ${NODE}" -conf /home/pi/MagickaBBS/doors/dosbox.conf
- rm /home/pi/MagickaBBS/doors/ffs.inuse
- fi
+ cp /home/pi/MagickaBBS/node${NODE}/door.sys /home/pi/MagickaBBS/doors/ffs/
+ /usr/local/bin/dosbox -c "C:\ffs\ffs.bat ${NODE}" -conf /home/pi/MagickaBBS/doors/dosbox-ffs.conf > /dev/null 2>&1
trap 2
-
-This will just dump the user back to the BBS if the door is in use. You could get fancy and use the 'inuse' door I created which will display an in-use message and then quit ([INUSE Door](https://github.com/apamment/inuse)), but that is outside the scope of this document.
-
You will also need to make the bash script executable:
chmod +x ffs.sh
+## Create Shell Script to Invoke the DosBox Shim
+
+ #!/bin/bash
+
+ if [ ! -e /home/pi/MagickaBBS/doors/ffs.inuse ]; then
+ touch /home/pi/MagickaBBS/doors/ffs.inuse
+ /home/pi/MagickaBBS/utils/dosbox_shim/shim 9999 $NODE /home/andrew/MagickaBBS/doors/ffs.sh
+ rm /home/pi/MagickaBBS/doors/ffs.inuse
+ fi
+
+This will just dump the user back to the BBS if the door is in use. You could get fancy and use the 'inuse' door I created which will display an in-use message and then quit ([INUSE Door](https://github.com/apamment/inuse)), but that is outside the scope of this document.
+
+Again be sure to change the port to match the dosbox config for this door.
+
## Create Batch File to Start Door
Please note, you will need to setup your doors using DosBox in the normal fashion, either you set them up on a machine where you have a monitor attached and transfer the files over, or you run DosBox directly from your PI with either remote X11 or a local monitor.
@@ -101,13 +108,13 @@ This loads BNU, then launches the door with the drop file.
## Setup BBS
-Finally, you will want to setup your BBS to call the script you made in Step 6. You also need to pass the node number and socket handle.
+Finally, you will want to setup your BBS to call the dosbox shim script.
In doors.ini, something like
[Freshwater Fishing]
- command = /home/pi/MagickaBBS/doors/ffs.sh
- stdio = false
+ command = /home/pi/MagickaBBS/doors/ffs-shim.sh
+ stdio = true
codepage = CP437
Then, add a command to your doors menu:
diff --git a/docs/docs/guide/files/config.md b/docs/docs/guide/files/config.md
index cca4b63..f3f1b5d 100644
--- a/docs/docs/guide/files/config.md
+++ b/docs/docs/guide/files/config.md
@@ -6,6 +6,7 @@ File directories and subdirectories are similar to message conferences and areas
[main]
Visible Sec Level = 10
+ Visible On Web = false
[Area One]
Database = area_one
@@ -19,7 +20,11 @@ File directories and subdirectories are similar to message conferences and areas
Upload Sec Level = 99
Upload Path = /path/to/MagickaBBS/files/area_two
-In the main section there is just one variable that applies to the whole directory, **Visible Sec Level** is the security level required to view the directory.
+In the main section variables apply to the whole directory,
+
+**Visible Sec Level** is the security level required to view the directory.
+
+**Visible On Web** is either true or false if you want it visible and the files downloadable via the website.
The section name for the sub-directory is the name of the sub directory.
@@ -33,9 +38,10 @@ The section name for the sub-directory is the name of the sub directory.
## Uploading Files
-When a user (or the sysop) uploads a file, they are not *approved* by default, so they will not be shown in the listings. To approve uploaded files, the sysop should run the fileapprove utility on the database.
+When a user (or the sysop) uploads a file, they are not *approved* by default, so they will not be shown in the listings. To approve uploaded files, the sysop should run the filecenter utility on the database.
- ./utils/fileapprove/fileapprove -d database.sq3
+ cd utils/filecenter
+ ./filecenter -c ../../config/bbs.ini
This will list all the files in the database, and allow the sysop to toggle the approved status, or remove the file entirely.
diff --git a/docs/docs/guide/ini/bbs.md b/docs/docs/guide/ini/bbs.md
index 94daea5..6489357 100644
--- a/docs/docs/guide/ini/bbs.md
+++ b/docs/docs/guide/ini/bbs.md
@@ -18,6 +18,7 @@ This is the main bbs INI file and contains the following sections
* **External Editor Codepage** The codepage the external editor uses (CP437 for magiedit) (Only required if External Editor CMD is set)
* **Automessage Write Level** The security level a user needs to change the automessage (Required)
* **Fork** True if you want the BBS to run in daemon mode false if not. (Required)
+ * **Run as User** Which user to run at if invoked as root. (Required if running as root)
* **Enable WWW** True to enable the WWW server, false if not. (Required)
* **WWW Port** Port to listen for HTTP connections (Required if WWW is enabled)
* **WWW URL** Public facing url of the BBS (Required if WWW is enabled)
diff --git a/docs/docs/guide/installation.md b/docs/docs/guide/installation.md
index e191a2d..9505741 100644
--- a/docs/docs/guide/installation.md
+++ b/docs/docs/guide/installation.md
@@ -24,10 +24,12 @@ should work on debian and debian derivatives.
## Install Magicka
-Clone the repo
+Clone the repo and checkout the branch you want, eg. v0.9-patch.
git clone https://github.com/MagickaBBS/MagickaBBS
+ git checkout v0.9-patch
+
Build the BBS
make www
diff --git a/docs/docs/guide/menus.md b/docs/docs/guide/menus.md
index 5ca93a8..03b5d02 100644
--- a/docs/docs/guide/menus.md
+++ b/docs/docs/guide/menus.md
@@ -32,6 +32,17 @@ Next is a DATA command, this specifies the DATA associated with the COMMAND comm
Finally, an optional SECLEVEL command indicates the required security level for a user to be able to trigger a command.
+## Chaining Commands
+
+As of v0.10 commands can be chained one after the other under a single hotkey. For example, a menu that would display a text file then run a door might look like this:
+
+ HOTKEY A
+ COMMAND DISPLAYTEXTFILE
+ DATA sometextfile
+ COMMAND RUNDOOR
+ DATA door to run
+ SECLEVEL 10
+
## List of COMMANDs
**SUBMENU** loads a new menu. DATA is the name of the submenu
@@ -118,7 +129,7 @@ Finally, an optional SECLEVEL command indicates the required security level for
**FILESCAN** Scan for new files.
-**FULLMAILSCAN** Scan for new messages and display them.
+**FULLMAILSCAN** Scan for new messages and display them. Optional DATA PERSONAL for personal mail scan.
**FILESEARCH** Search for a file.
@@ -131,3 +142,7 @@ Finally, an optional SECLEVEL command indicates the required security level for
**NLBROWSER** Browse the nodelist for the current conference.
**SENDFEEDBACK** Send feedback to the Sysop.
+
+**BLOGDISPLAY** Display the System Blog.
+
+**BLOGWRITE** Add an entry to the System Blog.
\ No newline at end of file
diff --git a/docs/docs/guide/scripting.md b/docs/docs/guide/scripting.md
index 571f34b..a7a486e 100644
--- a/docs/docs/guide/scripting.md
+++ b/docs/docs/guide/scripting.md
@@ -96,6 +96,8 @@ Where data is the name of the lua script to call without the extension.
**bbs_full_mail_scan** Performs a full mail scan (like a mail scan but also displays new messages)
+**bbs_personal_mail_scan** Performs a full mail scan (like a full mail scan but only displays personal messages)
+
**bbs_get_userhandle** Returns the logged in user's handle
**bbs_message_found** Takes three numbers, the conference, area and the message number, returns one number, 1 if found, 0 if not.
@@ -111,3 +113,5 @@ Where data is the name of the lua script to call without the extension.
**bbs_data_path** Returns a path for script data storage. This is shared with all scripts, so make sure your filenames are unique.
**bbs_user_security** Returns the current user's security level.
+
+**bbs_display_blog** Display the System Blog.
diff --git a/docs/docs/guide/updating.md b/docs/docs/guide/updating.md
index 4ae6531..1a85f5a 100644
--- a/docs/docs/guide/updating.md
+++ b/docs/docs/guide/updating.md
@@ -18,7 +18,7 @@ Assuming you've installed Magicka BBS from via git rather than use a ZIP file or
make cleanwww
make www
-Where branch is the branch you're updating to, for example v0.9-alpha.
+Where branch is the branch you're updating to, for example v0.9-patch.
## Step 3. Update Scripts
diff --git a/file_id.diz b/file_id.diz
index 95d964a..b2808fb 100644
--- a/file_id.diz
+++ b/file_id.diz
@@ -1,6 +1,6 @@
. . . .__ .__ __.
|\/| _. _ * _.;_/ _. [__)[__)(__
-| |(_](_]|(_.| \(_] [__)[__).__) v0.9a
+| |(_](_]|(_.| \(_] [__)[__).__) v0.10a
-------._|----------------------------------
Magicka BBS is a Free BBS System for Linux,
macOS, FreeBSD, NetBSD, OpenIndiana,
diff --git a/setup.sh b/setup.sh
index 298a02e..49da63b 100755
--- a/setup.sh
+++ b/setup.sh
@@ -69,9 +69,11 @@ else
SED=sed
fi
+
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/bbs.ini
$SED -i "s/BBS Name = Magicka BBS/BBS Name = ${bbsname}/g" config/bbs.ini
$SED -i "s/Sysop Name = sysop/Sysop Name = ${handle}/g" config/bbs.ini
+$SED -i "s/USERNAME/${USERNAME}/g" config/bbs.ini
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/localmail.ini
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/filesgen.ini
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/happynet.ini
diff --git a/src/Makefile.freebsd b/src/Makefile.freebsd
index 412f879..56c8f15 100644
--- a/src/Makefile.freebsd
+++ b/src/Makefile.freebsd
@@ -8,7 +8,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile freebsd MAKEFLAGS=
@@ -29,7 +29,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/local/include && ./configure --with-ncurses
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -51,8 +51,11 @@ magichat: $(JSMN)
mgpost: $(JAMLIB)
cd ../utils/mgpost && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -74,6 +77,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.freebsd.WWW b/src/Makefile.freebsd.WWW
index c4864e4..fad558e 100644
--- a/src/Makefile.freebsd.WWW
+++ b/src/Makefile.freebsd.WWW
@@ -10,7 +10,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile freebsd MAKEFLAGS=
@@ -34,7 +34,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/local/include && ./configure --with-ncurses
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o www_files.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o www_blog.o www_files.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -56,8 +56,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -80,6 +83,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.linux b/src/Makefile.linux
index 45e93af..ad62edc 100644
--- a/src/Makefile.linux
+++ b/src/Makefile.linux
@@ -8,7 +8,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile linux MAKEFLAGS=
@@ -30,7 +30,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -52,8 +52,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -75,6 +78,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.linux.WWW b/src/Makefile.linux.WWW
index 4010a2a..11cec93 100644
--- a/src/Makefile.linux.WWW
+++ b/src/Makefile.linux.WWW
@@ -10,7 +10,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile linux MAKEFLAGS=
@@ -34,7 +34,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && ./configure
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o www_files.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o www_blog.o www_files.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -56,8 +56,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -80,6 +83,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.netbsd b/src/Makefile.netbsd
index 781b4d7..2392299 100644
--- a/src/Makefile.netbsd
+++ b/src/Makefile.netbsd
@@ -8,7 +8,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS=
@@ -29,7 +29,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/pkg/include && ./configure --with-ncurses
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -51,8 +51,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -74,6 +77,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.netbsd.WWW b/src/Makefile.netbsd.WWW
index b681baf..543830c 100644
--- a/src/Makefile.netbsd.WWW
+++ b/src/Makefile.netbsd.WWW
@@ -10,7 +10,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS=
@@ -34,7 +34,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/pkg/include && ./configure --with-ncurses
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o www_files.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o www_files.o www_blog.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -56,8 +56,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -80,6 +83,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
\ No newline at end of file
diff --git a/src/Makefile.openbsd b/src/Makefile.openbsd
index bfcccd8..f72b5fc 100644
--- a/src/Makefile.openbsd
+++ b/src/Makefile.openbsd
@@ -8,7 +8,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS=
@@ -29,7 +29,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/local/include && ./configure --with-ncurses
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -51,8 +51,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -74,7 +77,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
-
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.openbsd.WWW b/src/Makefile.openbsd.WWW
index 2a1fb21..43d984a 100644
--- a/src/Makefile.openbsd.WWW
+++ b/src/Makefile.openbsd.WWW
@@ -10,7 +10,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile bsd MAKEFLAGS=
@@ -34,7 +34,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && export CPPFLAGS=-I/usr/local/include && ./configure --with-ncurses
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o www_files.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o www.o www_email.o www_msgs.o www_last10.o www_files.o www_blog.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -56,8 +56,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -80,7 +83,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
-
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.osx b/src/Makefile.osx
index 0aa7f59..653589e 100644
--- a/src/Makefile.osx
+++ b/src/Makefile.osx
@@ -8,9 +8,9 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile macosx MAKEFLAGS=
@@ -52,8 +52,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -75,6 +78,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
\ No newline at end of file
diff --git a/src/Makefile.osx.WWW b/src/Makefile.osx.WWW
index a1a69df..f6cfbf4 100644
--- a/src/Makefile.osx.WWW
+++ b/src/Makefile.osx.WWW
@@ -10,7 +10,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile macosx MAKEFLAGS=
@@ -34,7 +34,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && ./configure
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o www_files.o bluewave.o hashmap/hashmap.o menus.o nodelist.o
+OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o www_files.o www_blog.o bluewave.o hashmap/hashmap.o menus.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -56,8 +56,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE)
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -79,6 +82,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
\ No newline at end of file
diff --git a/src/Makefile.sunos b/src/Makefile.sunos
index c0205a4..7cb0971 100644
--- a/src/Makefile.sunos
+++ b/src/Makefile.sunos
@@ -8,7 +8,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter dosbox_shim magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile solaris MAKEFLAGS=
@@ -30,7 +30,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o os/sunos.o nodelist.o
+OBJ = inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o bluewave.o hashmap/hashmap.o menus.o os/sunos.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -52,8 +52,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE) -f Makefile.sunos
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -75,6 +78,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/Makefile.sunos.WWW b/src/Makefile.sunos.WWW
index 13fa7b5..902751f 100644
--- a/src/Makefile.sunos.WWW
+++ b/src/Makefile.sunos.WWW
@@ -10,7 +10,7 @@ ODOORS = ../deps/odoors/libs-`uname -s`/libODoors.a
JSMN = ../deps/jsmn/libjsmn.a
CDK = ../deps/cdk-5-20161210/libcdk.a
-all: magicka magimail magiedit ticproc mgpost magichat fileapprove magiftpd reset_pass
+all: magicka magimail magiedit ticproc mgpost magichat filecenter magiftpd reset_pass
${LUA}:
cd ../deps/lua && $(MAKE) -f Makefile solaris MAKEFLAGS=
@@ -34,7 +34,7 @@ $(CDK):
cd ../deps/cdk-5.0-20161210/ && ./configure
cd ../deps/cdk-5.0-20161210/ && $(MAKE)
-OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o bluewave.o www_files.o hashmap/hashmap.o menus.o os/sunos.o nodelist.o
+OBJ = ../deps/aha/aha.o ../deps/hashids/hashids.o inih/ini.o bbs.o main.o users.o main_menu.o mail_menu.o doors.o bbs_list.o chat_system.o email.o files.o settings.o lua_glue.o strings.o www.o www_email.o www_msgs.o www_last10.o bluewave.o www_files.o www_blog.o hashmap/hashmap.o menus.o os/sunos.o nodelist.o blog.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
@@ -56,8 +56,11 @@ mgpost: $(JAMLIB)
magichat: $(JSMN)
cd ../utils/magichat && $(MAKE) -f Makefile.sunos
-fileapprove: $(CDK)
- cd ../utils/fileapprove && $(MAKE)
+filecenter: $(CDK)
+ cd ../utils/filecenter && $(MAKE)
+
+dosbox_shim:
+ cd ../utils/dosbox_shim && $(MAKE)
magiftpd:
cd ../utils/magiftpd && $(MAKE)
@@ -80,6 +83,7 @@ clean:
cd ../utils/mgpost && $(MAKE) clean
cd ../utils/magichat && $(MAKE) clean
cd ../deps/cdk-5.0-20161210 && $(MAKE) clean
- cd ../utils/fileapprove && $(MAKE) clean
+ cd ../utils/filecenter && $(MAKE) clean
cd ../utils/magiftpd && $(MAKE) clean
- cd ../utils/reset_pass && $(MAKE) clean
\ No newline at end of file
+ cd ../utils/reset_pass && $(MAKE) clean
+ cd ../utils/dosbox_shim && $(MAKE) clean
diff --git a/src/bbs.c b/src/bbs.c
index 870764e..83d0ec0 100644
--- a/src/bbs.c
+++ b/src/bbs.c
@@ -256,12 +256,18 @@ void s_putchar(char c) {
size_t inc;
size_t ouc;
size_t sz;
+ int ret;
if (!should_convert_utf8()) {
if (sshBBS) {
putchar(c);
} else {
- write(gSocket, &c, 1);
+ ret = send(gSocket, &c, 1, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
} else {
ic = iconv_open("UTF-8", "CP437");
@@ -277,7 +283,12 @@ void s_putchar(char c) {
if (sshBBS) {
fprintf(stdout, "%s", ptr1);
} else {
- write(gSocket, ptr1, outbuf - ptr1);
+ ret = send(gSocket, ptr1, outbuf - ptr1, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
iconv_close(ic);
free(ptr1);
@@ -294,11 +305,17 @@ void s_putstring(char *c) {
size_t sz;
char *ptr1;
char *ptr2;
+ int ret;
if (!should_convert_utf8()) {
if (sshBBS) {
fprintf(stdout, "%s", c);
} else {
- write(gSocket, c, strlen(c));
+ ret = send(gSocket, c, strlen(c), 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
} else {
ic = iconv_open("UTF-8", "CP437");
@@ -313,7 +330,12 @@ void s_putstring(char *c) {
if (sshBBS) {
fprintf(stdout, "%s", ptr1);
} else {
- write(gSocket, ptr1, outbuf - ptr1);
+ ret = send(gSocket, ptr1, outbuf - ptr1, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
iconv_close(ic);
free(ptr1);
@@ -395,22 +417,25 @@ char s_getchar() {
char iac_binary_do[] = {IAC, IAC_DO, IAC_TRANSMIT_BINARY, '\0'};
char iac_binary_wont[] = {IAC, IAC_WONT, IAC_TRANSMIT_BINARY, '\0'};
char iac_binary_dont[] = {IAC, IAC_DONT, IAC_TRANSMIT_BINARY, '\0'};
-
+ int ret;
do {
if (sshBBS) {
c = getchar();
} else {
- len = read(gSocket, &c, 1);
-
- if (len == 0) {
+ do {
+ len = read(gSocket, &c, 1);
+ } while (len == -1 && errno == EINTR);
+ if (len <= 0) {
disconnect("Socket Closed");
}
}
if (!sshBBS) {
while (c == IAC) {
- len = read(gSocket, &c, 1);
+ do {
+ len = read(gSocket, &c, 1);
+ } while (len == -1 && errno == EINTR);
if (len == 0) {
disconnect("Socket Closed");
} else if (c == IAC) {
@@ -418,8 +443,10 @@ char s_getchar() {
return c;
}
if (c == IAC_WILL || c == IAC_WONT || c == IAC_DO || c == IAC_DONT) {
- len = read(gSocket, &d, 1);
- if (len == 0) {
+ do {
+ len = read(gSocket, &c, 1);
+ } while (len == -1 && errno == EINTR);
+ if (len <= 0) {
disconnect("Socket Closed");
}
@@ -428,7 +455,12 @@ char s_getchar() {
if (d == 0) {
if (telnet_bin_mode != 1) {
telnet_bin_mode = 1;
- write(gSocket, iac_binary_do, 3);
+ ret = send(gSocket, iac_binary_do, 3, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
}
break;
@@ -436,7 +468,12 @@ char s_getchar() {
if (d == 0) {
if (telnet_bin_mode != 0) {
telnet_bin_mode = 0;
- write(gSocket, iac_binary_dont, 3);
+ ret = send(gSocket, iac_binary_dont, 3, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
}
break;
@@ -444,7 +481,13 @@ char s_getchar() {
if (d == 0) {
if (telnet_bin_mode != 1) {
telnet_bin_mode = 1;
- write(gSocket, iac_binary_will, 3);
+ ret = send(gSocket, iac_binary_will, 3, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
+
}
}
break;
@@ -452,22 +495,31 @@ char s_getchar() {
if (d == 0) {
if (telnet_bin_mode != 0) {
telnet_bin_mode = 0;
- write(gSocket, iac_binary_wont, 3);
+ ret = send(gSocket, iac_binary_wont, 3, 0);
+ if (ret == -1) {
+ if (errno == ECONNRESET) {
+ disconnect("Disconnected");
+ }
+ }
}
}
break;
}
} else if (c == 250) {
do {
- len = read(gSocket, &c, 1);
- if (len == 0) {
+ do {
+ len = read(gSocket, &c, 1);
+ } while (len == -1 && errno == EINTR);
+ if (len <= 0) {
disconnect("Socket Closed");
}
} while(c != 240);
}
- len = read(gSocket, &c, 1);
- if (len == 0) {
+ do {
+ len = read(gSocket, &c, 1);
+ } while (len == -1 && errno == EINTR);
+ if (len <= 0) {
disconnect("Socket Closed");
}
}
@@ -485,6 +537,49 @@ char s_getc() {
return (char)c;
}
+void s_readstring_inject(char *buffer, int max, char *inject) {
+ int i;
+ char c;
+
+ memset(buffer, 0, max);
+
+ if (strlen(inject) > max) {
+ return;
+ }
+
+ strcpy(buffer, inject);
+
+ s_printf("%s", inject);
+
+ for (i=strlen(buffer);i 0) {
+ buffer[i-1] = '\0';
+ i -= 2;
+ s_printf("\e[D \e[D");
+ continue;
+ } else if (c == '\b' || c == 127) {
+ i -= 1;
+ continue;
+ } else if (c == 27) {
+ c = s_getchar();
+ if (c == 91) {
+ c = s_getchar();
+ }
+ i -= 1;
+ continue;
+ }
+
+ if (c == '\n' || c == '\r') {
+ return;
+ }
+ s_putchar(c);
+ buffer[i] = c;
+ buffer[i+1] = '\0';
+ }
+}
+
void s_readstring(char *buffer, int max) {
int i;
char c;
@@ -577,7 +672,7 @@ void record_last10_callers(struct user_record *user) {
struct last10_callers callers[10];
int i,j;
- FILE *fptr = fopen("last10.dat", "rb");
+ FILE *fptr = fopen("last10v2.dat", "rb");
if (fptr != NULL) {
for (i=0;i<10;i++) {
@@ -595,13 +690,13 @@ void record_last10_callers(struct user_record *user) {
strcpy(new_entry.name, user->loginname);
strcpy(new_entry.location, user->location);
new_entry.time = time(NULL);
-
+ new_entry.calls = user->timeson;
if (i == 10) {
j = 1;
} else {
j = 0;
}
- fptr = fopen("last10.dat", "wb");
+ fptr = fopen("last10v2.dat", "wb");
for (;jsec_level >= conf.automsgwritelvl) {
+ if (gUser->sec_level >= conf.automsgwritelvl) {
timen = time(NULL);
localtime_r(&timen, &timenow);
- sprintf(automsg, get_string(15), user->loginname, asctime(&timenow));
+ sprintf(automsg, get_string(15), gUser->loginname, asctime(&timenow));
automsg[strlen(automsg) - 1] = '\r';
automsg[strlen(automsg)] = '\n';
@@ -733,6 +828,24 @@ void automessage_display() {
s_getc();
}
+void automessage() {
+ char c;
+ s_printf(get_string(275));
+ c = s_getchar();
+ s_printf("\r\n");
+ switch(tolower(c)) {
+ case 'v':
+ automessage_display();
+ break;
+ case 'u':
+ automessage_write();
+ break;
+ default:
+ break;
+ }
+ return;
+}
+
void runbbs_real(int socket, char *ip, int ssh) {
char buffer[PATH_MAX];
char password[17];
@@ -754,25 +867,27 @@ void runbbs_real(int socket, char *ip, int ssh) {
int do_internal_login = 0;
int usernotfound;
int tries;
-
+ int fno;
+
atexit(exit_bbs);
- ipaddress = ip;
+ usertimeout = 10;
+ timeoutpaused = 0;
- if (!ssh) {
- gUser = NULL;
- sshBBS = 0;
- if (write(socket, iac_echo, 3) != 3) {
- dolog("Failed to send iac_echo");
- exit(0);
- }
- if (write(socket, iac_sga, 3) != 3) {
- dolog("Failed to send iac_sga");
- exit(0);
- }
- } else {
- sshBBS = 1;
- }
+
+ memset (&sa, 0, sizeof (sa));
+ sa.sa_handler = &timer_handler;
+ sa.sa_flags = SA_RESTART;
+ sigaction (SIGALRM, &sa, 0);
+
+ itime.it_interval.tv_sec = 60;
+ itime.it_interval.tv_usec = 0;
+ itime.it_value.tv_sec = 60;
+ itime.it_value.tv_usec = 0;
+
+ setitimer (ITIMER_REAL, &itime, 0);
+
+ ipaddress = ip;
st.sa_handler = sigterm_handler2;
sigemptyset(&st.sa_mask);
@@ -781,26 +896,45 @@ void runbbs_real(int socket, char *ip, int ssh) {
dolog("Failed to setup sigterm handler.");
exit(1);
}
-
+ if (sigaction(SIGPIPE, &st, NULL) == -1) {
+ dolog("Failed to setup sigpipe handler.");
+ exit(1);
+ }
gSocket = socket;
+
+ if (!ssh) {
+ gUser = NULL;
+ sshBBS = 0;
+ if (send(socket, iac_echo, 3, 0) != 3) {
+ dolog("Failed to send iac_echo");
+ exit(0);
+ }
+ if (send(socket, iac_sga, 3, 0) != 3) {
+ dolog("Failed to send iac_sga");
+ exit(0);
+ }
+ } else {
+ sshBBS = 1;
+ }
+
s_printf("Magicka BBS v%d.%d (%s), Loading...\r\n", VERSION_MAJOR, VERSION_MINOR, VERSION_STR);
// find out which node we are
for (i=1;i<=conf.nodes;i++) {
sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, i);
+
if (stat(buffer, &s) != 0) {
mynode = i;
- nodefile = fopen(buffer, "w");
- if (!nodefile) {
+ fno = open(buffer, O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
+ if (fno == -1) {
dolog("Error opening nodefile!");
- close(socket);
- exit(1);
+ continue;
}
- fputs("UNKNOWN", nodefile);
- fclose(nodefile);
-
+ write(fno, "UNKNOWN", 7);
+
+ close(fno);
break;
}
}
@@ -815,23 +949,9 @@ void runbbs_real(int socket, char *ip, int ssh) {
dolog("Incoming %s connection on node %d", (ssh ? "SSH" : "Telnet"), mynode);
- usertimeout = 10;
- timeoutpaused = 0;
- tries = 0;
-
- memset (&sa, 0, sizeof (sa));
- sa.sa_handler = &timer_handler;
- sa.sa_flags = SA_RESTART;
- sigaction (SIGALRM, &sa, 0);
-
- itime.it_interval.tv_sec = 60;
- itime.it_interval.tv_usec = 0;
- itime.it_value.tv_sec = 60;
- itime.it_value.tv_usec = 0;
-
- setitimer (ITIMER_REAL, &itime, 0);
-
s_displayansi("issue");
+
+ tries = 0;
if (!ssh) {
tryagain:
@@ -845,8 +965,8 @@ tryagain:
if (strcasecmp(buffer, "new") == 0) {
usernotfound = 1;
} else if (check_user(buffer)) {
- usernotfound = 1;
s_printf(get_string(203));
+ goto tryagain;
}
if (usernotfound) {
@@ -871,7 +991,7 @@ tryagain:
gUser = user;
for (i=1;i<=conf.nodes;i++) {
- sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, i);
+ snprintf(buffer, PATH_MAX, "%s/nodeinuse.%d", conf.bbs_path, i);
if (stat(buffer, &s) == 0) {
nodefile = fopen(buffer, "r");
if (!nodefile) {
@@ -895,7 +1015,7 @@ tryagain:
s_printf(get_string(24), gUser->loginname);
s_getc();
for (i=1;i<=conf.nodes;i++) {
- sprintf(buffer, "%s/nodeinuse.%d", conf.bbs_path, i);
+ snprintf(buffer, PATH_MAX, "%s/nodeinuse.%d", conf.bbs_path, i);
if (stat(buffer, &s) == 0) {
nodefile = fopen(buffer, "r");
if (!nodefile) {
@@ -988,8 +1108,8 @@ tryagain:
// bulletins
display_bulletins();
- // external login cmd
-
+ blog_display();
+
// display info
display_info();
@@ -1022,7 +1142,7 @@ tryagain:
}
void do_logout() {
- char buffer[256];
+ char buffer[PATH_MAX];
struct stat s;
lua_State *L;
int ret = 0;
diff --git a/src/bbs.h b/src/bbs.h
index 457462f..8f82707 100644
--- a/src/bbs.h
+++ b/src/bbs.h
@@ -12,7 +12,7 @@
#include "jamlib/jam.h"
#define VERSION_MAJOR 0
-#define VERSION_MINOR 9
+#define VERSION_MINOR 10
#define VERSION_STR "alpha"
#define NETWORK_FIDO 1
@@ -43,6 +43,7 @@ struct last10_callers {
char name[17];
char location[33];
time_t time;
+ int calls;
}__attribute__((packed));
struct text_file {
@@ -93,6 +94,7 @@ struct file_directory {
char *name;
char *path;
int sec_level;
+ int display_on_web;
int file_sub_count;
struct file_sub **file_subs;
};
@@ -124,6 +126,8 @@ struct ip_address_guard {
};
struct bbs_config {
+ uid_t uid;
+ gid_t gid;
int codepage;
int ipv6;
char *bbs_name;
@@ -239,11 +243,19 @@ struct msg_headers {
int msg_count;
};
+struct blog_entry_t {
+ char *subject;
+ char *author;
+ char *body;
+ time_t date;
+};
+
extern char *str_replace(const char *orig, const char *rep, const char *with);
extern int copy_file(char *src, char *dest);
extern int recursive_delete(const char *dir);
-extern void automessage_write(struct user_record *user);
+extern void automessage_write();
extern void automessage_display();
+extern void automessage();
extern void dolog(char *fmt, ...);
extern void dolog_www(char *ipaddr, char *fmt, ...);
extern void runbbs_ssh(char *ipaddress);
@@ -258,6 +270,7 @@ extern void s_displayansi(char *file);
extern char s_getchar();
extern void s_readpass(char *buffer, int max);
extern void s_readstring(char *buffer, int max);
+extern void s_readstring_inject(char *buffer, int max, char *inject);
extern char s_getc();
extern void disconnect(char *calledby);
extern void display_info();
@@ -282,7 +295,7 @@ extern void display_textfiles();
extern time_t utc_to_local(time_t utc);
extern s_JamBase *open_jam_base(char *path);
extern void free_message_headers(struct msg_headers *msghs);
-extern struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user);
+extern struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user, int personal);
extern void mail_scan(struct user_record *user);
extern char *editor(struct user_record *user, char *quote, int qlen, char *from, int email, int sig);
extern char *external_editor(struct user_record *user, char *to, char *from, char *quote, int qlen, char *qfrom, char *subject, int email, int sig);
@@ -302,6 +315,7 @@ extern void msg_conf_sub_bases();
extern void msgbase_reset_pointers(int conference, int msgarea, int readm, int msgno);
extern void msgbase_reset_all_pointers(int readm);
extern void full_mail_scan(struct user_record *user);
+extern void full_mail_scan_personal(struct user_record *user);
extern int read_new_msgs(struct user_record *user, struct msg_headers *msghs);
extern int new_messages(struct user_record *user, int conference, int area);
@@ -366,9 +380,19 @@ extern char *www_last10();
extern void www_expire_old_links();
extern char *www_create_link(int dir, int sub, int fid);
extern char *www_decode_hash(char *hash);
+extern char *www_sanitize(char *inp);
+extern char *www_files_display_listing(int dir, int sub);
+extern char *www_files_areas();
+extern char *www_files_get_from_area(int dir, int sub, char *file);
+extern char *www_blog();
#endif
extern int menu_system(char *menufile);
extern char *nl_get_bbsname(struct fido_addr *addr, char *domain);
extern void nl_browser();
+
+extern void blog_display();
+extern void blog_write();
+extern int blog_load(struct blog_entry_t ***entries);
+
#endif
diff --git a/src/bbs_list.c b/src/bbs_list.c
index ac5f260..eb0627b 100644
--- a/src/bbs_list.c
+++ b/src/bbs_list.c
@@ -389,4 +389,4 @@ void bbs_list() {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/blog.c b/src/blog.c
new file mode 100644
index 0000000..61b2c01
--- /dev/null
+++ b/src/blog.c
@@ -0,0 +1,256 @@
+#include
+#include
+#include
+#include "bbs.h"
+
+extern struct bbs_config conf;
+extern struct user_record *gUser;
+
+int blog_load(struct blog_entry_t ***entries) {
+ int blog_entry_count = 0;
+ struct blog_entry_t **blog_entries;
+ char *sql = "SELECT author, title, body, date FROM blog ORDER BY date DESC";
+
+ char buffer[PATH_MAX];
+ int rc;
+ sqlite3 *db;
+ sqlite3_stmt *res;
+
+ snprintf(buffer, PATH_MAX, "%s/blog.sq3", conf.bbs_path);
+
+ rc = sqlite3_open(buffer, &db);
+
+ if (rc != SQLITE_OK) {
+ dolog("Cannot open database: %s", sqlite3_errmsg(db));
+ *entries = NULL;
+ return 0;
+ }
+ sqlite3_busy_timeout(db, 5000);
+ rc = sqlite3_prepare_v2(db, sql, -1, &res, 0);
+
+ if (rc != SQLITE_OK) {
+ dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
+ sqlite3_close(db);
+ *entries = NULL;
+ return 0;
+ }
+ while (sqlite3_step(res) == SQLITE_ROW) {
+ if (blog_entry_count == 0) {
+ blog_entries = (struct blog_entry_t **)malloc(sizeof(struct blog_entry_t *));
+ } else {
+ blog_entries = (struct blog_entry_t **)realloc(blog_entries, sizeof(struct blog_entry_t *) * (blog_entry_count + 1));
+ }
+ blog_entries[blog_entry_count] = (struct blog_entry_t *)malloc(sizeof(struct blog_entry_t));
+
+ blog_entries[blog_entry_count]->author = strdup(sqlite3_column_text(res, 0));
+ blog_entries[blog_entry_count]->subject = strdup(sqlite3_column_text(res, 1));
+ blog_entries[blog_entry_count]->body = strdup(sqlite3_column_text(res, 2));
+ blog_entries[blog_entry_count]->date = sqlite3_column_int(res, 3);
+ blog_entry_count++;
+ }
+
+ sqlite3_finalize(res);
+ sqlite3_close(db);
+
+ *entries = blog_entries;
+ return blog_entry_count;
+}
+
+void blog_display() {
+
+ struct blog_entry_t **blog_entries;
+ int blog_entry_count = 0;
+
+ int i;
+ struct tm thetime;
+ char *days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "???"};
+ char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "???"};
+ char c;
+ int hour;
+ int j;
+ int lines = 2;
+ s_printf("\e[2J\e[1;1H");
+ s_printf(get_string(280));
+ s_printf(get_string(281));
+
+ blog_entry_count = blog_load(&blog_entries);
+ if (blog_entry_count == 0) {
+ s_printf(get_string(282));
+ s_printf(get_string(6));
+ s_getchar();
+ return;
+ }
+
+ c = 'y';
+
+ for (i=0;idate, &thetime);
+
+ s_printf(get_string(283), blog_entries[i]->subject, blog_entries[i]->author);
+ lines++;
+ if (lines == 22 && tolower(c) != 'c') {
+ s_printf("\r\n");
+ s_printf(get_string(223));
+ c = s_getchar();
+ if (tolower(c) == 'n') {
+ break;
+ }
+ s_printf("\r\n\r\n");
+ lines = 0;
+ }
+ if (thetime.tm_hour >= 12) {
+ hour = thetime.tm_hour - 12;
+ } else {
+ hour = thetime.tm_hour;
+ }
+ s_printf(get_string(284), (hour == 0 ? 12 : hour), thetime.tm_min, (thetime.tm_hour >= 12 ? "pm" : "am"), days[thetime.tm_wday], months[thetime.tm_mon], thetime.tm_mday, thetime.tm_year + 1900);
+
+ lines++;
+ if (lines == 22 && tolower(c) != 'c') {
+ s_printf("\r\n");
+ s_printf(get_string(223));
+ c = s_getchar();
+ if (tolower(c) == 'n') {
+ break;
+ }
+ s_printf("\r\n\r\n");
+ lines = 0;
+ }
+
+ s_printf("\r\n\e[0m");
+ lines++;
+ if (lines == 22 && tolower(c) != 'c') {
+ s_printf("\r\n");
+ s_printf(get_string(223));
+ c = s_getchar();
+ if (tolower(c) == 'n') {
+ break;
+ }
+ s_printf("\r\n\r\n");
+ lines = 0;
+ }
+ for (j=0; jbody); j++) {
+ if (blog_entries[i]->body[j] == '\r') {
+ s_printf("\r\n");
+ lines++;
+ if (lines == 22 && tolower(c) != 'c') {
+ s_printf("\r\n");
+ s_printf(get_string(223));
+ c = s_getchar();
+ if (tolower(c) == 'n') {
+ break;
+ }
+ s_printf("\r\n\r\n");
+ lines = 0;
+ }
+ } else {
+ s_printf("%c", blog_entries[i]->body[j]);
+ }
+ }
+
+ if (tolower(c) == 'n') {
+ break;
+ }
+ s_printf("\r\n");
+ lines++;
+ if (lines == 22 && tolower(c) != 'c') {
+ s_printf("\r\n");
+ s_printf(get_string(223));
+ c = s_getchar();
+ if (tolower(c) == 'n') {
+ break;
+ }
+ s_printf("\r\n\r\n");
+ lines = 0;
+ }
+ }
+ for (i=0;isubject);
+ free(blog_entries[i]->author);
+ free(blog_entries[i]->body);
+ free(blog_entries[i]);
+ }
+
+ free(blog_entries);
+
+ s_printf(get_string(6));
+ s_getchar();
+
+}
+
+void blog_write() {
+ char *csql = "CREATE TABLE IF NOT EXISTS blog ("
+ "id INTEGER PRIMARY KEY,"
+ "author TEXT COLLATE NOCASE,"
+ "title TEXT,"
+ "body TEXT,"
+ "date INTEGER);";
+
+ char *isql = "INSERT INTO blog (author, title, body, date) VALUES(?, ?, ?, ?)";
+ int rc;
+ sqlite3 *db;
+ sqlite3_stmt *res;
+ char *blog_entry;
+ char buffer[PATH_MAX];
+ char *blog_subject;
+ char *err_msg = 0;
+
+ s_printf(get_string(285));
+ s_readstring(buffer, 64);
+ s_printf("\r\n");
+
+ if (strlen(buffer) == 0) {
+ s_printf(get_string(39));
+ return;
+ }
+
+ blog_subject = strdup(buffer);
+
+ blog_entry = external_editor(gUser, "No-One", "No-One", NULL, 0, "No-One", "Blog Editor", 0, 1);
+
+ if (blog_entry != NULL) {
+ snprintf(buffer, PATH_MAX, "%s/blog.sq3", conf.bbs_path);
+ rc = sqlite3_open(buffer, &db);
+
+ if (rc != SQLITE_OK) {
+ dolog("Cannot open database: %s", sqlite3_errmsg(db));
+ free(blog_entry);
+ free(blog_subject);
+ return;
+ }
+ sqlite3_busy_timeout(db, 5000);
+ rc = sqlite3_exec(db, csql, 0, 0, &err_msg);
+ if (rc != SQLITE_OK ) {
+ dolog("SQL error: %s", err_msg);
+ sqlite3_free(err_msg);
+ sqlite3_close(db);
+ free(blog_entry);
+ free(blog_subject);
+ return;
+ }
+
+ rc = sqlite3_prepare_v2(db, isql, -1, &res, 0);
+
+ if (rc == SQLITE_OK) {
+ sqlite3_bind_text(res, 1, gUser->loginname, -1, 0);
+ sqlite3_bind_text(res, 2, blog_subject, -1, 0);
+ sqlite3_bind_text(res, 3, blog_entry, -1, 0);
+ sqlite3_bind_int(res, 4, time(NULL));
+ } else {
+ dolog("Failed to execute statement: %s", sqlite3_errmsg(db));
+ sqlite3_finalize(res);
+ sqlite3_close(db);
+ free(blog_entry);
+ free(blog_subject);
+ return;
+ }
+ sqlite3_step(res);
+
+ sqlite3_finalize(res);
+ sqlite3_close(db);
+ free(blog_entry);
+ free(blog_subject);
+ return;
+ }
+ free(blog_subject);
+}
\ No newline at end of file
diff --git a/src/bluewave.c b/src/bluewave.c
index 0e2274a..1f8001e 100644
--- a/src/bluewave.c
+++ b/src/bluewave.c
@@ -134,7 +134,7 @@ int bwave_scan_email(int areano, int totmsgs, FILE *fti_file, FILE *mix_file, FI
}
int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file, FILE *mix_file, FILE *dat_file, int *last_ptr) {
- struct msg_headers *msghs = read_message_headers(confr, area, gUser);
+ struct msg_headers *msghs = read_message_headers(confr, area, gUser, 0);
int all_unread = 1;
s_JamBase *jb;
s_JamLastRead jlr;
@@ -282,6 +282,7 @@ int bwave_scan_area(int confr, int area, int areano, int totmsgs, FILE *fti_file
fwrite(&mix, sizeof(MIX_REC), 1, mix_file);
//}
JAM_CloseMB(jb);
+ free(jb);
free_message_headers(msghs);
return totmsgs;
}
@@ -313,7 +314,8 @@ void bwave_create_packet() {
FILE *inf_file;
int tot_areas = 0;
int totmsgs = 0;
-
+ int ret;
+
for (i=0;imail_area_count;j++) {
if (msgbase_is_subscribed(i, j)) {
@@ -528,7 +530,8 @@ void bwave_create_packet() {
dup2(bbs_stderr, STDERR_FILENO);
dup2(bbs_stdin, STDIN_FILENO);
}
- system(buffer);
+
+ ret = system(buffer);
if (sshBBS) {
@@ -541,8 +544,11 @@ void bwave_create_packet() {
close(sterr);
}
-
- do_download(gUser, archive);
+ if (ret != -1 && ret >> 8 != 127) {
+ do_download(gUser, archive);
+ } else {
+ s_printf(get_string(274));
+ }
snprintf(buffer, 1024, "%s/node%d/bwave", conf.bbs_path, mynode);
recursive_delete(buffer);
@@ -706,7 +712,8 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
sleep(1);
} else {
dolog("Failed to lock msg base!");
- JAM_CloseMB(jb);
+ JAM_CloseMB(jb);
+ free(jb);
return 1;
}
}
@@ -716,12 +723,14 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
+ free(jb);
return -1;
} else {
JAM_UnlockMB(jb);
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
+ free(jb);
}
return 0;
}
diff --git a/src/chat_system.c b/src/chat_system.c
index 87e7506..9b27b0d 100644
--- a/src/chat_system.c
+++ b/src/chat_system.c
@@ -420,7 +420,7 @@ void chat_system(struct user_record *user) {
}
memset(inputbuffer, 0, 256);
inputbuffer_at = 0;
- } else if (c != '\n') {
+ } else if (c != '\n' && c != '\0') {
if (c == '\b' || c == 127) {
if (inputbuffer_at > 0) {
inputbuffer_at--;
@@ -446,7 +446,7 @@ void chat_system(struct user_record *user) {
strncat(partmessage, readbuffer, len);
strcpy(readbuffer, partmessage);
-
+
y = 0;
for (z = 0;z < strlen(readbuffer); z++) {
if (readbuffer[z] != '\n') {
@@ -454,6 +454,7 @@ void chat_system(struct user_record *user) {
message[y+1] = '\0';
y++;
} else {
+
y = 0;
// json parse
jsmn_init(&parser);
diff --git a/src/files.c b/src/files.c
index 2c313b8..f110028 100644
--- a/src/files.c
+++ b/src/files.c
@@ -846,11 +846,11 @@ void download_zmodem(struct user_record *user, char *filename) {
break ;
case ZmErrCantOpen:
- dolog("cannot open file \"%s\": %s\n", filename, strerror(errno)) ;
+ dolog("cannot open file \"%s\": %s", filename, strerror(errno)) ;
return;
case ZmFileTooLong:
- dolog("filename \"%s\" too long, skipping...\n", filename) ;
+ dolog("filename \"%s\" too long, skipping...", filename) ;
return;
case ZmDone:
diff --git a/src/lua_glue.c b/src/lua_glue.c
index 86102c4..8ead90b 100644
--- a/src/lua_glue.c
+++ b/src/lua_glue.c
@@ -21,6 +21,12 @@ int l_bbsWString(lua_State *L) {
return 0;
}
+int l_displayBlog(lua_State *L) {
+ blog_display();
+
+ return 0;
+}
+
int l_bbsRString(lua_State *L) {
char buffer[256];
int len = lua_tonumber(L, -1);
@@ -87,7 +93,7 @@ int l_bbsReadLast10(lua_State *L) {
struct last10_callers l10;
FILE *fptr;
- fptr = fopen("last10.dat", "rb");
+ fptr = fopen("last10v2.dat", "rb");
if (!fptr) {
return 0;
}
@@ -100,8 +106,8 @@ int l_bbsReadLast10(lua_State *L) {
lua_pushstring(L, l10.name);
lua_pushstring(L, l10.location);
lua_pushnumber(L, l10.time);
-
- return 3;
+ lua_pushnumber(L, l10.calls);
+ return 4;
}
int l_bbsGetEmailCount(lua_State *L) {
@@ -115,6 +121,11 @@ int l_bbsFullMailScan(lua_State *L) {
return 0;
}
+int l_bbsPersonalMailScan(lua_State *L) {
+ full_mail_scan_personal(gUser);
+ return 0;
+}
+
int l_bbsMailScan(lua_State *L) {
mail_scan(gUser);
return 0;
@@ -203,21 +214,22 @@ int l_messageFound(lua_State *L) {
z = JAM_ReadMsgHeader(jb, id, &jmh, &jsp);
if (z != 0) {
- dolog("Failed to read msg header: %d Erro %d", z, JAM_Errno(jb));
JAM_CloseMB(jb);
+ free(jb);
lua_pushnumber(L, 0);
return 1;
}
if (jmh.Attribute & JAM_MSG_DELETED) {
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
+ free(jb);
lua_pushnumber(L, 0);
return 1;
}
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
-
+ free(jb);
lua_pushnumber(L, 1);
return 1;
}
@@ -247,9 +259,11 @@ int l_readMessageHdr(lua_State *L) {
if (z != 0) {
dolog("Failed to read msg header: %d Erro %d", z, JAM_Errno(jb));
JAM_CloseMB(jb);
+ free(jb);
} else if (jmh.Attribute & JAM_MSG_DELETED) {
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
+ free(jb);
} else {
for (z=0;zNumFields;z++) {
if (jsp->Fields[z]->LoID == JAMSFLD_SUBJECT) {
@@ -270,7 +284,8 @@ int l_readMessageHdr(lua_State *L) {
}
JAM_DelSubPacket(jsp);
- JAM_CloseMB(jb);
+ JAM_CloseMB(jb);
+ free(jb);
}
if (subject == NULL) {
subject = strdup("(No Subject)");
@@ -318,9 +333,11 @@ int l_readMessage(lua_State *L) {
if (z != 0) {
dolog("Failed to read msg header: %d Erro %d", z, JAM_Errno(jb));
JAM_CloseMB(jb);
+ free(jb);
body = strdup("No Message");
} else if (jmh.Attribute & JAM_MSG_DELETED) {
JAM_CloseMB(jb);
+ free(jb);
body = strdup("No Message");
} else {
body = (char *)malloc(jmh.TxtLen + 1);
@@ -328,6 +345,7 @@ int l_readMessage(lua_State *L) {
body[jmh.TxtLen] = '\0';
JAM_CloseMB(jb);
+ free(jb);
}
lua_pushstring(L, body);
@@ -468,6 +486,7 @@ int l_postMessage(lua_State *L) {
} else if (conf.mail_conferences[confr]->mail_areas[area]->type == TYPE_NETMAIL_AREA) {
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
+ free(jb);
return 0;
}
@@ -479,7 +498,8 @@ int l_postMessage(lua_State *L) {
sleep(1);
} else {
dolog("Failed to lock msg base!");
- JAM_CloseMB(jb);
+ JAM_CloseMB(jb);
+ free(jb);
return 0;
}
}
@@ -533,6 +553,7 @@ int l_postMessage(lua_State *L) {
JAM_DelSubPacket(jsp);
JAM_CloseMB(jb);
+ free(jb);
}
free(msg);
@@ -599,6 +620,10 @@ void lua_push_cfunctions(lua_State *L) {
lua_setglobal(L, "bbs_data_path");
lua_pushcfunction(L, l_userSecurity);
lua_setglobal(L, "bbs_user_security");
+ lua_pushcfunction(L, l_bbsPersonalMailScan);
+ lua_setglobal(L, "bbs_personal_mail_scan");
+ lua_pushcfunction(L, l_displayBlog);
+ lua_setglobal(L, "bbs_display_blog");
}
void do_lua_script(char *script) {
diff --git a/src/mail_menu.c b/src/mail_menu.c
index c2236bd..382ea55 100644
--- a/src/mail_menu.c
+++ b/src/mail_menu.c
@@ -128,6 +128,7 @@ void free_message_headers(struct msg_headers *msghs) {
if (msghs->msgs[i]->replyid != NULL) {
free(msghs->msgs[i]->replyid);
}
+ free(msghs->msgs[i]);
}
if (msghs->msg_count > 0) {
free(msghs->msgs);
@@ -145,7 +146,7 @@ int msg_is_to(struct user_record *user, char *addressed_to, char *address, int t
} else {
myname = strdup(user->loginname);
}
- if (type == NETWORK_FIDO) {
+ if (type == NETWORK_FIDO && address != NULL) {
if (strcasecmp(myname, addressed_to) == 0) {
dest = parse_fido_addr(address);
if (conf.mail_conferences[msgconf]->fidoaddr->zone == dest->zone &&
@@ -205,7 +206,7 @@ int msg_is_from(struct user_record *user, char *addressed_from, char *address, i
}
}
-struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user) {
+struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_record *user, int personal) {
s_JamBase *jb;
s_JamBaseHeader jbh;
s_JamMsgHeader jmh;
@@ -339,6 +340,36 @@ struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_r
k++;
continue;
}
+ } else if (personal) {
+ if (!msg_is_to(user, jamm->to, jamm->daddress, conf.mail_conferences[msgconf]->nettype, conf.mail_conferences[msgconf]->realnames, msgconf) &&
+ !msg_is_to(user, jamm->to, jamm->daddress, conf.mail_conferences[msgconf]->nettype, !conf.mail_conferences[msgconf]->realnames, msgconf)) {
+
+ if (jamm->subject != NULL) {
+ free(jamm->subject);
+ }
+ if (jamm->from != NULL) {
+ free(jamm->from);
+ }
+ if (jamm->to != NULL) {
+ free(jamm->to);
+ }
+ if (jamm->oaddress != NULL) {
+ free(jamm->oaddress);
+ }
+ if (jamm->daddress != NULL) {
+ free(jamm->daddress);
+ }
+ if (jamm->msgid != NULL) {
+ free(jamm->msgid);
+ }
+ if (jamm->replyid != NULL) {
+ free(jamm->replyid);
+ }
+ free(jamm->msg_h);
+ free(jamm);
+ k++;
+ continue;
+ }
}
if (msghs->msg_count == 0) {
@@ -354,9 +385,11 @@ struct msg_headers *read_message_headers(int msgconf, int msgarea, struct user_r
} else {
JAM_CloseMB(jb);
+ free(jb);
return NULL;
}
JAM_CloseMB(jb);
+ free(jb);
return msghs;
}
@@ -588,9 +621,9 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in
s_printf(get_string(87));
while(!doquit) {
- s_printf(get_string(88), lines, next_line_buffer);
+ s_printf(get_string(88), lines, "");
strcpy(linebuffer, next_line_buffer);
- s_readstring(&linebuffer[strlen(next_line_buffer)], 70 - strlen(next_line_buffer));
+ s_readstring_inject(linebuffer, 70, next_line_buffer);
memset(next_line_buffer, 0, 70);
if (strlen(linebuffer) == 70 && linebuffer[69] != ' ') {
@@ -1652,6 +1685,8 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
if (tolower(c) == 'r') {
JAM_CloseMB(jb);
+ free(jb);
+ jb = NULL;
if (user->sec_level < conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->write_sec_level) {
s_printf(get_string(113));
} else {
@@ -1665,23 +1700,14 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
subject = (char *)malloc(strlen(buffer) + 1);
strcpy(subject, buffer);
- s_printf(get_string(114), subject);
+ s_printf(get_string(114));
+ s_readstring_inject(buffer, 32, msghs->msgs[mailno]->from);
+ to = strdup(buffer);
s_printf(get_string(115));
+ s_readstring_inject(buffer, 64, subject);
+ free(subject);
+ subject = strdup(buffer);
- c = s_getc();
-
- if (tolower(c) == 'y') {
- s_printf(get_string(116));
- s_readstring(buffer, 25);
-
- if (strlen(buffer) == 0) {
- s_printf(get_string(117));
- } else {
- free(subject);
- subject = (char *)malloc(strlen(buffer) + 1);
- strcpy(subject, buffer);
- }
- }
s_printf("\r\n");
if (msghs->msgs[mailno]->from != NULL) {
@@ -1695,11 +1721,9 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
sprintf(from, "%s %s", user->firstname, user->lastname);
}
if (conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->type == TYPE_NEWSGROUP_AREA) {
+ free(to);
to = (char *)malloc(4);
strcpy(to, "ALL");
- } else {
- to = (char *)malloc(strlen(buffer) + 1);
- strcpy(to, buffer);
}
replybody = external_editor(user, to, from, body, z2, msghs->msgs[mailno]->from, subject, 0, 0);
if (replybody != NULL) {
@@ -1942,6 +1966,11 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
msg_line_count = 0;
}
+ if (jb != NULL) {
+ JAM_CloseMB(jb);
+ free(jb);
+ }
+
if (doquit == 2) {
return 1;
}
@@ -1970,18 +1999,25 @@ int read_new_msgs(struct user_record *user, struct msg_headers *msghs) {
jlr.LastReadMsg = 0;
jlr.HighReadMsg = 0;
all_unread = 1;
- } else if (jlr.LastReadMsg == 0 && jlr.HighReadMsg == 0) {
+ }
+ if (jlr.LastReadMsg == 0 && jlr.HighReadMsg == 0) {
all_unread = 1;
}
JAM_CloseMB(jb);
+ free(jb);
if (all_unread == 0) {
k = jlr.HighReadMsg;
for (i=0;imsg_count;i++) {
if (msghs->msgs[i]->msg_h->MsgNum == k) {
+ i+=2;
break;
}
+ if (msghs->msgs[i]->msg_h->MsgNum > k) {
+ i++;
+ break;
+ }
}
- i += 2;
+
} else {
i = 1;
}
@@ -2007,7 +2043,7 @@ void read_mail(struct user_record *user) {
s_printf("\r\n");
// list mail in message base
- msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
+ msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user, 0);
if (msghs != NULL && msghs->msg_count > 0) {
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
if (!jb) {
@@ -2023,6 +2059,7 @@ void read_mail(struct user_record *user) {
all_unread = 1;
}
JAM_CloseMB(jb);
+ free(jb);
s_printf(get_string(120), msghs->msg_count);
s_readstring(buffer, 6);
@@ -2080,7 +2117,7 @@ void post_message(struct user_record *user) {
sprintf(buffer, "ALL");
} else {
s_printf(get_string(54));
- s_readstring(buffer, 16);
+ s_readstring(buffer, 32);
}
if (strlen(buffer) == 0) {
strcpy(buffer, "ALL");
@@ -2287,6 +2324,7 @@ void post_message(struct user_record *user) {
}
if (z != 0) {
JAM_CloseMB(jb);
+ free(jb);
return;
}
@@ -2311,6 +2349,7 @@ void post_message(struct user_record *user) {
JAM_DelSubPacket(jsp);
free(msg);
JAM_CloseMB(jb);
+ free(jb);
}
free(to);
free(subject);
@@ -2333,7 +2372,7 @@ void list_messages(struct user_record *user) {
s_printf("\r\n");
// list mail in message base
- msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
+ msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user, 0);
if (msghs != NULL && msghs->msg_count > 0) {
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
if (!jb) {
@@ -2349,6 +2388,7 @@ void list_messages(struct user_record *user) {
all_unread = 1;
}
JAM_CloseMB(jb);
+ free(jb);
s_printf(get_string(125), msghs->msg_count);
s_readstring(buffer, 6);
@@ -2561,7 +2601,7 @@ void list_messages(struct user_record *user) {
redraw = 1;
read_message(user, msghs, i - 1, 0);
free_message_headers(msghs);
- msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user);
+ msghs = read_message_headers(user->cur_mail_conf, user->cur_mail_area, user, 0);
jb = open_jam_base(conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
if (!jb) {
dolog("Error opening JAM base.. %s", conf.mail_conferences[user->cur_mail_conf]->mail_areas[user->cur_mail_area]->path);
@@ -2577,6 +2617,7 @@ void list_messages(struct user_record *user) {
all_unread = 1;
}
JAM_CloseMB(jb);
+ free(jb);
}
}
}
@@ -2949,7 +2990,7 @@ void prev_mail_area(struct user_record *user) {
-void do_mail_scan(struct user_record *user, int oldscan) {
+void do_mail_scan(struct user_record *user, int oldscan, int personal) {
s_JamBase *jb;
s_JamBaseHeader jbh;
s_JamLastRead jlr;
@@ -2961,7 +3002,15 @@ void do_mail_scan(struct user_record *user, int oldscan) {
int orig_conf;
int orig_area;
int res = 0;
- s_printf(get_string(139));
+ char ch;
+ int unread_count;
+ int k;
+
+ if (personal) {
+ s_printf(get_string(276));
+ } else {
+ s_printf(get_string(139));
+ }
c = s_getc();
if (tolower(c) == 'y' || tolower(c) == 's') {
@@ -2969,12 +3018,15 @@ void do_mail_scan(struct user_record *user, int oldscan) {
if (conf.mail_conferences[i]->sec_level > user->sec_level) {
continue;
}
- s_printf(get_string(140), i, conf.mail_conferences[i]->name);
- lines+=2;
- if (lines == 22) {
- s_printf(get_string(6));
- s_getc();
- lines = 0;
+ if (oldscan) {
+ s_printf(get_string(140), i, conf.mail_conferences[i]->name);
+
+ lines+=2;
+ if (lines == 22) {
+ s_printf(get_string(6));
+ s_getc();
+ lines = 0;
+ }
}
for (j=0;jmail_area_count;j++) {
if (conf.mail_conferences[i]->mail_areas[j]->read_sec_level > user->sec_level) {
@@ -2993,16 +3045,18 @@ void do_mail_scan(struct user_record *user, int oldscan) {
if (JAM_ReadMBHeader(jb, &jbh) != 0) {
JAM_CloseMB(jb);
+ free(jb);
continue;
}
if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) {
if (jbh.ActiveMsgs == 0) {
JAM_CloseMB(jb);
+ free(jb);
continue;
}
if (conf.mail_conferences[i]->mail_areas[j]->type == TYPE_NETMAIL_AREA) {
- msghs = read_message_headers(i, j, user);
+ msghs = read_message_headers(i, j, user, personal);
if (msghs != NULL) {
if (msghs->msg_count > 0) {
if (oldscan) {
@@ -3014,16 +3068,25 @@ void do_mail_scan(struct user_record *user, int oldscan) {
lines = 0;
}
} else {
- orig_conf = user->cur_mail_conf;
- orig_area = user->cur_mail_area;
-
- user->cur_mail_conf = i;
- user->cur_mail_area = j;
-
- res = read_new_msgs(user, msghs);
-
- user->cur_mail_conf = orig_conf;
- user->cur_mail_area = orig_area;
+ s_printf("\e[2J\e[1;1H");
+ s_printf(get_string(277), i, conf.mail_conferences[i]->name);
+ s_printf(get_string(278), j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count);
+ s_printf(get_string(279));
+
+ ch = s_getchar();
+ s_printf("\r\n");
+ if (tolower(ch) == 'y') {
+ orig_conf = user->cur_mail_conf;
+ orig_area = user->cur_mail_area;
+
+ user->cur_mail_conf = i;
+ user->cur_mail_area = j;
+
+ res = read_new_msgs(user, msghs);
+
+ user->cur_mail_conf = orig_conf;
+ user->cur_mail_area = orig_area;
+ }
}
}
free_message_headers(msghs);
@@ -3038,19 +3101,29 @@ void do_mail_scan(struct user_record *user, int oldscan) {
lines = 0;
}
} else {
- msghs = read_message_headers(i, j, user);
+ msghs = read_message_headers(i, j, user, personal);
if (msghs != NULL) {
- if (msghs->msg_count > 0) {
- orig_conf = user->cur_mail_conf;
- orig_area = user->cur_mail_area;
-
- user->cur_mail_conf = i;
- user->cur_mail_area = j;
-
- res = read_new_msgs(user, msghs);
-
- user->cur_mail_conf = orig_conf;
- user->cur_mail_area = orig_area;
+
+ if (msghs->msg_count > 0) {
+ s_printf("\e[2J\e[1;1H");
+ s_printf(get_string(277), i, conf.mail_conferences[i]->name);
+ s_printf(get_string(278), j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msg_count);
+ s_printf(get_string(279));
+
+ ch = s_getchar();
+ s_printf("\r\n");
+ if (tolower(ch) == 'y') {
+ orig_conf = user->cur_mail_conf;
+ orig_area = user->cur_mail_area;
+
+ user->cur_mail_conf = i;
+ user->cur_mail_area = j;
+
+ res = read_new_msgs(user, msghs);
+
+ user->cur_mail_conf = orig_conf;
+ user->cur_mail_area = orig_area;
+ }
}
free_message_headers(msghs);
}
@@ -3058,13 +3131,24 @@ void do_mail_scan(struct user_record *user, int oldscan) {
}
} else {
if (jlr.HighReadMsg < jbh.ActiveMsgs) {
+
+
+
if (conf.mail_conferences[i]->mail_areas[j]->type == TYPE_NETMAIL_AREA) {
- msghs = read_message_headers(i, j, user);
+ msghs = read_message_headers(i, j, user, personal);
if (msghs != NULL) {
if (msghs->msg_count > 0) {
- if (msghs->msgs[msghs->msg_count-1]->msg_no > jlr.HighReadMsg) {
+ unread_count = 0;
+
+ for (k=msghs->msg_count-1;k>=0;k--) {
+ if (msghs->msgs[k]->msg_no < jlr.HighReadMsg) {
+ break;
+ }
+ unread_count++;
+ }
+ if (unread_count > 0) {
if (oldscan) {
- s_printf(get_string(141), j, conf.mail_conferences[i]->mail_areas[j]->name, msghs->msgs[msghs->msg_count-1]->msg_h->MsgNum - jlr.HighReadMsg);
+ s_printf(get_string(141), j, conf.mail_conferences[i]->mail_areas[j]->name, unread_count);
lines++;
if (lines == 22) {
s_printf(get_string(6));
@@ -3072,16 +3156,25 @@ void do_mail_scan(struct user_record *user, int oldscan) {
lines = 0;
}
} else {
- orig_conf = user->cur_mail_conf;
- orig_area = user->cur_mail_area;
-
- user->cur_mail_conf = i;
- user->cur_mail_area = j;
-
- res = read_new_msgs(user, msghs);
-
- user->cur_mail_conf = orig_conf;
- user->cur_mail_area = orig_area;
+ s_printf("\e[2J\e[1;1H");
+ s_printf(get_string(277), i, conf.mail_conferences[i]->name);
+ s_printf(get_string(278), j, conf.mail_conferences[i]->mail_areas[j]->name, unread_count);
+ s_printf(get_string(279));
+
+ ch = s_getchar();
+ s_printf("\r\n");
+ if (tolower(ch) == 'y') {
+ orig_conf = user->cur_mail_conf;
+ orig_area = user->cur_mail_area;
+
+ user->cur_mail_conf = i;
+ user->cur_mail_area = j;
+
+ res = read_new_msgs(user, msghs);
+
+ user->cur_mail_conf = orig_conf;
+ user->cur_mail_area = orig_area;
+ }
}
}
}
@@ -3097,19 +3190,38 @@ void do_mail_scan(struct user_record *user, int oldscan) {
lines = 0;
}
} else {
- msghs = read_message_headers(i, j, user);
+ msghs = read_message_headers(i, j, user, personal);
if (msghs != NULL) {
- if (msghs->msg_count > 0) {
- orig_conf = user->cur_mail_conf;
- orig_area = user->cur_mail_area;
+ if (msghs->msg_count > 0) {
+ unread_count = 0;
+
+ for (k=msghs->msg_count-1;k>=0;k--) {
+ if (msghs->msgs[k]->msg_no < jlr.HighReadMsg) {
+ break;
+ }
+ unread_count++;
+ }
+ if (unread_count > 0) {
+ s_printf("\e[2J\e[1;1H");
+ s_printf(get_string(277), i, conf.mail_conferences[i]->name);
+ s_printf(get_string(278), j, conf.mail_conferences[i]->mail_areas[j]->name, unread_count);
+ s_printf(get_string(279));
- user->cur_mail_conf = i;
- user->cur_mail_area = j;
-
- res = read_new_msgs(user, msghs);
-
- user->cur_mail_conf = orig_conf;
- user->cur_mail_area = orig_area;
+ ch = s_getchar();
+ s_printf("\r\n");
+ if (tolower(ch) == 'y') {
+ orig_conf = user->cur_mail_conf;
+ orig_area = user->cur_mail_area;
+
+ user->cur_mail_conf = i;
+ user->cur_mail_area = j;
+
+ res = read_new_msgs(user, msghs);
+
+ user->cur_mail_conf = orig_conf;
+ user->cur_mail_area = orig_area;
+ }
+ }
}
free_message_headers(msghs);
}
@@ -3117,10 +3229,12 @@ void do_mail_scan(struct user_record *user, int oldscan) {
}
} else {
JAM_CloseMB(jb);
+ free(jb);
continue;
}
}
JAM_CloseMB(jb);
+ free(jb);
if (res) {
break;
}
@@ -3135,12 +3249,16 @@ void do_mail_scan(struct user_record *user, int oldscan) {
}
}
+void full_mail_scan_personal(struct user_record *user) {
+ do_mail_scan(user, 0, 1);
+}
+
void full_mail_scan(struct user_record *user) {
- do_mail_scan(user, 0);
+ do_mail_scan(user, 0, 0);
}
void mail_scan(struct user_record *user) {
- do_mail_scan(user, 1);
+ do_mail_scan(user, 1, 0);
}
@@ -3257,6 +3375,7 @@ void msgbase_reset_pointers(int conference, int msgarea, int readm, int msgno) {
if (JAM_ReadMBHeader(jb, &jbh) != 0) {
JAM_CloseMB(jb);
+ free(jb);
return;
}
@@ -3301,6 +3420,7 @@ void msgbase_reset_pointers(int conference, int msgarea, int readm, int msgno) {
JAM_WriteLastRead(jb, gUser->id, &jlr);
}
JAM_CloseMB(jb);
+ free(jb);
}
void msgbase_reset_all_pointers(int readm) {
@@ -3326,15 +3446,17 @@ int new_messages(struct user_record *user, int conference, int area) {
}
if (JAM_ReadMBHeader(jb, &jbh) != 0) {
JAM_CloseMB(jb);
+ free(jb);
return 0;
}
if (JAM_ReadLastRead(jb, user->id, &jlr) == JAM_NO_USER) {
if (jbh.ActiveMsgs == 0) {
JAM_CloseMB(jb);
+ free(jb);
return 0;
}
if (conf.mail_conferences[conference]->mail_areas[area]->type == TYPE_NETMAIL_AREA) {
- msghs = read_message_headers(conference, area, user);
+ msghs = read_message_headers(conference, area, user, 0);
if (msghs != NULL) {
if (msghs->msg_count > 0) {
count = msghs->msg_count;
@@ -3347,7 +3469,7 @@ int new_messages(struct user_record *user, int conference, int area) {
} else {
if (jlr.HighReadMsg < jbh.ActiveMsgs) {
if (conf.mail_conferences[conference]->mail_areas[area]->type == TYPE_NETMAIL_AREA) {
- msghs = read_message_headers(conference, area, user);
+ msghs = read_message_headers(conference, area, user, 0);
if (msghs != NULL) {
if (msghs->msg_count > 0) {
if (msghs->msgs[msghs->msg_count-1]->msg_h->MsgNum > jlr.HighReadMsg) {
@@ -3362,5 +3484,6 @@ int new_messages(struct user_record *user, int conference, int area) {
}
}
JAM_CloseMB(jb);
+ free(jb);
return count;
}
diff --git a/src/main.c b/src/main.c
index 4f28d71..3b0be5b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -5,6 +5,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -40,6 +41,7 @@ extern struct user_record *gUser;
int ssh_pid = -1;
int bbs_pid = 0;
int server_socket = -1;
+int ipv6_pid = -1;
int bbs_stdin;
int bbs_stdout;
@@ -62,6 +64,9 @@ void sigterm_handler(int s)
MHD_stop_daemon(www_daemon);
}
#endif
+ if (ipv6_pid != -1) {
+ kill(ipv6_pid, SIGTERM);
+ }
remove(conf.pid_file);
exit(0);
}
@@ -255,6 +260,12 @@ static int file_sub_handler(void* user, const char* section, const char* name,
if (strcasecmp(section, "main") == 0) {
if (strcasecmp(name, "visible sec level") == 0) {
fd->sec_level = atoi(value);
+ } else if (strcasecmp(name, "visible on web") == 0) {
+ if (strcasecmp(value, "true") == 0) {
+ fd->display_on_web = 1;
+ } else {
+ fd->display_on_web = 0;
+ }
}
} else {
// check if it's partially filled in
@@ -401,6 +412,7 @@ static int handler(void* user, const char* section, const char* name,
const char* value)
{
struct bbs_config *conf = (struct bbs_config *)user;
+ struct passwd *pwd;
if (strcasecmp(section, "main") == 0) {
if (strcasecmp(name, "bbs name") == 0) {
@@ -515,6 +527,12 @@ static int handler(void* user, const char* section, const char* name,
} else {
conf->date_style = 0;
}
+ } else if (strcasecmp(name, "run as user") == 0) {
+ pwd = getpwnam(value);
+ if (pwd != NULL) {
+ conf->uid = pwd->pw_uid;
+ conf->gid = pwd->pw_gid;
+ }
}
} else if (strcasecmp(section, "paths") == 0){
if (strcasecmp(name, "ansi path") == 0) {
@@ -566,6 +584,7 @@ static int handler(void* user, const char* section, const char* name,
conf->file_directories[conf->file_directory_count]->name = strdup(name);
conf->file_directories[conf->file_directory_count]->path = strdup(value);
conf->file_directories[conf->file_directory_count]->file_sub_count = 0;
+ conf->file_directories[conf->file_directory_count]->display_on_web = 0;
conf->file_directory_count++;
} else if (strcasecmp(section, "text files") == 0) {
if (conf->text_file_count == 0) {
@@ -787,6 +806,14 @@ void serverssh(int port, int ipv6) {
}
c = sizeof(struct sockaddr_in);
}
+
+ if (conf.uid != getuid()) {
+ if (setgid(conf.gid) != 0 || setuid(conf.uid) != 0) {
+ perror("SetUID Failed: ");
+ remove(conf.pid_file);
+ exit(1);
+ }
+ }
listen(ssh_sock, 3);
@@ -1063,6 +1090,7 @@ void server(int port, int ipv6) {
ssh_pid = fork();
if (ssh_pid == 0) {
+ ipv6_pid = -1;
ssh_pid = -1;
serverssh(conf.ssh_port, ipv6);
exit(0);
@@ -1072,20 +1100,6 @@ void server(int port, int ipv6) {
}
}
-#if defined(ENABLE_WWW)
- if (conf.www_server && conf.www_path != NULL && conf.www_url != NULL) {
- if (!conf.fork) {
- printf(" - HTTP Starting on Port %d (IPv%d)\n", conf.www_port, (ipv6 ? 6 : 4));
- }
- www_init();
- if (ipv6) {
- www_daemon = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION|MHD_USE_IPv6, conf.www_port, NULL, NULL, &www_handler, NULL, MHD_OPTION_NOTIFY_COMPLETED, &www_request_completed, NULL, MHD_OPTION_URI_LOG_CALLBACK, &www_logger, NULL, MHD_OPTION_END);
- } else {
- www_daemon = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION, conf.www_port, NULL, NULL, &www_handler, NULL, MHD_OPTION_NOTIFY_COMPLETED, &www_request_completed, NULL, MHD_OPTION_URI_LOG_CALLBACK, &www_logger, NULL, MHD_OPTION_END);
- }
- }
-#endif
-
if (ipv6) {
server_socket = socket(AF_INET6, SOCK_STREAM, 0);
} else {
@@ -1145,6 +1159,28 @@ void server(int port, int ipv6) {
client_p = &client4;
}
+ if (conf.uid != getuid()) {
+ if (setgid(conf.gid) != 0 || setuid(conf.uid) != 0) {
+ perror("SetUID Failed: ");
+ remove(conf.pid_file);
+ exit(1);
+ }
+ }
+
+#if defined(ENABLE_WWW)
+ if (conf.www_server && conf.www_path != NULL && conf.www_url != NULL) {
+ if (!conf.fork) {
+ printf(" - HTTP Starting on Port %d (IPv%d)\n", conf.www_port, (ipv6 ? 6 : 4));
+ }
+ www_init();
+ if (ipv6) {
+ www_daemon = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION|MHD_USE_IPv6, conf.www_port, NULL, NULL, &www_handler, NULL, MHD_OPTION_NOTIFY_COMPLETED, &www_request_completed, NULL, MHD_OPTION_URI_LOG_CALLBACK, &www_logger, NULL, MHD_OPTION_END);
+ } else {
+ www_daemon = MHD_start_daemon(MHD_USE_THREAD_PER_CONNECTION, conf.www_port, NULL, NULL, &www_handler, NULL, MHD_OPTION_NOTIFY_COMPLETED, &www_request_completed, NULL, MHD_OPTION_URI_LOG_CALLBACK, &www_logger, NULL, MHD_OPTION_END);
+ }
+ }
+#endif
+
listen(server_socket, 3);
@@ -1222,7 +1258,7 @@ void server(int port, int ipv6) {
int main(int argc, char **argv) {
int i;
- int main_pid, ipv6_pid;
+ int main_pid;
FILE *fptr;
struct stat s;
char buffer[1024];
@@ -1262,7 +1298,8 @@ int main(int argc, char **argv) {
conf.codepage = 0;
conf.date_style = 0;
conf.ipv6 = 0;
-
+ conf.uid = getuid();
+ conf.gid = getgid();
// Load BBS data
if (ini_parse(argv[1], handler, &conf) <0) {
fprintf(stderr, "Unable to load configuration ini (%s)!\n", argv[1]);
@@ -1329,6 +1366,12 @@ int main(int argc, char **argv) {
exit(-1);
} else
if (main_pid > 0) {
+ if (conf.uid != getuid()) {
+ if (setgid(conf.gid) != 0 || setuid(conf.uid) != 0) {
+ perror("Setuid Error: ");
+ exit(1);
+ }
+ }
fptr = fopen(conf.pid_file, "w");
if (!fptr) {
fprintf(stderr, "Unable to open pid file for writing.\n");
@@ -1351,6 +1394,7 @@ int main(int argc, char **argv) {
} else if (ipv6_pid > 0) {
server(conf.telnet_port, 0);
} else {
+ ipv6_pid = -1;
server(conf.telnet_port, 1);
}
} else {
@@ -1375,6 +1419,7 @@ int main(int argc, char **argv) {
} else if (ipv6_pid > 0) {
server(conf.telnet_port, 0);
} else {
+ ipv6_pid = -1;
server(conf.telnet_port, 1);
}
} else {
diff --git a/src/menus.c b/src/menus.c
index 68dc8c6..98bf801 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -11,7 +11,7 @@
#define MENU_SUBMENU 1
#define MENU_LOGOFF 2
#define MENU_PREVMENU 3
-#define MENU_AUTOMESSAGEWRITE 4
+#define MENU_AUTOMESSAGE 4
#define MENU_TEXTFILES 5
#define MENU_CHATSYSTEM 6
#define MENU_BBSLIST 7
@@ -57,6 +57,8 @@
#define MENU_GENWWWURLS 47
#define MENU_NLBROWSER 48
#define MENU_SENDFEEDBACK 49
+#define MENU_BLOGDISPLAY 50
+#define MENU_BLOGWRITE 51
extern struct bbs_config conf;
extern struct user_record *gUser;
@@ -64,8 +66,9 @@ extern int mynode;
struct menu_item {
char hotkey;
- int command;
- char *data;
+ int *command;
+ char **data;
+ int command_count;
int seclevel;
};
@@ -80,6 +83,7 @@ int menu_system(char *menufile) {
int i;
int j;
int k;
+ int m;
struct stat s;
char *lRet;
lua_State *L;
@@ -123,113 +127,131 @@ int menu_system(char *menufile) {
}
menu[menu_items-1] = (struct menu_item *)malloc(sizeof(struct menu_item));
menu[menu_items-1]->hotkey = buffer[7];
- menu[menu_items-1]->command = 0;
+ menu[menu_items-1]->command = NULL;
menu[menu_items-1]->data = NULL;
+ menu[menu_items-1]->command_count = 0;
menu[menu_items-1]->seclevel = 0;
} else if (strncasecmp(buffer, "COMMAND", 7) == 0 && menu_items > 0) {
+ if (menu[menu_items-1]->command_count == 0) {
+ menu[menu_items-1]->command = (int *)malloc(sizeof(int));
+ menu[menu_items-1]->data = (char **)malloc(sizeof(char *));
+ } else {
+ menu[menu_items-1]->command = (int *)realloc(menu[menu_items-1]->command, sizeof(int) * (menu[menu_items-1]->command_count + 1));
+ menu[menu_items-1]->data = (char **)realloc(menu[menu_items-1]->data, sizeof(char *) * (menu[menu_items-1]->command_count + 1));
+ }
+ menu[menu_items-1]->command_count++;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = 0;
+ menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1] = NULL;
if (strncasecmp(&buffer[8], "SUBMENU", 7) == 0) {
- menu[menu_items-1]->command = MENU_SUBMENU;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SUBMENU;
} else if (strncasecmp(&buffer[8], "LOGOFF", 6) == 0) {
- menu[menu_items-1]->command = MENU_LOGOFF;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LOGOFF;
} else if (strncasecmp(&buffer[8], "PREVMENU", 8) == 0) {
- menu[menu_items-1]->command = MENU_PREVMENU;
- } else if (strncasecmp(&buffer[8], "AUTOMESSAGE_WRITE", 17) == 0) {
- menu[menu_items-1]->command = MENU_AUTOMESSAGEWRITE;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVMENU;
+ } else if (strncasecmp(&buffer[8], "AUTOMESSAGE", 11) == 0) {
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_AUTOMESSAGE;
} else if (strncasecmp(&buffer[8], "TEXTFILES", 9) == 0) {
- menu[menu_items-1]->command = MENU_TEXTFILES;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_TEXTFILES;
} else if (strncasecmp(&buffer[8], "CHATSYSTEM", 10) == 0) {
- menu[menu_items-1]->command = MENU_CHATSYSTEM;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHATSYSTEM;
} else if (strncasecmp(&buffer[8], "BBSLIST", 7) == 0) {
- menu[menu_items-1]->command = MENU_BBSLIST;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BBSLIST;
} else if (strncasecmp(&buffer[8], "LISTUSERS", 9) == 0) {
- menu[menu_items-1]->command = MENU_LISTUSERS;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTUSERS;
} else if (strncasecmp(&buffer[8], "BULLETINS", 9) == 0) {
- menu[menu_items-1]->command = MENU_BULLETINS;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BULLETINS;
} else if (strncasecmp(&buffer[8], "LAST10CALLERS", 13) == 0) {
- menu[menu_items-1]->command = MENU_LAST10;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LAST10;
} else if (strncasecmp(&buffer[8], "SETTINGS", 8) == 0) {
- menu[menu_items-1]->command = MENU_SETTINGS;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SETTINGS;
} else if (strncasecmp(&buffer[8], "RUNDOOR", 7) == 0) {
- menu[menu_items-1]->command = MENU_DOOR;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DOOR;
} else if (strncasecmp(&buffer[8], "MAILSCAN", 8) == 0) {
- menu[menu_items-1]->command = MENU_MAILSCAN;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_MAILSCAN;
} else if (strncasecmp(&buffer[8], "READMAIL", 8) == 0) {
- menu[menu_items-1]->command = MENU_READMAIL;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_READMAIL;
} else if (strncasecmp(&buffer[8], "POSTMESSAGE", 11) == 0) {
- menu[menu_items-1]->command = MENU_POSTMESSAGE;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_POSTMESSAGE;
} else if (strncasecmp(&buffer[8], "CHOOSEMAILCONF", 14) == 0) {
- menu[menu_items-1]->command = MENU_CHOOSEMAILCONF;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEMAILCONF;
} else if (strncasecmp(&buffer[8], "CHOOSEMAILAREA", 14) == 0) {
- menu[menu_items-1]->command = MENU_CHOOSEMAILAREA;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEMAILAREA;
} else if (strncasecmp(&buffer[8], "SENDEMAIL", 9) == 0) {
- menu[menu_items-1]->command = MENU_SENDEMAIL;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SENDEMAIL;
} else if (strncasecmp(&buffer[8], "LISTEMAIL", 9) == 0) {
- menu[menu_items-1]->command = MENU_LISTEMAIL;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTEMAIL;
} else if (strncasecmp(&buffer[8], "NEXTMAILCONF", 12) == 0) {
- menu[menu_items-1]->command = MENU_NEXTMAILCONF;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTMAILCONF;
} else if (strncasecmp(&buffer[8], "PREVMAILCONF", 12) == 0) {
- menu[menu_items-1]->command = MENU_PREVMAILCONF;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVMAILCONF;
} else if (strncasecmp(&buffer[8], "NEXTMAILAREA", 12) == 0) {
- menu[menu_items-1]->command = MENU_NEXTMAILAREA;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTMAILAREA;
} else if (strncasecmp(&buffer[8], "PREVMAILAREA", 12) == 0) {
- menu[menu_items-1]->command = MENU_PREVMAILAREA;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVMAILAREA;
} else if (strncasecmp(&buffer[8], "BLUEWAVEDOWNLOAD", 16) == 0) {
- menu[menu_items-1]->command = MENU_BLUEWAVEDOWN;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLUEWAVEDOWN;
} else if (strncasecmp(&buffer[8], "BLUEWAVEUPLOAD", 14) == 0) {
- menu[menu_items-1]->command = MENU_BLUEWAVEUP;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLUEWAVEUP;
} else if (strncasecmp(&buffer[8], "CHOOSEFILEDIR", 13) == 0) {
- menu[menu_items-1]->command = MENU_CHOOSEFILEDIR;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEFILEDIR;
} else if (strncasecmp(&buffer[8], "CHOOSEFILESUB", 13) == 0) {
- menu[menu_items-1]->command = MENU_CHOOSEFILESUB;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CHOOSEFILESUB;
} else if (strncasecmp(&buffer[8], "LISTFILES", 9) == 0) {
- menu[menu_items-1]->command = MENU_LISTFILES;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTFILES;
} else if (strncasecmp(&buffer[8], "UPLOAD", 6) == 0) {
- menu[menu_items-1]->command = MENU_UPLOAD;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_UPLOAD;
} else if (strncasecmp(&buffer[8], "DOWNLOAD", 8) == 0) {
- menu[menu_items-1]->command = MENU_DOWNLOAD;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DOWNLOAD;
} else if (strncasecmp(&buffer[8], "CLEARTAGGED", 11) == 0) {
- menu[menu_items-1]->command = MENU_CLEARTAGGEDFILES;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_CLEARTAGGEDFILES;
} else if (strncasecmp(&buffer[8], "NEXTFILEDIR", 11) == 0) {
- menu[menu_items-1]->command = MENU_NEXTFILEDIR;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTFILEDIR;
} else if (strncasecmp(&buffer[8], "PREVFILEDIR", 11) == 0) {
- menu[menu_items-1]->command = MENU_PREVFILEDIR;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVFILEDIR;
} else if (strncasecmp(&buffer[8], "NEXTFILESUB", 11) == 0) {
- menu[menu_items-1]->command = MENU_NEXTFILESUB;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NEXTFILESUB;
} else if (strncasecmp(&buffer[8], "PREVFILESUB", 11) == 0) {
- menu[menu_items-1]->command = MENU_PREVFILESUB;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_PREVFILESUB;
} else if (strncasecmp(&buffer[8], "LISTMESSAGES", 12) == 0) {
- menu[menu_items-1]->command = MENU_LISTMESSAGES;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_LISTMESSAGES;
} else if (strncasecmp(&buffer[8], "DOSCRIPT", 8) == 0) {
- menu[menu_items-1]->command = MENU_DOSCRIPT;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DOSCRIPT;
} else if (strncasecmp(&buffer[8], "SENDNODEMSG", 11) == 0) {
- menu[menu_items-1]->command = MENU_SENDNODEMSG;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SENDNODEMSG;
} else if (strncasecmp(&buffer[8], "SUBUNSUBCONF", 12) == 0) {
- menu[menu_items-1]->command = MENU_SUBUNSUBCONF;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SUBUNSUBCONF;
} else if (strncasecmp(&buffer[8], "RESETMSGPTRS", 12) == 0) {
- menu[menu_items-1]->command = MENU_RESETPOINTERS;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_RESETPOINTERS;
} else if (strncasecmp(&buffer[8], "RESETALLMSGPTRS", 15) == 0) {
- menu[menu_items-1]->command = MENU_RESETALLPOINTERS;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_RESETALLPOINTERS;
} else if (strncasecmp(&buffer[8], "FILESCAN", 8) == 0) {
- menu[menu_items-1]->command = MENU_FILESCAN;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_FILESCAN;
} else if (strncasecmp(&buffer[8], "FULLMAILSCAN", 12) == 0) {
- menu[menu_items-1]->command = MENU_FULLMAILSCAN;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_FULLMAILSCAN;
} else if (strncasecmp(&buffer[8], "FILESEARCH", 10) == 0) {
- menu[menu_items-1]->command = MENU_FILESEARCH;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_FILESEARCH;
} else if (strncasecmp(&buffer[8], "DISPLAYTXTFILE", 14) == 0) {
- menu[menu_items-1]->command = MENU_DISPTXTFILE;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DISPTXTFILE;
} else if (strncasecmp(&buffer[8], "DISPLAYTXTPAUSE", 15) == 0) {
- menu[menu_items-1]->command = MENU_DISPTXTFILEPAUSE;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_DISPTXTFILEPAUSE;
} else if (strncasecmp(&buffer[8], "GENWWWURLS", 10) == 0) {
- menu[menu_items-1]->command = MENU_GENWWWURLS;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_GENWWWURLS;
} else if (strncasecmp(&buffer[8], "NLBROWSER", 9) == 0) {
- menu[menu_items-1]->command = MENU_NLBROWSER;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_NLBROWSER;
} else if (strncasecmp(&buffer[8], "SENDFEEDBACK", 12) == 0) {
- menu[menu_items-1]->command = MENU_SENDFEEDBACK;
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_SENDFEEDBACK;
+ } else if (strncasecmp(&buffer[8], "BLOGDISPLAY", 11) == 0) {
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLOGDISPLAY;
+ } else if (strncasecmp(&buffer[8], "BLOGWRITE", 9) == 0) {
+ menu[menu_items-1]->command[menu[menu_items -1]->command_count - 1] = MENU_BLOGWRITE;
}
} else if (strncasecmp(buffer, "SECLEVEL", 8) == 0) {
menu[menu_items-1]->seclevel = atoi(&buffer[9]);
} else if (strncasecmp(buffer, "DATA", 4) == 0) {
- menu[menu_items-1]->data = strdup(&buffer[5]);
+ if (menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1] != NULL) {
+ free(menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1]);
+ }
+ menu[menu_items-1]->data[menu[menu_items -1]->command_count - 1] = strdup(&buffer[5]);
} else if (strncasecmp(buffer, "LUASCRIPT", 9) == 0) {
if (lua_script != NULL) {
free(lua_script);
@@ -328,14 +350,39 @@ int menu_system(char *menufile) {
for (i=0;ihotkey) == tolower(c)) {
if (menu[i]->seclevel <= gUser->sec_level) {
- switch(menu[i]->command) {
- case MENU_SUBMENU:
- doquit = menu_system(menu[i]->data);
- if (doquit == 1) {
- // free menus
+ for (j=0; j