Update Vcs-* headers.
[debian/nanobloggertrackback.git] / trackbackping.sh
1 # sends trackback pings to URLs found in $NB_EntryBody
2 # needs SEND_TRACKBACK_PING="1" und TB_PATH in blog.conf
3
4 PINGCACHE=${BLOG_DIR}/tb/pings/${NB_EntryID}
5
6 if [ "$SEND_TRACKBACK_PING" = "1" ] && [ ! -z "$TB_PATH" ]; then
7         if [ ! -e "$PINGCACHE" ]; then
8                 for URL in $(echo $NB_EntryBody | perl -ne 'print "$1\n" if /href=\C(.*?)\C>/g'); do 
9                         nb_msg "sending trackback pings ..."
10                         PING_URL=$URL
11                         TITLE=$NB_EntryTitle
12                         BLOG_NAME=$BLOG_TITLE
13                         EXCERPT=$(echo $NB_EntryBody | perl -ne 'print "$1 ..." if /^(.{1,80})(\s+|$)/' | html2text -nobs | xargs -0 | head -n -1)
14                         URL=${ARCHIVES_PATH}$NB_EntryPermalink
15                         TBURL="${TB_PATH}?__mode=send_ping&ping_url=${PING_URL}&title=${TITLE}&blog_name=${BLOG_NAME}&excerpt=${EXCERPT}&url=${URL}"
16                         TBURL=$(echo $TBURL | sed -e 's/!/\\!/')
17                         #nb_msg "++ $TBURL"
18                         /usr/bin/wget -q -O /dev/null "$TBURL"
19                         touch $PINGCACHE
20                 done
21         fi
22 fi