summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe <joe@joelightning.com>2011-11-10 20:26:45 +0000
committerJoe <joe@joelightning.com>2011-11-10 20:26:45 +0000
commitede41b6a15ac8d14823b161353fee2253298874b (patch)
treef764939f05056706cbe14cdc8463c91ca2204ab5
parentf23c71af59dbac854a027997f243c38628c0f65f (diff)
made it only get the tile of a url if pbot is believed to not be present
-rw-r--r--hack_of_all_hacks39
1 files changed, 23 insertions, 16 deletions
diff --git a/hack_of_all_hacks b/hack_of_all_hacks
index 009fd0f..1e42457 100644
--- a/hack_of_all_hacks
+++ b/hack_of_all_hacks
@@ -136,24 +136,31 @@ EOF
# Page title getter #
#####################
- if [[ ${line} =~ http://[^\ ]+ ]] || [[ ${line} =~ https://[^\ ]+ ]]
+ # If pbot is present record it.
+ [[ ${sender%%!*} == pbot ]] && touch pbot_present
+
+ # If pbot is not present.
+ if ! [[ -f pbot_present ]]
then
- url_to_get="${BASH_REMATCH}"
-
- the_title=$(
- curl -L --compressed "${url_to_get}" 2> /dev/null |
- while rdom
- do
- if [[ ${element} = title ]]
- then
- echo "${content}" | replace_wierd_html_chars
- fi
- done
- )
-
- if ! [[ -z ${the_title} ]]
+ if [[ ${line} =~ http://[^\ ]+ ]] || [[ ${line} =~ https://[^\ ]+ ]]
then
- send_msg "${channel_it_came_from}" "The title of that page is: \`${the_title}'"
+ url_to_get="${BASH_REMATCH}"
+
+ the_title=$(
+ curl -L --compressed "${url_to_get}" 2> /dev/null |
+ while rdom
+ do
+ if [[ ${element} = title ]]
+ then
+ echo "${content}" | replace_wierd_html_chars
+ fi
+ done
+ )
+
+ if ! [[ -z ${the_title} ]]
+ then
+ send_msg "${channel_it_came_from}" "The title of that page is: \`${the_title}'"
+ fi
fi
fi