summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbill-auger <mr.j.spam.me@gmail.com>2019-04-21 07:41:48 +0000
committerbill-auger <mr.j.spam.me@gmail.com>2019-04-21 04:25:15 -0400
commita836b2244a142223ac6671aee13a737031baa583 (patch)
treee68435fcda65a55aa1265d68cd01d8def00b67b2
parentd27e1842dcb96c097fbb8b79c1dafdab84f000f7 (diff)
refactor is_injected_msg handling
-rw-r--r--process_event26
1 files changed, 14 insertions, 12 deletions
diff --git a/process_event b/process_event
index adea311..5250293 100644
--- a/process_event
+++ b/process_event
@@ -84,28 +84,30 @@ function process_event
# If it's a private message
[[ "${channel_it_came_from}" == "${my_own_name}" ]] && channel_it_came_from="${personoslash}"
+ # is this am injected message
+ [[ ${personoslash} == ${INJECT_NICK} ]] && is_injected_msg=1 || is_injected_msg=0
+
######################
# Echo injected data #
######################
# Should send a message like: echo 'This is the message' > /tmp/un-provoked-message-store
- injected_data=0
line_filtered=${line##*PRIVMSG +([![:space:]]) :}
- if [[ ${personoslash} == ${INJECT_NICK} ]]
- then
- send_msg "${channel_it_came_from}" "${line_filtered}"
- injected_data=1
- fi
- # NOTE: this 'injected_data' clause is apparently the IPC mechanism
+ [[ "${line_filtered}" != 'Parabola Community Forum' ]] && \
+ (($is_injected_msg)) && send_msg "${channel_it_came_from}" "${line_filtered}"
+ # NOTE: this 'injected_data' is the IPC mechanism
# used by the ./labs_change_detector script
# see ./labs_change_detector, transport/socat.sh, and transport/dev-tcp.sh
- # the clause above was originally mutually exclusive
+ # the 'send_msg' command above was originally mutually exclusive
# with the remaining entirety of this function
- # and it is the only place where 'injected_data' is set
- # yet, 'injected_data' is tested below in the 'Page title getter' section
+ # and it was the only place where the 'injected_data' var was set
+ # ('injected_data' is now 'is_injected_msg')
+ # yet, that is tested for below in the 'Page title getter' section
# so, presumably this 'injected_data' was intended to fall through?
+ # or perhaps not, because the "Shared libraries error" matcher
+ # does not filter this 'injected_data', which it should
###############################################################
@@ -137,7 +139,7 @@ function process_event
# If someone complains about error while loading shared libraries error
# then recomend them to the bug tracker.
- if [[ ${sentence} == *"error while loading shared libraries"* ]]
+ if [[ ${sentence} == *"error while loading shared libraries"* ]] && (( ! $is_injected_msg ))
then
# Make sure they have not already been recommended to the bug
# tracker less than one day ago.
@@ -237,7 +239,7 @@ function process_event
# We don't want to get the page title if it's injected data
# nor if it probably came from a spambot
- if [[ ${line} =~ http://[^\ ]+ ]] || [[ ${line} =~ https://[^\ ]+ ]] && (( ! injected_data ))
+ if [[ ${line} =~ http://[^\ ]+ ]] || [[ ${line} =~ https://[^\ ]+ ]] && (( ! $is_injected_msg ))
then
url_to_get="${BASH_REMATCH}"
the_title=$(