#!/bin/sh
#
# Filename..........: $RCSfile: firemail,v $
# Original Author...: Anthony L. Awtrey
# Version...........: $Revision: 1.1 $
# Last Modified By..: $Author: aawtrey $
# Last Modified On..: $Date: 2005/04/25 21:08:27 $
#
# Copyright 2005 I.D.E.A.L. Technology Corporation
#
# 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 for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Purpose: 
# This script helps FireFox to send mailto: links and its 'Send Links' to
# mozilla mail or thunderbird 
#

# Uncomment to use mozilla mail
MAILBIN="/usr/bin/mozilla"
MAILREMOTE="/usr/lib/mozilla/mozilla-xremote-client -a mozilla"

# Uncomment to use thunderbird
#MAILBIN="/usr/bin/mozilla-thunderbird"
#MAILREMOTE="/usr/lib/mozilla-thunderbird/mozilla-thunderbird-xremote-client -a thunderbird"

MAILTO_URL="$*"
MAIL_DATA=`echo "$MAILTO_URL" | /bin/sed -e s/mailto:/to=/ -e s/?/,/ -e s/\&/,/`

if $MAILREMOTE 'ping()' ; then
  $MAILREMOTE "xfeDoCommand(composeMessage,$MAIL_DATA)"
else
  $MAILBIN -compose "$MAIL_URL"
fi
exit 0

# End
