#######################################################################################
#                                                                                     # 
#                        yourfritz customization framework                            # 
#                                                                                     # 
#######################################################################################
#                                                                                     #
# Copyright (C) 2014-2015 P. Haemmerlein / framework@yourfritz.de                     #
#                                                                                     #
# 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.                              #
#                                                                                     #
# This program is distributed in the hope that it will be useful,                     #
# but WITHOUT ANY WARRANTY; without even the implied warranty of                      #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                       #
# GNU General Public License under                                                    #
#                                                                                     #
# http://www.gnu.org/licenses/gpl-2.0.html                                            #
#                                                                                     #
# for more details.                                                                   #
#                                                                                     #
#######################################################################################
#                                                                                     #
# "FRITZ!Box" and "FRITZ!" are registered word marks and "AVM" is a registered        #
# word and figurative mark of:                                                        #
# AVM Computersysteme Vertriebs GmbH, 10559, Berlin, DE.                              #
#                                                                                     #
#######################################################################################
#                                                                                     #
# set up our hook distribution scripts for every supported action                     #
#                                                                                     #
#######################################################################################
yourfritz_setup_hook_routing()
{
	local count=0 rc=0 name value order action
	source "$YOURFRITZ_CONFDIR/hooks"
	while true; do
		let count+=1
		eval name="\$YF_HOOK_$count"
		[ ${#name} -eq 0 ] && break
		eval value="$name"
		order="${value:0:1}"
		action="${value:1}"
		if [ -x "$YOURFRITZ_SCRIPTSDIR/hooks/$action" ]; then
			mkdir "$YOURFRITZ_HOOKSDIR/$action.d" 2>/dev/null
			ln -s "$YOURFRITZ_SCRIPTSDIR/hooks/$action" "$YOURFRITZ_HOOKSDIR/$action"
			echo "$order" >"$YOURFRITZ_HOOKSDIR/$action.d/order"
			yourfritz_log_message 100 "$action"
		fi
    done
    return $rc
}
#######################################################################################
#                                                                                     # 
#                        yourfritz customization framework                            # 
#                                                                                     # 
#######################################################################################
