summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2018-09-01 04:56:30 +0000
committerbill-auger <mr.j.spam.me@gmail.com>2018-09-28 23:30:25 -0400
commite646b4dcdb8f4b46de683f7cf823e3b1b3ce6503 (patch)
tree532efd45d674b06e84ada9069d6bb9ba04dc2537
parent7d6673533834d6e8bac5b7f99e0c44657169cb71 (diff)
normalize whitespace in memo reminder
-rw-r--r--lib/main.sh64
1 files 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]}"