eudora-mac/nag.c

1 line
52 KiB
C
Raw Normal View History

2018-05-23 09:59:15 +00:00
/* Copyright (c) 2017, Computer History Museum All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Computer History Museum nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifdef NAG #include "nag.h" #define FILE_NUM 120 #pragma segment Nagging #define kUpdateNagScheduleDuringBeta 0x55555555 // Update checks every other day #define kUpdateNagIntervalDuringBeta 2 #define kDelayBeforeSwitchingRepayUsersToSponsored (60 * 60 * 60) // 60 ticks x 60 seconds x 60 minutes long gTimeAtWhichRepayUsersBecomeSponsored = 0; extern ModalFilterUPP DlgFilterUPP; OSErr PutFeaturesInto (DialogPtr theDialog, short theItem); #define NAG_INTRO_DLOG_OK 1 #define NAG_INTRO_INFO_BTN 3 #define NAG_INTRO_CODE_BTN 2 void CheckAdQT(void); // // InitNagging // // This is not a real function. It exists right now mostly to initialize the user state // for our early betas. It should be replaced by a function that erifies the user's // registration state. For now, the user is a newUser if the 'NagS' resource is not // present. If it is present, we automatically make them an Ad User. // InitNagResultType InitNagging (void) { InitNagResultType result; UserStateType newState; uLong regDate; int pnPolicyCode; int regMonth; Boolean foundRegFile, needsRegistration; needsRegistration = false; // Grab the nag state information from the settings file, or create a new // resource if we didn't fint what we wanted nagState = GetResourceFromFile (NAG_STATE_TYPE, NAG_STATE_ID, SettingsRefN); if (!nagState) if (nagState = NuHandleClear (sizeof (NagStateRec))) { (*nagState)->version = NAG_STATE_VERS; #ifdef I_HATE_THE_BOX (*nagState)->state = boxUser; #else if (ValidRegCode(paidUser,&pnPolicyCode,&regMonth) && PolicyCheck (pnPolicyCode, regMonth)) (*nagState)->state = paidUser; else (*nagState)->state = newUser; #endif (*nagState)->regDate = 0; SettingsHandle (NAG_STATE_TYPE, nil, NAG_STATE_ID, nagState); } else DieWithError (MEM_ERR, MemError ()); #ifdef DEATH_BUILD newState = paidUser; result = noDialogPending; #else // If we somehow happened upon an old EP 4 user, they will become adware users for 5.0 if (IsEP4User ()) #ifdef I_HATE_THE_BOX (*nagState)->state = boxUser; #else (*nagState)->state = adwareUser; #endif #ifdef I_HATE_THE_BOX if (!PrefIsSet (PREF_BOX_NO_LONGER_VIRGIN)) { (*nagState)->state = boxUser; SetPref(PREF_BOX_NO_LONGER_VIRGIN,"\py"); } #else // If someone ran as a box user, then switches to a non-box build, make them a paid user // (which we e