1 line
26 KiB
C
1 line
26 KiB
C
|
/* 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. */
#define FILE_NUM 131
/* Copyright (c) 1999 by QUALCOMM Incorporated */
#include "regcode_v2.h"
#include "regcode_charsets.h"
// Prototypes
void MakeJumpPath(StringPtr s,short hostResID);
Handle GenerateAdwareURLStr (UserStateType state, StringPtr host, short action, UInt32 query, long refcon);
extern ModalFilterUPP DlgFilterUPP;
//
// OpenAdwareURL
//
//
// Host is resource
void OpenAdwareURL (UserStateType state, short hostResID, short action, UInt32 query, long refcon)
{
Str255 host;
MakeJumpPath(host,hostResID);
OpenAdwareURLStr (state,host,action,query,refcon);
}
// Host is string
OSErr OpenAdwareURLStr (UserStateType state, StringPtr host, short action, UInt32 query, long refcon)
{
Handle url;
Str255 protocol;
short length;
OSErr err;
if (url = GenerateAdwareURLStr (state, host, action, query, refcon)) {
length = GetHandleSize (url);
if (length && (*url)[length]==0) length--;
if (!ParseProtocolFromURLPtr (LDRef (url), length, protocol))
err = OpenOtherURLPtr (protocol, *url, length);
ZapHandle (url);
}
return err;
}
//
// GenerateAdwareURL
//
// 'state' - The state to be used when generating the URL (used by registration)
// 'hostResID' - The host stuff... www.eudora.com
// 'action' - The action to be taken. Pass in one of the constants from URLAction in StrnDefs
// 'query' - A bit mask identifying the fields to be included in the query. Use the 'urlQueryParts' constants in adutil.h
// 'refcon' - Paramater for special use of certain actions and query types. This mechanism is not entirely
// swift since multiple query parts _could_ each require different refcons. This would break. Badly.
// Don't do this.
//
// Host is resource
Handle GenerateAdwareURL (UserStateType state, short hostResID, short action, UInt32 query, long refcon)
{
Str255 host;
MakeJumpPath(host,hostResID);
return GenerateAdwareURLStr (state,host,action,query,refcon);
}
// Host is string
Handle GenerateAdwareURLStr (UserStateType state, StringPtr host, short action, UInt32 query, long refcon)
{
Accumulator urlAccumulator;
AdURLStringsPtr urlStringPtrs;
Str255 attribute,
value;
OSErr theError;
// Initialize the accumulator into which we'll build the URL
theError = AccuInit (&urlAccumulator);
// Add the URL path, normally "http://www.eudora.com/jump.cgi"
if (!theError)
theError = AccuAddStr(&urlAccumulator, host)
|