#!/bin/bash
#
#
#    Scalix Public License
#
#
#    The contents of this file are subject to the Scalix Public License
#    Version 1.1 ("License"); you may not use this file except in
#    compliance with the License. You may obtain a copy of the License at
#
# 
#    http://www.scalix.com/community/licensing 
#
# 
#    Software distributed under the License is distributed on an "AS IS"
#    basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
#    the License for the specific language governing rights and limitations
#    under the License.
#
# 
#    The Original Code is Scalix Server. 
#    The Initial Developer of the Original Code is Scalix Corporation. 
#    Copyright (C) 2006 Scalix Corporation. 
#    All Rights Reserved.
#    Additional Copyrights may apply - see the notice in each file
#
#
#
#
#
#
# Copyright (C) 2006 Scalix Corporation.  All Rights Reserved.
#

help() {
	echo ""
	echo ""
	echo "VERSION:" 
	echo "1.0"
	echo ""
	echo "NAME:" 
	echo "Maintain Buletin Boards"
	echo ""
	echo "DESCRIPTION:"
	echo "ommaintbb deletes items from all Bulletin Boards, or a  specified  Bulletin Board  and,  optionally,  all  Bulletin Boards under it that are either a specified number of days old (the -e  option)  or  items  that have  reached  their  expiration date or delay (the -A option) or items that have been imported from other systems via a  bulletin  board  synchronisation agreement (the -I option) and have not already been automatically deleted during client access or by omscan."
	echo ""
	echo "PARAMETERS:"
        echo "-a	All Buletin Boards			none	All Buletin Boards."
        echo "-B	AbsRef		number	single	The absolute reference number of the Bulletin Board.  To<br>list  the absolute reference number of a Bulletin Board,<br>use the -b option with the command omlistbbs."
        echo "-m	Match		string	single	The subject, within quotes, of the Bulletin  Board.   To<br>specify  a  nested  Bulletin  Board, give a hierarchy of<br>Bulletin Board subjects, delimiting  the  subjects  with<br>angle  brackets  (>).   To list the subjects of Bulletin<br>Boards, use the command omlistbbs."
        echo "-n	Number		number	single	The temporary reference number of the Bulletin Board.<br>To list the temporary reference number of a<br> Bulletin Board, use the command omlistbbs."
        echo "-d	Depth		number	single	The depth of the Bulletin Board.  The depth is the number<br>of  levels  the  Bulletin Board is nested under the<br>Bulletin Board area.<br><br>Required with the -B and -n options unless  a  top-level<br>Bulletin Board is specified.<br><br>The  depth must be the same as that used when the reference<br>number was obtained using the command omlistbbs."
        echo "-A	Age items			none	Age items within the Bulletin Board."
        echo "-e	days		number	single	Delete items added to the Bulletin Board more than ___ days ago."
        echo "-I	Delete Imported Items			none	Delete Imported (Slave) items within the Bulletin Board.<br>Master Bulletin Board items, will be unaffected by  this<br>option."
        echo "-R	Recurse			none	Recurse  down the Bulletin Board tree from the specified<br>Bulletin Board and apply the -e or  -A  options  to  all<br>Bulletin Boards below this point."
        echo ""
	echo "--help	Help	\"\"	\"\"	\"\"	Usage Information"
	echo ""
	echo "OUTPUT:"
	echo ""
	echo "text/plain"
}
#
# main script
#

declare params;
params="";
while [ "$1" != "" ]; do
	case "$1" in
		--help) help;
                        exit 0
			shift;;
		*) params="$params $1 $2";
                   shift;;
	esac
	shift
done
/opt/scalix/bin/ommaintbb $params
exit 0
