#!/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 "List Buletin Boards"
	echo ""
	echo "DESCRIPTION:"
	echo "omlistbbs lists Bulletin Boards."
	echo ""
	echo "PARAMETERS:"
        echo "-B	AbsRef		number	single	The absolute reference number of the Bulletin Board from<br>which to start the listing.  The default is the Bulletin<br>Board area itself."
        echo "-m	Match		string	single	The  subject,  within quotes, of the Bulletin Board from<br>which to start the listing.  To specify  a  nested  Bulletin<br> Board,  give  a  hierarchy of Bulletin Board subjects,<br>delimiting the subjects with angle brackets  (>)."
        echo "-d	Depth	1	number	single	The  number  of  levels  to list.  The default is 1.  To<br>list all levels below the current level, specify a depth<br>of 0."
        echo "-a	Display Aging Parameters			none	Display the aging parameters of a Bulletin Board: Expiry<br>Date, Expiry Delay, and Message Expiry Flag."
        echo "-s	Display Size			none	Display the size of a Bulletin Board in kilobytes."
        echo "-b	List with Absolute Ref. Number			none	List Bulletin Boards with their absolute reference  numbers,<br>rather than their temporary reference numbers."
	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;;
		-a) params="$params -a $2";
                   shift;;
		-s) params="$params -s $2";
                   shift;;
		-b) params="$params -b $2";
                   shift;;
		*) params="$params $1 $2";
                   shift;;
	esac
	shift
done
/opt/scalix/bin/omlistbbs $params
exit 0
