1 line
19 KiB
C
1 line
19 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. */
#include "nickae.h"
/* Copyright (c) 1995 by QUALCOMM Incorporated */
#define FILE_NUM 78
#define This (*Aliases)[which]
OSErr NickObjFromNum(AEDescPtr nickFileDescP,short mNum,AEDescPtr nickDescP);
OSErr NickFileObjFromNum(AEDescPtr dummyDescP,short nNum,AEDescPtr nickFileDescP);
typedef struct
{
PropToken property;
short file;
} NickFileSpecifier;
typedef struct
{
PropToken property;
NickToken nick;
} NickSpecifier;
#pragma segment NickAE
Boolean AENickFileExists(AEDescPtr token)
{
short which;
AEGetDescData(token,&which,sizeof(which));
if (which >=0 && which < NAliases)
return (true);
else
return(False);
}
Boolean AENicknameExists(AEDescPtr token)
{
NickToken nickToken;
AEGetDescData(token,&nickToken,sizeof(nickToken));
if (nickToken.nickIndex >=0 && nickToken.nickFileNumber >=0)
return (true);
return(False);
}
Boolean AENickFieldExists(AEDescPtr token)
{
FieldToken ft;
AEGetDescData(token,&ft,sizeof(ft));
return (NickUserFieldExists(ft.name));
}
OSErr GetNickFileProperty(AEDescPtr token,AppleEvent *reply, uLong refCon)
{
NickFileSpecifier whichNickFile;
short which;
FSSpec spec;
short err = errAENoSuchObject;
AEGetDescData(token,&whichNickFile,sizeof(whichNickFile));
which = whichNickFile.file;
spec = This.spec;
switch (whichNickFile.property.propertyId)
{
case pEuFSS:
err = MyAEPutAlias(reply,keyAEResult,&spec);
break;
default:
err = errAENoSuchObject;
break;
}
return err;
}
OSErr GetNickProperty(AEDescPtr token,AppleEvent *reply, uLong refCon)
{
#pragma unused(refCon)
AttributeValueHandle avPairs;
AttributeValuePtr avPairPtr;
short count,i;
Str255 tag;
NickSpecifier whichNick;
OSErr err= noErr;
short index;
short which;
Str63 name;
Handle tempHandle = nil,temp2Handle = nil,theNames = nil;
AEGetDescData(token,&whichNick,sizeof(whichNick));
index = whichNick.nick.nickIndex;
which = whichNick.nick.nickFileNumber;
if (index >=0 && which >=0)
{
switch (whichNick.property.propertyId)
{
case pEuNickNick:
// PCopy(name,*((*((*Aliases)[which].theData))[index].theName));
GetNicknameNamePStr(which,index,name);
err = AEPutPStr(reply,keyAEResult,name);
break;
case pEuNickAddrOld:
case pEuNickAddrNew:
tempHandle = GetNicknameData(which,index,true,true);
if (tempHandle)
{
MyHandToHand(&tempHandle);
err = AEPutParamPtr(reply,keyAEResult,typeChar,LDRef(tem
|