2010-09-20 19:44:17 -05:00
|
|
|
//
|
|
|
|
// MGMInstance.h
|
|
|
|
// VoiceBase
|
|
|
|
//
|
|
|
|
// Created by Mr. Gecko on 8/15/10.
|
2011-03-07 19:02:53 -06:00
|
|
|
// Copyright (c) 2011 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
|
|
// with or without fee is hereby granted, provided that the above copyright notice
|
|
|
|
// and this permission notice appear in all copies.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
|
|
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
|
|
|
|
// OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
|
|
// DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
|
|
// ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2010-09-20 19:44:17 -05:00
|
|
|
//
|
|
|
|
|
2011-03-21 07:43:56 -05:00
|
|
|
#import <Foundation/Foundation.h>
|
2010-09-20 19:44:17 -05:00
|
|
|
|
|
|
|
@class MGMInstance, MGMUser, MGMHTTPCookieStorage, MGMURLConnectionManager, MGMWhitePages, MGMInbox, MGMContacts;
|
|
|
|
|
|
|
|
#define MGMInstanceDebug 0
|
|
|
|
|
|
|
|
extern NSString * const MGMVoiceIndexURL;
|
|
|
|
extern NSString * const MGMLoginURL;
|
2011-03-21 07:43:56 -05:00
|
|
|
extern NSString * const MGMLoginVerifyURL;
|
2010-09-20 19:44:17 -05:00
|
|
|
extern NSString * const MGMLoginBody;
|
|
|
|
extern NSString * const MGMXPCPath;
|
|
|
|
extern NSString * const MGMCheckPath;
|
|
|
|
extern NSString * const MGMCreditURL;
|
2011-03-21 07:43:56 -05:00
|
|
|
extern NSString * const MGMPhonesURL;
|
2010-09-20 19:44:17 -05:00
|
|
|
extern NSString * const MGMCallURL;
|
|
|
|
extern NSString * const MGMCallCancelURL;
|
|
|
|
|
|
|
|
extern NSString * const MGMPostMethod;
|
|
|
|
extern NSString * const MGMURLForm;
|
|
|
|
extern NSString * const MGMContentType;
|
|
|
|
|
|
|
|
extern NSString * const MGMPhoneNumber;
|
|
|
|
extern NSString * const MGMPhone;
|
|
|
|
extern NSString * const MGMName;
|
|
|
|
extern NSString * const MGMType;
|
|
|
|
|
|
|
|
extern NSString * const MGMSContactsSourceKey;
|
|
|
|
extern NSString * const MGMSContactsActionKey;
|
|
|
|
|
|
|
|
extern NSString * const MGMUCAll;
|
|
|
|
extern NSString * const MGMUCInbox;
|
|
|
|
extern NSString * const MGMUCMissed;
|
|
|
|
extern NSString * const MGMUCPlaced;
|
|
|
|
extern NSString * const MGMUCReceived;
|
|
|
|
extern NSString * const MGMUCRecorded;
|
|
|
|
extern NSString * const MGMUCSMS;
|
|
|
|
extern NSString * const MGMUCSpam;
|
|
|
|
extern NSString * const MGMUCStarred;
|
|
|
|
extern NSString * const MGMUCTrash;
|
|
|
|
extern NSString * const MGMUCUnread;
|
|
|
|
extern NSString * const MGMUCVoicemail;
|
|
|
|
|
|
|
|
@protocol MGMInstanceDelegate <NSObject>
|
|
|
|
- (void)loginError:(NSError *)theError;
|
2011-03-21 07:43:56 -05:00
|
|
|
- (void)loginVerificationRequested;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)loginSuccessful;
|
|
|
|
- (void)updatedContacts;
|
2011-03-21 07:43:56 -05:00
|
|
|
- (void)updatedUserPhones;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)updateUnreadCount:(int)theCount;
|
|
|
|
- (void)updateVoicemail;
|
|
|
|
- (void)updateSMS;
|
2011-03-21 07:43:56 -05:00
|
|
|
- (void)updateCredit:(NSString *)theCredit;
|
2010-09-20 19:44:17 -05:00
|
|
|
@end
|
|
|
|
|
|
|
|
@interface MGMInstance : NSObject {
|
|
|
|
id<MGMInstanceDelegate> delegate;
|
|
|
|
MGMUser *user;
|
|
|
|
MGMHTTPCookieStorage *cookeStorage;
|
|
|
|
MGMURLConnectionManager *connectionManager;
|
|
|
|
MGMInbox *inbox;
|
|
|
|
MGMContacts *contacts;
|
|
|
|
|
|
|
|
int webLoginTries;
|
|
|
|
BOOL loggedIn;
|
2011-03-21 07:43:56 -05:00
|
|
|
NSMutableDictionary *verificationParameters;
|
2011-09-23 23:29:16 -05:00
|
|
|
NSURL *verificationURL;
|
2010-09-20 19:44:17 -05:00
|
|
|
|
|
|
|
NSString *XPCURL;
|
|
|
|
NSString *XPCCD;
|
|
|
|
NSString *rnr_se;
|
|
|
|
|
|
|
|
NSString *userName;
|
|
|
|
NSString *userNumber;
|
|
|
|
NSString *userAreacode;
|
|
|
|
NSMutableArray *userPhoneNumbers;
|
|
|
|
|
|
|
|
NSTimer *checkTimer;
|
|
|
|
NSDictionary *unreadCounts;
|
|
|
|
NSTimer *creditTimer;
|
|
|
|
|
|
|
|
BOOL checkingAccount;
|
|
|
|
}
|
|
|
|
+ (id)instanceWithUser:(MGMUser *)theUser delegate:(id)theDelegate;
|
|
|
|
+ (id)instanceWithUser:(MGMUser *)theUser delegate:(id)theDelegate isCheck:(BOOL)isCheck;
|
|
|
|
- (id)initWithUser:(MGMUser *)theUser delegate:(id)theDelegate isCheck:(BOOL)isCheck;
|
|
|
|
|
|
|
|
- (void)registerSettings;
|
|
|
|
|
|
|
|
- (void)stop;
|
|
|
|
|
|
|
|
- (void)setDelegate:(id)theDelegate;
|
|
|
|
- (id<MGMInstanceDelegate>)delegate;
|
|
|
|
- (MGMUser *)user;
|
|
|
|
- (MGMHTTPCookieStorage *)cookieStorage;
|
|
|
|
- (MGMURLConnectionManager *)connectionManager;
|
|
|
|
- (MGMInbox *)inbox;
|
|
|
|
- (MGMContacts *)contacts;
|
|
|
|
|
|
|
|
- (NSString *)XPCURL;
|
|
|
|
- (NSString *)XPCCD;
|
|
|
|
- (NSString *)rnr_se;
|
|
|
|
|
|
|
|
- (NSString *)userName;
|
|
|
|
- (NSString *)userNumber;
|
|
|
|
- (NSString *)userAreaCode;
|
|
|
|
- (NSArray *)userPhoneNumbers;
|
|
|
|
- (NSDictionary *)unreadCounts;
|
|
|
|
|
2011-03-21 07:43:56 -05:00
|
|
|
- (void)cancelVerification;
|
|
|
|
- (void)verifyWithCode:(NSString *)theCode;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (BOOL)isLoggedIn;
|
2011-03-21 07:43:56 -05:00
|
|
|
- (void)checkPhones;
|
|
|
|
- (void)parseUserPhones:(NSDictionary *)thePhones;
|
2010-09-20 19:44:17 -05:00
|
|
|
- (void)checkTimer;
|
|
|
|
- (void)creditTimer;
|
|
|
|
|
|
|
|
- (void)placeCall:(NSString *)thePhoneNumber usingPhone:(int)thePhone delegate:(id)theDelegate;
|
|
|
|
- (void)placeCall:(NSString *)thePhoneNumber usingPhone:(int)thePhone delegate:(id)theDelegate didFailWithError:(SEL)didFailWithError didFinish:(SEL)didFinish;
|
|
|
|
- (void)cancelCallWithDelegate:(id)theDelegate;
|
|
|
|
- (void)cancelCallWithDelegate:(id)theDelegate didFailWithError:(SEL)didFailWithError didFinish:(SEL)didFinish;
|
|
|
|
@end
|