blob: 81e2bee4897b1155826359c45fcd076983bbc19c (
plain)
- #!/bin/sh
- set -e
- simpleword() {
- echo "$1" | tr '[A-Z]' '[a-z]' | egrep '^[a-z][a-z0-9-]+$' || exit 1
- }
- uridecode() {
- echo "$1" | perl -e 'use URI::Escape; print lc(uri_unescape(<STDIN>));'
- }
- urlencode() {
- echo "$1" | perl -e 'use URI::URL; print URI::URL->new(<STDIN>)."\n";'
- }
- phone=`uridecode "$1" | sed -e 's/\+/ /g'`; shift
- set -- `uridecode "$@" | sed -e 's/\+/ /g'`
- app=`simpleword "$1"`; shift
- case "$app" in
- wadmin|wall)
- # coolsms dislikes leading + in phone number
- SMS_PHONE=`echo "$SMS_PHONE" | sed 's/^%2b//i'`
- origin="$1"; shift
- i=
- for p in $phone; do
- case $p in
- $origin)
- ;;
- *)
- /usr/local/sbin/localsendsms "$p" "$@"
- i=$((i+1))
- ;;
- esac
- done
- /usr/local/sbin/localsendsms "$origin" "Message \"$1 $2...\" sent to $i recipients."
- ;;
- *)
- esac
|