Merge branch 'master' into debian
This commit is contained in:
commit
699989ccd5
152
GNUmakefile.debian
Normal file
152
GNUmakefile.debian
Normal file
@ -0,0 +1,152 @@
|
||||
ifdef PREFIX
|
||||
prefix := $(PREFIX)
|
||||
else
|
||||
prefix := /opt/magicka
|
||||
endif
|
||||
|
||||
exec_prefix := $(prefix)
|
||||
datarootdir = $(prefix)/share
|
||||
datadir = $(datarootdir)
|
||||
bindir = $(exec_prefix)/bin
|
||||
localstatedir = $(prefix)/var
|
||||
sysconfdir = $(prefix)/etc
|
||||
|
||||
user := magicka
|
||||
|
||||
all: magicka
|
||||
|
||||
.PHONY: magicka www clean cleanwww install
|
||||
|
||||
magicka:
|
||||
cd src && $(MAKE) -f GNUmakefile.debian MAGIEDIT_ANSI_PATH="$(datarootdir)/magicka/ansis/" MAGIEDIT_DRAFT_PATH="$(datarootdir)/magicka/ansis/"
|
||||
|
||||
www:
|
||||
cd src && $(MAKE) -f GNUmakefile.debian MAGIEDIT_ANSI_PATH="$(datarootdir)/magicka/ansis/" MAGIEDIT_DRAFT_PATH="$(datarootdir)/magicka/ansis/" www
|
||||
|
||||
clean:
|
||||
cd src && $(MAKE) -f GNUmakefile.debian clean
|
||||
|
||||
cleanwww:
|
||||
cd src && $(MAKE) -f GNUmakefile.debian clean
|
||||
|
||||
install:
|
||||
install -m755 -d ${DESTDIR}${bindir}
|
||||
install -m755 -d ${DESTDIR}${datarootdir}/doc/magicka
|
||||
install -m755 -d ${DESTDIR}${localstatedir}/magicka
|
||||
install -m755 -d ${DESTDIR}${sysconfdir}/magicka
|
||||
install -m755 -d ${DESTDIR}${datarootdir}/magicka
|
||||
install -m755 -d ${DESTDIR}${localstatedir}/magicka/logs
|
||||
install -m755 -d ${DESTDIR}${localstatedir}/magicka/msgs
|
||||
install -m755 -d ${DESTDIR}${localstatedir}/magicka/files/misc
|
||||
install -m755 -d ${DESTDIR}${datarootdir}/magicka/scripts/data
|
||||
install -m755 -d ${DESTDIR}${datarootdir}/magicka/ansis
|
||||
install -m755 -d ${DESTDIR}${datarootdir}/magicka/www/static/fonts
|
||||
install -m755 -d ${DESTDIR}${datarootdir}/magicka/menus
|
||||
|
||||
install -m755 magicka ${DESTDIR}${bindir}/magicka
|
||||
install -m755 utils/dosbox_shim/shim ${DESTDIR}${bindir}/magi_shim
|
||||
install -m755 utils/filecenter/filecenter ${DESTDIR}${bindir}/magi_filecenter
|
||||
install -m755 utils/magichat/magichat ${DESTDIR}${bindir}/magichat
|
||||
install -m755 utils/magiedit/magiedit ${DESTDIR}${bindir}/magiedit
|
||||
install -m755 utils/magiftpd/magiftpd ${DESTDIR}${bindir}/magiftpd
|
||||
install -m755 utils/magimail/bin/magiexport ${DESTDIR}${bindir}/magiexport
|
||||
install -m755 utils/magimail/bin/magigetnode ${DESTDIR}${bindir}/magigetnode
|
||||
install -m755 utils/magimail/bin/magilist ${DESTDIR}${bindir}/magilist
|
||||
install -m755 utils/magimail/bin/magilistout ${DESTDIR}${bindir}/magilistout
|
||||
install -m755 utils/magimail/bin/magimail ${DESTDIR}${bindir}/magimail
|
||||
install -m755 utils/magimail/bin/magimaint ${DESTDIR}${bindir}/magimaint
|
||||
install -m755 utils/magimail/bin/magistats ${DESTDIR}${bindir}/magistats
|
||||
install -m755 utils/magimail/bin/magiwrite ${DESTDIR}${bindir}/magiwrite
|
||||
install -m755 utils/massupload/massupload.pl ${DESTDIR}${bindir}/magi_massupload.pl
|
||||
install -m755 utils/mgpost/mgpost ${DESTDIR}${bindir}/mgpost
|
||||
install -m755 utils/nodelistp/nodelistp.pl ${DESTDIR}${bindir}/magi_nodelistp.pl
|
||||
install -m755 utils/reset_pass/reset_pass ${DESTDIR}${bindir}/magi_reset_pass
|
||||
install -m755 utils/ticproc/ticproc ${DESTDIR}${bindir}/magi_ticproc
|
||||
|
||||
install -m644 dist/config/bbs.ini ${DESTDIR}${sysconfdir}/magicka/bbs.ini
|
||||
sed -i "s@__CONFIGPREFIX__@${sysconfdir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini
|
||||
sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini
|
||||
sed -i "s@__SHAREPREFIX__@${datarootdir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini
|
||||
sed -i "s@__EXECPREFIX__@${bindir}@g" ${DESTDIR}${sysconfdir}/magicka/bbs.ini
|
||||
|
||||
install -m644 dist/config/archivers.ini ${DESTDIR}${sysconfdir}/magicka/archivers.ini
|
||||
install -m644 dist/config/doors.ini ${DESTDIR}${sysconfdir}/magicka/doors.ini
|
||||
install -m644 dist/config/protocols.ini ${DESTDIR}${sysconfdir}/magicka/protocols.ini
|
||||
install -m644 dist/config/s10.ini ${DESTDIR}${sysconfdir}/magicka/s10.ini
|
||||
|
||||
install -m644 dist/config/filesgen.ini ${DESTDIR}${sysconfdir}/magicka/filesgen.ini
|
||||
sed -i "s@__LOCALSTATEPREFIX__@$${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/filesgen.ini
|
||||
|
||||
|
||||
install -m644 dist/config/happynet.ini ${DESTDIR}${sysconfdir}/magicka/happynet.ini
|
||||
sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/happynet.ini
|
||||
|
||||
install -m644 dist/config/localmail.ini ${DESTDIR}${sysconfdir}/magicka/localmail.ini
|
||||
sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${sysconfdir}/magicka/localmail.ini
|
||||
|
||||
install -m755 utils/magiedit/magiedit.sh ${DESTDIR}${bindir}/magiedit.sh
|
||||
sed -i "s@__LOCALSTATEPREFIX__@${localstatedir}/magicka@g" ${DESTDIR}${bindir}/magiedit.sh
|
||||
sed -i "s@__EXECPREFIX__@${bindir}@g" ${DESTDIR}${bindir}/magiedit.sh
|
||||
|
||||
install -m644 dist/magicka.strings ${DESTDIR}${datarootdir}/magicka/magicka.strings
|
||||
|
||||
install -m644 dist/scripts/doors.lua ${DESTDIR}${datarootdir}/magicka/scripts/doors.lua
|
||||
install -m644 dist/scripts/filemenu.lua ${DESTDIR}${datarootdir}/magicka/scripts/filemenu.lua
|
||||
install -m644 dist/scripts/login_stanza.lua ${DESTDIR}${datarootdir}/magicka/scripts/login_stanza.lua
|
||||
|
||||
sed -i "s@__SHAREPREFIX__@${datarootdir}/magicka@g" ${DESTDIR}${datarootdir}/magicka/scripts/login_stanza.lua
|
||||
|
||||
install -m644 dist/scripts/logoff.lua ${DESTDIR}${datarootdir}/magicka/scripts/logoff.lua
|
||||
install -m644 dist/scripts/logout_stanza.lua ${DESTDIR}${datarootdir}/magicka/scripts/logout_stanza.lua
|
||||
install -m644 dist/scripts/mailmenu.lua ${DESTDIR}${datarootdir}/magicka/scripts/mailmenu.lua
|
||||
install -m644 dist/scripts/mainmenu.lua ${DESTDIR}${datarootdir}/magicka/scripts/mainmenu.lua
|
||||
install -m644 dist/scripts/data/taglines.txt ${DESTDIR}${datarootdir}/magicka/scripts/data/taglines.txt
|
||||
|
||||
install -m644 dist/ansis/bulletin0.ans ${DESTDIR}${datarootdir}/magicka/ansis/bulletin0.ans
|
||||
install -m644 dist/ansis/bulletin1.ans ${DESTDIR}${datarootdir}/magicka/ansis/bulletin1.ans
|
||||
install -m644 dist/ansis/doors.ans ${DESTDIR}${datarootdir}/magicka/ansis/doors.ans
|
||||
install -m644 dist/ansis/filemenu.ans ${DESTDIR}${datarootdir}/magicka/ansis/filemenu.ans
|
||||
install -m644 dist/ansis/goodbye.ans ${DESTDIR}${datarootdir}/magicka/ansis/goodbye.ans
|
||||
install -m644 dist/ansis/issue.ans ${DESTDIR}${datarootdir}/magicka/ansis/issue.ans
|
||||
install -m644 dist/ansis/logoff.ans ${DESTDIR}${datarootdir}/magicka/ansis/logoff.ans
|
||||
install -m644 dist/ansis/mailmenu.ans ${DESTDIR}${datarootdir}/magicka/ansis/mailmenu.ans
|
||||
install -m644 dist/ansis/mainmenu.ans ${DESTDIR}${datarootdir}/magicka/ansis/mainmenu.ans
|
||||
install -m644 dist/ansis/newuser.ans ${DESTDIR}${datarootdir}/magicka/ansis/newuser.ans
|
||||
install -m644 utils/magiedit/magiedit.ans ${DESTDIR}${datarootdir}/magicka/ansis/magiedit.ans
|
||||
install -m644 utils/magiedit/magiquote.ans ${DESTDIR}${datarootdir}/magicka/ansis/magiquote.ans
|
||||
|
||||
install -m644 dist/www-bootstrap/401.tpl ${DESTDIR}${datarootdir}/magicka/www/401.tpl
|
||||
install -m644 dist/www-bootstrap/403.tpl ${DESTDIR}${datarootdir}/magicka/www/403.tpl
|
||||
install -m644 dist/www-bootstrap/404.tpl ${DESTDIR}${datarootdir}/magicka/www/404.tpl
|
||||
install -m644 dist/www-bootstrap/footer.tpl ${DESTDIR}${datarootdir}/magicka/www/footer.tpl
|
||||
install -m644 dist/www-bootstrap/header.tpl ${DESTDIR}${datarootdir}/magicka/www/header.tpl
|
||||
install -m644 dist/www-bootstrap/index.tpl ${DESTDIR}${datarootdir}/magicka/www/index.tpl
|
||||
install -m644 dist/www-bootstrap/mime.types ${DESTDIR}${datarootdir}/magicka/www/mime.types
|
||||
|
||||
install -m644 dist/www-bootstrap/static/delete.png ${DESTDIR}${datarootdir}/magicka/www/static/delete.png
|
||||
install -m644 dist/www-bootstrap/static/flag.png ${DESTDIR}${datarootdir}/magicka/www/static/flag.png
|
||||
install -m644 dist/www-bootstrap/static/header-m.png ${DESTDIR}${datarootdir}/magicka/www/static/header-m.png
|
||||
install -m644 dist/www-bootstrap/static/header.png ${DESTDIR}${datarootdir}/magicka/www/static/header.png
|
||||
install -m644 dist/www-bootstrap/static/newuser.png ${DESTDIR}${datarootdir}/magicka/www/static/newuser.png
|
||||
install -m644 dist/www-bootstrap/static/style.css ${DESTDIR}${datarootdir}/magicka/www/static/style.css
|
||||
install -m644 dist/www-bootstrap/static/style-mobile.css ${DESTDIR}${datarootdir}/magicka/www/static/style-mobile.css
|
||||
|
||||
install -m644 dist/www-bootstrap/static/fonts/LICENSE.TXT ${DESTDIR}${datarootdir}/magicka/www/static/fonts/LICENSE.TXT
|
||||
install -m644 dist/www-bootstrap/static/fonts/pxplus_ibm_vga8-webfont.svg ${DESTDIR}${datarootdir}/magicka/www/static/fonts/pxplus_ibm_vga8-webfont.svg
|
||||
install -m644 dist/www-bootstrap/static/fonts/pxplus_ibm_vga8-webfont.woff ${DESTDIR}${datarootdir}/magicka/www/static/fonts/pxplus_ibm_vga8-webfont.woff
|
||||
install -m644 dist/www-bootstrap/static/fonts/pxplus_ibm_vga8-webfont.woff2 ${DESTDIR}${datarootdir}/magicka/www/static/fonts/pxplus_ibm_vga8-webfont.woff2
|
||||
|
||||
install -m644 dist/menus/doors.mnu ${DESTDIR}${datarootdir}/magicka/menus/doors.mnu
|
||||
install -m644 dist/menus/main.mnu ${DESTDIR}${datarootdir}/magicka/menus/main.mnu
|
||||
install -m644 dist/menus/file.mnu ${DESTDIR}${datarootdir}/magicka/menus/file.mnu
|
||||
install -m644 dist/menus/logoff.mnu ${DESTDIR}${datarootdir}/magicka/menus/logoff.mnu
|
||||
install -m644 dist/menus/mail.mnu ${DESTDIR}${datarootdir}/magicka/menus/mail.mnu
|
||||
|
||||
echo "You should now create a user to run magicka"
|
||||
echo "and assuming that user is magicka:
|
||||
echo " "
|
||||
echo " chown -R magicka:magicka ${datarootdir}/magicka/scripts/data"
|
||||
echo " chown -R magicka:magicka ${localstatedir}/magicka"
|
||||
echo " "
|
||||
echo "Then configure ${sysconfdir}/magicka/bbs.ini to your liking"
|
||||
|
38
dist/config/bbs.ini
vendored
38
dist/config/bbs.ini
vendored
@ -9,7 +9,7 @@ MagiChat Server = localhost
|
||||
MagiChat Port = 6667
|
||||
MagiChat BBSTag = Magicka
|
||||
Default Tagline = Brought to you by Another Magicka BBS!
|
||||
External Editor cmd = /home/andrew/MagickaBBS/utils/magiedit/magiedit.sh
|
||||
External Editor cmd = __EXECPREFIX__/magiedit.sh
|
||||
External Editor stdio = true
|
||||
External Editor Codepage = CP437
|
||||
Automessage Write Level = 10
|
||||
@ -20,8 +20,8 @@ WWW Port = 8080
|
||||
WWW URL = http://127.0.0.1:8080/
|
||||
Enable SSH = false
|
||||
SSH Port = 2024
|
||||
SSH DSA Key = /home/andrew/MagickaBBS/keys/ssh_host_dsa_key
|
||||
SSH RSA Key = /home/andrew/MagickaBBS/keys/ssh_host_rsa_key
|
||||
SSH DSA Key = __CONFIGPREFIX__/keys/ssh_host_dsa_key
|
||||
SSH RSA Key = __CONFIGPREFIX__/keys/ssh_host_rsa_key
|
||||
Main AKA = 1:2/3.4
|
||||
QWK Name = MAGICKA
|
||||
QWK Max Messages = 5000
|
||||
@ -39,25 +39,25 @@ Date Style = EU
|
||||
Enable IPv6 = true
|
||||
|
||||
[paths]
|
||||
Config Path = /home/andrew/MagickaBBS/config
|
||||
WWW Path = /home/andrew/MagickaBBS/www
|
||||
String File = /home/andrew/MagickaBBS/magicka.strings
|
||||
PID File = /home/andrew/MagickaBBS/magicka.pid
|
||||
ANSI Path = /home/andrew/MagickaBBS/ansis
|
||||
BBS Path = /home/andrew/MagickaBBS
|
||||
Log Path = /home/andrew/MagickaBBS/logs
|
||||
Script Path = /home/andrew/MagickaBBS/scripts
|
||||
Echomail Semaphore = /home/andrew/MagickaBBS/echomail.out
|
||||
Netmail Semaphore = /home/andrew/MagickaBBS/netmail.out
|
||||
Menu Path = /home/andrew/MagickaBBS/menus
|
||||
Config Path = __CONFIGPREFIX__
|
||||
WWW Path = __SHAREPREFIX__/www
|
||||
String File = __SHAREPREFIX__/magicka.strings
|
||||
PID File = __LOCALSTATEPREFIX__/magicka.pid
|
||||
ANSI Path = __SHAREPREFIX__/ansis
|
||||
BBS Path = __LOCALSTATEPREFIX__
|
||||
Log Path = __LOCALSTATEPREFIX__/logs
|
||||
Script Path = __SHAREPREFIX__/scripts
|
||||
Echomail Semaphore = __LOCALSTATEPREFIX__/mail.out
|
||||
Netmail Semaphore = __LOCALSTATEPREFIX__/mail.out
|
||||
Menu Path = __SHAREPREFIX__/menus
|
||||
|
||||
[mail conferences]
|
||||
Local Mail = config/localmail.ini
|
||||
HappyNet = config/happynet.ini
|
||||
Local Mail = __CONFIGPREFIX__/localmail.ini
|
||||
HappyNet = __CONFIGPREFIX__/happynet.ini
|
||||
|
||||
[file directories]
|
||||
General Files = config/filesgen.ini
|
||||
General Files = __CONFIGPREFIX__/filesgen.ini
|
||||
|
||||
[text files]
|
||||
Magicka Advertisement = ansis/bulletin0.ans
|
||||
Whats New = ansis/bulletin1.ans
|
||||
Magicka Advertisement = __SHAREPREFIX__/ansis/bulletin0.ans
|
||||
Whats New = __SHAREPREFIX__/ansis/bulletin1.ans
|
||||
|
2
dist/config/filesgen.ini
vendored
2
dist/config/filesgen.ini
vendored
@ -6,4 +6,4 @@ Visible on Web = false
|
||||
Database = files_misc
|
||||
Download Sec Level = 10
|
||||
Upload Sec Level = 10
|
||||
Upload Path = /home/andrew/MagickaBBS/files/misc
|
||||
Upload Path = __LOCALSTATEPREFIX__/files/misc
|
||||
|
4
dist/config/happynet.ini
vendored
4
dist/config/happynet.ini
vendored
@ -15,7 +15,7 @@ domain = happynet
|
||||
[General]
|
||||
Read Sec Level = 10
|
||||
Write Sec Level = 10
|
||||
Path = /home/andrew/MagickaBBS/msgs/hnet_general
|
||||
Path = __LOCALSTATEPREFIX__/msgs/hnet_general
|
||||
; local / echo or netmail
|
||||
Type = Echo
|
||||
QWK Name = HN_GEN
|
||||
@ -23,7 +23,7 @@ QWK Name = HN_GEN
|
||||
[Netmail]
|
||||
Read Sec Level = 10
|
||||
Write Sec Level = 10
|
||||
Path = /home/andrew/MagickaBBS/msgs/hnet_netmail
|
||||
Path = __LOCALSTATEPREFIX__/msgs/hnet_netmail
|
||||
; local / echo or netmail
|
||||
Type = Netmail
|
||||
QWK Name = HN_NET
|
||||
|
4
dist/config/localmail.ini
vendored
4
dist/config/localmail.ini
vendored
@ -6,13 +6,13 @@ Real Names = false
|
||||
[General]
|
||||
Read Sec Level = 10
|
||||
Write Sec Level = 10
|
||||
Path = /home/andrew/MagickaBBS/msgs/general
|
||||
Path = __LOCALSTATEPREFIX__/msgs/general
|
||||
Type = Local
|
||||
QWK Name = GENERAL
|
||||
|
||||
[Testing]
|
||||
Read Sec Level = 10
|
||||
Write Sec Level = 10
|
||||
Path = /home/andrew/MagickaBBS/msgs/testing
|
||||
Path = __LOCALSTATEPREFIX__/msgs/testing
|
||||
Type = Local
|
||||
QWK Name = TEST
|
||||
|
2
dist/scripts/login_stanza.lua
vendored
2
dist/scripts/login_stanza.lua
vendored
@ -1,4 +1,4 @@
|
||||
local bulletin_path = "/home/andrew/MagickaBBS/ansis";
|
||||
local bulletin_path = "__SHAREPREFIX__/ansis";
|
||||
|
||||
|
||||
function file_exists(name)
|
||||
|
21
setup.sh
21
setup.sh
@ -70,16 +70,21 @@ else
|
||||
fi
|
||||
|
||||
|
||||
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" config/bbs.ini
|
||||
$SED -i "s@__CONFIGPREFIX__/keys@${PWD}/keys@g" config/bbs.ini
|
||||
$SED -i "s@__CONFIGPREFIX__@${PWD}/config@g" config/bbs.ini
|
||||
$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/bbs.ini
|
||||
$SED -i "s@__SHAREPREFIX__@${PWD}@g" config/bbs.ini
|
||||
$SED -i "s@__EXECPREFIX__@${PWD}/utils/magiedit/@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
|
||||
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" utils/magiedit/magiedit.sh
|
||||
$SED -i "s@/home/andrew/MagickaBBS@${PWD}@g" scripts/login_stanza.lua
|
||||
$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/localmail.ini
|
||||
$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/filesgen.ini
|
||||
$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" config/happynet.ini
|
||||
$SED -i "s@__BINPREFIX__@${PWD}@g" utils/magiedit/magiedit.sh
|
||||
$SED -i "s@cd __LOCALSTATEPREFIX__@cd ${PWD}/utils/magiedit/@g" utils/magiedit/magiedit.sh
|
||||
$SED -i "s@__LOCALSTATEPREFIX__@${PWD}@g" utils/magiedit/magiedit.sh
|
||||
$SED -i "s@__EXECPREFIX__@.@g" utils/magiedit/magiedit.sh
|
||||
$SED -i "s@__SHAREPREFIX__@${PWD}@g" scripts/login_stanza.lua
|
||||
$SED -i "s/MagiChat Server = localhost/; MagiChat Server = localhost/g" config/bbs.ini
|
||||
$SED -i "s/Default Tagline = Brought to you by Another Magicka BBS!/Default Tagline = ${bbsname}/g" config/bbs.ini
|
||||
$SED -i "s/echomail.out/mail.out/g" config/bbs.ini
|
||||
$SED -i "s/netmail.out/mail.out/g" config/bbs.ini
|
||||
|
@ -14,10 +14,10 @@ UUID:= ${DEPSDIR}/libuuid/.libs/libuuid.a
|
||||
CUTEST:= ${DEPSDIR}/cutest-1.5/libcutest.a
|
||||
|
||||
all: magicka magimail magiedit ticproc mgpost magichat \
|
||||
filecenter dosbox_shim magiftpd reset_pass
|
||||
filecenter dosbox_shim magiftpd reset_pass qwknet
|
||||
|
||||
www: magickawww magimail magiedit ticproc mgpost magichat \
|
||||
filecenter dosbox_shim magiftpd reset_pass
|
||||
filecenter dosbox_shim magiftpd reset_pass qwknet
|
||||
|
||||
${LUA}:
|
||||
cd ${DEPSDIR}/lua && ${MAKE} -f Makefile ${DEPS_LUA_TARGET} MAKEFLAGS= CC=${CC}
|
||||
@ -67,14 +67,14 @@ endif
|
||||
${CC} -c -o $@ $< ${CFLAGS}
|
||||
|
||||
magickawww: ${OBJS} ${WWWOBJS} ${LUA} ${ZMODEM} ${B64} ${JAMLIB} ${JSMN} ${UUID}
|
||||
${CC} -o ../magicka $^ ${LIBS} -lmicrohttpd
|
||||
${CC} -o ../magicka $^ ${LIBS} -lmicrohttpd
|
||||
|
||||
magicka: ${OBJS} ${LUA} ${ZMODEM} ${JAMLIB} ${JSMN} ${UUID}
|
||||
${CC} -o ../magicka $^ ${LIBS}
|
||||
|
||||
|
||||
magiedit: ${ODOORS}
|
||||
cd ${UTILSDIR}/magiedit && ${MAKE}
|
||||
cd ${UTILSDIR}/magiedit && ${MAKE} ANSI_PATH=${MAGIEDIT_ANSI_PATH} DRAFT_PATH=${MAGIEDIT_DRAFT_PATH}
|
||||
|
||||
magimail: ${JAMLIB}
|
||||
cd ${UTILSDIR}/magimail && ${MAKE} all
|
||||
@ -100,6 +100,9 @@ magiftpd:
|
||||
reset_pass:
|
||||
cd ${UTILSDIR}/reset_pass && ${MAKE}
|
||||
|
||||
qwknet:
|
||||
cd ${UTILSDIR}/qwknet && ${MAKE}
|
||||
|
||||
.PHONY: clean www
|
||||
|
||||
clean:
|
||||
@ -123,3 +126,4 @@ clean:
|
||||
cd ${DEPSDIR}/libuuid && rm -rf .libs
|
||||
cd ${DEPSDIR}/cutest-1.5 && ${MAKE} clean
|
||||
cd ${DEPSDIR}/jsmn && ${MAKE} clean
|
||||
cd ${UTILSDIR}/qwknet && ${MAKE} clean
|
||||
|
11
src/GNUmakefile.debian
Normal file
11
src/GNUmakefile.debian
Normal file
@ -0,0 +1,11 @@
|
||||
CC:= cc
|
||||
CFLAGS:= -std=gnu99 -I/usr/local/include
|
||||
LIBS:= -L/usr/local/lib -lsqlite3 -lutil -lm -ldl -lssl -lcrypto -lssh -lmosquitto
|
||||
EXTRAOBJS:= strlcpy/strlcpy.o strlcpy/strlcat.o
|
||||
|
||||
LIBTOOLIZE:= libtoolize
|
||||
|
||||
DEPS_LUA_TARGET:= linux
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
include GNUmakefile.common
|
@ -9,4 +9,7 @@ DEPS_CDK_OPTS:= --with-curses-dir=/usr/local
|
||||
DEPS_LUA_TARGET:= dragonfly
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -7,4 +7,7 @@ LIBTOOLIZE:= libtoolize
|
||||
DEPS_LUA_TARGET:= freebsd
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -8,4 +8,7 @@ LIBTOOLIZE:= libtoolize
|
||||
DEPS_LUA_TARGET:= haiku
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -8,4 +8,7 @@ LIBTOOLIZE:= libtoolize
|
||||
DEPS_LUA_TARGET:= linux
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -10,4 +10,7 @@ DEPS_JAMLIB_MAKEFILE:= Makefile.linux-musl
|
||||
|
||||
FTSLIB:= FTSLIB=1
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -8,4 +8,7 @@ DEPS_CDK_OPTS:= --with-curses-dir=/usr/pkg
|
||||
DEPS_LUA_TARGET:= bsd
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -7,4 +7,7 @@ LIBTOOLIZE:= libtoolize
|
||||
DEPS_LUA_TARGET:= bsd
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -7,4 +7,7 @@ LIBTOOLIZE:= glibtoolize
|
||||
DEPS_LUA_TARGET:= macosx
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.linux
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -8,4 +8,7 @@ LIBTOOLIZE:= libtoolize
|
||||
DEPS_LUA_TARGET:= solaris
|
||||
DEPS_JAMLIB_MAKEFILE:= Makefile.sunos
|
||||
|
||||
MAGIEDIT_ANSI_PATH:= ""
|
||||
MAGIEDIT_DRAFT_PATH:= ""
|
||||
|
||||
include GNUmakefile.common
|
||||
|
@ -151,6 +151,7 @@ struct bbs_config {
|
||||
gid_t gid;
|
||||
int codepage;
|
||||
int ipv6;
|
||||
char *external_address;
|
||||
char *bbs_name;
|
||||
char *bwave_name;
|
||||
char *sysop_name;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sqlite3.h>
|
||||
#include <sys/wait.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include "jamlib/jam.h"
|
||||
#include "libuuid/uuid.h"
|
||||
@ -591,8 +592,9 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
|
||||
s_JamSubfield jsf;
|
||||
int z;
|
||||
char buffer[256];
|
||||
char qwkuuid[38];
|
||||
uuid_t magi_msgid;
|
||||
|
||||
uuid_t qwk_msgid;
|
||||
struct mail_area *ma = get_area(confr, area);
|
||||
jb = open_jam_base(ma->path);
|
||||
if (!jb) {
|
||||
@ -698,6 +700,19 @@ int bwave_add_message(int confr, int area, unsigned int dwritten, char *to, char
|
||||
jsf.DatLen = strlen(conf.bwave_name);
|
||||
jsf.Buffer = (char *)conf.bwave_name;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
if (conf.external_address != NULL) {
|
||||
|
||||
uuid_generate(qwk_msgid);
|
||||
uuid_unparse_lower(qwk_msgid, qwkuuid);
|
||||
snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address);
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
}
|
||||
}
|
||||
} else if (ma->type == TYPE_NETMAIL_AREA && mc->nettype == NETWORK_FIDO) {
|
||||
jmh.Attribute |= JAM_MSG_TYPENET;
|
||||
@ -1082,8 +1097,8 @@ void bwave_upload_reply() {
|
||||
snprintf(originlinebuffer, sizeof originlinebuffer, "\r--- %s\r * Origin: %s (@%d)\r",
|
||||
upl_hdr.reader_tear, tagline, mc->maginode);
|
||||
} else if (mc->nettype == NETWORK_QWK) {
|
||||
snprintf(originlinebuffer, sizeof originlinebuffer, "\r--- $s\r * Origin: %s (%s)\r",
|
||||
upl_hdr.reader_tear, tagline, conf.bwave_name);
|
||||
snprintf(originlinebuffer, sizeof originlinebuffer, "\r---\r * MagickaBBS * %s\r",
|
||||
tagline);
|
||||
} else {
|
||||
snprintf(originlinebuffer, sizeof originlinebuffer, "\r");
|
||||
}
|
||||
|
123
src/lua_glue.c
123
src/lua_glue.c
@ -7,6 +7,7 @@
|
||||
#include "lua/lua.h"
|
||||
#include "lua/lauxlib.h"
|
||||
#include "jamlib/jam.h"
|
||||
#include "libuuid/uuid.h"
|
||||
|
||||
extern int mynode;
|
||||
extern struct bbs_config conf;
|
||||
@ -203,6 +204,12 @@ int l_getUserHandle(lua_State *L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int l_getUserLocation(lua_State *L) {
|
||||
lua_pushstring(L, gUser->location);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int l_messageFound(lua_State *L) {
|
||||
int conference = lua_tointeger(L, 1);
|
||||
int area = lua_tointeger(L, 2);
|
||||
@ -407,7 +414,9 @@ int l_postMessage(lua_State *L) {
|
||||
const char *subject = lua_tostring(L, 5);
|
||||
const char *body = lua_tostring(L, 6);
|
||||
int sem_fd;
|
||||
|
||||
uuid_t mnet_msgid;
|
||||
uuid_t qwk_msgid;
|
||||
char qwkuuid[38];
|
||||
char buffer[256];
|
||||
|
||||
s_JamBase *jb;
|
||||
@ -464,47 +473,69 @@ int l_postMessage(lua_State *L) {
|
||||
jsf.Buffer = (char *)subject;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
if (ma->type == TYPE_ECHOMAIL_AREA || ma->type == TYPE_NEWSGROUP_AREA) {
|
||||
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
||||
if (mc->networked) {
|
||||
if (mc->nettype == NETWORK_FIDO) {
|
||||
if (ma->type == TYPE_ECHOMAIL_AREA || ma->type == TYPE_NEWSGROUP_AREA) {
|
||||
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
||||
|
||||
if (mc->fidoaddr->point) {
|
||||
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d",
|
||||
mc->fidoaddr->zone,
|
||||
mc->fidoaddr->net,
|
||||
mc->fidoaddr->node,
|
||||
mc->fidoaddr->point);
|
||||
} else {
|
||||
snprintf(buffer, sizeof buffer, "%d:%d/%d",
|
||||
mc->fidoaddr->zone,
|
||||
mc->fidoaddr->net,
|
||||
mc->fidoaddr->node);
|
||||
if (mc->fidoaddr->point) {
|
||||
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d",
|
||||
mc->fidoaddr->zone,
|
||||
mc->fidoaddr->net,
|
||||
mc->fidoaddr->node,
|
||||
mc->fidoaddr->point);
|
||||
} else {
|
||||
snprintf(buffer, sizeof buffer, "%d:%d/%d",
|
||||
mc->fidoaddr->zone,
|
||||
mc->fidoaddr->net,
|
||||
mc->fidoaddr->node);
|
||||
}
|
||||
jsf.LoID = JAMSFLD_OADDRESS;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx",
|
||||
mc->fidoaddr->zone,
|
||||
mc->fidoaddr->net,
|
||||
mc->fidoaddr->node,
|
||||
mc->fidoaddr->point,
|
||||
generate_msgid());
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
jmh.MsgIdCRC = JAM_Crc32(buffer, strlen(buffer));
|
||||
} else if (ma->type == TYPE_NETMAIL_AREA) {
|
||||
JAM_DelSubPacket(jsp);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
return 0;
|
||||
}
|
||||
} else if (mc->nettype == NETWORK_MAGI) {
|
||||
uuid_generate(mnet_msgid);
|
||||
uuid_unparse_lower(mnet_msgid, buffer);
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
} else if (mc->nettype == NETWORK_QWK) {
|
||||
uuid_generate(qwk_msgid);
|
||||
uuid_unparse_lower(qwk_msgid, qwkuuid);
|
||||
snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address);
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
}
|
||||
jsf.LoID = JAMSFLD_OADDRESS;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
snprintf(buffer, sizeof buffer, "%d:%d/%d.%d %08lx",
|
||||
mc->fidoaddr->zone,
|
||||
mc->fidoaddr->net,
|
||||
mc->fidoaddr->node,
|
||||
mc->fidoaddr->point,
|
||||
generate_msgid());
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
jmh.MsgIdCRC = JAM_Crc32(buffer, strlen(buffer));
|
||||
} else if (ma->type == TYPE_NETMAIL_AREA) {
|
||||
JAM_DelSubPacket(jsp);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
z = JAM_LockMB(jb, 100);
|
||||
if (z == 0) {
|
||||
@ -521,7 +552,7 @@ int l_postMessage(lua_State *L) {
|
||||
|
||||
uname(&name);
|
||||
tagline = conf.default_tagline;
|
||||
if (mc != NULL) {
|
||||
if (mc->tagline != NULL) {
|
||||
tagline = mc->tagline;
|
||||
}
|
||||
|
||||
@ -535,9 +566,15 @@ int l_postMessage(lua_State *L) {
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline,
|
||||
mc->fidoaddr->zone, mc->fidoaddr->net, mc->fidoaddr->node, mc->fidoaddr->point);
|
||||
}
|
||||
} else if (mc->nettype == NETWORK_MAGI) {
|
||||
snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (@%d)\r",
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline,
|
||||
mc->maginode);
|
||||
} else if (mc->nettype == NETWORK_QWK) {
|
||||
snprintf(buffer, sizeof buffer, "\r---\r * MagickaBBS * %s\r",
|
||||
tagline);
|
||||
} else {
|
||||
snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s \r",
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline);
|
||||
snprintf(buffer, sizeof buffer, "\r");
|
||||
}
|
||||
|
||||
stralloc sa = EMPTY_STRALLOC;
|
||||
@ -614,6 +651,8 @@ void lua_push_cfunctions(lua_State *L) {
|
||||
lua_setglobal(L, "bbs_full_mail_scan");
|
||||
lua_pushcfunction(L, l_getUserHandle);
|
||||
lua_setglobal(L, "bbs_get_userhandle");
|
||||
lua_pushcfunction(L, l_getUserLocation);
|
||||
lua_setglobal(L, "bbs_get_userlocation");
|
||||
lua_pushcfunction(L, l_messageFound);
|
||||
lua_setglobal(L, "bbs_message_found");
|
||||
lua_pushcfunction(L, l_readMessageHdr);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/file.h>
|
||||
#include <fcntl.h>
|
||||
#include <libgen.h>
|
||||
|
||||
#include "jamlib/jam.h"
|
||||
#include "lua/lua.h"
|
||||
@ -469,9 +470,8 @@ char *external_editor(struct user_record *user, char *to, char *from, char *quot
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline,
|
||||
mc->maginode);
|
||||
} else if (mc->nettype == NETWORK_QWK && !email) {
|
||||
snprintf(buffer, sizeof buffer, "\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%s)\r",
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline,
|
||||
conf.bwave_name);
|
||||
snprintf(buffer, sizeof buffer, "\r---\r * MagickaBBS * %s\r",
|
||||
tagline);
|
||||
} else {
|
||||
snprintf(buffer, sizeof buffer, "\r");
|
||||
}
|
||||
@ -608,10 +608,8 @@ char *editor(struct user_record *user, char *quote, int quotelen, char *from, in
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline,
|
||||
mc->maginode);
|
||||
} else if (mc->nettype == NETWORK_QWK && !email) {
|
||||
snprintf(buffer, sizeof buffer,
|
||||
"\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (%s)\r",
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline,
|
||||
conf.bwave_name);
|
||||
snprintf(buffer, sizeof buffer, "\r---\r * MagickaBBS * %s\r",
|
||||
tagline);
|
||||
} else {
|
||||
strlcpy(buffer, "\r", sizeof buffer);
|
||||
}
|
||||
@ -1390,6 +1388,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
||||
s_JamLastRead jlr;
|
||||
|
||||
char buffer[256];
|
||||
char qwkuuid[38];
|
||||
int z, z2;
|
||||
struct tm msg_date;
|
||||
|
||||
@ -1413,6 +1412,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
||||
int position;
|
||||
int y;
|
||||
uuid_t magi_msgid;
|
||||
uuid_t qwk_msgid;
|
||||
struct ptr_vector msg_lines;
|
||||
|
||||
init_ptr_vector(&msg_lines);
|
||||
@ -1602,7 +1602,7 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
||||
free(from);
|
||||
ptr_vector_apply(&msg_lines, free);
|
||||
destroy_ptr_vector(&msg_lines);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
s_printf(get_string(115));
|
||||
s_readstring_inject(buffer, 64, subject);
|
||||
@ -1734,6 +1734,27 @@ int read_message(struct user_record *user, struct msg_headers *msghs, int mailno
|
||||
jsf.DatLen = strlen(conf.bwave_name);
|
||||
jsf.Buffer = (char *)conf.bwave_name;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
if (conf.external_address != NULL) {
|
||||
uuid_generate(qwk_msgid);
|
||||
uuid_unparse_lower(qwk_msgid, qwkuuid);
|
||||
snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address);
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
if (msghs->msgs[mailno]->msgid != NULL) {
|
||||
strlcpy(buffer, msghs->msgs[mailno]->msgid, sizeof buffer);
|
||||
jsf.LoID = JAMSFLD_REPLYID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
jmh.ReplyCRC = JAM_Crc32(buffer, strlen(buffer));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (ma->type == TYPE_NETMAIL_AREA) {
|
||||
jmh.Attribute |= JAM_MSG_TYPENET;
|
||||
@ -2010,11 +2031,12 @@ void post_message(struct user_record *user) {
|
||||
struct fido_addr *from_addr = NULL;
|
||||
char buffer[256];
|
||||
char buffer2[256];
|
||||
char qwkuuid[38];
|
||||
int z;
|
||||
int sem_fd;
|
||||
char *bbsname;
|
||||
uuid_t magi_msgid;
|
||||
|
||||
uuid_t qwk_msgid;
|
||||
s_JamBase *jb;
|
||||
s_JamMsgHeader jmh;
|
||||
s_JamSubPacket *jsp;
|
||||
@ -2184,6 +2206,18 @@ void post_message(struct user_record *user) {
|
||||
jsf.DatLen = strlen(conf.bwave_name);
|
||||
jsf.Buffer = (char *)conf.bwave_name;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
if (conf.external_address != NULL) {
|
||||
uuid_generate(qwk_msgid);
|
||||
uuid_unparse_lower(qwk_msgid, qwkuuid);
|
||||
snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address);
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
}
|
||||
}
|
||||
} else if (ma->type == TYPE_NETMAIL_AREA) {
|
||||
jmh.Attribute |= JAM_MSG_TYPENET;
|
||||
|
@ -308,6 +308,8 @@ static int handler(void *user, const char *section, const char *name,
|
||||
if (strcasecmp(section, "main") == 0) {
|
||||
if (strcasecmp(name, "bbs name") == 0) {
|
||||
conf->bbs_name = strdup(value);
|
||||
} else if (strcasecmp(name, "external address") == 0) {
|
||||
conf->external_address = strdup(value);
|
||||
} else if (strcasecmp(name, "telnet port") == 0) {
|
||||
conf->telnet_port = atoi(value);
|
||||
} else if (strcasecmp(name, "enable ssh") == 0) {
|
||||
@ -1178,7 +1180,8 @@ int main(int argc, char **argv) {
|
||||
conf.ipv6 = 0;
|
||||
conf.uid = getuid();
|
||||
conf.gid = getgid();
|
||||
|
||||
conf.external_address = NULL;
|
||||
|
||||
// Load BBS data
|
||||
if (ini_parse(argv[1], handler, &conf) < 0) {
|
||||
fprintf(stderr, "Unable to load configuration ini (%s)!\n", argv[1]);
|
||||
|
10
src/users.c
10
src/users.c
@ -542,21 +542,21 @@ void list_users(struct user_record *user) {
|
||||
|
||||
int check_fullname_j(char *firstandlastname) {
|
||||
char *firstname = strdup(firstandlastname);
|
||||
|
||||
|
||||
if (!firstname) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *lastname = strchr(firstname, ' ');
|
||||
int ret;
|
||||
|
||||
|
||||
if (lastname == NULL) {
|
||||
return 0;
|
||||
}
|
||||
*lastname = '\0';
|
||||
lastname++;
|
||||
ret = check_fullname(firstname, lastname);
|
||||
|
||||
|
||||
free(firstname);
|
||||
return ret;
|
||||
}
|
||||
@ -778,7 +778,7 @@ struct user_record *new_user() {
|
||||
user->sec_level = conf.newuserlvl;
|
||||
user->bwavepktno = 0;
|
||||
user->sec_info = (struct sec_level_t *)malloz(sizeof(struct sec_level_t));
|
||||
snprintf(buffer, PATH_MAX, "%s/config/s%d.ini", conf.bbs_path, user->sec_level);
|
||||
snprintf(buffer, PATH_MAX, "%s/s%d.ini", conf.config_path, user->sec_level);
|
||||
|
||||
if (ini_parse(buffer, secLevel, user->sec_info) < 0) {
|
||||
dolog("Unable to load sec Level ini (%s)!", buffer);
|
||||
|
@ -249,5 +249,5 @@ FILE *fopen_node_path(const char *filename, const char *mode) {
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/node%d/%s", conf.bbs_path, mynode, filename);
|
||||
|
||||
return fopen(buffer, mode);
|
||||
return fopen(buffer, mode);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ char *www_blog() {
|
||||
struct www_tag *child_tag;
|
||||
struct www_tag *child_child_tag;
|
||||
struct www_tag *child_child_child_tag;
|
||||
|
||||
|
||||
page = www_tag_new(NULL, "");
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
@ -28,8 +28,8 @@ char *www_blog() {
|
||||
cur_tag = www_tag_new("p", NULL);
|
||||
www_tag_add_child(cur_tag, www_tag_new(NULL, "No Entries"));
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
|
||||
|
||||
return www_tag_unwravel(page);
|
||||
}
|
||||
for (size_t i = 0; i < ptr_vector_len(&entries); i++) {
|
||||
@ -47,39 +47,39 @@ char *www_blog() {
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "blog-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "blog-title");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("h3", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, entry->subject);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "blog-date");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, timebuf);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new(NULL, hour >= 12 ? "pm" : "am");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new(NULL, datebuf);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "blog-author");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "by ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new(NULL, entry->author);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "blog-entry");
|
||||
@ -87,9 +87,9 @@ char *www_blog() {
|
||||
|
||||
child_tag = www_tag_new("p", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
stralloc blog_body = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
for (char *p = entry->body; *p != '\0'; ++p) {
|
||||
if (*p != '\r') {
|
||||
stralloc_append1(&blog_body, *p);
|
||||
@ -100,16 +100,16 @@ char *www_blog() {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, blog_body.s);
|
||||
|
||||
|
||||
free(blog_body.s);
|
||||
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
}
|
||||
ptr_vector_apply(&entries, free);
|
||||
destroy_ptr_vector(&entries);
|
||||
|
||||
|
||||
return www_tag_unwravel(page);
|
||||
}
|
||||
|
||||
|
136
src/www_email.c
136
src/www_email.c
@ -144,28 +144,28 @@ char *www_new_email() {
|
||||
struct www_tag *cur_tag;
|
||||
struct www_tag *child_tag;
|
||||
struct www_tag *child_child_tag;
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "New Email");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
cur_tag = www_tag_new("form", NULL);
|
||||
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "email/");
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(cur_tag, "action", url.s);
|
||||
free(url.s);
|
||||
|
||||
|
||||
www_tag_add_attrib(cur_tag, "method", "POST");
|
||||
www_tag_add_attrib(cur_tag, "onsubmit", "return validate()");
|
||||
www_tag_add_attrib(cur_tag, "enctype", "application/x-www-form-urlencoded");
|
||||
@ -173,26 +173,26 @@ char *www_new_email() {
|
||||
|
||||
child_tag = www_tag_new(NULL, "To : ");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_tag, "type", "text");
|
||||
www_tag_add_attrib(child_tag, "name", "recipient");
|
||||
www_tag_add_attrib(child_tag, "id", "recipient");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
|
||||
child_tag = www_tag_new(NULL, "Subject : ");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_tag, "type", "text");
|
||||
www_tag_add_attrib(child_tag, "name", "subject");
|
||||
www_tag_add_attrib(child_tag, "id", "subject");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
@ -203,13 +203,13 @@ char *www_new_email() {
|
||||
www_tag_add_attrib(child_tag, "cols", "79");
|
||||
www_tag_add_attrib(child_tag, "id", "body");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_tag, "type", "submit");
|
||||
www_tag_add_attrib(child_tag, "name", "submit");
|
||||
@ -218,7 +218,7 @@ char *www_new_email() {
|
||||
|
||||
child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
return www_tag_unwravel(page);
|
||||
}
|
||||
|
||||
@ -280,17 +280,17 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
|
||||
if (sqlite3_step(res) != SQLITE_ROW) {
|
||||
page = www_tag_new(NULL, "");
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "No such email!");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
return www_tag_unwravel(page);
|
||||
}
|
||||
id = sqlite3_column_int(res, 0);
|
||||
@ -301,14 +301,14 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
localtime_r(&date, &msg_date);
|
||||
|
||||
page = www_tag_new(NULL, "");
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Your Email");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -319,42 +319,42 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "email-view-subject");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, subject);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "email-view-from");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, from);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "email-view-date");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Date: ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
if (conf.date_style == 1)
|
||||
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
|
||||
else
|
||||
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, datebuf);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "id", "msgbody");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
aha(body, cur_tag);
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "email-reply-form");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h3", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
@ -362,20 +362,20 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_tag = www_tag_new("form", NULL);
|
||||
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "email/");
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "action", url.s);
|
||||
free(url.s);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "method", "POST");
|
||||
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "type", "hidden");
|
||||
www_tag_add_attrib(child_child_tag, "name", "recipient");
|
||||
@ -383,21 +383,21 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Subject : ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "type", "text");
|
||||
www_tag_add_attrib(child_child_tag, "name", "subject");
|
||||
|
||||
stralloc subj = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
if (strncasecmp(subject, "re:", 3) != 0)
|
||||
stralloc_cats(&subj, "RE: ");
|
||||
stralloc_cats(&subj, subject);
|
||||
stralloc_0(&subj);
|
||||
www_tag_add_attrib(child_child_tag, "value", subj.s);
|
||||
free(subj.s);
|
||||
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("br", NULL);
|
||||
@ -410,7 +410,7 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
www_tag_add_attrib(child_child_tag, "cols", "79");
|
||||
www_tag_add_attrib(child_child_tag, "id", "replybody");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
stralloc content = EMPTY_STRALLOC;
|
||||
|
||||
stralloc_cats(&content, from);
|
||||
@ -429,12 +429,12 @@ char *www_email_display(struct user_record *user, int email) {
|
||||
stralloc_append1(&content, *p);
|
||||
++column;
|
||||
}
|
||||
|
||||
|
||||
stralloc_0(&content);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, content.s);
|
||||
free(content.s);
|
||||
|
||||
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("br", NULL);
|
||||
@ -511,14 +511,14 @@ char *www_email_summary(struct user_record *user) {
|
||||
sqlite3_bind_text(res, 1, user->loginname, -1, 0);
|
||||
|
||||
page = www_tag_new(NULL, "");
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Your Email");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -528,7 +528,7 @@ char *www_email_summary(struct user_record *user) {
|
||||
|
||||
child_tag = www_tag_new("a", NULL);
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "email/new");
|
||||
stralloc_0(&url);
|
||||
@ -543,7 +543,7 @@ char *www_email_summary(struct user_record *user) {
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "div-table");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
|
||||
while (sqlite3_step(res) == SQLITE_ROW) {
|
||||
char datebuf[32];
|
||||
@ -556,7 +556,7 @@ char *www_email_summary(struct user_record *user) {
|
||||
|
||||
time_t date = (time_t)sqlite3_column_int(res, 4);
|
||||
localtime_r(&date, &msg_date);
|
||||
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
|
||||
if (seen != 0) {
|
||||
@ -566,7 +566,7 @@ char *www_email_summary(struct user_record *user) {
|
||||
}
|
||||
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "email-id");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
@ -574,30 +574,30 @@ char *www_email_summary(struct user_record *user) {
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cat_long(&url, msgid);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, url.s);
|
||||
free(url.s);
|
||||
|
||||
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "email-subject");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new("a", NULL);
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "email/");
|
||||
stralloc_cat_long(&url, msgid);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_child_child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_child_child_tag = www_tag_new(NULL, subject);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "email-from");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
@ -609,33 +609,33 @@ char *www_email_summary(struct user_record *user) {
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "email-date");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
if (conf.date_style == 1)
|
||||
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
|
||||
else
|
||||
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, datebuf);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("a", NULL);
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "email/delete/");
|
||||
stralloc_cat_long(&url, id);
|
||||
stralloc_0(&url);
|
||||
stralloc_0(&url);
|
||||
www_tag_add_attrib(child_child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_child_tag, "class", "email-delete");
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_child_child_tag = www_tag_new(NULL, "");
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ char *www_files_display_listing(int dir, int sub) {
|
||||
struct file_sub *fsub = ptr_vector_get(&fdir->file_subs, sub);
|
||||
assert(fsub != NULL);
|
||||
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
@ -351,53 +351,53 @@ char *www_files_display_listing(int dir, int sub) {
|
||||
www_tag_destroy(page);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
cur_tag = www_tag_new("table", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "fileentry");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("thead", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("tr", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new("td", NULL);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_child_child_tag = www_tag_new(NULL, "Filename");
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
child_child_child_tag = www_tag_new("td", NULL);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_child_child_tag = www_tag_new(NULL, "Size");
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
child_child_child_tag = www_tag_new("td", NULL);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_child_child_tag = www_tag_new(NULL, "Description");
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
child_tag = www_tag_new("tbody", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
while (sqlite3_step(res) == SQLITE_ROW) {
|
||||
char *filename = strdup((char *)sqlite3_column_text(res, 1));
|
||||
char *base_filename = basename(filename);
|
||||
child_child_tag = www_tag_new("tr", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new("td", NULL);
|
||||
www_tag_add_attrib(child_child_child_tag, "class", "filename");
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_child_child_tag = www_tag_new("a", NULL);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "files/areas/");
|
||||
stralloc_cat_long(&url, dir);
|
||||
@ -405,20 +405,20 @@ char *www_files_display_listing(int dir, int sub) {
|
||||
stralloc_cat_long(&url, sub);
|
||||
stralloc_append1(&url, '/');
|
||||
www_encode(&url, base_filename);
|
||||
|
||||
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_child_child_child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
|
||||
child_child_child_child_child_tag = www_tag_new(NULL, base_filename);
|
||||
www_tag_add_child(child_child_child_child_tag, child_child_child_child_child_tag);
|
||||
www_tag_add_child(child_child_child_child_tag, child_child_child_child_child_tag);
|
||||
|
||||
int size = sqlite3_column_int(res, 3);
|
||||
child_child_child_tag = www_tag_new("td", NULL);
|
||||
www_tag_add_attrib(child_child_child_tag, "class", "filesize");
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
int c = 'b';
|
||||
if (size > 1024) {
|
||||
size /= 1024;
|
||||
@ -432,9 +432,9 @@ char *www_files_display_listing(int dir, int sub) {
|
||||
size /= 1024;
|
||||
c = 'G';
|
||||
}
|
||||
|
||||
|
||||
stralloc size_str = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cat_long(&size_str, size);
|
||||
stralloc_append1(&size_str, c);
|
||||
|
||||
@ -445,7 +445,7 @@ char *www_files_display_listing(int dir, int sub) {
|
||||
child_child_child_tag = www_tag_new("td", NULL);
|
||||
www_tag_add_attrib(child_child_child_tag, "class", "filedesc");
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
char *description = strdup((char *)sqlite3_column_text(res, 2));
|
||||
for (char *p = description; *p != '\0'; ++p) {
|
||||
if (*p == '\n')
|
||||
@ -468,14 +468,14 @@ char *www_files_areas() {
|
||||
struct www_tag *cur_tag;
|
||||
struct www_tag *child_tag;
|
||||
struct www_tag *child_child_tag;
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "File Directories");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -483,11 +483,11 @@ char *www_files_areas() {
|
||||
struct file_directory *dir = ptr_vector_get(&conf.file_directories, i);
|
||||
if (!dir->display_on_web)
|
||||
continue;
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "conference-list-item");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new(NULL, dir->name);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
@ -496,22 +496,22 @@ char *www_files_areas() {
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "area-list-item");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("a", NULL);
|
||||
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "files/areas/");
|
||||
stralloc_cat_long(&url, i);
|
||||
stralloc_append1(&url, '/');
|
||||
stralloc_cat_long(&url, j);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, sub->name);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
}
|
||||
|
@ -35,10 +35,10 @@ char *www_last10() {
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Last 10 Callers");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -53,11 +53,11 @@ char *www_last10() {
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "last10-row");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "last10-name");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, callers[i].name);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
@ -65,10 +65,10 @@ char *www_last10() {
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "last10-location");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, callers[i].location);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "last10-date");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
@ -86,14 +86,14 @@ char *www_last10() {
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "last10-new");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_copys(&url, conf.www_url);
|
||||
stralloc_cats(&url, "static/newuser.png");
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new("img", NULL);
|
||||
www_tag_add_attrib(child_child_child_tag, "src", url.s);
|
||||
free(url.s);
|
||||
|
224
src/www_msgs.c
224
src/www_msgs.c
@ -6,6 +6,7 @@
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iconv.h>
|
||||
#include <libgen.h>
|
||||
#include "www_tree.h"
|
||||
#include "jamlib/jam.h"
|
||||
#include "libuuid/uuid.h"
|
||||
@ -109,7 +110,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
char *from;
|
||||
char *subject;
|
||||
char datebuf[32];
|
||||
|
||||
|
||||
stralloc url;
|
||||
|
||||
struct www_tag *page;
|
||||
@ -118,7 +119,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
struct www_tag *child_child_tag;
|
||||
struct www_tag *child_child_child_tag;
|
||||
struct www_tag *child_child_child_child_tag;
|
||||
|
||||
|
||||
if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences))
|
||||
return NULL;
|
||||
struct mail_conference *mc = get_conf(conference);
|
||||
@ -133,10 +134,10 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, mc->name);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, " - ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -147,9 +148,9 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "button");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("a", NULL);
|
||||
|
||||
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "msgs/new/");
|
||||
@ -157,12 +158,12 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
stralloc_append1(&url, '/');
|
||||
stralloc_cat_long(&url, area);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
|
||||
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "New Message");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
}
|
||||
@ -171,7 +172,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
if (mhrs == NULL) {
|
||||
cur_tag = www_tag_new("h3", NULL);
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new(NULL, "No Messages");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
} else {
|
||||
@ -205,7 +206,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
subject = strdup(mhrs->msgs[i]->subject);
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
|
||||
|
||||
if (msgbase_is_flagged(user, conference, area, mhrs->msgs[i]->msg_h->MsgNum)) {
|
||||
www_tag_add_attrib(child_tag, "class", "msg-summary-flag");
|
||||
} else if (mhrs->msgs[i]->msg_h->MsgNum > jlr.HighReadMsg) {
|
||||
@ -214,23 +215,23 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
www_tag_add_attrib(child_tag, "class", "msg-summary-seen");
|
||||
}
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "msg-summary-id");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cat_long(&url, mhrs->msgs[i]->msg_no + 1);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "msg-summary-subject");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
@ -241,41 +242,41 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
stralloc_append1(&url, '/');
|
||||
stralloc_cat_long(&url, mhrs->msgs[i]->msg_h->MsgNum);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new("a", NULL);
|
||||
www_tag_add_attrib(child_child_child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_child_child_tag = www_tag_new(NULL, subject);
|
||||
www_tag_add_child(child_child_child_tag, child_child_child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "msg-summary-from");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, from);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "msg-summary-to");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, to);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "msg-summary-date");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
if (conf.date_style == 1)
|
||||
strftime(datebuf, sizeof datebuf, "%H:%M %m-%d-%y", &msg_date);
|
||||
else
|
||||
strftime(datebuf, sizeof datebuf, "%H:%M %d-%m-%y", &msg_date);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, datebuf);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
free(to);
|
||||
free(from);
|
||||
free(subject);
|
||||
@ -285,11 +286,11 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "msg-summary-next");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("a", NULL);
|
||||
|
||||
|
||||
url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "msgs/");
|
||||
stralloc_cat_long(&url, conference);
|
||||
@ -298,7 +299,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
stralloc_cats(&url, "/?skip=");
|
||||
stralloc_cat_long(&url, skip + 50);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
@ -309,7 +310,7 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
if (skip > 0) {
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "msg-summary-prev");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
www_tag_add_child(page, cur_tag);
|
||||
child_tag = www_tag_new("a", NULL);
|
||||
url = EMPTY_STRALLOC;
|
||||
if (skip - 50 < 0) {
|
||||
@ -328,10 +329,10 @@ char *www_msgs_messagelist(struct user_record *user, int conference, int area, i
|
||||
stralloc_cats(&url, "/?skip=");
|
||||
stralloc_cat_long(&url, skip - 50);
|
||||
}
|
||||
stralloc_0(&url);
|
||||
stralloc_0(&url);
|
||||
www_tag_add_attrib(child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
|
||||
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
child_child_tag = www_tag_new(NULL, "Prev");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
@ -379,7 +380,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
struct www_tag *child_tag;
|
||||
struct www_tag *child_child_tag;
|
||||
struct www_tag *child_child_child_tag;
|
||||
|
||||
|
||||
if (conference < 0 || conference >= ptr_vector_len(&conf.mail_conferences))
|
||||
return NULL;
|
||||
struct mail_conference *mc = get_conf(conference);
|
||||
@ -474,24 +475,24 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
JAM_WriteLastRead(jb, user->id, &jlr);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
|
||||
|
||||
page = www_tag_new(NULL, "");
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("a", NULL);
|
||||
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "msgs/");
|
||||
stralloc_cat_long(&url, conference);
|
||||
stralloc_append1(&url, '/');
|
||||
stralloc_cat_long(&url, area);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
@ -507,17 +508,17 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, ma->name);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
|
||||
|
||||
if (msgbase_is_flagged(user, conference, area, msg)) {
|
||||
www_tag_add_attrib(cur_tag, "class", "msg-view-header-flagged");
|
||||
} else {
|
||||
www_tag_add_attrib(cur_tag, "class", "msg-view-header");
|
||||
}
|
||||
|
||||
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(child_tag, "class", "msg-view-subject");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
@ -550,7 +551,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
child_child_tag = www_tag_new("span", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "class", "bbsname");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, nodename);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
@ -573,7 +574,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
} else {
|
||||
snprintf(buffer, sizeof buffer, "From: %s", from);
|
||||
child_child_tag = www_tag_new(NULL, buffer);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
}
|
||||
|
||||
child_tag = www_tag_new("div", NULL);
|
||||
@ -582,7 +583,7 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "To : ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, to);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -608,9 +609,9 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("a", NULL);
|
||||
|
||||
|
||||
url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "msgs/flag/");
|
||||
stralloc_cat_long(&url, conference);
|
||||
@ -619,24 +620,24 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
stralloc_append1(&url, '/');
|
||||
stralloc_cat_long(&url, msg);
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_child_tag, "href", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_child_tag = www_tag_new("img", NULL);
|
||||
|
||||
|
||||
url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "static/flag.png");
|
||||
stralloc_0(&url);
|
||||
www_tag_add_attrib(child_child_child_tag, "src", url.s);
|
||||
free(url.s);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
|
||||
|
||||
www_tag_add_attrib(cur_tag, "id", "msgbody");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
@ -649,23 +650,23 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "msg-reply-form");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h3", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Reply");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
|
||||
child_tag = www_tag_new("form", NULL);
|
||||
url = EMPTY_STRALLOC;
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "msgs/");
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "action", url.s);
|
||||
free(url.s);
|
||||
|
||||
|
||||
www_tag_add_attrib(child_tag, "method", "POST");
|
||||
www_tag_add_attrib(child_tag, "enctype", "application/x-www-form-urlencoded;charset=UTF-8");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
@ -696,29 +697,32 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "To : ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "type", "text");
|
||||
www_tag_add_attrib(child_child_tag, "name", "recipient");
|
||||
www_tag_add_attrib(child_child_tag, "value", from);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "Subject : ");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
child_child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "type", "text");
|
||||
www_tag_add_attrib(child_child_tag, "name", "subject");
|
||||
|
||||
|
||||
if (strncasecmp(subject, "re:", 3) != 0) {
|
||||
snprintf(buffer, sizeof buffer, "RE: %s", subject);
|
||||
www_tag_add_attrib(child_child_tag, "value", buffer);
|
||||
} else {
|
||||
www_tag_add_attrib(child_child_tag, "value", subject);
|
||||
}
|
||||
|
||||
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
@ -729,9 +733,9 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
www_tag_add_attrib(child_child_tag, "wrap", "soft");
|
||||
www_tag_add_attrib(child_child_tag, "id", "replybody");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
stralloc text = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_append1(&text, ' ');
|
||||
stralloc_append1(&text, from[0]);
|
||||
stralloc_cats(&text, "> ");
|
||||
@ -777,20 +781,20 @@ char *www_msgs_messageview(struct user_record *user, int conference, int area, i
|
||||
stralloc_cats(&text, buffer);
|
||||
}
|
||||
free(body2);
|
||||
|
||||
|
||||
stralloc_0(&text);
|
||||
|
||||
|
||||
child_child_child_tag = www_tag_new(NULL, text.s);
|
||||
www_tag_add_child(child_child_tag, child_child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_child_tag, "type", "submit");
|
||||
www_tag_add_attrib(child_child_tag, "name", "submit");
|
||||
www_tag_add_attrib(child_child_tag, "value", "Reply");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
child_child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
}
|
||||
@ -854,7 +858,7 @@ static char *www_wordwrap(char *content, int cutoff) {
|
||||
line_count = 0;
|
||||
quote_line = 0;
|
||||
}
|
||||
} else if (content[i] == '\r' && content[i + 1] == '\r') {
|
||||
} else if (i < len - 2 && content[i] == '\r' && content[i + 1] == '\r') {
|
||||
content[at++] = '\r';
|
||||
content[at++] = '\r';
|
||||
line_count = 0;
|
||||
@ -941,6 +945,7 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
int max_len;
|
||||
int len;
|
||||
char buffer[256];
|
||||
char qwkuuid[38];
|
||||
char *body2;
|
||||
char *tagline;
|
||||
struct utsname name;
|
||||
@ -952,7 +957,7 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
size_t sz;
|
||||
char *inbuf, *oubuf;
|
||||
|
||||
uuid_t magi_msgid;
|
||||
uuid_t magi_msgid, qwk_msgid;
|
||||
|
||||
if (subj == NULL || to == NULL || body == NULL) {
|
||||
return 0;
|
||||
@ -1046,7 +1051,7 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
jsf.DatLen = strlen(replyid);
|
||||
jsf.Buffer = (char *)replyid;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
jmh.ReplyCRC = JAM_Crc32(buffer, strlen(replyid));
|
||||
jmh.ReplyCRC = JAM_Crc32(replyid, strlen(replyid));
|
||||
}
|
||||
} else if (mc->nettype == NETWORK_MAGI) {
|
||||
snprintf(buffer, sizeof buffer, "%d", mc->maginode);
|
||||
@ -1072,7 +1077,33 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
jsf.DatLen = strlen(replyid);
|
||||
jsf.Buffer = (char *)replyid;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
jmh.ReplyCRC = JAM_Crc32(buffer, strlen(replyid));
|
||||
jmh.ReplyCRC = JAM_Crc32(replyid, strlen(replyid));
|
||||
}
|
||||
} else if (mc->nettype == NETWORK_QWK) {
|
||||
jsf.LoID = JAMSFLD_OADDRESS;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(conf.bwave_name);
|
||||
jsf.Buffer = (char *)conf.bwave_name;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
if (conf.external_address != NULL) {
|
||||
uuid_generate(qwk_msgid);
|
||||
uuid_unparse_lower(qwk_msgid, qwkuuid);
|
||||
snprintf(buffer, sizeof buffer, "<%s@%s>", qwkuuid, conf.external_address);
|
||||
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(buffer);
|
||||
jsf.Buffer = (char *)buffer;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
if (strcasecmp(replyid, "NULL") != 0) {
|
||||
jsf.LoID = JAMSFLD_REPLYID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(replyid);
|
||||
jsf.Buffer = (char *)replyid;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
jmh.ReplyCRC = JAM_Crc32(replyid, strlen(replyid));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1114,14 +1145,17 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
} else if (mc->nettype == NETWORK_MAGI) {
|
||||
snprintf(buffer, sizeof buffer, "\r\r--- MagickaBBS v%d.%d%s (%s/%s)\r * Origin: %s (@%d)\r",
|
||||
VERSION_MAJOR, VERSION_MINOR, VERSION_STR, name.sysname, name.machine, tagline, mc->maginode);
|
||||
} else if (mc->nettype == NETWORK_QWK) {
|
||||
snprintf(buffer, sizeof buffer, "\r\r---\r * MagickaBBS * %s\r",
|
||||
tagline);
|
||||
} else {
|
||||
snprintf(buffer, sizeof buffer, "\r");
|
||||
}
|
||||
|
||||
|
||||
char *p = body;
|
||||
stralloc unhtmlized = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
|
||||
|
||||
// remove nbsp
|
||||
while (*p != '\0') {
|
||||
if ((*p & 0xff) == 0xc2 && (*(p + 1) & 0xff) == 0xa0) {
|
||||
@ -1130,12 +1164,12 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
} else {
|
||||
stralloc_append1(&unhtmlized, *p);
|
||||
}
|
||||
|
||||
|
||||
p++;
|
||||
}
|
||||
|
||||
|
||||
stralloc_0(&unhtmlized);
|
||||
|
||||
|
||||
body2 = www_wordwrap(unhtmlized.s, 73);
|
||||
free(unhtmlized.s);
|
||||
if (body2 == NULL) {
|
||||
@ -1145,9 +1179,9 @@ int www_send_msg(struct user_record *user, char *to, char *subj, int conference,
|
||||
free(jb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
body3 = str2dup(body2, buffer);
|
||||
if (body3 == NULL) {
|
||||
free(body2);
|
||||
@ -1206,28 +1240,28 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
|
||||
struct www_tag *cur_tag;
|
||||
struct www_tag *child_tag;
|
||||
struct www_tag *child_child_tag;
|
||||
|
||||
|
||||
char buffer[10];
|
||||
|
||||
|
||||
cur_tag = www_tag_new("div", NULL);
|
||||
www_tag_add_attrib(cur_tag, "class", "content-header");
|
||||
www_tag_add_child(page, cur_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("h2", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_child_tag = www_tag_new(NULL, "New Message");
|
||||
www_tag_add_child(child_tag, child_child_tag);
|
||||
|
||||
|
||||
|
||||
cur_tag = www_tag_new("form", NULL);
|
||||
|
||||
|
||||
stralloc url = EMPTY_STRALLOC;
|
||||
|
||||
|
||||
stralloc_cats(&url, conf.www_url);
|
||||
stralloc_cats(&url, "msgs/");
|
||||
stralloc_0(&url);
|
||||
|
||||
|
||||
www_tag_add_attrib(cur_tag, "action", url.s);
|
||||
free(url.s);
|
||||
|
||||
@ -1242,7 +1276,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
|
||||
snprintf(buffer, sizeof buffer, "%d", conference);
|
||||
www_tag_add_attrib(child_tag, "value", buffer);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("input", NULL);
|
||||
www_tag_add_attrib(child_tag, "type", "hidden");
|
||||
www_tag_add_attrib(child_tag, "name", "area");
|
||||
@ -1301,7 +1335,7 @@ char *www_new_msg(struct user_record *user, int conference, int area) {
|
||||
www_tag_add_attrib(child_tag, "name", "submit");
|
||||
www_tag_add_attrib(child_tag, "value", "Send");
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
||||
child_tag = www_tag_new("br", NULL);
|
||||
www_tag_add_child(cur_tag, child_tag);
|
||||
|
||||
|
332
src/www_tree.c
332
src/www_tree.c
@ -17,95 +17,95 @@ static char *www_tag_sanatize(char *data, int isdata) {
|
||||
case '>':
|
||||
stralloc_cats(&str, ">");
|
||||
break;
|
||||
case '\x01':
|
||||
case '\x01':
|
||||
stralloc_cats(&str, "☺");
|
||||
break;
|
||||
case '\x02':
|
||||
case '\x02':
|
||||
stralloc_cats(&str, "☻");
|
||||
break;
|
||||
case '\x03':
|
||||
case '\x03':
|
||||
stralloc_cats(&str, "♥");
|
||||
break;
|
||||
case '\x04':
|
||||
case '\x04':
|
||||
stralloc_cats(&str, "♦");
|
||||
break;
|
||||
case '\x05':
|
||||
case '\x05':
|
||||
stralloc_cats(&str, "♣");
|
||||
break;
|
||||
case '\x06':
|
||||
case '\x06':
|
||||
stralloc_cats(&str, "♠");
|
||||
break;
|
||||
case '\x07':
|
||||
case '\x07':
|
||||
stralloc_cats(&str, "•");
|
||||
break;
|
||||
case '\x08':
|
||||
case '\x08':
|
||||
stralloc_cats(&str, "◘");
|
||||
break;
|
||||
case '\x09':
|
||||
case '\x09':
|
||||
stralloc_cats(&str, "○");
|
||||
break;
|
||||
case '\x0b':
|
||||
case '\x0b':
|
||||
stralloc_cats(&str, "♂");
|
||||
break;
|
||||
case '\x0c':
|
||||
case '\x0c':
|
||||
stralloc_cats(&str, "♀");
|
||||
break;
|
||||
case '\x0e':
|
||||
case '\x0e':
|
||||
stralloc_cats(&str, "♫");
|
||||
break;
|
||||
case '\x0f':
|
||||
stralloc_cats(&str, "☼");
|
||||
break;
|
||||
case '\x10':
|
||||
case '\x10':
|
||||
stralloc_cats(&str, "▸");
|
||||
break;
|
||||
case '\x11':
|
||||
case '\x11':
|
||||
stralloc_cats(&str, "◂");
|
||||
break;
|
||||
case '\x12':
|
||||
case '\x12':
|
||||
stralloc_cats(&str, "↕");
|
||||
break;
|
||||
case '\x13':
|
||||
case '\x13':
|
||||
stralloc_cats(&str, "‼");
|
||||
break;
|
||||
case '\x14':
|
||||
case '\x14':
|
||||
stralloc_cats(&str, "¶");
|
||||
break;
|
||||
case '\x15':
|
||||
case '\x15':
|
||||
stralloc_cats(&str, "§");
|
||||
break;
|
||||
case '\x16':
|
||||
case '\x16':
|
||||
stralloc_cats(&str, "▬");
|
||||
break;
|
||||
case '\x17':
|
||||
case '\x17':
|
||||
stralloc_cats(&str, "↨");
|
||||
break;
|
||||
case '\x18':
|
||||
case '\x18':
|
||||
stralloc_cats(&str, "↑");
|
||||
break;
|
||||
case '\x19':
|
||||
case '\x19':
|
||||
stralloc_cats(&str, "↓");
|
||||
break;
|
||||
case '\x1a':
|
||||
case '\x1a':
|
||||
stralloc_cats(&str, "→");
|
||||
break;
|
||||
case '\x1b':
|
||||
case '\x1b':
|
||||
stralloc_cats(&str, "←");
|
||||
break;
|
||||
case '\x1c':
|
||||
case '\x1c':
|
||||
stralloc_cats(&str, "∟");
|
||||
break;
|
||||
case '\x1d':
|
||||
case '\x1d':
|
||||
stralloc_cats(&str, "↔");
|
||||
break;
|
||||
case '\x1e':
|
||||
case '\x1e':
|
||||
stralloc_cats(&str, "▴");
|
||||
break;
|
||||
case '\x1f':
|
||||
case '\x1f':
|
||||
stralloc_cats(&str, "▾");
|
||||
break;
|
||||
/*
|
||||
case '\x21':
|
||||
case '\x21':
|
||||
stralloc_cats(&str, "!");
|
||||
break;
|
||||
case '\x22':
|
||||
@ -166,364 +166,364 @@ static char *www_tag_sanatize(char *data, int isdata) {
|
||||
case '\x88':
|
||||
stralloc_cats(&str, "ê");
|
||||
break;
|
||||
case '\x89':
|
||||
case '\x89':
|
||||
stralloc_cats(&str, "ë");
|
||||
break;
|
||||
case '\x8a':
|
||||
case '\x8a':
|
||||
stralloc_cats(&str, "è");
|
||||
break;
|
||||
case '\x8b':
|
||||
case '\x8b':
|
||||
stralloc_cats(&str, "ï");
|
||||
break;
|
||||
case '\x8c':
|
||||
case '\x8c':
|
||||
stralloc_cats(&str, "î");
|
||||
break;
|
||||
case '\x8d':
|
||||
case '\x8d':
|
||||
stralloc_cats(&str, "ì");
|
||||
break;
|
||||
case '\x8e':
|
||||
case '\x8e':
|
||||
stralloc_cats(&str, "Ä");
|
||||
break;
|
||||
case '\x8f':
|
||||
case '\x8f':
|
||||
stralloc_cats(&str, "Å");
|
||||
break;
|
||||
case '\x90':
|
||||
case '\x90':
|
||||
stralloc_cats(&str, "É");
|
||||
break;
|
||||
case '\x91':
|
||||
case '\x91':
|
||||
stralloc_cats(&str, "æ");
|
||||
break;
|
||||
case '\x92':
|
||||
case '\x92':
|
||||
stralloc_cats(&str, "Æ");
|
||||
break;
|
||||
case '\x93':
|
||||
case '\x93':
|
||||
stralloc_cats(&str, "ô");
|
||||
break;
|
||||
case '\x94':
|
||||
case '\x94':
|
||||
stralloc_cats(&str, "ö");
|
||||
break;
|
||||
case '\x95':
|
||||
case '\x95':
|
||||
stralloc_cats(&str, "ò");
|
||||
break;
|
||||
case '\x96':
|
||||
case '\x96':
|
||||
stralloc_cats(&str, "û");
|
||||
break;
|
||||
case '\x97':
|
||||
case '\x97':
|
||||
stralloc_cats(&str, "ù");
|
||||
break;
|
||||
case '\x98':
|
||||
case '\x98':
|
||||
stralloc_cats(&str, "ÿ");
|
||||
break;
|
||||
case '\x99':
|
||||
case '\x99':
|
||||
stralloc_cats(&str, "Ö");
|
||||
break;
|
||||
case '\x9a':
|
||||
case '\x9a':
|
||||
stralloc_cats(&str, "Ü");
|
||||
break;
|
||||
case '\x9b':
|
||||
case '\x9b':
|
||||
stralloc_cats(&str, "¢");
|
||||
break;
|
||||
case '\x9c':
|
||||
case '\x9c':
|
||||
stralloc_cats(&str, "£");
|
||||
break;
|
||||
case '\x9d':
|
||||
case '\x9d':
|
||||
stralloc_cats(&str, "¥");
|
||||
break;
|
||||
case '\x9e':
|
||||
case '\x9e':
|
||||
stralloc_cats(&str, "₧");
|
||||
break;
|
||||
case '\x9f':
|
||||
case '\x9f':
|
||||
stralloc_cats(&str, "ƒ");
|
||||
break;
|
||||
case '\xa0':
|
||||
case '\xa0':
|
||||
stralloc_cats(&str, "á");
|
||||
break;
|
||||
case '\xa1':
|
||||
case '\xa1':
|
||||
stralloc_cats(&str, "í");
|
||||
break;
|
||||
case '\xa2':
|
||||
case '\xa2':
|
||||
stralloc_cats(&str, "ó");
|
||||
break;
|
||||
case '\xa3':
|
||||
case '\xa3':
|
||||
stralloc_cats(&str, "ú");
|
||||
break;
|
||||
case '\xa4':
|
||||
case '\xa4':
|
||||
stralloc_cats(&str, "ñ");
|
||||
break;
|
||||
case '\xa5':
|
||||
case '\xa5':
|
||||
stralloc_cats(&str, "Ñ");
|
||||
break;
|
||||
case '\xa6':
|
||||
case '\xa6':
|
||||
stralloc_cats(&str, "ª");
|
||||
break;
|
||||
case '\xa7':
|
||||
case '\xa7':
|
||||
stralloc_cats(&str, "º");
|
||||
break;
|
||||
case '\xa8':
|
||||
case '\xa8':
|
||||
stralloc_cats(&str, "¿");
|
||||
break;
|
||||
case '\xa9':
|
||||
case '\xa9':
|
||||
stralloc_cats(&str, "⌐");
|
||||
break;
|
||||
case '\xaa':
|
||||
case '\xaa':
|
||||
stralloc_cats(&str, "¬");
|
||||
break;
|
||||
case '\xab':
|
||||
case '\xab':
|
||||
stralloc_cats(&str, "½");
|
||||
break;
|
||||
case '\xac':
|
||||
case '\xac':
|
||||
stralloc_cats(&str, "¼");
|
||||
break;
|
||||
case '\xad':
|
||||
case '\xad':
|
||||
stralloc_cats(&str, "¡");
|
||||
break;
|
||||
case '\xae':
|
||||
case '\xae':
|
||||
stralloc_cats(&str, "«");
|
||||
break;
|
||||
case '\xaf':
|
||||
case '\xaf':
|
||||
stralloc_cats(&str, "»");
|
||||
break;
|
||||
case '\xb0':
|
||||
case '\xb0':
|
||||
stralloc_cats(&str, "░");
|
||||
break;
|
||||
case '\xb1':
|
||||
case '\xb1':
|
||||
stralloc_cats(&str, "▒");
|
||||
break;
|
||||
case '\xb2':
|
||||
case '\xb2':
|
||||
stralloc_cats(&str, "▓");
|
||||
break;
|
||||
case '\xb3':
|
||||
case '\xb3':
|
||||
stralloc_cats(&str, "│");
|
||||
break;
|
||||
case '\xb4':
|
||||
case '\xb4':
|
||||
stralloc_cats(&str, "┤");
|
||||
break;
|
||||
case '\xb5':
|
||||
case '\xb5':
|
||||
stralloc_cats(&str, "╡");
|
||||
break;
|
||||
case '\xb6':
|
||||
case '\xb6':
|
||||
stralloc_cats(&str, "╢");
|
||||
break;
|
||||
case '\xb7':
|
||||
case '\xb7':
|
||||
stralloc_cats(&str, "╖");
|
||||
break;
|
||||
case '\xb8':
|
||||
case '\xb8':
|
||||
stralloc_cats(&str, "╕");
|
||||
break;
|
||||
case '\xb9':
|
||||
case '\xb9':
|
||||
stralloc_cats(&str, "╣");
|
||||
break;
|
||||
case '\xba':
|
||||
case '\xba':
|
||||
stralloc_cats(&str, "║");
|
||||
break;
|
||||
case '\xbb':
|
||||
case '\xbb':
|
||||
stralloc_cats(&str, "╗");
|
||||
break;
|
||||
case '\xbc':
|
||||
case '\xbc':
|
||||
stralloc_cats(&str, "╝");
|
||||
break;
|
||||
case '\xbd':
|
||||
case '\xbd':
|
||||
stralloc_cats(&str, "╜");
|
||||
break;
|
||||
case '\xbe':
|
||||
case '\xbe':
|
||||
stralloc_cats(&str, "╛");
|
||||
break;
|
||||
case '\xbf':
|
||||
case '\xbf':
|
||||
stralloc_cats(&str, "┐");
|
||||
break;
|
||||
case '\xc0':
|
||||
case '\xc0':
|
||||
stralloc_cats(&str, "└");
|
||||
break;
|
||||
case '\xc1':
|
||||
case '\xc1':
|
||||
stralloc_cats(&str, "┴");
|
||||
break;
|
||||
case '\xc2':
|
||||
case '\xc2':
|
||||
stralloc_cats(&str, "┬");
|
||||
break;
|
||||
case '\xc3':
|
||||
case '\xc3':
|
||||
stralloc_cats(&str, "├");
|
||||
break;
|
||||
case '\xc4':
|
||||
case '\xc4':
|
||||
stralloc_cats(&str, "─");
|
||||
break;
|
||||
case '\xc5':
|
||||
case '\xc5':
|
||||
stralloc_cats(&str, "┼");
|
||||
break;
|
||||
case '\xc6':
|
||||
case '\xc6':
|
||||
stralloc_cats(&str, "╞");
|
||||
break;
|
||||
case '\xc7':
|
||||
case '\xc7':
|
||||
stralloc_cats(&str, "╟");
|
||||
break;
|
||||
case '\xc8':
|
||||
case '\xc8':
|
||||
stralloc_cats(&str, "╚");
|
||||
break;
|
||||
case '\xc9':
|
||||
case '\xc9':
|
||||
stralloc_cats(&str, "╔");
|
||||
break;
|
||||
case '\xca':
|
||||
case '\xca':
|
||||
stralloc_cats(&str, "╩");
|
||||
break;
|
||||
case '\xcb':
|
||||
case '\xcb':
|
||||
stralloc_cats(&str, "╦");
|
||||
break;
|
||||
case '\xcc':
|
||||
case '\xcc':
|
||||
stralloc_cats(&str, "╠");
|
||||
break;
|
||||
case '\xcd':
|
||||
case '\xcd':
|
||||
stralloc_cats(&str, "═");
|
||||
break;
|
||||
case '\xce':
|
||||
case '\xce':
|
||||
stralloc_cats(&str, "╬");
|
||||
break;
|
||||
case '\xcf':
|
||||
case '\xcf':
|
||||
stralloc_cats(&str, "╧");
|
||||
break;
|
||||
case '\xd0':
|
||||
case '\xd0':
|
||||
stralloc_cats(&str, "╨");
|
||||
break;
|
||||
case '\xd1':
|
||||
case '\xd1':
|
||||
stralloc_cats(&str, "╤");
|
||||
break;
|
||||
case '\xd2':
|
||||
case '\xd2':
|
||||
stralloc_cats(&str, "╥");
|
||||
break;
|
||||
case '\xd3':
|
||||
case '\xd3':
|
||||
stralloc_cats(&str, "╙");
|
||||
break;
|
||||
case '\xd4':
|
||||
case '\xd4':
|
||||
stralloc_cats(&str, "╛");
|
||||
break;
|
||||
case '\xd5':
|
||||
case '\xd5':
|
||||
stralloc_cats(&str, "╒");
|
||||
break;
|
||||
case '\xd6':
|
||||
case '\xd6':
|
||||
stralloc_cats(&str, "╓");
|
||||
break;
|
||||
case '\xd7':
|
||||
case '\xd7':
|
||||
stralloc_cats(&str, "╫");
|
||||
break;
|
||||
case '\xd8':
|
||||
case '\xd8':
|
||||
stralloc_cats(&str, "╪");
|
||||
break;
|
||||
case '\xd9':
|
||||
case '\xd9':
|
||||
stralloc_cats(&str, "┘");
|
||||
break;
|
||||
case '\xda':
|
||||
case '\xda':
|
||||
stralloc_cats(&str, "┌");
|
||||
break;
|
||||
case '\xdb':
|
||||
case '\xdb':
|
||||
stralloc_cats(&str, "█");
|
||||
break;
|
||||
case '\xdc':
|
||||
case '\xdc':
|
||||
stralloc_cats(&str, "▄");
|
||||
break;
|
||||
case '\xdd':
|
||||
case '\xdd':
|
||||
stralloc_cats(&str, "▌");
|
||||
break;
|
||||
case '\xde':
|
||||
case '\xde':
|
||||
stralloc_cats(&str, "▐");
|
||||
break;
|
||||
case '\xdf':
|
||||
case '\xdf':
|
||||
stralloc_cats(&str, "▀");
|
||||
break;
|
||||
case '\xe0':
|
||||
case '\xe0':
|
||||
stralloc_cats(&str, "α");
|
||||
break;
|
||||
case '\xe1':
|
||||
case '\xe1':
|
||||
stralloc_cats(&str, "β");
|
||||
break;
|
||||
case '\xe2':
|
||||
case '\xe2':
|
||||
stralloc_cats(&str, "Γ");
|
||||
break;
|
||||
case '\xe3':
|
||||
case '\xe3':
|
||||
stralloc_cats(&str, "π");
|
||||
break;
|
||||
case '\xe4':
|
||||
case '\xe4':
|
||||
stralloc_cats(&str, "Σ");
|
||||
break;
|
||||
case '\xe5':
|
||||
case '\xe5':
|
||||
stralloc_cats(&str, "σ");
|
||||
break;
|
||||
case '\xe6':
|
||||
case '\xe6':
|
||||
stralloc_cats(&str, "µ");
|
||||
break;
|
||||
case '\xe7':
|
||||
case '\xe7':
|
||||
stralloc_cats(&str, "τ");
|
||||
break;
|
||||
case '\xe8':
|
||||
case '\xe8':
|
||||
stralloc_cats(&str, "Φ");
|
||||
break;
|
||||
case '\xe9':
|
||||
case '\xe9':
|
||||
stralloc_cats(&str, "Θ");
|
||||
break;
|
||||
case '\xea':
|
||||
case '\xea':
|
||||
stralloc_cats(&str, "Ω");
|
||||
break;
|
||||
case '\xeb':
|
||||
case '\xeb':
|
||||
stralloc_cats(&str, "δ");
|
||||
break;
|
||||
case '\xec':
|
||||
case '\xec':
|
||||
stralloc_cats(&str, "∞");
|
||||
break;
|
||||
case '\xed':
|
||||
case '\xed':
|
||||
stralloc_cats(&str, "∅");
|
||||
break;
|
||||
case '\xee':
|
||||
case '\xee':
|
||||
stralloc_cats(&str, "∈");
|
||||
break;
|
||||
case '\xef':
|
||||
case '\xef':
|
||||
stralloc_cats(&str, "∩");
|
||||
break;
|
||||
case '\xf0':
|
||||
case '\xf0':
|
||||
stralloc_cats(&str, "≡");
|
||||
break;
|
||||
case '\xf1':
|
||||
case '\xf1':
|
||||
stralloc_cats(&str, "±");
|
||||
break;
|
||||
case '\xf2':
|
||||
case '\xf2':
|
||||
stralloc_cats(&str, "≥");
|
||||
break;
|
||||
case '\xf3':
|
||||
case '\xf3':
|
||||
stralloc_cats(&str, "≤");
|
||||
break;
|
||||
case '\xf4':
|
||||
case '\xf4':
|
||||
stralloc_cats(&str, "⌠");
|
||||
break;
|
||||
case '\xf5':
|
||||
case '\xf5':
|
||||
stralloc_cats(&str, "⌡");
|
||||
break;
|
||||
case '\xf6':
|
||||
case '\xf6':
|
||||
stralloc_cats(&str, "÷");
|
||||
break;
|
||||
case '\xf7':
|
||||
case '\xf7':
|
||||
stralloc_cats(&str, "≈");
|
||||
break;
|
||||
case '\xf8':
|
||||
case '\xf8':
|
||||
stralloc_cats(&str, "°");
|
||||
break;
|
||||
case '\xf9':
|
||||
case '\xf9':
|
||||
stralloc_cats(&str, "∙");
|
||||
break;
|
||||
case '\xfa':
|
||||
case '\xfa':
|
||||
stralloc_cats(&str, "·");
|
||||
break;
|
||||
case '\xfb':
|
||||
case '\xfb':
|
||||
stralloc_cats(&str, "√");
|
||||
break;
|
||||
case '\xfc':
|
||||
case '\xfc':
|
||||
stralloc_cats(&str, "ⁿ");
|
||||
break;
|
||||
case '\xfd':
|
||||
case '\xfd':
|
||||
stralloc_cats(&str, "²");
|
||||
break;
|
||||
case '\xfe':
|
||||
stralloc_cats(&str, "▪");
|
||||
case '\xfe':
|
||||
stralloc_cats(&str, "▪");
|
||||
break;
|
||||
case ' ':
|
||||
if (isdata) {
|
||||
if (*(p+1) == ' ') {
|
||||
stralloc_cats(&str, " ");
|
||||
stralloc_cats(&str, " ");
|
||||
} else {
|
||||
if (p > data && (*(p-1) == ' ' || *(p-1) == '\n')) {
|
||||
stralloc_cats(&str, " ");
|
||||
@ -541,7 +541,7 @@ static char *www_tag_sanatize(char *data, int isdata) {
|
||||
default:
|
||||
stralloc_append1(&str, *p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
stralloc_0(&str);
|
||||
return str.s;
|
||||
@ -549,27 +549,27 @@ static char *www_tag_sanatize(char *data, int isdata) {
|
||||
|
||||
struct www_tag *www_tag_new(char *tag, char *data) {
|
||||
struct www_tag *new_tag = malloz(sizeof(struct www_tag));
|
||||
|
||||
|
||||
|
||||
|
||||
new_tag->attribs = EMPTY_PTR_VECTOR;
|
||||
new_tag->values = EMPTY_PTR_VECTOR;
|
||||
new_tag->children = EMPTY_PTR_VECTOR;
|
||||
|
||||
|
||||
if (tag == NULL) {
|
||||
new_tag->tag = NULL;
|
||||
|
||||
|
||||
/* SANATIZE DATA HERE */
|
||||
new_tag->data = www_tag_sanatize(data, 1);
|
||||
} else {
|
||||
new_tag->tag = strdup(tag);
|
||||
new_tag->data = NULL;
|
||||
|
||||
|
||||
init_ptr_vector(&new_tag->attribs);
|
||||
init_ptr_vector(&new_tag->values);
|
||||
}
|
||||
|
||||
|
||||
init_ptr_vector(&new_tag->children);
|
||||
|
||||
|
||||
return new_tag;
|
||||
}
|
||||
|
||||
@ -595,14 +595,14 @@ char *www_tag_destroy(struct www_tag *tag) {
|
||||
struct www_tag *child = ptr_vector_del(&tag->children, 0);
|
||||
www_tag_destroy(child);
|
||||
}
|
||||
|
||||
|
||||
if (tag->tag != NULL) {
|
||||
ptr_vector_apply(&tag->attribs, free);
|
||||
destroy_ptr_vector(&tag->attribs);
|
||||
ptr_vector_apply(&tag->values, free);
|
||||
destroy_ptr_vector(&tag->values);
|
||||
}
|
||||
destroy_ptr_vector(&tag->children);
|
||||
destroy_ptr_vector(&tag->children);
|
||||
}
|
||||
|
||||
char *www_tag_unwravel(struct www_tag *tag) {
|
||||
@ -621,14 +621,14 @@ char *www_tag_unwravel(struct www_tag *tag) {
|
||||
stralloc_cats(&thedata, (char *)ptr_vector_get(&child->values, i));
|
||||
stralloc_append1(&thedata, '\"');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
stralloc_append1(&thedata, '>');
|
||||
}
|
||||
char *data = www_tag_unwravel(child);
|
||||
stralloc_cats(&thedata, data);
|
||||
free(data);
|
||||
|
||||
|
||||
if (child->tag != NULL) {
|
||||
stralloc_cats(&thedata, "</");
|
||||
stralloc_cats(&thedata, child->tag);
|
||||
@ -654,17 +654,17 @@ char *www_tag_unwravel(struct www_tag *tag) {
|
||||
ptr_vector_apply(&child->attribs, free);
|
||||
destroy_ptr_vector(&child->attribs);
|
||||
ptr_vector_apply(&child->values, free);
|
||||
destroy_ptr_vector(&child->values);
|
||||
destroy_ptr_vector(&child->values);
|
||||
} else {
|
||||
stralloc_cats(&thedata, child->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
destroy_ptr_vector(&child->children);
|
||||
|
||||
|
||||
}
|
||||
|
||||
stralloc_0(&thedata);
|
||||
|
||||
|
||||
return thedata.s;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ struct www_tag {
|
||||
char *data;
|
||||
struct ptr_vector attribs;
|
||||
struct ptr_vector values;
|
||||
|
||||
|
||||
struct ptr_vector children;
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,10 @@
|
||||
CC=cc
|
||||
CFLAGS=-I../../deps/odoors/
|
||||
CFLAGS=-I../../deps/odoors/ -DANSI_PATH="\"$(ANSI_PATH)\"" -DDRAFT_PATH="\"$(DRAFT_PATH)\""
|
||||
DEPS = main.c
|
||||
OS = $(shell uname -s)
|
||||
ODOORS = ../../deps/odoors/libs-${OS}/libODoors.a
|
||||
|
||||
|
||||
ifeq ($(OS), SunOS)
|
||||
EXTRA_LIBS = -lsocket
|
||||
endif
|
||||
|
@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd /home/andrew/MagickaBBS/utils/magiedit
|
||||
./magiedit -D /home/andrew/MagickaBBS/node$1/dorinfo1.def -MSGTMP /home/andrew/MagickaBBS/node$1
|
||||
cd __LOCALSTATEPREFIX__
|
||||
__EXECPREFIX__/magiedit -D __LOCALSTATEPREFIX__/node$1/dorinfo1.def -MSGTMP __LOCALSTATEPREFIX__/node$1
|
||||
|
@ -16,6 +16,14 @@
|
||||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#ifndef DRAFT_PATH
|
||||
#define DRAFT_PATH ""
|
||||
#endif
|
||||
|
||||
#ifndef ANSI_PATH
|
||||
#define ANSI_PATH ""
|
||||
#endif
|
||||
|
||||
char **quote_lines;
|
||||
int quote_line_count;
|
||||
|
||||
@ -27,7 +35,6 @@ int msgpriv;
|
||||
|
||||
char *draft_filename = NULL;
|
||||
|
||||
|
||||
char *load_draft() {
|
||||
DIR *dirp;
|
||||
struct dirent *dent;
|
||||
@ -40,7 +47,7 @@ char *load_draft() {
|
||||
int i;
|
||||
tODInputEvent ch;
|
||||
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s", od_control_get()->user_name);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s", od_control_get()->user_name);
|
||||
|
||||
dirp = opendir(draft_path);
|
||||
|
||||
@ -183,7 +190,7 @@ char *load_draft() {
|
||||
|
||||
return draft_filename;
|
||||
} else if (ch.chKeyPress == 'd') {
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, filenames[selected]);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, filenames[selected]);
|
||||
unlink(draft_path);
|
||||
|
||||
free(filenames[selected]);
|
||||
@ -213,7 +220,7 @@ char *load_draft() {
|
||||
void delete_draft(char *filename) {
|
||||
char draft_path[PATH_MAX];
|
||||
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, filename);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, filename);
|
||||
|
||||
unlink(draft_path);
|
||||
}
|
||||
@ -233,13 +240,13 @@ int check_draft_filename(char *filename) {
|
||||
mkdir("drafts", 0700);
|
||||
}
|
||||
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s", od_control_get()->user_name);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s", od_control_get()->user_name);
|
||||
|
||||
if (stat(draft_path, &s) != 0) {
|
||||
mkdir(draft_path, 0700);
|
||||
}
|
||||
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, filename);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, filename);
|
||||
|
||||
if (stat(draft_path, &s) != 0) {
|
||||
return 1;
|
||||
@ -290,7 +297,7 @@ char *message_editor() {
|
||||
while (!done) {
|
||||
od_clr_scr();
|
||||
od_set_cursor(1, 1);
|
||||
od_send_file("magiedit.ans");
|
||||
od_send_file(ANSI_PATH "magiedit.ans");
|
||||
od_set_color(D_GREY, D_BLACK);
|
||||
od_set_cursor(2, 13);
|
||||
od_printf("%-26.26s", msgto);
|
||||
@ -444,7 +451,7 @@ char *message_editor() {
|
||||
}
|
||||
|
||||
// write
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, draft_filename);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, draft_filename);
|
||||
fptr = fopen(draft_path, "w");
|
||||
|
||||
if (!fptr) {
|
||||
@ -467,7 +474,7 @@ char *message_editor() {
|
||||
// restore screen
|
||||
od_clr_scr();
|
||||
od_set_cursor(1, 1);
|
||||
od_send_file("magiedit.ans");
|
||||
od_send_file(ANSI_PATH "magiedit.ans");
|
||||
od_set_color(D_GREY, D_BLACK);
|
||||
od_set_cursor(2, 13);
|
||||
od_printf("%-26.26s", msgto);
|
||||
@ -494,7 +501,7 @@ char *message_editor() {
|
||||
} else if (ch.chKeyPress == OD_KEY_F10) {
|
||||
// load draft
|
||||
if (load_draft() != NULL) {
|
||||
snprintf(draft_path, PATH_MAX, "drafts/%s/%s.draft", od_control_get()->user_name, draft_filename);
|
||||
snprintf(draft_path, PATH_MAX, DRAFT_PATH "drafts/%s/%s.draft", od_control_get()->user_name, draft_filename);
|
||||
fptr = fopen(draft_path, "r");
|
||||
if (!fptr) {
|
||||
// error loading draft
|
||||
@ -535,7 +542,7 @@ char *message_editor() {
|
||||
// restore screen
|
||||
od_clr_scr();
|
||||
od_set_cursor(1, 1);
|
||||
od_send_file("magiedit.ans");
|
||||
od_send_file(ANSI_PATH "magiedit.ans");
|
||||
od_set_color(D_GREY, D_BLACK);
|
||||
od_set_cursor(2, 13);
|
||||
od_printf("%-26.26s", msgto);
|
||||
@ -846,7 +853,7 @@ char *message_editor() {
|
||||
// Quote
|
||||
od_clr_scr();
|
||||
od_set_cursor(1, 1);
|
||||
od_send_file("magiquote.ans");
|
||||
od_send_file(ANSI_PATH "magiquote.ans");
|
||||
od_set_color(D_GREY, D_BLACK);
|
||||
od_set_cursor(2, 13);
|
||||
od_printf("%-26.26s", msgto);
|
||||
@ -1015,7 +1022,7 @@ char *message_editor() {
|
||||
// restore screen
|
||||
od_clr_scr();
|
||||
od_set_cursor(1, 1);
|
||||
od_send_file("magiedit.ans");
|
||||
od_send_file(ANSI_PATH "magiedit.ans");
|
||||
od_set_color(D_GREY, D_BLACK);
|
||||
od_set_cursor(2, 13);
|
||||
od_printf("%-26.26s", msgto);
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 31cd8fcb781c73c97ac7cc963eed0f8caefbf86b
|
||||
Subproject commit 6dc6b7559cd0730e44b61447df18761a0fc497f9
|
@ -1,21 +1,25 @@
|
||||
CC=cc
|
||||
CFLAGS=-I/usr/local/include -ggdb
|
||||
DEPS = qwktoss.c
|
||||
CFLAGS=-I/usr/local/include
|
||||
DEPS = qwktoss.c qwkscan.c
|
||||
JAMLIB = ../../deps/jamlib/jamlib.a
|
||||
OBJ = qwktoss.o ../../src/inih/ini.o
|
||||
SOBJ = qwkscan.o ../../src/inih/ini.o
|
||||
|
||||
all: qwktoss
|
||||
all: qwktoss qwkscan
|
||||
|
||||
%.o: %.c $(DEPS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
$(JAMLIB):
|
||||
cd ../../deps/jamlib && make -f Makefile.linux
|
||||
cd ../../deps/jamlib && make -f $(JAMMAKE)
|
||||
|
||||
qwktoss: $(OBJ) $(JAMLIB)
|
||||
$(CC) -o qwktoss $^ $(CFLAGS) -L/usr/local/lib
|
||||
|
||||
|
||||
qwkscan: $(SOBJ) $(JAMLIB)
|
||||
$(CC) -o qwkscan $^ $(CFLAGS) -L/usr/local/lib
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f $(OBJ) qwktoss
|
||||
rm -f $(OBJ) $(SOBJ) qwktoss qwkscan
|
||||
|
@ -12,5 +12,7 @@ struct QwkHeader {
|
||||
unsigned char Msglive; /* Message active status*/
|
||||
unsigned char Msgarealo; /* Lo-byte message area */
|
||||
unsigned char Msgareahi; /* Hi-byte message area */
|
||||
unsigned char Msgfiller[3]; /* Filler bytes */
|
||||
unsigned char Msgofflo;
|
||||
unsigned char Msgoffhi;
|
||||
unsigned char Msgtagp;
|
||||
} __attribute__((packed));
|
@ -1,6 +1,11 @@
|
||||
[Main]
|
||||
Host = VERT
|
||||
Ftp server = vert.synchro.net
|
||||
Ftp user = username
|
||||
Ftp Password = password
|
||||
Message Path = /home/andrew/MagickaBBS/msgs/dovenet
|
||||
Inbound = /home/andrew/MagickaBBS/qwk/in
|
||||
Outbound = /home/andrew/MagickaBBS/qwk/out
|
||||
Temp Dir = /home/andrew/MagickaBBS/qwm/Temp
|
||||
Unpack Command = unzip -j -o *a -d *d
|
||||
Unpack Command = unzip -j -o *a -d *d
|
||||
Pack Command = zip -j *a *f
|
||||
|
55
utils/qwknet/qwknetftpc.py
Normal file
55
utils/qwknet/qwknetftpc.py
Normal file
@ -0,0 +1,55 @@
|
||||
from ftplib import FTP
|
||||
from ftplib import all_errors
|
||||
import configparser
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def dostuff(config_file):
|
||||
config = configparser.ConfigParser()
|
||||
config.read(config_file)
|
||||
host = config.get("Main", "Ftp Server")
|
||||
username = config.get("Main", "Ftp User")
|
||||
password = config.get("Main", "Ftp Password")
|
||||
|
||||
ftp = FTP(host, timeout=300)
|
||||
ftp.login(username, password)
|
||||
|
||||
repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP"
|
||||
|
||||
i = 1
|
||||
|
||||
while True:
|
||||
exists = os.path.isfile(repfile)
|
||||
if exists:
|
||||
file = open(repfile, "rb")
|
||||
ftp.storbinary("STOR " + config.get("Main", "Host") + ".REP", file)
|
||||
file.close()
|
||||
os.remove(repfile)
|
||||
print("SENT: " + config.get("Main", "Host") + ".REP")
|
||||
repfile = config.get("Main", "Outbound") + "/" + config.get("Main", "Host") + ".REP." + str(i)
|
||||
i = i + 1
|
||||
else:
|
||||
break
|
||||
|
||||
qwkfile = config.get("Main", "Inbound") + "/" + config.get("Main", "Host") + ".QWK"
|
||||
with open(qwkfile, 'wb') as file:
|
||||
def callback(data):
|
||||
file.write(data)
|
||||
|
||||
try:
|
||||
ftp.retrbinary("RETR " + config.get("Main", "Host") + ".QWK", callback)
|
||||
file.close()
|
||||
print("RETREIVED: " + config.get("Main", "Host") + ".QWK")
|
||||
except all_errors:
|
||||
file.close()
|
||||
os.remove(qwkfile)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage python qwknetftpc.py config.ini")
|
||||
exit(1)
|
||||
|
||||
server = dostuff(sys.argv[1])
|
455
utils/qwknet/qwkscan.c
Normal file
455
utils/qwknet/qwkscan.c
Normal file
@ -0,0 +1,455 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <fts.h>
|
||||
#include <errno.h>
|
||||
#include "qwk.h"
|
||||
#include "../../deps/jamlib/jam.h"
|
||||
#include "../../src/inih/ini.h"
|
||||
|
||||
char *outbound_path;
|
||||
char *message_base_path;
|
||||
char *temp_dir;
|
||||
char *pack_cmd;
|
||||
char *config_file;
|
||||
char *hostid;
|
||||
|
||||
int bases_exists = 0;
|
||||
|
||||
struct msg_bases {
|
||||
int baseno;
|
||||
char *path;
|
||||
};
|
||||
|
||||
struct msg_bases **msgbases;
|
||||
int msgbasecount = 0;
|
||||
|
||||
int recursive_delete(const char *dir) {
|
||||
int ret = 0;
|
||||
FTS *ftsp = NULL;
|
||||
FTSENT *curr;
|
||||
|
||||
char *files[] = { (char *) dir, NULL };
|
||||
|
||||
ftsp = fts_open(files, FTS_NOCHDIR | FTS_PHYSICAL | FTS_XDEV, NULL);
|
||||
if (!ftsp) {
|
||||
fprintf(stderr, "%s: fts_open failed: %s\n", dir, strerror(errno));
|
||||
ret = -1;
|
||||
goto finish;
|
||||
}
|
||||
|
||||
while ((curr = fts_read(ftsp))) {
|
||||
switch (curr->fts_info) {
|
||||
case FTS_NS:
|
||||
case FTS_DNR:
|
||||
case FTS_ERR:
|
||||
fprintf(stderr, "%s: fts_read error: %s\n", curr->fts_accpath, strerror(curr->fts_errno));
|
||||
break;
|
||||
|
||||
case FTS_DC:
|
||||
case FTS_DOT:
|
||||
case FTS_NSOK:
|
||||
break;
|
||||
|
||||
case FTS_D:
|
||||
break;
|
||||
|
||||
case FTS_DP:
|
||||
case FTS_F:
|
||||
case FTS_SL:
|
||||
case FTS_SLNONE:
|
||||
case FTS_DEFAULT:
|
||||
if (remove(curr->fts_accpath) < 0) {
|
||||
fprintf(stderr, "%s: Failed to remove: %s", curr->fts_path, strerror(errno));
|
||||
ret = -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
finish:
|
||||
if (ftsp) {
|
||||
fts_close(ftsp);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s_JamBase *open_jam_base(char *path) {
|
||||
int ret;
|
||||
s_JamBase *jb;
|
||||
|
||||
ret = JAM_OpenMB((char *)path, &jb);
|
||||
|
||||
if (ret != 0) {
|
||||
if (ret == JAM_IO_ERROR) {
|
||||
free(jb);
|
||||
ret = JAM_CreateMB((char *)path, 1, &jb);
|
||||
if (ret != 0) {
|
||||
free(jb);
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
free(jb);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return jb;
|
||||
}
|
||||
|
||||
static int handler(void* user, const char* section, const char* name,
|
||||
const char* value)
|
||||
{
|
||||
if (strcasecmp(section, "main") == 0) {
|
||||
if (strcasecmp(name, "message path") == 0) {
|
||||
message_base_path = strdup(value);
|
||||
} else if (strcasecmp(name, "outbound") == 0) {
|
||||
outbound_path = strdup(value);
|
||||
} else if (strcasecmp(name, "temp dir") == 0) {
|
||||
temp_dir = strdup(value);
|
||||
} else if (strcasecmp(name, "pack command") == 0) {
|
||||
pack_cmd = strdup(value);
|
||||
} else if (strcasecmp(name, "host") == 0) {
|
||||
hostid = strdup(value);
|
||||
}
|
||||
} else if (strcasecmp(section, "bases") == 0) {
|
||||
bases_exists = 1;
|
||||
if (msgbasecount == 0) {
|
||||
msgbases = (struct msg_bases **)malloc(sizeof(struct msg_bases *));
|
||||
} else {
|
||||
msgbases = (struct msg_bases **)realloc(msgbases, sizeof(struct msg_bases *) * (msgbasecount + 1));
|
||||
}
|
||||
|
||||
msgbases[msgbasecount] = (struct msg_bases *)malloc(sizeof(struct msg_bases));
|
||||
|
||||
msgbases[msgbasecount]->baseno = atoi(name);
|
||||
msgbases[msgbasecount]->path = strdup(value);
|
||||
msgbasecount++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int export_messages(int baseno, char *basefilename, int qwkidx) {
|
||||
int msgcount = 0;
|
||||
s_JamBase *jb;
|
||||
s_JamBaseHeader jbh;
|
||||
s_JamMsgHeader jmh;
|
||||
s_JamSubPacket* jsp;
|
||||
s_JamSubfield jsf;
|
||||
int i;
|
||||
int z;
|
||||
int len;
|
||||
int lenbytes;
|
||||
char buffer[PATH_MAX];
|
||||
|
||||
struct QwkHeader qh;
|
||||
struct tm msgtm;
|
||||
FILE *fptr;
|
||||
FILE *hdrptr;
|
||||
char text[128];
|
||||
char *msgbuf;
|
||||
char *msgptr;
|
||||
|
||||
long offset;
|
||||
|
||||
char *msgsubj = NULL;
|
||||
char *msgto = NULL;
|
||||
char *msgfrom = NULL;
|
||||
char *msgid = NULL;
|
||||
char *msgreplyid = NULL;
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", message_base_path, basefilename);
|
||||
|
||||
jb = open_jam_base(buffer);
|
||||
if (jb) {
|
||||
JAM_ReadMBHeader(jb, &jbh);
|
||||
if (jbh.ActiveMsgs > 0) {
|
||||
for (i=0;i<jbh.ActiveMsgs;i++) {
|
||||
memset(&jmh, 0, sizeof(s_JamMsgHeader));
|
||||
z = JAM_ReadMsgHeader(jb, i, &jmh, &jsp);
|
||||
|
||||
if (z != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (jmh.Attribute & JAM_MSG_DELETED) {
|
||||
JAM_DelSubPacket(jsp);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((jmh.Attribute & JAM_MSG_SENT) || !(jmh.Attribute & JAM_MSG_LOCAL)) {
|
||||
JAM_DelSubPacket(jsp);
|
||||
continue;
|
||||
} else {
|
||||
// export message
|
||||
for (z=0;z<jsp->NumFields;z++) {
|
||||
if (jsp->Fields[z]->LoID == JAMSFLD_SUBJECT) {
|
||||
msgsubj = (char *)malloc(jsp->Fields[z]->DatLen + 1);
|
||||
memset(msgsubj, 0, jsp->Fields[z]->DatLen + 1);
|
||||
memcpy(msgsubj, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
||||
|
||||
if (jsp->Fields[z]->DatLen > 24) {
|
||||
len = 24;
|
||||
} else {
|
||||
len = jsp->Fields[z]->DatLen;
|
||||
}
|
||||
memset(qh.MsgSubj, ' ', 25);
|
||||
memcpy(qh.MsgSubj, jsp->Fields[z]->Buffer, len);
|
||||
}
|
||||
if (jsp->Fields[z]->LoID == JAMSFLD_SENDERNAME) {
|
||||
msgfrom = (char *)malloc(jsp->Fields[z]->DatLen + 1);
|
||||
memset(msgfrom, 0, jsp->Fields[z]->DatLen + 1);
|
||||
memcpy(msgfrom, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
||||
if (jsp->Fields[z]->DatLen > 24) {
|
||||
len = 24;
|
||||
} else {
|
||||
len = jsp->Fields[z]->DatLen;
|
||||
}
|
||||
memset(qh.MsgFrom, ' ', 25);
|
||||
memcpy(qh.MsgFrom, jsp->Fields[z]->Buffer, len);
|
||||
}
|
||||
if (jsp->Fields[z]->LoID == JAMSFLD_RECVRNAME) {
|
||||
msgto = (char *)malloc(jsp->Fields[z]->DatLen + 1);
|
||||
memset(msgto, 0, jsp->Fields[z]->DatLen + 1);
|
||||
memcpy(msgto, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
||||
if (jsp->Fields[z]->DatLen > 24) {
|
||||
len = 24;
|
||||
} else {
|
||||
len = jsp->Fields[z]->DatLen;
|
||||
}
|
||||
memset(qh.MsgTo, ' ', 25);
|
||||
memcpy(qh.MsgTo, jsp->Fields[z]->Buffer, len);
|
||||
}
|
||||
if (jsp->Fields[z]->LoID == JAMSFLD_MSGID) {
|
||||
msgid = (char *)malloc(jsp->Fields[z]->DatLen + 1);
|
||||
memset(msgid, 0, jsp->Fields[z]->DatLen + 1);
|
||||
memcpy(msgid, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
||||
}
|
||||
if (jsp->Fields[z]->LoID == JAMSFLD_REPLYID) {
|
||||
msgreplyid = (char *)malloc(jsp->Fields[z]->DatLen + 1);
|
||||
memset(msgreplyid, 0, jsp->Fields[z]->DatLen + 1);
|
||||
memcpy(msgreplyid, jsp->Fields[z]->Buffer, jsp->Fields[z]->DatLen);
|
||||
}
|
||||
}
|
||||
qh.Msgstat = ' ';
|
||||
snprintf(buffer, 7, "%d", baseno);
|
||||
memset(qh.Msgnum, ' ', 7);
|
||||
memcpy(qh.Msgnum, buffer, strlen(buffer));
|
||||
|
||||
localtime_r(&jmh.DateWritten, &msgtm);
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%02d-%02d-%02d", msgtm.tm_mon + 1, msgtm.tm_mday, msgtm.tm_year - 100);
|
||||
memcpy(qh.Msgdate, buffer, 8);
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%02d:%02d", msgtm.tm_hour, msgtm.tm_min);
|
||||
memcpy(qh.Msgtime, buffer, 5);
|
||||
|
||||
memset(qh.Msgpass, ' ', 12);
|
||||
memset(qh.Msgrply, ' ', 8);
|
||||
|
||||
len = jmh.TxtLen / 128 + 2;
|
||||
lenbytes = len * 128;
|
||||
|
||||
msgbuf = (char *)malloc(lenbytes);
|
||||
|
||||
memset(msgbuf, ' ', lenbytes);
|
||||
|
||||
JAM_ReadMsgText(jb, jmh.TxtOffset, jmh.TxtLen, msgbuf);
|
||||
|
||||
msgptr = msgbuf;
|
||||
while (*msgptr != '\0') {
|
||||
if (*msgptr == '\r') {
|
||||
*msgptr = '\xe3';
|
||||
}
|
||||
msgptr++;
|
||||
}
|
||||
|
||||
for (z=0;z<lenbytes;z++) {
|
||||
if (msgbuf[z] == '\0') {
|
||||
msgbuf[z] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(buffer, 7, "%d", len);
|
||||
memset(qh.Msgrecs, ' ', 6);
|
||||
memcpy(qh.Msgrecs, buffer, strlen(buffer));
|
||||
|
||||
qh.Msglive = 0xE1;
|
||||
qh.Msgarealo = baseno & 0xff;
|
||||
qh.Msgareahi = (baseno >> 8) & 0xff;
|
||||
|
||||
qh.Msgoffhi = ((qwkidx + msgcount + 1) >> 8) & 0xff;
|
||||
qh.Msgofflo = (qwkidx + msgcount + 1) & 0xff;
|
||||
|
||||
qh.Msgtagp = '*';
|
||||
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s.MSG", temp_dir, hostid);
|
||||
fptr = fopen(buffer, "r+");
|
||||
if (!fptr) {
|
||||
fptr = fopen(buffer, "w");
|
||||
if (fptr) {
|
||||
memset(text, ' ', 128);
|
||||
memcpy(text, hostid, strlen(hostid));
|
||||
fwrite(text, 128, 1, fptr);
|
||||
} else {
|
||||
fprintf(stderr, "UNABLE TO OPEN %s!!\n", buffer);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
fseek(fptr, 0, SEEK_END);
|
||||
}
|
||||
|
||||
offset = ftell(fptr);
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/HEADERS.DAT", temp_dir);
|
||||
hdrptr = fopen(buffer, "a");
|
||||
|
||||
fprintf(hdrptr, "[%lx]\n", offset);
|
||||
if (msgid != NULL) {
|
||||
fprintf(hdrptr, "Message-ID: %s\n", msgid);
|
||||
free(msgid);
|
||||
msgid = NULL;
|
||||
}
|
||||
if (msgreplyid != NULL) {
|
||||
fprintf(hdrptr, "In-Reply-To: %s\n", msgreplyid);
|
||||
free(msgreplyid);
|
||||
msgreplyid = NULL;
|
||||
}
|
||||
if (msgsubj != NULL) {
|
||||
fprintf(hdrptr, "Subject: %s\n", msgsubj);
|
||||
free(msgsubj);
|
||||
msgsubj = NULL;
|
||||
}
|
||||
if (msgto != NULL) {
|
||||
fprintf(hdrptr, "To: %s\n", msgto);
|
||||
free(msgto);
|
||||
msgto = NULL;
|
||||
}
|
||||
if (msgfrom != NULL) {
|
||||
fprintf(hdrptr, "Sender: %s\n", msgfrom);
|
||||
free(msgfrom);
|
||||
msgfrom = NULL;
|
||||
}
|
||||
|
||||
fprintf(hdrptr, "\n");
|
||||
fclose(hdrptr);
|
||||
|
||||
fwrite(&qh, 128, 1, fptr);
|
||||
fwrite(msgbuf, lenbytes - 128, 1, fptr);
|
||||
fclose(fptr);
|
||||
jmh.Attribute |= JAM_MSG_SENT;
|
||||
while (1) {
|
||||
z = JAM_LockMB(jb, 100);
|
||||
if (z == 0) {
|
||||
break;
|
||||
} else if (z == JAM_LOCK_FAILED) {
|
||||
sleep(1);
|
||||
} else {
|
||||
JAM_DelSubPacket(jsp);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
fprintf(stderr, "Error locking JAM base!\n");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
z =JAM_ChangeMsgHeader(jb, i, &jmh);
|
||||
JAM_UnlockMB(jb);
|
||||
JAM_DelSubPacket(jsp);
|
||||
free(msgbuf);
|
||||
msgcount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
}
|
||||
|
||||
return msgcount;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
message_base_path = NULL;
|
||||
outbound_path = NULL;
|
||||
temp_dir = NULL;
|
||||
int qwkidx = 0;
|
||||
int msgcount = 0;
|
||||
char buffer[PATH_MAX];
|
||||
char archive[PATH_MAX];
|
||||
int ret;
|
||||
struct stat st;
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage:\n ./qwkscan config.ini\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
config_file = argv[1];
|
||||
|
||||
if (ini_parse(config_file, handler, NULL) <0) {
|
||||
fprintf(stderr, "Unable to load configuration ini (%s)!\n", config_file);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if (temp_dir == NULL || message_base_path == NULL || outbound_path == NULL) {
|
||||
fprintf(stderr, "Outbound Path & Temp dir must both be set\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
mkdir(temp_dir, 0755);
|
||||
|
||||
for (i=0;i<msgbasecount;i++) {
|
||||
msgcount = export_messages(msgbases[i]->baseno, msgbases[i]->path, qwkidx);
|
||||
qwkidx += msgcount;
|
||||
fprintf(stderr, "Exporting from base %d... %d exported\n", msgbases[i]->baseno, msgcount);
|
||||
}
|
||||
|
||||
if (qwkidx > 0) {
|
||||
|
||||
snprintf(archive, PATH_MAX, "%s/%s.REP", outbound_path, hostid);
|
||||
i = 1;
|
||||
while (stat(archive, &st) == 0) {
|
||||
snprintf(archive, PATH_MAX, "%s/%s.REP.%d", outbound_path, hostid, i);
|
||||
i++;
|
||||
}
|
||||
|
||||
char *b = buffer;
|
||||
size_t blen = sizeof buffer;
|
||||
for (const char *p = pack_cmd; *p != '\0' && blen >= 1; ++p) {
|
||||
if (*p != '*') {
|
||||
*b++ = *p;
|
||||
--blen;
|
||||
continue;
|
||||
}
|
||||
p++;
|
||||
size_t alen = 0;
|
||||
if (*p == 'a') {
|
||||
strncpy(b, archive, blen);
|
||||
alen = strlen(archive);
|
||||
} else if (*p == 'f') {
|
||||
snprintf(b, blen, "%s/%s.MSG %s/HEADERS.DAT", temp_dir, hostid, temp_dir);
|
||||
alen = strlen(b);
|
||||
} else if (*p == '*') {
|
||||
*b++ = '*';
|
||||
alen = 1;
|
||||
}
|
||||
b += alen;
|
||||
blen -= alen;
|
||||
}
|
||||
*b = '\0';
|
||||
|
||||
ret = system(buffer);
|
||||
if (ret == -1 || ret >> 8 == 127) {
|
||||
fprintf(stderr, "Failed to run archiver!\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
recursive_delete(temp_dir);
|
||||
}
|
@ -15,6 +15,31 @@ char *inbound_path;
|
||||
char *message_base_path;
|
||||
char *temp_dir;
|
||||
char *unpack_cmd;
|
||||
char *config_file;
|
||||
|
||||
int bases_exists = 0;
|
||||
|
||||
struct msg_bases {
|
||||
int baseno;
|
||||
char *path;
|
||||
};
|
||||
|
||||
struct header_t {
|
||||
char *key;
|
||||
char *value;
|
||||
};
|
||||
|
||||
struct msg_headers_t {
|
||||
long offset;
|
||||
struct header_t **headers;
|
||||
int header_count;
|
||||
};
|
||||
|
||||
struct msg_headers_t **msg_headers;
|
||||
int msg_count = 0;
|
||||
|
||||
struct msg_bases **msgbases;
|
||||
int msgbasecount = 0;
|
||||
|
||||
int recursive_delete(const char *dir) {
|
||||
int ret = 0;
|
||||
@ -89,6 +114,58 @@ s_JamBase *open_jam_base(char *path) {
|
||||
return jb;
|
||||
}
|
||||
|
||||
static char *get_key_value(struct msg_headers_t *header, char *key) {
|
||||
if (header == NULL) return NULL;
|
||||
for (int i=0;i<header->header_count;i++) {
|
||||
if (strcmp(key, header->headers[i]->key) == 0) {
|
||||
return header->headers[i]->value;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct msg_headers_t *get_header(long offset) {
|
||||
for (int i=0;i<msg_count;i++) {
|
||||
if (msg_headers[i]->offset == offset) {
|
||||
return msg_headers[i];
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int header_handler(void* user, const char* section, const char* name,
|
||||
const char* value)
|
||||
{
|
||||
for (int i=0;i<msg_count;i++) {
|
||||
if (msg_headers[i]->offset == strtol(section, NULL, 16)) {
|
||||
msg_headers[i]->headers = (struct header_t **)realloc(msg_headers[i]->headers, sizeof(struct header_t *) * (msg_headers[i]->header_count + 1));
|
||||
msg_headers[i]->headers[msg_headers[i]->header_count] = (struct header_t *)malloc(sizeof(struct header_t));
|
||||
msg_headers[i]->headers[msg_headers[i]->header_count]->key = strdup(name);
|
||||
msg_headers[i]->headers[msg_headers[i]->header_count]->value = strdup(value);
|
||||
msg_headers[i]->header_count++;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (msg_count == 0) {
|
||||
msg_headers = (struct msg_headers_t **)malloc(sizeof(struct msg_headers_t *));
|
||||
} else {
|
||||
msg_headers = (struct msg_headers_t **)realloc(msg_headers, sizeof(struct msg_headers_t *) * (msg_count + 1));
|
||||
}
|
||||
|
||||
msg_headers[msg_count] = (struct msg_headers_t *)malloc(sizeof(struct msg_headers_t));
|
||||
msg_headers[msg_count]->offset = strtol(section, NULL, 16);
|
||||
msg_headers[msg_count]->header_count = 1;
|
||||
msg_headers[msg_count]->headers = (struct header_t **)malloc(sizeof(struct header_t *));
|
||||
msg_headers[msg_count]->headers[0] = (struct header_t *)malloc(sizeof(struct header_t));
|
||||
msg_headers[msg_count]->headers[0]->key = strdup(name);
|
||||
msg_headers[msg_count]->headers[0]->value = strdup(value);
|
||||
|
||||
msg_count++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int handler(void* user, const char* section, const char* name,
|
||||
const char* value)
|
||||
{
|
||||
@ -102,7 +179,20 @@ static int handler(void* user, const char* section, const char* name,
|
||||
} else if (strcasecmp(name, "unpack command") == 0) {
|
||||
unpack_cmd = strdup(value);
|
||||
}
|
||||
}
|
||||
} else if (strcasecmp(section, "bases") == 0) {
|
||||
bases_exists = 1;
|
||||
if (msgbasecount == 0) {
|
||||
msgbases = (struct msg_bases **)malloc(sizeof(struct msg_bases *));
|
||||
} else {
|
||||
msgbases = (struct msg_bases **)realloc(msgbases, sizeof(struct msg_bases *) * (msgbasecount + 1));
|
||||
}
|
||||
|
||||
msgbases[msgbasecount] = (struct msg_bases *)malloc(sizeof(struct msg_bases));
|
||||
|
||||
msgbases[msgbasecount]->baseno = atoi(name);
|
||||
msgbases[msgbasecount]->path = strdup(value);
|
||||
msgbasecount++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -130,7 +220,10 @@ size_t trimwhitespace(char *out, size_t len, const char *str) {
|
||||
|
||||
int process_msgs_dat(char *msgsdat) {
|
||||
FILE *fptr;
|
||||
FILE *cfgfptr;
|
||||
|
||||
char buffer[PATH_MAX];
|
||||
char headerfile[PATH_MAX];
|
||||
struct QwkHeader qhdr;
|
||||
int msgrecs;
|
||||
char *msgbody;
|
||||
@ -148,7 +241,17 @@ int process_msgs_dat(char *msgsdat) {
|
||||
s_JamSubPacket* jsp;
|
||||
s_JamSubfield jsf;
|
||||
int z;
|
||||
int basefound = 0;
|
||||
long offset;
|
||||
char *ptr;
|
||||
|
||||
struct msg_headers_t *header = NULL;
|
||||
|
||||
|
||||
snprintf(headerfile, PATH_MAX, "%s/HEADERS.DAT", temp_dir);
|
||||
|
||||
ini_parse(headerfile, header_handler, NULL);
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", temp_dir, msgsdat);
|
||||
|
||||
fptr = fopen(buffer, "rb");
|
||||
@ -157,11 +260,15 @@ int process_msgs_dat(char *msgsdat) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
fread(&qhdr, sizeof(struct QwkHeader), 1, fptr);
|
||||
while (!feof(fptr)) {
|
||||
offset = ftell(fptr);
|
||||
header = get_header(offset);
|
||||
if (fread(&qhdr, sizeof(struct QwkHeader), 1, fptr) != 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
msgrecs = atoi(qhdr.Msgrecs);
|
||||
msgbody = (char *)malloc((msgrecs * 128) + 1);
|
||||
memset(msgbody, 0, (msgrecs * 128) + 1);
|
||||
@ -212,12 +319,47 @@ int process_msgs_dat(char *msgsdat) {
|
||||
|
||||
msgconf = ((qhdr.Msgareahi & 0xff) << 8) | qhdr.Msgarealo;
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%d", message_base_path, msgconf);
|
||||
basefound = 0;
|
||||
for (i=0;i<msgbasecount;i++) {
|
||||
if (msgbases[i]->baseno == msgconf) {
|
||||
basefound = 1;
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", message_base_path, msgbases[i]->path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!basefound) {
|
||||
|
||||
|
||||
cfgfptr = fopen(config_file, "a");
|
||||
|
||||
if (!bases_exists) {
|
||||
fprintf(cfgfptr, "[bases]\n");
|
||||
bases_exists = 1;
|
||||
}
|
||||
|
||||
fprintf(cfgfptr, "%d = %d\n", msgconf, msgconf);
|
||||
fclose(cfgfptr);
|
||||
|
||||
if (msgbasecount == 0) {
|
||||
msgbases = (struct msg_bases **)malloc(sizeof(struct msg_bases *));
|
||||
} else {
|
||||
msgbases = (struct msg_bases **)realloc(msgbases, sizeof(struct msg_bases *) * (msgbasecount + 1));
|
||||
}
|
||||
|
||||
msgbases[msgbasecount] = (struct msg_bases *)malloc(sizeof(struct msg_bases));
|
||||
msgbases[msgbasecount]->baseno = msgconf;
|
||||
snprintf(buffer, PATH_MAX, "%d", msgconf);
|
||||
msgbases[msgbasecount]->path = strdup(buffer);
|
||||
msgbasecount++;
|
||||
snprintf(buffer, PATH_MAX, "%s/%d", message_base_path, msgconf);
|
||||
}
|
||||
|
||||
jb = open_jam_base(buffer);
|
||||
if (!jb) {
|
||||
fprintf(stderr, "Unable to open JAM base: %s\n", buffer);
|
||||
free(msgbody);
|
||||
fclose(fptr);
|
||||
return -1;
|
||||
}
|
||||
JAM_ClearMsgHeader( &jmh );
|
||||
@ -227,22 +369,60 @@ int process_msgs_dat(char *msgsdat) {
|
||||
|
||||
jsf.LoID = JAMSFLD_SENDERNAME;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(msgfrom);
|
||||
jsf.Buffer = (char *)msgfrom;
|
||||
|
||||
ptr = get_key_value(header, "Sender");
|
||||
if (ptr != NULL) {
|
||||
jsf.DatLen = strlen(ptr);
|
||||
jsf.Buffer = ptr;
|
||||
} else {
|
||||
jsf.DatLen = strlen(msgfrom);
|
||||
jsf.Buffer = (char *)msgfrom;
|
||||
}
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
jsf.LoID = JAMSFLD_RECVRNAME;
|
||||
jsf.LoID = JAMSFLD_RECVRNAME;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(msgto);
|
||||
jsf.Buffer = (char *)msgto;
|
||||
|
||||
ptr = get_key_value(header, "To");
|
||||
if (ptr != NULL) {
|
||||
jsf.DatLen = strlen(ptr);
|
||||
jsf.Buffer = (char *)ptr;
|
||||
} else {
|
||||
jsf.DatLen = strlen(msgto);
|
||||
jsf.Buffer = (char *)msgto;
|
||||
}
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
jsf.LoID = JAMSFLD_SUBJECT;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(msgsubj);
|
||||
jsf.Buffer = (char *)msgsubj;
|
||||
ptr = get_key_value(header, "Subject");
|
||||
if (ptr != NULL) {
|
||||
jsf.DatLen = strlen(ptr);
|
||||
jsf.Buffer = (char *)ptr;
|
||||
} else {
|
||||
jsf.DatLen = strlen(msgsubj);
|
||||
jsf.Buffer = (char *)msgsubj;
|
||||
}
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
|
||||
ptr = get_key_value(header, "Message-ID");
|
||||
if (ptr != NULL) {
|
||||
jsf.LoID = JAMSFLD_MSGID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(ptr);
|
||||
jsf.Buffer = (char *)ptr;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
}
|
||||
|
||||
ptr = get_key_value(header, "In-Reply-To");
|
||||
if (ptr != NULL) {
|
||||
jsf.LoID = JAMSFLD_REPLYID;
|
||||
jsf.HiID = 0;
|
||||
jsf.DatLen = strlen(ptr);
|
||||
jsf.Buffer = (char *)ptr;
|
||||
JAM_PutSubfield(jsp, &jsf);
|
||||
}
|
||||
|
||||
jmh.Attribute |= JAM_MSG_TYPEECHO;
|
||||
|
||||
while (1) {
|
||||
@ -253,6 +433,7 @@ int process_msgs_dat(char *msgsdat) {
|
||||
sleep(1);
|
||||
} else {
|
||||
fprintf(stderr, "Failed to lock msg base!\n");
|
||||
fclose(fptr);
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
free(msgbody);
|
||||
@ -267,6 +448,7 @@ int process_msgs_dat(char *msgsdat) {
|
||||
JAM_CloseMB(jb);
|
||||
free(jb);
|
||||
free(msgbody);
|
||||
fclose(fptr);
|
||||
return -1;
|
||||
} else {
|
||||
JAM_UnlockMB(jb);
|
||||
@ -358,8 +540,10 @@ int main(int argc, char **argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ini_parse(argv[1], handler, NULL) <0) {
|
||||
fprintf(stderr, "Unable to load configuration ini (%s)!\n", argv[1]);
|
||||
config_file = argv[1];
|
||||
|
||||
if (ini_parse(config_file, handler, NULL) <0) {
|
||||
fprintf(stderr, "Unable to load configuration ini (%s)!\n", config_file);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -391,4 +575,4 @@ int main(int argc, char **argv) {
|
||||
closedir(inb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,11 @@ ifeq ($(OS), Haiku)
|
||||
CFLAGS=
|
||||
LDFLAGS=-lsqlite3
|
||||
endif
|
||||
ifeq ($(OS), SunOS)
|
||||
CC=gcc
|
||||
CFLAGS=
|
||||
LDFLAGS=-lsqlite3
|
||||
endif
|
||||
|
||||
DEPS = ticproc.c
|
||||
|
||||
|
19
utils/wwivnet/wwivnet.h
Normal file
19
utils/wwivnet/wwivnet.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef __WWIVNET_H__
|
||||
#define __WWIVNET_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct net_header_rec {
|
||||
uint16_t tosys, /* destination system */
|
||||
touser, /* destination user */
|
||||
fromsys, /* originating system */
|
||||
fromuser, /* originating user */
|
||||
main_type, /* main message type */
|
||||
minor_type, /* minor message type */
|
||||
list_len; /* # of entries in system list */
|
||||
uint32_t daten, /* date/time sent */
|
||||
length; /* # of bytes of msg after header */
|
||||
uint16_t method; /* method of compression */
|
||||
} __attribute__((packed));
|
||||
|
||||
#endif
|
169
utils/wwivnet/wwivtoss.c
Normal file
169
utils/wwivnet/wwivtoss.c
Normal file
@ -0,0 +1,169 @@
|
||||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
#include "wwivnet.h"
|
||||
#include "../../deps/jamlib/jam.h"
|
||||
#include "../../src/inih/ini.h"
|
||||
|
||||
char *config_file;
|
||||
char *inbound_dir = NULL;
|
||||
char *outbound_dir = NULL;
|
||||
uint16_t wwivnet_node = 0;
|
||||
|
||||
static int handler(void* user, const char* section, const char* name,
|
||||
const char* value)
|
||||
{
|
||||
if (strcasecmp(section, "main") == 0) {
|
||||
if (strcasecmp(name, "inbound") == 0) {
|
||||
inbound_dir = strdup(value);
|
||||
} else if (strcasecmp(name, "outbound") == 0) {
|
||||
outbound_dir = strdup(value);
|
||||
} else if (strcasecmp(name, "wwiv node") == 0) {
|
||||
wwivnet_node = atoi(value);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void main_type_new_post(struct net_header_rec *msg_hdr, char *msg_txt) {
|
||||
char *subtype;
|
||||
char *ptr;
|
||||
char *title;
|
||||
|
||||
subtype = strdup(msg_txt);
|
||||
|
||||
ptr = msg_txt;
|
||||
while (*ptr != '\0') {
|
||||
ptr++;
|
||||
}
|
||||
ptr++;
|
||||
|
||||
title = strdup(ptr);
|
||||
while (*ptr != '\0') {
|
||||
ptr++;
|
||||
}
|
||||
ptr++;
|
||||
|
||||
|
||||
}
|
||||
|
||||
int process_file(char *filename) {
|
||||
char buffer[PATH_MAX];
|
||||
FILE *fptr;
|
||||
struct net_header_rec msg_hdr;
|
||||
char *msg_txt;
|
||||
|
||||
snprintf(buffer, PATH_MAX, "%s/%s", inbound_dir, filename);
|
||||
|
||||
|
||||
|
||||
fptr = fopen(buffer, "rb");
|
||||
if (!fptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (!feof(fptr)) {
|
||||
if (fread(&msg_hdr, sizeof(struct net_header_rec), 1, fptr) != 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (msg_hdr.length > 0) {
|
||||
msg_txt = (char *)malloc(msg_hdr.length);
|
||||
if (fread(msg_txt, 1, msg_hdr.length, fptr) != msg_hdr.length) {
|
||||
free(msg_txt);
|
||||
fprintf(stderr, "Short read on message.\n");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
msg_txt = NULL;
|
||||
}
|
||||
|
||||
switch(msg_hdr.main_type) {
|
||||
case 0x0001:
|
||||
// main_type_net_info
|
||||
fprintf(stderr, "Got main_type_net_info\n");
|
||||
break;
|
||||
case 0x0002:
|
||||
// main_type_email
|
||||
fprintf(stderr, "Got main_type_email\n");
|
||||
break;
|
||||
case 0x0007:
|
||||
// main_type_email_name
|
||||
fprintf(stderr, "Got main_type_email_name\n");
|
||||
break;
|
||||
case 0x0009:
|
||||
// main_type_sub_list
|
||||
fprintf(stderr, "Got main_type_sub_list\n");
|
||||
break;
|
||||
case 0x000f:
|
||||
// main_type_ssm
|
||||
fprintf(stderr, "Got main_type_ssm\n");
|
||||
break;
|
||||
case 0x0010:
|
||||
// main_type_sub_add_req
|
||||
fprintf(stderr, "Got main_type_sub_add_req\n");
|
||||
break;
|
||||
case 0x0011:
|
||||
// main_type_sub_drop_req
|
||||
fprintf(stderr, "Got main_type_sub_drop_req\n");
|
||||
break;
|
||||
case 0x0012:
|
||||
// main_type_sub_add_resp
|
||||
fprintf(stderr, "Got main_type_sub_add_resp\n");
|
||||
break;
|
||||
case 0x0013:
|
||||
// main_type_sub_drop_resp
|
||||
fprintf(stderr, "Got main_type_sub_drop_resp\n");
|
||||
break;
|
||||
case 0x0014:
|
||||
// main_type_sub_list_info
|
||||
fprintf(stderr, "Got main_type_sub_list_info\n");
|
||||
break;
|
||||
case 0x001a:
|
||||
// main_type_new_post
|
||||
main_type_new_post(&msg_hdr, msg_txt);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unsupported main type 0x%x\n", msg_hdr.main_type);
|
||||
break;
|
||||
}
|
||||
if (msg_txt != NULL) {
|
||||
free(msg_txt);
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
DIR *inb;
|
||||
struct dirent *dent;
|
||||
char buffer[256];
|
||||
|
||||
if (argc < 2) {
|
||||
fprintf(stderr, "Usage:\n ./wwivtoss config.ini\n");
|
||||
return -1;
|
||||
}
|
||||
config_file = argv[1];
|
||||
|
||||
if (ini_parse(config_file, handler, NULL) <0) {
|
||||
fprintf(stderr, "Unable to load configuration ini (%s)!\n", config_file);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
snprintf(buffer, 256, "s%d.net", wwivnet_node);
|
||||
|
||||
inb = opendir(inbound_dir);
|
||||
if (!inb) {
|
||||
fprintf(stderr, "Error opening inbound directory\n");
|
||||
return -1;
|
||||
}
|
||||
while ((dent = readdir(inb)) != NULL) {
|
||||
if (strncmp(dent->d_name, buffer, strlen(buffer)) == 0) {
|
||||
if(process_file(dent->d_name)) {
|
||||
rewinddir(inb);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(inb);
|
||||
}
|
Reference in New Issue
Block a user