#!/bin/bash -v
#
# Executed from KDE Service Menu
#

# Execution starts here
if [ "$1" = "" ]; then
	exit 1
fi

SCANTHIS=("$@")

until [ -z "$1" ]  # Until all parameters used up...
do
  if [ "$URL" = "" ]; then
	URL=$1
	SCANTHIS=$1
  else
	URL=$URL'*'$1
	SCANTHIS=$SCANTHIS' '$1
  fi
  shift
done

if dcop `dcop|grep klamav|head -n 1` DCOPKlamscan scanURLs "$URL"; then
	exit 0
else
	klamav --scanthis "${SCANTHIS[@]}"
fi

