#!/bin/sh
#
#
# Remove node from areas.bbs, kill outbound files
#

BIN=/usr/local/bin
LIBEXEC=/usr/local/libexec/fidogate

for n in $*; do
	[ -z "$n" ] && exit 0;

	echo ""
	echo -n "Kill outbound files for node $n and remove from areas.bbs? [no] "
	read ans
	if [ "$ans" = "yes" ]; then
		echo "Currently subscribed areas:"
		$BIN/ftnaf -- $n query
		echo "Unsubscribing to all areas ..."
		$BIN/ftnaf -- $n '-*' 
		echo "Killing outbound files ..."
		$LIBEXEC/ftnflo -v -x "echo '  %s'" -- $n
	fi
done
