From e646b4dcdb8f4b46de683f7cf823e3b1b3ce6503 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sat, 1 Sep 2018 04:56:30 +0000 Subject: normalize whitespace in memo reminder --- lib/main.sh | 64 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/lib/main.sh b/lib/main.sh index fccec5b..47585e3 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -529,40 +529,36 @@ while true; do done [[ ${sender%%!*} == pbot ]] && echo yes > pbot_present - my_own_name='pbot' - - person="${sender%%!*}" - - # Remove any forward slashes. - personoslash="${person//\/}" - declare -l personoslashlower="${personoslash}" - - the_time_now=$(date +%s) - - # If someone has sent this person a message then tell them. - if [[ -f "announcements/people/${personoslashlower}/messages" ]] - then - yepyep=1 - - # Make sure they have not already been - # told they have a message less than 1 - # hour ago - if [[ -f "announcements/people/${personoslashlower}/seen" ]] && (( ( $( stat -c %Y "announcements/people/${personoslashlower}/you_have_mail" 2> /dev/null ) + 3600 ) > the_time_now )) - then - yepyep=0 - fi - - if (( yepyep )) - then - if (( $(wc -l "announcements/people/${personoslashlower}/messages" | cut -d ' ' -f 1) > 1 )) - then - send_msg "${channel}" "${personoslash}: you have messages, type something to see them." - else - send_msg "${channel}" "${personoslash}: you have a message, type something to see it." - fi - touch "announcements/people/${personoslashlower}/you_have_mail" - fi - fi + my_own_name='pbot' + person="${sender%%!*}" + personoslash="${person//\/}" + declare -l personoslashlower="${personoslash}" + the_time_now=$(date +%s) + + # If someone has sent this person a message then tell them. + if [[ -f "announcements/people/${personoslashlower}/messages" ]] + then + yepyep=1 + + # Make sure they have not already been + # told they have a message less than 1 + # hour ago + if [[ -f "announcements/people/${personoslashlower}/seen" ]] && (( ( $( stat -c %Y "announcements/people/${personoslashlower}/you_have_mail" 2> /dev/null ) + 3600 ) > the_time_now )) + then + yepyep=0 + fi + + if (( yepyep )) + then + if (( $(wc -l "announcements/people/${personoslashlower}/messages" | cut -d ' ' -f 1) > 1 )) + then + send_msg "${channel}" "${personoslash}: you have messages, type something to see them." + else + send_msg "${channel}" "${personoslash}: you have a message, type something to see it." + fi + touch "announcements/people/${personoslashlower}/you_have_mail" + fi + fi elif [[ "$line" =~ ^:([^ ]*)\ +PART\ +(#[^ ]+)(\ +:(.*))? ]]; then sender="${BASH_REMATCH[1]}" -- cgit v1.2.2