/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: NPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Netscape Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/NPL/
 *
 * 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 mozilla.org code.
 *
 * The Initial Developer of the Original Code is 
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *    Doug Turner <dougt@netscape.com>
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or 
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the NPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the NPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */



/****************************************************************
  Time Bomb
   
    In order to use timebombs, you must set the preference:
    
    timebomb.enabled
       
    This must be set to true for the time bomb to be activated.
    
    There are two type of timebombs.  The first is an absolute
    timebomb which expires on a given date regardless of build
    date.  These absolute dates are set in the preferences:

    timebomb.expiration_time
    timebomb.warning_time

    The values are relative to the epoch, midnight, January 1, 
    1970 UTC in microseconds.  This is basically a PRTime.

    The second form of timebomb is naturally relative.  It take
    a start date and an two offset.  

    The first relative check is agains the build time preference:
    
    timebomb.build_time
    
    The two offsets are:

    timebomb.expiration_offset
    timebomb.warning_offset

    The next relative check is against the first launch.  The 
    preferences for first run is:

    timebomb.first_launch_time

    It will be set for you the first time nsITimeBomb is called.

    If you only want to preform a time bomb after the
    first launch, simply do not define timebomb.build_time.


    Since these preferences are set in a plain text 
    javascript file and there currently is not pref
    locking in mozilla, a user could simply remove 
    any one of these setting.  

    When the application does expire, you can specify a
    URL to load.  

    timebomb.timebombURL


****************************************************************/
#include "nsISupports.idl"

[scriptable, uuid(93fabc84-e1bf-11d3-ac71-00c04fa0d26b)]
interface nsITimeBomb : nsISupports
{
    void init();

    void checkWithUI(out boolean expired);
    void loadUpdateURL();

    readonly attribute boolean expired;
    readonly attribute boolean warned;
    
    readonly attribute boolean enabled;

    readonly attribute PRTime expirationTime;
    readonly attribute PRTime warningTime;

    readonly attribute PRTime buildTime;
    readonly attribute PRTime firstLaunch;
    readonly attribute PRInt64 warningOffset;
    readonly attribute PRInt64 expirationOffset;

    readonly attribute string timebombURL;
};

%{ C++
#define NS_TIMEBOMB_CONTRACTID "@mozilla.org/timebomb;1"
%}

