root/apps/iphone/superbook/trunk/DotTel_SDK/Classes/TelDomain.h
@
864
| Revision 864, 4.4 kB (checked in by henri, 23 months ago) |
|---|
| Line | |
|---|---|
| 1 | // |
| 2 | // TelDomain.h |
| 3 | // DotTel SDK |
| 4 | // |
| 5 | // Created by Henri Asseily on 3/17/10. |
| 6 | // Copyright 2010 Telnic Limited. All rights reserved. |
| 7 | /* |
| 8 | Redistribution and use in source and binary forms, with or without modification, |
| 9 | are permitted provided that the following conditions are met: |
| 10 | |
| 11 | Redistributions of source code must retain the above copyright notice, this list of conditions |
| 12 | and the following disclaimer. Redistributions in binary form must reproduce the above copyright |
| 13 | notice, this list of conditions and the following disclaimer in the documentation and/or other |
| 14 | materials provided with the distribution. |
| 15 | Neither the name of the Telnic Ltd. nor the names of its contributors may be used to endorse or |
| 16 | promote products derived from this software without specific prior written permission. |
| 17 | THIS DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS |
| 18 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
| 19 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 20 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER |
| 23 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 24 | OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 | */ |
| 26 | // |
| 27 | |
| 28 | /* |
| 29 | This class encapsulates all the data for a domain |
| 30 | You can use the get* methods to acquire NAPTR, TXT and/or LOC records |
| 31 | It is highly recommended to use getNaptrAndTxtInBackground to acquire both |
| 32 | NAPTR and TXT together because it merges the two datasets properly, setting |
| 33 | the NAPTR labels correctly. |
| 34 | |
| 35 | Also if you wish to use the caching, you must call archiveToCache when you are done acquiring all |
| 36 | the data for the domain. Loading of a cached entry is automatic, but archiving (caching) it isn't. |
| 37 | */ |
| 38 | |
| 39 | #import <Foundation/Foundation.h> |
| 40 | #import "DnsResolver.h" |
| 41 | #import "NetworkUtility.h" |
| 42 | |
| 43 | @protocol TelDomainDelegate <NSObject> |
| 44 | @optional |
| 45 | - (void)didFinishGettingNaptrWithError:(NSError *)error; |
| 46 | - (void)didFinishGettingTxtWithError:(NSError *)error; |
| 47 | - (void)didFinishGettingLocWithError:(NSError *)error; |
| 48 | - (void)didFinishGettingNaptrAndTxtWithError:(NSError *)error; |
| 49 | - (void)didFinishGettingCountryAndTimeZoneWithError:(NSError *)error; |
| 50 | |
| 51 | @end |
| 52 | |
| 53 | |
| 54 | @interface TelDomain : NSObject { |
| 55 | BOOL isCached; // set if the data comes from cache |
| 56 | NSString *displayName; |
| 57 | NSString *headerText; |
| 58 | NSMutableArray *naptrArray; |
| 59 | NSMutableArray *txtArray; // only keywords |
| 60 | NSMutableArray *allTxtArray; // all txt records |
| 61 | NSMutableArray *locArray; |
| 62 | NSString *country; |
| 63 | NSTimeZone *timeZone; |
| 64 | NSDate *expiryDate; |
| 65 | id <TelDomainDelegate> delegate; |
| 66 | @private |
| 67 | NSString *_telName; |
| 68 | NSString *_cleanTelName; |
| 69 | NSURL *_logoUrl; |
| 70 | BOOL geoLocDidFinish; |
| 71 | } |
| 72 | |
| 73 | - (id)initWithTelName:(NSString *)aTelName delegate:(id<TelDomainDelegate>)aDelegate; |
| 74 | - (BOOL)archiveToCache; |
| 75 | - (void)deleteCachedArchive; |
| 76 | - (NSError *)getNaptr; |
| 77 | - (NSError *)getTxt; |
| 78 | - (NSError *)getLocWithReverseGeo:(BOOL)revGeo; |
| 79 | - (void)getNaptrInBackground; |
| 80 | - (void)getNaptrAndTxtInBackground; |
| 81 | - (void)getLocAndReverseGeoInBackground; |
| 82 | - (void)getLocInBackground; |
| 83 | - (void)getCountryAndTimeZoneForLoc:(CLLocation *)aLoc; |
| 84 | |
| 85 | //Make sure a .tel is properly filtered |
| 86 | - (NSString *)telFromQueryString:(NSString *)query; |
| 87 | |
| 88 | // utility |
| 89 | + (void)deleteCachedArchiveForTelName:(NSString *)telName; |
| 90 | + (NSString *)archivesDirectory; |
| 91 | |
| 92 | @property (nonatomic, readonly) BOOL isCached; |
| 93 | @property (nonatomic, readonly) NSString *telName; |
| 94 | @property (nonatomic, readonly) NSString *cleanTelName; |
| 95 | @property (nonatomic, copy) NSString *displayName; |
| 96 | @property (nonatomic, copy) NSString *headerText; |
| 97 | @property (nonatomic, readonly) NSURL *logoUrl; |
| 98 | @property (nonatomic, retain) NSMutableArray *naptrArray; |
| 99 | @property (nonatomic, retain) NSMutableArray *txtArray; |
| 100 | @property (nonatomic, retain) NSMutableArray *allTxtArray; |
| 101 | @property (nonatomic, retain) NSMutableArray *locArray; |
| 102 | @property (nonatomic, retain) NSString *country; |
| 103 | @property (nonatomic, retain) NSTimeZone *timeZone; |
| 104 | @property (readonly) BOOL geoLocDidFinish; |
| 105 | @property (nonatomic, readonly) NSDate *expiryDate; |
| 106 | @property (nonatomic, assign) id <TelDomainDelegate> delegate; |
| 107 | |
| 108 | |
| 109 | @end |
Note: See TracBrowser
for help on using the browser.








