# Usenet
#
# Mail to newsgroups.  The newsgroup name is intended to be in . format
# instead of -, so you can look it up in the news active file.

#require
provide usenet

do_newsgroup=1	# A signal to aliases.cf about the existence of this
		# database..

# optional: newsgroup database in news.group format
if [ -f $MAILVAR/db/active$DBEXTtest ]; then

#| If the usenet protocol is loaded, we recognize mail to newsgroup names
#| by looking them up in the active file.  If the real active file is on
#| another system, this database should be a copy on local disk.  This
#| avoids the mailer hanging due to outages of the news server.

	relation -lmt $DBTYPE -f $MAILVAR/db/active$DBEXT -b newsgroup
else
	newsgroup () { return 1 }
fi

usenet_neighbour () {
	return 1
}

localpart (address) {

#| This extracts the newsgroup name from the address.

	address=$(uucproute $address)
	tsift $address in
	.*!([^!])	returns \1 ;;
	.*		returns $address ;;
	tfist
}	# end of localpart

