G1sms/shell/sms_ABO.sh

50 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
##################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: GPL (http://www.google.com/search?q=GPL)
##################################################################
# Commande SMS: sms_ABO.sh
# ABO "$SERVICE" "$YESNO"
# Gère les Abonnements aux communications PUSH SMS
##################################################################
# TODO: Create information Channels and moderate OPT IN/OUT
source ./shell/init.sh
source ./shell/functions.sh
log "__SUB:sms_ABO.sh: START ($1=PHONE, $2=SERVICE)"
PHONE=$1
SERVICE=$2
sms_INIT_ACCOUNT "$PHONE"
case "$SERVICE" in
ON)
log "Abonnement Kalkun"
add_contact $PHONE $MEMBER && log "${c_green}Contact has been added to database$c_" || log "${c_red}Contact can't be added to database$c_";
sms_SEND "$PHONE" "$MEMBER votre inscription annuaire est active"
;;
OFF)
log "Retrait Kalkun"
rm_contact $PHONE $MEMBER && log "${c_green}Contact has been deleted from database$c_" || log "${c_red}Contact can't be deleted database$c_";
sms_SEND "$PHONE" "$MEMBER retrait annuaire prise en compte..."
;;
MARCHE)
log "Avertissement G1 marchés"
# PARAMS could be "$distance" to Member GeoPoint...
;;
GCHANGE)
log "Création Alerte Annonce GCHANGE"
# PARAMS could be "$distance#$keyword" to search gchange.fr near Member GeoPoint...
;;
INFO)
log "Abonnement Newsletter"
# PARAMS could be "$distance#$keyword" to search gchange.fr near Member GeoPoint...
;;
*)
# AIDE : ABO GCHANGE 100#maison...
log "Renvoyez AIDE..."
sms_SEND "$PHONE" "Cette commande est inactive..."
;;
esac