#!/bin/sh #---------------------------------------------------------------------------------------- # /var/install/bin/yowsup-send-test-message - send Wh***App test message # # Copyright (c) 2015-2016 The Eisfair Team, team(at)eisfair(dot)org # # Creation: 2015-12-31 jed # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------------------- # read eislib . /var/install/include/eislib #exec 2>./yowsup-send-test-message-$$.log #set -x act_pmode=`get_printmode` # check if screensize handling is available if [ "${_EISLIB_SCREENSIZE_Y}" != '' ] then if check_screensize then # # define maxrownum = _EISLIB_SCREENSIZE # - 3 Header Lines # - 1 Footer Lines # ask line maxcolnum=`expr ${_EISLIB_SCREENSIZE_X} - 1` maxrownum=`expr ${_EISLIB_SCREENSIZE_Y} - 4` true else mecho --info "Return to calling script" exit 1 fi else # default if screensize handling is not available maxcolnum=79 maxrownum=18 fi maxcolnum=60 seperator=`printf '%*s\n' ${maxcolnum} "" | tr ' ' '-'` yowsup_config_file=${HOME}/.yowsup-config if [ -f ${yowsup_config_file} ] then nbr='' u_exit=0 until [ ${u_exit} -eq 1 ] do clrhome mecho --info "Send Yowsup test message" mecho mecho "Input example: 49 172 55667788 (with country code/without '+' or '00')" mecho /var/install/bin/ask "Enter phone number [q]" "${nbr}" '+' > /tmp/ask.$$ rc=$? nbr=`cat /tmp/ask.$$ | sed -e 's/^+//' -e 's/^00//' -e 's/[^0-9* qQ]//g'` rm -f /tmp/ask.$$ if [ ${rc} = 255 ] then exit 1 fi case "${nbr}" in [qQ] ) # quit u_exit=1 ;; * ) # remove spaces and round brackets nbr="`echo ${nbr} | sed -e 's/[ )(]//g'`" /var/install/bin/ask "Enter text [q]" "${msg}" '+' > /tmp/ask.$$ rc=$? msg=`cat /tmp/ask.$$ | sed -e 's/^ *//' -e 's/ *$//'` rm -f /tmp/ask.$$ if [ ${rc} = 255 ] then exit 1 fi case "${msg}" in [qQ] ) # quit u_exit=1 ;; * ) echo if /var/install/bin/ask "Sending message '${msg}' to number '${nbr}'" then echo msgtext="'${msg}'" # echo "yowsup-cli demos --config ${yowsup_config_file} --send ${nbr} ${msgtext}" yowsup-cli demos --config ${yowsup_config_file} --send ${nbr} ${msgtext} echo anykey u_exit=1 fi ;; esac esac done else mecho --warn "The required configuration file '${yowsup_config_file}' could not be found!" anykey fi exit 0