/***********************************************************************\ CInternetConfig.h A C++ class for using Internet Config by Dan Crevier version 1.2 \***********************************************************************/ #include class CInternetConfig { public: CInternetConfig(OSType appSig); virtual ~CInternetConfig(); #if TARGET_API_MAC_CARBON OSStatus Start(); #else OSStatus Start(FSSpec *prefFile = NULL); #endif OSStatus Stop(); Boolean ICComponentInstalled() { return installed; }; //_tk_ added for older systems UInt32 GetActualAPIVersion(); OSStatus DoURL(ConstStringPtr theURL); OSStatus DoURL(const char *inURL, long inLen);//_tk_ for URLs longer than 255 chars // preferences that return strings OSStatus GetRealName(StringPtr result) { return GetKeysString(kICRealName, result); }; OSStatus GetEmailAddress(StringPtr result) { return GetKeysString(kICEmail, result); }; OSStatus GetMailAccount(StringPtr result) { return GetKeysString(kICMailAccount, result); }; OSStatus GetMailPassword(StringPtr result) { return GetKeysString(kICMailPassword, result); }; OSStatus GetNewsAuthUsername(StringPtr result) { return GetKeysString(kICNewsAuthUsername, result); }; OSStatus GetNewsAuthPassword(StringPtr result) { return GetKeysString(kICNewsAuthPassword, result); }; OSStatus GetArchiePrefered(StringPtr result) { return GetKeysString(kICArchiePreferred, result); }; OSStatus GetUMichPreferred(StringPtr result) { return GetKeysString(kICUMichPreferred, result); }; OSStatus GetInfoMacPreferred(StringPtr result) { return GetKeysString(kICInfoMacPreferred, result); }; OSStatus GetPhHost(StringPtr result) { return GetKeysString(kICPhHost, result); }; OSStatus GetWhoisHost(StringPtr result) { return GetKeysString(kICWhoisHost, result); }; OSStatus GetFingerHost(StringPtr result) { return GetKeysString(kICFingerHost, result); }; OSStatus GetFTPHost(StringPtr result) { return GetKeysString(kICFTPHost, result); }; OSStatus GetTelnetHost(StringPtr result) { return GetKeysString(kICTelnetHost, result); }; OSStatus GetSMTPHost(StringPtr result) { return GetKeysString(kICSMTPHost, result); }; OSStatus GetNNTPHost(StringPtr result) { return GetKeysString(kICNNTPHost, result); }; OSStatus GetGopherHost(StringPtr result) { return GetKeysString(kICGopherHost, result); }; OSStatus GetLDAPServer(StringPtr result) { return GetKeysString(kICLDAPServer, result); }; OSStatus GetLDAPSearchbase(StringPtr result) { return GetKeysString(kICLDAPSearchbase, result); }; OSStatus GetWWWHomePage(StringPtr result) { return GetKeysString(kICWWWHomePage, result); }; OSStatus GetWAISGateway(StringPtr result) { return GetKeysString(kICWAISGateway, result); }; OSStatus GetOrganization(StringPtr result) { return GetKeysString(kICOrganization, result); }; // key based OSStatus GetKeysString(ConstStr255Param keyStr, Str255 thePStr); // font records OSStatus GetListFont(ICFontRecord *fontRecord) { return GetFontRecord(kICListFont, fontRecord); }; OSStatus GetScreenFont(ICFontRecord *fontRecord) { return GetFontRecord(kICScreenFont, fontRecord); }; OSStatus GetPrinterFont(ICFontRecord *fontRecord) { return GetFontRecord(kICPrinterFont, fontRecord); }; OSStatus GetFontRecord(ConstStr255Param keyStr, ICFontRecord *fontRecord); // File mappings OSStatus MapFilename(ConstStr255Param inName, ICMapEntry &outEntry); OSStatus MapFilename(char *name, ICMapEntry &outEntry); OSStatus MapTypeCreator( OSType inType, OSType inCreator, ConstStr255Param inName, ICMapEntry &outEntry); OSStatus StartMapIteration(void); Boolean NextMapEntry(ICMapEntry *entry, long &outPos); OSStatus FinishMapIteration(void); OSStatus SetMapEntry(const ICMapEntry *entry, long inPos); OSStatus AddMapEntry(const ICMapEntry *inEntry); OSStatus SaveMapEntries(); // editing preferences OSStatus EditPreferences(ConstStr255Param key = "\p"); // Routines to get helper application FSSpec's OSStatus GetEditorHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥editor", theFileSpec, creator); }; OSStatus GetFTPHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥fto", theFileSpec, creator); }; OSStatus GetNewsHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥nntp", theFileSpec, creator); }; OSStatus GetMailHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥mailto", theFileSpec, creator); }; OSStatus GetGopherHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥gopher", theFileSpec, creator); }; OSStatus GetWebHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥http", theFileSpec, creator); }; OSStatus GetFingerHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥finger", theFileSpec, creator); }; OSStatus GetTelnetHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥editor", theFileSpec, creator); }; OSStatus GetTN3270Helper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥telnet", theFileSpec, creator); }; OSStatus GetWAISHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥tn3270", theFileSpec, creator); }; OSStatus GetWhoIsHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥wais", theFileSpec, creator); }; OSStatus GetNetPhHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥netphone", theFileSpec, creator); }; OSStatus GetXNetPhHelper(FSSpec *theFileSpec, OSType *creator) { return GetHelperFileSpec("\pHelper¥x-netphone", theFileSpec, creator); }; protected: OSStatus GetHelperFileSpec(StringPtr key, FSSpec *theFileSpec, OSType *creator); Boolean LocateApplication(OSType signature, FSSpec *theFileSpec); ICInstance inst; Boolean installed, started; Handle mappings; long numMappings, currentPos; OSType applicationSig; };