#!/bin/bash
cd `dirname "$0"`
CMD="./HNagent -checkFilters "

locale=$1
file=$2

$CMD "$file" >& /dev/null
prot=$?

if [ "$locale" = "fr" ]; then
  ttle="Protection status"
  msg="Impossible d'obtenir le statut de protection"
  case $prot in
   1) msg="est INCLUS par les règles SERVEUR" ;;
   2) msg="est INCLUS par les règles CLIENT" ;;
   3) msg="est EXCLUS par les règles SYSTÈME" ;;
   4) msg="est EXCLUS par les règles SERVEUR" ;;
   5) msg="est EXCLUS par les règles CLIENT" ;;
   6) msg="n'est actuellement PAS protégé" ;;
  esac
else
  ttle="Protection status"
  msg="protection status cannot be retrieved"
  case $prot in
   1) msg="is INCLUDED by SERVER rules" ;;
   2) msg="is INCLUDED by CLIENT rules" ;;
   3) msg="is EXCLUDED by SYSTEM rules" ;;
   4) msg="is EXCLUDED by SERVER rules" ;;
   5) msg="is EXCLUDED by CLIENT rules" ;;
   6) msg="is currently NOT protected" ;;
  esac
fi

fullmsg=`echo "$file" ; echo "$msg"`
which zenity > /dev/null 2>&1
if [ "$?" = "0" ]; then
 zenity --window-icon=/usr/share/icons/hicolor/24x24/apps/AtempoLiveNavigator.png --title "$ttle" --info --text="$fullmsg" --width=300 
else
 which kdialog > /dev/null 2>&1
 if [ "$?" = "0" ]; then
  kdialog --title "$ttle" --msgbox "$fullmsg"
 fi
fi
