~ysu/gemini-chatroom

bcd26e93a6f73bed4c9b542de904760a13efabc0 — vps 3 years ago 5d52bfb
added new styling
2 files changed, 11 insertions(+), 6 deletions(-)

M bin/chat0/post
M bin/chat0/postuser
M bin/chat0/post => bin/chat0/post +6 -6
@@ 14,15 14,15 @@ fi

nstr=$(echo $QUERY_STRING | sed 's/\(%0A\|
\)/ /g' | sed 's/%/\\x/g')

if [ -z $nstr]; then
	echo -e "30 /\r\n"
	exit 0
fi
# if [ -z $nstr]; then
#	echo -e "30 \r\n"
#	exit 0
# fi

if [ $(cat last_message) != $nstr ]; then
	printf "($(date "+%D %R %Z"))\t\t$user:\t$nstr\n" >> message_log
	printf "($(date "+%D %R %Z")) $(echo $user: $nstr | awk '{printf "%9s\t%s\n", $1, $2}')\n" >> message_log
	echo $nstr > last_message
	echo -e "30 /bin/chat$chatNum\r\n"
else
	echo -e "40 Message failed! Reason: Spam protection\r\n"
fi
echo -e "30 /bin/chat$chatNum\r\n"

M bin/chat0/postuser => bin/chat0/postuser +5 -0
@@ 4,4 4,9 @@ if [ -z $QUERY_STRING ]; then
	echo "10 Username\r\n"
fi

if [ ${#QUERY_STRING} -gt 9 ]; then
	echo "40 Message failed! Reason: Username must be below 9 characters\r\n"
	exit 0
fi

echo "30 post/$QUERY_STRING\r\n"