Updated Theme Tester for the new system. Fixed issues with MGMAdressBook. Changed to new dealloc setup. Fixed issue with MGMContacts nameForNumber. Fixed issues with calling SIP addresses. Fixed issues with images having a size of zero. Fixed possibility of error being null for placing calls. Added caf support for theme manager. Added support for setting a custom useragent for MGMSIP. Fixed issues with TCP/UDP connections and added option per an account on what type the user wants. Added choice of DTMF tone type. Fixed issues with registration of SIP accounts. Fixed issue where windows wouldn't reopen after being cloed and quit. Updated to a fixed version of PJSIP.

This commit is contained in:
GRMrGecko 2011-02-22 12:00:36 -06:00
parent f7a808f394
commit 7fdf9035a7
264 changed files with 1798 additions and 4566 deletions

View File

@ -11,7 +11,7 @@ RockStar ({\field{\*\fldinst{HYPERLINK "http://rocknthesweater.com"}}{\fldrslt r
PowerOfCheese ({\field{\*\fldinst{HYPERLINK "http://xtrememachinez.com"}}{\fldrslt xtrememachinez.com}})\ PowerOfCheese ({\field{\*\fldinst{HYPERLINK "http://xtrememachinez.com"}}{\fldrslt xtrememachinez.com}})\
\ \
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural\pardirnatural
\cf0 VoiceMac Uses {\field{\*\fldinst{HYPERLINK "http://mrgeckosmedia.com"}}{\fldrslt MGMSIP}} as a wrapper for {\field{\*\fldinst{HYPERLINK "http://www.pjsip.org/"}}{\fldrslt PJSIP}} which is a VOIP library, {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org"}}{\fldrslt Sparkle}} for software update, and Growl for notifications.\ \cf0 VoiceMac Uses {\field{\*\fldinst{HYPERLINK "http://mrgeckosmedia.com"}}{\fldrslt MGMSIP}} as a wrapper for {\field{\*\fldinst{HYPERLINK "http://www.pjsip.org/"}}{\fldrslt PJSIP}} which is a VOIP library, {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org"}}{\fldrslt Sparkle}} for software update, and {\field{\*\fldinst{HYPERLINK "http://growl.info/"}}{\fldrslt Growl}} for notifications.\
\ \
VoiceMac is the first Google Voice client for the Mac. Send multiple SMS Messages, send SMS Messages, receive SMS Messages, place calls, look at your call history, receive voicemail, reverse lookup a phone number, and search your contact list in one easy interface. When you receive a SMS Message or Voicemail, you get notifications view Growl and hear sounds that is customizable.\ VoiceMac is the first Google Voice client for the Mac. Send multiple SMS Messages, send SMS Messages, receive SMS Messages, place calls, look at your call history, receive voicemail, reverse lookup a phone number, and search your contact list in one easy interface. When you receive a SMS Message or Voicemail, you get notifications view Growl and hear sounds that is customizable.\
\ \

View File

@ -186,7 +186,7 @@
} }
NSDateFormatter *formatter = [[NSDateFormatter new] autorelease]; NSDateFormatter *formatter = [[NSDateFormatter new] autorelease];
[formatter setDateFormat:[[themeManager variant] objectForKey:MGMTDate]]; [formatter setDateFormat:[[themeManager variant] objectForKey:MGMTDate]];
[SMSView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"newMessage('%@', '%@', '%@', %@, '%@', '%@', '%@', %d);", [[message objectForKey:MGMIText] escapeSMS], [[message objectForKey:MGMTPhoto] escapeSMS], [[message objectForKey:MGMITime] escapeSMS], [message objectForKey:MGMIID], [[message objectForKey:MGMTName] escapeSMS], [[[message objectForKey:MGMIPhoneNumber] readableNumber] escapeSMS], [formatter stringFromDate:[messageInfo objectForKey:MGMITime]], type]]; [SMSView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"newMessage('%@', '%@', '%@', %@, '%@', '%@', '%@', %d);", [[message objectForKey:MGMIText] javascriptEscape], [[message objectForKey:MGMTPhoto] javascriptEscape], [[message objectForKey:MGMITime] javascriptEscape], [message objectForKey:MGMIID], [[message objectForKey:MGMTName] javascriptEscape], [[[message objectForKey:MGMIPhoneNumber] readableNumber] javascriptEscape], [formatter stringFromDate:[messageInfo objectForKey:MGMITime]], type]];
[SMSView stringByEvaluatingJavaScriptFromString:@"scrollToBottom();"]; [SMSView stringByEvaluatingJavaScriptFromString:@"scrollToBottom();"];
} }
- (IBAction)incoming:(id)sender { - (IBAction)incoming:(id)sender {

View File

@ -20,7 +20,7 @@
@implementation MGMAddressBook @implementation MGMAddressBook
- (id)initWithDelegate:(id)theDelegate { - (id)initWithDelegate:(id)theDelegate {
if (self = [super init]) { if ((self = [super init])) {
delegate = theDelegate; delegate = theDelegate;
shouldStop = NO; shouldStop = NO;
gettingContacts = NO; gettingContacts = NO;
@ -38,7 +38,6 @@
if (addressBook!=NULL) if (addressBook!=NULL)
CFRelease(addressBook); CFRelease(addressBook);
#else #else
if (addressBook!=nil)
[addressBook release]; [addressBook release];
#endif #endif
[super dealloc]; [super dealloc];
@ -101,10 +100,12 @@
NSMutableDictionary *contact = [NSMutableDictionary dictionary]; NSMutableDictionary *contact = [NSMutableDictionary dictionary];
[contact setObject:name forKey:MGMCName]; [contact setObject:name forKey:MGMCName];
[contact setObject:company forKey:MGMCCompany]; [contact setObject:company forKey:MGMCCompany];
CFStringRef phoneNumber = ABMultiValueCopyValueAtIndex(phones, p);
if (delegate!=nil) if (delegate!=nil)
[contact setObject:[[(NSString *)ABMultiValueCopyValueAtIndex(phones, p) autorelease] phoneFormatWithAreaCode:[delegate areaCode]] forKey:MGMCNumber]; [contact setObject:[(NSString *)phoneNumber phoneFormatWithAreaCode:[delegate areaCode]] forKey:MGMCNumber];
else else
[contact setObject:[[(NSString *)ABMultiValueCopyValueAtIndex(phones, p) autorelease] phoneFormat] forKey:MGMCNumber]; [contact setObject:[(NSString *)phoneNumber phoneFormat] forKey:MGMCNumber];
CFRelease(phoneNumber);
NSString *label = [(NSString *)ABMultiValueCopyLabelAtIndex(phones, p) autorelease]; NSString *label = [(NSString *)ABMultiValueCopyLabelAtIndex(phones, p) autorelease];
NSRange range = [label rangeOfString:@"<"]; NSRange range = [label rangeOfString:@"<"];
if (range.location!=NSNotFound) { if (range.location!=NSNotFound) {

View File

@ -42,7 +42,7 @@ const int MGMCMaxResults = 10;
return [[[self alloc] initWithClass:theClass delegate:theDelegate] autorelease]; return [[[self alloc] initWithClass:theClass delegate:theDelegate] autorelease];
} }
- (id)initWithClass:(Class)theClass delegate:(id)theDelegate { - (id)initWithClass:(Class)theClass delegate:(id)theDelegate {
if (self = [super init]) { if ((self = [super init])) {
maxResults = MGMCMaxResults; maxResults = MGMCMaxResults;
delegate = theDelegate; delegate = theDelegate;
user = [delegate user]; user = [delegate user];
@ -71,21 +71,14 @@ const int MGMCMaxResults = 10;
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (updateLock!=nil) {
[updateLock lock]; [updateLock lock];
[updateLock unlock]; [updateLock unlock];
[updateLock release]; [updateLock release];
}
if (contactsLock!=nil) {
[contactsLock lock]; [contactsLock lock];
[contactsLock unlock]; [contactsLock unlock];
[contactsLock release]; [contactsLock release];
}
if (contactsConnection!=nil)
[contactsConnection release]; [contactsConnection release];
if (updateConnection!=nil)
[updateConnection release]; [updateConnection release];
if (contacts!=nil)
[contacts release]; [contacts release];
[super dealloc]; [super dealloc];
} }
@ -103,10 +96,8 @@ const int MGMCMaxResults = 10;
[contacts stop]; [contacts stop];
[updateLock lock]; [updateLock lock];
[updateLock unlock]; [updateLock unlock];
if (updateConnection!=nil) {
[updateConnection release]; [updateConnection release];
updateConnection = nil; updateConnection = nil;
}
isUpdating = NO; isUpdating = NO;
stopingUpdate = NO; stopingUpdate = NO;
} }
@ -117,7 +108,7 @@ const int MGMCMaxResults = 10;
if ([theUser isEqual:user] && (![[theUser settingForKey:MGMSContactsSourceKey] isEqual:NSStringFromClass([contacts class])] || ([contacts isKindOfClass:[MGMGoogleContacts class]] && ![[[(MGMGoogleContacts *)contacts user] settingForKey:MGMUserID] isEqual:[theUser settingForKey:MGMCGoogleContactsUser]]))) { if ([theUser isEqual:user] && (![[theUser settingForKey:MGMSContactsSourceKey] isEqual:NSStringFromClass([contacts class])] || ([contacts isKindOfClass:[MGMGoogleContacts class]] && ![[[(MGMGoogleContacts *)contacts user] settingForKey:MGMUserID] isEqual:[theUser settingForKey:MGMCGoogleContactsUser]]))) {
if (stopingUpdate) return; if (stopingUpdate) return;
[self stop]; [self stop];
if (contacts!=nil) [contacts release]; [contacts release];
contacts = [[NSClassFromString([theUser settingForKey:MGMSContactsSourceKey]) alloc] initWithDelegate:delegate]; contacts = [[NSClassFromString([theUser settingForKey:MGMSContactsSourceKey]) alloc] initWithDelegate:delegate];
[self updateContacts]; [self updateContacts];
} }
@ -135,7 +126,7 @@ const int MGMCMaxResults = 10;
} }
- (void)setContactsConnection:(MGMLiteConnection *)theConnection { - (void)setContactsConnection:(MGMLiteConnection *)theConnection {
[contactsLock lock]; [contactsLock lock];
if (contactsConnection!=nil) [contactsConnection release]; [contactsConnection release];
contactsConnection = [theConnection retain]; contactsConnection = [theConnection retain];
[contactsLock unlock]; [contactsLock unlock];
} }
@ -202,11 +193,10 @@ const int MGMCMaxResults = 10;
long long int groupID = [updateConnection insertId]; long long int groupID = [updateConnection insertId];
for (unsigned int i=0; i<[theMembers count]; i++) { for (unsigned int i=0; i<[theMembers count]; i++) {
NSDictionary *result = [[updateConnection query:@"SELECT docid, * FROM contacts WHERE number = %@", [theMembers objectAtIndex:i]] nextRow]; NSDictionary *result = [[updateConnection query:@"SELECT docid, * FROM contacts WHERE number = %@", [theMembers objectAtIndex:i]] nextRow];
if (result!=nil) { if (result!=nil)
[updateConnection query:@"INSERT INTO groupMembers (groupid, contactid) VALUES (%qi, %@)", groupID, [result objectForKey:MGMCDocID]]; [updateConnection query:@"INSERT INTO groupMembers (groupid, contactid) VALUES (%qi, %@)", groupID, [result objectForKey:MGMCDocID]];
} }
} }
}
[updateLock unlock]; [updateLock unlock];
[pool drain]; [pool drain];
} }
@ -481,7 +471,7 @@ const int MGMCMaxResults = 10;
else if (![[contact objectForKey:MGMCCompany] isEqual:@""]) else if (![[contact objectForKey:MGMCCompany] isEqual:@""])
return [contact objectForKey:MGMCCompany]; return [contact objectForKey:MGMCCompany];
} }
if ([theNumber isPhone]) if ([theNumber isPhoneComplete])
return [theNumber readableNumber]; return [theNumber readableNumber];
return theNumber; return theNumber;
} }
@ -533,10 +523,9 @@ const int MGMCMaxResults = 10;
NSDictionary *member = nil; NSDictionary *member = nil;
while ((member=[result nextRow])!=nil) { while ((member=[result nextRow])!=nil) {
NSDictionary *contact = [self contactWithID:[member objectForKey:MGMCContactID]]; NSDictionary *contact = [self contactWithID:[member objectForKey:MGMCContactID]];
if (contact!=nil) { if (contact!=nil)
[memebersArray addObject:contact]; [memebersArray addObject:contact];
} }
}
[contactsLock unlock]; [contactsLock unlock];
[pool drain]; [pool drain];
return memebersArray; return memebersArray;

View File

@ -22,4 +22,8 @@ NSString * const MGMCContactID = @"contactid";
NSString * const MGMCGoogleContactsUser = @"MGMCGoogleContactsUser"; NSString * const MGMCGoogleContactsUser = @"MGMCGoogleContactsUser";
#if TARGET_OS_IPHONE
const float MGMABPhotoSizePX = 120.0;
#else
const float MGMABPhotoSizePX = 64.0; const float MGMABPhotoSizePX = 64.0;
#endif

View File

@ -25,7 +25,7 @@ const BOOL MGMGoogleContactsInvisible = YES;
@implementation MGMGoogleContacts @implementation MGMGoogleContacts
- (id)initWithDelegate:(id)theDelegate { - (id)initWithDelegate:(id)theDelegate {
if (self = [super init]) { if ((self = [super init])) {
gettingContacts = NO; gettingContacts = NO;
delegate = theDelegate; delegate = theDelegate;
user = [[MGMUser userWithID:[[delegate user] settingForKey:MGMCGoogleContactsUser]] retain]; user = [[MGMUser userWithID:[[delegate user] settingForKey:MGMCGoogleContactsUser]] retain];
@ -49,21 +49,13 @@ const BOOL MGMGoogleContactsInvisible = YES;
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (user!=nil)
[user release]; [user release];
if (connectionManager!=nil) {
[connectionManager cancelAll]; [connectionManager cancelAll];
[connectionManager release]; [connectionManager release];
}
if (authenticationString!=nil)
[authenticationString release]; [authenticationString release];
if (afterAuthentication!=nil)
[afterAuthentication release]; [afterAuthentication release];
if (releaseTimer!=nil)
[releaseTimer fire]; [releaseTimer fire];
if (contactEntries!=nil)
[contactEntries release]; [contactEntries release];
if (contactPhoto!=nil)
[contactPhoto release]; [contactPhoto release];
[super dealloc]; [super dealloc];
} }
@ -88,7 +80,7 @@ const BOOL MGMGoogleContactsInvisible = YES;
} }
- (void)authenticationDidFinish:(NSDictionary *)theInfo { - (void)authenticationDidFinish:(NSDictionary *)theInfo {
NSDictionary *info = [MGMGoogleContacts dictionaryWithData:[theInfo objectForKey:MGMConnectionData]]; NSDictionary *info = [MGMGoogleContacts dictionaryWithData:[theInfo objectForKey:MGMConnectionData]];
if (authenticationString!=nil) [authenticationString release]; [authenticationString release];
authenticationString = [[NSString stringWithFormat:@"GoogleLogin auth=%@", [info objectForKey:@"Auth"]] retain]; authenticationString = [[NSString stringWithFormat:@"GoogleLogin auth=%@", [info objectForKey:@"Auth"]] retain];
isAuthenticating = NO; isAuthenticating = NO;
while ([afterAuthentication count]!=0) { while ([afterAuthentication count]!=0) {
@ -139,12 +131,10 @@ const BOOL MGMGoogleContactsInvisible = YES;
if ([contactsSender respondsToSelector:@selector(contactsError:)]) [contactsSender contactsError:theError]; if ([contactsSender respondsToSelector:@selector(contactsError:)]) [contactsSender contactsError:theError];
} }
- (void)contactsDidFinish:(NSDictionary *)theInfo { - (void)contactsDidFinish:(NSDictionary *)theInfo {
if (releaseTimer!=nil) {
[releaseTimer invalidate]; [releaseTimer invalidate];
[releaseTimer release]; [releaseTimer release];
releaseTimer = nil; releaseTimer = nil;
} [contacts release];
if (contacts!=nil) [contacts release];
contacts = [NSMutableArray new]; contacts = [NSMutableArray new];
MGMXMLElement *XML = [(MGMXMLDocument *)[[[MGMXMLDocument alloc] initWithData:[theInfo objectForKey:MGMConnectionData] options:MGMXMLDocumentTidyXML error:nil] autorelease] rootElement]; MGMXMLElement *XML = [(MGMXMLDocument *)[[[MGMXMLDocument alloc] initWithData:[theInfo objectForKey:MGMConnectionData] options:MGMXMLDocumentTidyXML error:nil] autorelease] rootElement];
contactEntries = [[XML elementsForName:@"entry"] retain]; contactEntries = [[XML elementsForName:@"entry"] retain];
@ -254,16 +244,12 @@ const BOOL MGMGoogleContactsInvisible = YES;
} }
} }
- (void)releaseContacts { - (void)releaseContacts {
if (releaseTimer!=nil) {
[releaseTimer invalidate]; [releaseTimer invalidate];
[releaseTimer release]; [releaseTimer release];
releaseTimer = nil; releaseTimer = nil;
}
if (contacts!=nil) {
[contacts release]; [contacts release];
contacts = nil; contacts = nil;
} }
}
- (void)getGroups:(id)sender { - (void)getGroups:(id)sender {
if (isAuthenticating) { if (isAuthenticating) {

View File

@ -144,12 +144,16 @@
return number; return number;
} }
- (BOOL)isPhone { - (BOOL)isPhone {
if ([self rangeOfString:@"@"].location!=NSNotFound)
return YES;
NSString *number = [self removePhoneWhiteSpace]; NSString *number = [self removePhoneWhiteSpace];
if ([number length]<1) if ([number length]<1)
return NO; return NO;
return [[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[number characterAtIndex:0]]; return [[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[number characterAtIndex:0]];
} }
- (BOOL)isPhoneComplete { - (BOOL)isPhoneComplete {
if ([self rangeOfString:@"@"].location!=NSNotFound)
return YES;
NSString *number = [self removePhoneWhiteSpace]; NSString *number = [self removePhoneWhiteSpace];
if ([number length]<1 || ![[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[number characterAtIndex:0]]) if ([number length]<1 || ![[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[number characterAtIndex:0]])
return NO; return NO;
@ -162,6 +166,8 @@
return NO; return NO;
} }
- (NSString *)phoneFormatWithAreaCode:(NSString *)theAreaCode { - (NSString *)phoneFormatWithAreaCode:(NSString *)theAreaCode {
if ([self rangeOfString:@"@"].location!=NSNotFound)
return self;
NSString *number = [[self removePhoneWhiteSpace] littersToNumbers]; NSString *number = [[self removePhoneWhiteSpace] littersToNumbers];
if (![number hasPrefix:@"011"]) { if (![number hasPrefix:@"011"]) {
int length = [number length]; int length = [number length];
@ -175,6 +181,8 @@
return number; return number;
} }
- (NSString *)phoneFormatAreaCode:(NSString *)theAreaCode { - (NSString *)phoneFormatAreaCode:(NSString *)theAreaCode {
if ([self rangeOfString:@"@"].location!=NSNotFound)
return self;
NSString *number = [[self removePhoneWhiteSpace] littersToNumbers]; NSString *number = [[self removePhoneWhiteSpace] littersToNumbers];
if (![number hasPrefix:@"011"]) { if (![number hasPrefix:@"011"]) {
int length = [number length]; int length = [number length];
@ -186,6 +194,8 @@
return number; return number;
} }
- (NSString *)phoneFormat { - (NSString *)phoneFormat {
if ([self rangeOfString:@"@"].location!=NSNotFound)
return self;
NSString *number = [[self removePhoneWhiteSpace] littersToNumbers]; NSString *number = [[self removePhoneWhiteSpace] littersToNumbers];
if (![number hasPrefix:@"011"]) { if (![number hasPrefix:@"011"]) {
if ([number hasPrefix:@"1"]) if ([number hasPrefix:@"1"])
@ -1371,6 +1381,8 @@ NSComparisonResult dateSort(NSDictionary *info1, NSDictionary *info2, void *cont
#else #else
NSImage *image = [[NSImage alloc] initWithData:self]; NSImage *image = [[NSImage alloc] initWithData:self];
#endif #endif
if (image==nil)
return self;
if (image!=nil) { if (image!=nil) {
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
CGSize size = [image size]; CGSize size = [image size];
@ -1416,6 +1428,8 @@ NSComparisonResult dateSort(NSDictionary *info1, NSDictionary *info2, void *cont
NSSize newSize = NSMakeSize(scaledWidth, scaledHeight); NSSize newSize = NSMakeSize(scaledWidth, scaledHeight);
if (!NSEqualSizes(newSize, NSZeroSize)) { if (!NSEqualSizes(newSize, NSZeroSize)) {
NSImage *newImage = [[NSImage alloc] initWithSize:newSize]; NSImage *newImage = [[NSImage alloc] initWithSize:newSize];
if (newImage==nil || NSEqualSizes([newImage size], NSZeroSize))
return self;
[newImage lockFocus]; [newImage lockFocus];
NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext]; NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
[graphicsContext setImageInterpolation:NSImageInterpolationHigh]; [graphicsContext setImageInterpolation:NSImageInterpolationHigh];

View File

@ -73,17 +73,15 @@ const BOOL MGMInboxInvisible = YES;
return [[[self alloc] initWithInstance:theInstance] autorelease]; return [[[self alloc] initWithInstance:theInstance] autorelease];
} }
- (id)initWithInstance:(MGMInstance *)theInstance { - (id)initWithInstance:(MGMInstance *)theInstance {
if (self = [super init]) { if ((self = [super init])) {
instance = theInstance; instance = theInstance;
connectionManager = [[MGMURLConnectionManager managerWithCookieStorage:[theInstance cookieStorage]] retain]; connectionManager = [[MGMURLConnectionManager managerWithCookieStorage:[theInstance cookieStorage]] retain];
} }
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (connectionManager!=nil) {
[connectionManager cancelAll]; [connectionManager cancelAll];
[connectionManager release]; [connectionManager release];
}
[super dealloc]; [super dealloc];
} }

View File

@ -58,7 +58,7 @@ const BOOL MGMInstanceInvisible = YES;
return [[[self alloc] initWithUser:theUser delegate:theDelegate isCheck:isCheck] autorelease]; return [[[self alloc] initWithUser:theUser delegate:theDelegate isCheck:isCheck] autorelease];
} }
- (id)initWithUser:(MGMUser *)theUser delegate:(id)theDelegate isCheck:(BOOL)isCheck { - (id)initWithUser:(MGMUser *)theUser delegate:(id)theDelegate isCheck:(BOOL)isCheck {
if (self = [super init]) { if ((self = [super init])) {
checkingAccount = isCheck; checkingAccount = isCheck;
loggedIn = NO; loggedIn = NO;
webLoginTries = 0; webLoginTries = 0;
@ -75,44 +75,26 @@ const BOOL MGMInstanceInvisible = YES;
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (connectionManager!=nil) {
[connectionManager cancelAll]; [connectionManager cancelAll];
[connectionManager release]; [connectionManager release];
}
if (user!=nil)
[user release]; [user release];
if (cookeStorage!=nil)
[cookeStorage release]; [cookeStorage release];
if (inbox!=nil)
[inbox release]; [inbox release];
if (contacts!=nil)
[contacts release]; [contacts release];
if (XPCURL!=nil)
[XPCURL release]; [XPCURL release];
if (XPCCD!=nil)
[XPCCD release]; [XPCCD release];
if (rnr_se!=nil)
[rnr_se release]; [rnr_se release];
if (userName!=nil)
[userName release]; [userName release];
if (userNumber!=nil)
[userNumber release]; [userNumber release];
if (userAreacode!=nil)
[userAreacode release]; [userAreacode release];
if (userPhoneNumbers!=nil)
[userPhoneNumbers release]; [userPhoneNumbers release];
if (checkTimer!=nil) {
[checkTimer invalidate]; [checkTimer invalidate];
[checkTimer release]; [checkTimer release];
checkTimer = nil; checkTimer = nil;
}
if (unreadCounts!=nil)
[unreadCounts release]; [unreadCounts release];
if (creditTimer!=nil) {
[creditTimer invalidate]; [creditTimer invalidate];
[creditTimer release]; [creditTimer release];
creditTimer = nil; creditTimer = nil;
}
[super dealloc]; [super dealloc];
} }
@ -125,17 +107,13 @@ const BOOL MGMInstanceInvisible = YES;
[contacts stop]; [contacts stop];
[inbox stop]; [inbox stop];
[connectionManager cancelAll]; [connectionManager cancelAll];
if (checkTimer!=nil) {
[checkTimer invalidate]; [checkTimer invalidate];
[checkTimer release]; [checkTimer release];
checkTimer = nil; checkTimer = nil;
}
if (creditTimer!=nil) {
[creditTimer invalidate]; [creditTimer invalidate];
[creditTimer release]; [creditTimer release];
creditTimer = nil; creditTimer = nil;
} }
}
- (void)registerSettings { - (void)registerSettings {
NSMutableDictionary *settings = [NSMutableDictionary dictionary]; NSMutableDictionary *settings = [NSMutableDictionary dictionary];
@ -323,7 +301,7 @@ const BOOL MGMInstanceInvisible = YES;
if (range.location==NSNotFound) { if (range.location==NSNotFound) {
NSLog(@"failed 0001"); NSLog(@"failed 0001");
} else { } else {
if (rnr_se!=nil) [rnr_se release]; [rnr_se release];
rnr_se = [[[string substringWithRange:NSMakeRange(0, range.location)] addPercentEscapes] copy]; rnr_se = [[[string substringWithRange:NSMakeRange(0, range.location)] addPercentEscapes] copy];
} }
} }
@ -364,7 +342,7 @@ const BOOL MGMInstanceInvisible = YES;
if (range.location==NSNotFound) { if (range.location==NSNotFound) {
NSLog(@"failed 0003.1"); NSLog(@"failed 0003.1");
} else { } else {
if (userName!=nil) [userName release]; [userName release];
userName = [[string substringWithRange:NSMakeRange(0, range.location)] copy]; userName = [[string substringWithRange:NSMakeRange(0, range.location)] copy];
} }
} }
@ -406,7 +384,7 @@ const BOOL MGMInstanceInvisible = YES;
if (range.location==NSNotFound) { if (range.location==NSNotFound) {
NSLog(@"failed 0004.1"); NSLog(@"failed 0004.1");
} else { } else {
if (userNumber!=nil) [userNumber release]; [userNumber release];
userNumber = [[[string substringWithRange:NSMakeRange(0, range.location)] phoneFormat] copy]; userNumber = [[[string substringWithRange:NSMakeRange(0, range.location)] phoneFormat] copy];
} }
} }
@ -420,7 +398,7 @@ const BOOL MGMInstanceInvisible = YES;
} }
return; return;
} }
if (userAreacode!=nil) [userAreacode release]; [userAreacode release];
userAreacode = [[userNumber areaCode] copy]; userAreacode = [[userNumber areaCode] copy];
#if MGMInstanceDebug #if MGMInstanceDebug
NSLog(@"Google Number = %@", userNumber); NSLog(@"Google Number = %@", userNumber);
@ -441,7 +419,7 @@ const BOOL MGMInstanceInvisible = YES;
NSDictionary *phones = [phonesInfo parseJSON]; NSDictionary *phones = [phonesInfo parseJSON];
//NSLog(@"%@", phones); //NSLog(@"%@", phones);
NSArray *phoneKeys = [phones allKeys]; NSArray *phoneKeys = [phones allKeys];
if (userPhoneNumbers!=nil) [userPhoneNumbers release]; [userPhoneNumbers release];
userPhoneNumbers = [NSMutableArray new]; userPhoneNumbers = [NSMutableArray new];
for (int i=0; i<[phoneKeys count]; i++) { for (int i=0; i<[phoneKeys count]; i++) {
NSDictionary *phoneInfo = [phones objectForKey:[phoneKeys objectAtIndex:i]]; NSDictionary *phoneInfo = [phones objectForKey:[phoneKeys objectAtIndex:i]];
@ -465,7 +443,7 @@ const BOOL MGMInstanceInvisible = YES;
if (range.location==NSNotFound) { if (range.location==NSNotFound) {
NSLog(@"failed 0008"); NSLog(@"failed 0008");
} else { } else {
if (XPCURL!=nil) [XPCURL release]; [XPCURL release];
XPCURL = [[string substringWithRange:NSMakeRange(0, range.location)] copy]; XPCURL = [[string substringWithRange:NSMakeRange(0, range.location)] copy];
} }
} }
@ -476,16 +454,12 @@ const BOOL MGMInstanceInvisible = YES;
if (delegate!=nil && [delegate respondsToSelector:@selector(loginSuccessful)]) [delegate loginSuccessful]; if (delegate!=nil && [delegate respondsToSelector:@selector(loginSuccessful)]) [delegate loginSuccessful];
if (!checkingAccount) { if (!checkingAccount) {
[contacts updateContacts]; [contacts updateContacts];
if (checkTimer!=nil) {
[checkTimer invalidate]; [checkTimer invalidate];
[checkTimer release]; [checkTimer release];
}
checkTimer = [[NSTimer scheduledTimerWithTimeInterval:15.0 target:self selector:@selector(checkTimer) userInfo:nil repeats:YES] retain]; checkTimer = [[NSTimer scheduledTimerWithTimeInterval:15.0 target:self selector:@selector(checkTimer) userInfo:nil repeats:YES] retain];
[checkTimer fire]; [checkTimer fire];
if (creditTimer!=nil) {
[creditTimer invalidate]; [creditTimer invalidate];
[creditTimer release]; [creditTimer release];
}
creditTimer = [[NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(creditTimer) userInfo:nil repeats:YES] retain]; creditTimer = [[NSTimer scheduledTimerWithTimeInterval:60.0 target:self selector:@selector(creditTimer) userInfo:nil repeats:YES] retain];
[creditTimer fire]; [creditTimer fire];
} }
@ -503,7 +477,7 @@ const BOOL MGMInstanceInvisible = YES;
range = [string rangeOfString:@"'"]; range = [string rangeOfString:@"'"];
if (range.location==NSNotFound) NSLog(@"failed 0009"); if (range.location==NSNotFound) NSLog(@"failed 0009");
if (XPCCD!=nil) [XPCCD release]; [XPCCD release];
XPCCD = [[[string substringWithRange:NSMakeRange(0, range.location)] addPercentEscapes] copy]; XPCCD = [[[string substringWithRange:NSMakeRange(0, range.location)] addPercentEscapes] copy];
} }
#if MGMInstanceDebug #if MGMInstanceDebug
@ -535,7 +509,7 @@ const BOOL MGMInstanceInvisible = YES;
if (delegate!=nil && [delegate respondsToSelector:@selector(updateVoicemail)]) [delegate updateVoicemail]; if (delegate!=nil && [delegate respondsToSelector:@selector(updateVoicemail)]) [delegate updateVoicemail];
if (smsCount>0) if (smsCount>0)
if (delegate!=nil && [delegate respondsToSelector:@selector(updateSMS)]) [delegate updateSMS]; if (delegate!=nil && [delegate respondsToSelector:@selector(updateSMS)]) [delegate updateSMS];
if (unreadCounts!=nil) [unreadCounts release]; [unreadCounts release];
unreadCounts = [currentUnreadCounts copy]; unreadCounts = [currentUnreadCounts copy];
} }
} }
@ -640,7 +614,9 @@ const BOOL MGMInstanceInvisible = YES;
} }
} }
} else { } else {
NSDictionary *info = [NSDictionary dictionaryWithObject:[infoDic objectForKey:@"error"] forKey:NSLocalizedDescriptionKey]; NSDictionary *info = nil;
if ([infoDic objectForKey:@"error"]!=nil)
info = [NSDictionary dictionaryWithObject:[infoDic objectForKey:@"error"] forKey:NSLocalizedDescriptionKey];
NSError *error = [NSError errorWithDomain:@"com.MrGeckosMedia.VoiceBase.Call" code:1 userInfo:info]; NSError *error = [NSError errorWithDomain:@"com.MrGeckosMedia.VoiceBase.Call" code:1 userInfo:info];
NSDictionary *thisInfo = [theInfo objectForKey:MGMConnectionObject]; NSDictionary *thisInfo = [theInfo objectForKey:MGMConnectionObject];
if ([thisInfo objectForKey:MGMIDidFailWithError]!=nil) { if ([thisInfo objectForKey:MGMIDidFailWithError]!=nil) {

View File

@ -22,6 +22,8 @@
@interface MGMSound : NSObject @interface MGMSound : NSObject
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
<AVAudioPlayerDelegate> <AVAudioPlayerDelegate>
#else
<NSSoundDelegate>
#endif #endif
{ {
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE

View File

@ -10,7 +10,7 @@
@implementation MGMSound @implementation MGMSound
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
loops = NO; loops = NO;
} }
return self; return self;
@ -19,7 +19,7 @@
return [self initWithContentsOfURL:[NSURL fileURLWithPath:theFile]]; return [self initWithContentsOfURL:[NSURL fileURLWithPath:theFile]];
} }
- (id)initWithContentsOfURL:(NSURL *)theURL { - (id)initWithContentsOfURL:(NSURL *)theURL {
if (self = [self init]) { if ((self = [self init])) {
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
sound = [[AVAudioPlayer alloc] initWithContentsOfURL:theURL error:nil]; sound = [[AVAudioPlayer alloc] initWithContentsOfURL:theURL error:nil];
#else #else
@ -30,7 +30,7 @@
return self; return self;
} }
- (id)initWithData:(NSData *)theData { - (id)initWithData:(NSData *)theData {
if (self = [self init]) { if ((self = [self init])) {
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
sound = [[AVAudioPlayer alloc] initWithData:theData error:nil]; sound = [[AVAudioPlayer alloc] initWithData:theData error:nil];
#else #else
@ -41,11 +41,9 @@
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (sound!=nil) {
[sound setDelegate:nil]; [sound setDelegate:nil];
[sound stop]; [sound stop];
[sound release]; [sound release];
}
[super dealloc]; [super dealloc];
} }

View File

@ -76,6 +76,7 @@ extern NSString * const MGMMP3Ext;
extern NSString * const MGMWavExt; extern NSString * const MGMWavExt;
extern NSString * const MGMAuExt; extern NSString * const MGMAuExt;
extern NSString * const MGMM4AExt; extern NSString * const MGMM4AExt;
extern NSString * const MGMCAFExt;
@interface MGMThemeManager : NSObject { @interface MGMThemeManager : NSObject {
NSMutableDictionary *currentTheme; NSMutableDictionary *currentTheme;

View File

@ -108,10 +108,11 @@ NSString * const MGMMP3Ext = @"mp3";
NSString * const MGMWavExt = @"wav"; NSString * const MGMWavExt = @"wav";
NSString * const MGMAuExt = @"au"; NSString * const MGMAuExt = @"au";
NSString * const MGMM4AExt = @"m4a"; NSString * const MGMM4AExt = @"m4a";
NSString * const MGMCAFExt = @"caf";
@implementation MGMThemeManager @implementation MGMThemeManager
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
shouldPostNotification = NO; shouldPostNotification = NO;
[self registerDefaults]; [self registerDefaults];
if (![self setupCurrentTheme]) { if (![self setupCurrentTheme]) {
@ -128,7 +129,6 @@ NSString * const MGMM4AExt = @"m4a";
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (currentTheme!=nil)
[currentTheme release]; [currentTheme release];
[super dealloc]; [super dealloc];
} }
@ -172,17 +172,25 @@ NSString * const MGMM4AExt = @"m4a";
- (NSDictionary *)sounds { - (NSDictionary *)sounds {
NSFileManager *manager = [NSFileManager defaultManager]; NSFileManager *manager = [NSFileManager defaultManager];
NSMutableDictionary *sounds = [NSMutableDictionary dictionary]; NSMutableDictionary *sounds = [NSMutableDictionary dictionary];
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC
NSMutableArray *systemSounds = [NSMutableArray array]; NSMutableArray *systemSounds = [NSMutableArray array];
NSMutableArray *userSounds = [NSMutableArray array]; NSMutableArray *userSounds = [NSMutableArray array];
#endif
NSMutableArray *unknownSounds = [NSMutableArray array]; NSMutableArray *unknownSounds = [NSMutableArray array];
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC
NSString *systemSoundsPath = @"/System/Library/Sounds/"; NSString *systemSoundsPath = @"/System/Library/Sounds/";
NSString *userSoundsPath = [@"~/Library/Sounds/" stringByExpandingTildeInPath]; NSString *userSoundsPath = [@"~/Library/Sounds/" stringByExpandingTildeInPath];
NSArray *allowedExtensions = [NSArray arrayWithObjects:MGMAiffExt, MGMAifExt, MGMMP3Ext, MGMWavExt, MGMAuExt, MGMM4AExt, nil]; #endif
NSArray *checkPaths = [NSArray arrayWithObjects:[self soundsFolderPath], [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:MGMTSoundsFolder], systemSoundsPath, userSoundsPath, nil]; NSArray *allowedExtensions = [NSArray arrayWithObjects:MGMAiffExt, MGMAifExt, MGMMP3Ext, MGMWavExt, MGMAuExt, MGMM4AExt, MGMCAFExt, nil];
NSArray *checkPaths = [NSArray arrayWithObjects:[self soundsFolderPath], [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:MGMTSoundsFolder]
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC
, systemSoundsPath, userSoundsPath
#endif
, nil];
for (int i=0; i<[checkPaths count]; i++) { for (int i=0; i<[checkPaths count]; i++) {
NSDirectoryEnumerator *soundFolders = [manager enumeratorAtPath:[checkPaths objectAtIndex:i]]; NSDirectoryEnumerator *soundFolders = [manager enumeratorAtPath:[checkPaths objectAtIndex:i]];
NSString *soundName = nil; NSString *soundName = nil;
while (soundName = [soundFolders nextObject]) { while ((soundName = [soundFolders nextObject])) {
NSString *path = [[[checkPaths objectAtIndex:i] stringByAppendingPathComponent:soundName] stringByResolvingSymlinksInPath]; NSString *path = [[[checkPaths objectAtIndex:i] stringByAppendingPathComponent:soundName] stringByResolvingSymlinksInPath];
if ([[[soundName pathExtension] lowercaseString] isEqual:MGMTSoundExt]) { if ([[[soundName pathExtension] lowercaseString] isEqual:MGMTSoundExt]) {
if (![manager fileExistsAtPath:[path stringByAppendingPathComponent:MGMTInfoPlist]]) if (![manager fileExistsAtPath:[path stringByAppendingPathComponent:MGMTInfoPlist]])
@ -212,20 +220,27 @@ NSString * const MGMM4AExt = @"m4a";
NSMutableDictionary *sound = [NSMutableDictionary dictionary]; NSMutableDictionary *sound = [NSMutableDictionary dictionary];
[sound setObject:[soundName stringByDeletingPathExtension] forKey:MGMTSName]; [sound setObject:[soundName stringByDeletingPathExtension] forKey:MGMTSName];
[sound setObject:path forKey:MGMTSPath]; [sound setObject:path forKey:MGMTSPath];
if ([[checkPaths objectAtIndex:i] isEqual:systemSoundsPath]) #if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC
if ([[checkPaths objectAtIndex:i] isEqual:systemSoundsPath] && ![systemSounds containsObject:sound])
[systemSounds addObject:sound]; [systemSounds addObject:sound];
else if ([[checkPaths objectAtIndex:i] isEqual:userSoundsPath]) else if ([[checkPaths objectAtIndex:i] isEqual:userSoundsPath] && ![userSounds containsObject:sound])
[userSounds addObject:sound]; [userSounds addObject:sound];
else else if (![[checkPaths objectAtIndex:i] isEqual:systemSoundsPath] && ![[checkPaths objectAtIndex:i] isEqual:userSoundsPath] && ![unknownSounds containsObject:sound])
[unknownSounds addObject:sound]; [unknownSounds addObject:sound];
#else
if (![unknownSounds containsObject:sound])
[unknownSounds addObject:sound];
#endif
} }
} }
} }
#if TARGET_IPHONE_SIMULATOR || TARGET_OS_MAC
if ([systemSounds count]>0) if ([systemSounds count]>0)
[sounds setObject:systemSounds forKey:@"System Sounds"]; [sounds setObject:systemSounds forKey:@"System Sounds"];
if ([userSounds count]>0) if ([userSounds count]>0)
[sounds setObject:userSounds forKey:@"User Sounds"]; [sounds setObject:userSounds forKey:@"User Sounds"];
if ([unknownSounds count]>1) if ([unknownSounds count]>1)
#endif
[sounds setObject:unknownSounds forKey:@"Unknown"]; [sounds setObject:unknownSounds forKey:@"Unknown"];
return sounds; return sounds;
} }
@ -255,7 +270,12 @@ NSString * const MGMM4AExt = @"m4a";
return path; return path;
path = [path replace:MGMTPResource with:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:MGMTSoundsFolder]]; path = [path replace:MGMTPResource with:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:MGMTSoundsFolder]];
path = [path replace:MGMTPSounds with:[self soundsFolderPath]]; path = [path replace:MGMTPSounds with:[self soundsFolderPath]];
return [path stringByAppendingPathComponent:[defaults objectForKey:[MGMTSName stringByAppendingString:theSoundName]]]; path = [path stringByAppendingPathComponent:[defaults objectForKey:[MGMTSName stringByAppendingString:theSoundName]]];
if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
[defaults setObject:MGMTNoSound forKey:[MGMTSPath stringByAppendingString:theSoundName]];
path = MGMTNoSound;
}
return path;
} }
- (BOOL)setSound:(NSString *)theSoundName withPath:(NSString *)thePath { - (BOOL)setSound:(NSString *)theSoundName withPath:(NSString *)thePath {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
@ -374,7 +394,7 @@ NSString * const MGMM4AExt = @"m4a";
for (int i=0; i<[checkPaths count]; i++) { for (int i=0; i<[checkPaths count]; i++) {
NSDirectoryEnumerator *themeFolders = [manager enumeratorAtPath:[checkPaths objectAtIndex:i]]; NSDirectoryEnumerator *themeFolders = [manager enumeratorAtPath:[checkPaths objectAtIndex:i]];
NSString *themeFolder = nil; NSString *themeFolder = nil;
while (themeFolder = [themeFolders nextObject]) { while ((themeFolder = [themeFolders nextObject])) {
if ([[[themeFolder pathExtension] lowercaseString] isEqual:MGMTThemeExt]) { if ([[[themeFolder pathExtension] lowercaseString] isEqual:MGMTThemeExt]) {
NSString *folder = [[[checkPaths objectAtIndex:i] stringByAppendingPathComponent:themeFolder] stringByResolvingSymlinksInPath]; NSString *folder = [[[checkPaths objectAtIndex:i] stringByAppendingPathComponent:themeFolder] stringByResolvingSymlinksInPath];
if (![manager fileExistsAtPath:[folder stringByAppendingPathComponent:MGMTInfoPlist]]) if (![manager fileExistsAtPath:[folder stringByAppendingPathComponent:MGMTInfoPlist]])
@ -394,7 +414,7 @@ NSString * const MGMM4AExt = @"m4a";
} }
- (BOOL)setTheme:(NSDictionary *)theTheme { - (BOOL)setTheme:(NSDictionary *)theTheme {
BOOL isNew = ![[theTheme objectForKey:MGMTThemePath] isEqual:[self currentThemePath]]; BOOL isNew = ![[theTheme objectForKey:MGMTThemePath] isEqual:[self currentThemePath]];
if (currentTheme!=nil) [currentTheme release]; [currentTheme release];
currentTheme = [theTheme mutableCopy]; currentTheme = [theTheme mutableCopy];
NSFileManager<NSFileManagerProtocol> *manager = [NSFileManager defaultManager]; NSFileManager<NSFileManagerProtocol> *manager = [NSFileManager defaultManager];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

View File

@ -30,6 +30,7 @@ extern NSString * const MGMSIPNameServersEnabled;
extern NSString * const MGMSIPEchoCacnellationEnabled; extern NSString * const MGMSIPEchoCacnellationEnabled;
extern NSString * const MGMSIPPort; extern NSString * const MGMSIPPort;
extern NSString * const MGMSIPPublicAddress; extern NSString * const MGMSIPPublicAddress;
extern NSString * const MGMSIPUserAgent;
extern NSString * const MGMNetworkConnectedNotification; extern NSString * const MGMNetworkConnectedNotification;
extern NSString * const MGMNetworkDisconnectedNotification; extern NSString * const MGMNetworkDisconnectedNotification;

View File

@ -38,6 +38,7 @@ NSString * const MGMSIPNameServersEnabled = @"MGMSIPNameServersEnabled";
NSString * const MGMSIPEchoCacnellationEnabled = @"MGMSIPEchoCacnellationEnabled"; NSString * const MGMSIPEchoCacnellationEnabled = @"MGMSIPEchoCacnellationEnabled";
NSString * const MGMSIPPort = @"MGMSIPPort"; NSString * const MGMSIPPort = @"MGMSIPPort";
NSString * const MGMSIPPublicAddress = @"MGMSIPPublicAddress"; NSString * const MGMSIPPublicAddress = @"MGMSIPPublicAddress";
NSString * const MGMSIPUserAgent = @"MGMSIPUserAgent";
NSString * const MGMNetworkConnectedNotification = @"MGMNetworkConnectedNotification"; NSString * const MGMNetworkConnectedNotification = @"MGMNetworkConnectedNotification";
NSString * const MGMNetworkDisconnectedNotification = @"MGMNetworkDisconnectedNotification"; NSString * const MGMNetworkDisconnectedNotification = @"MGMNetworkDisconnectedNotification";
@ -206,7 +207,8 @@ static void MGMSIPCallTransferStatusChanged(pjsua_call_id callIdentifier, int st
static void MGMSIPAccountRegistrationStateChanged(pjsua_acc_id accountIdentifier) { static void MGMSIPAccountRegistrationStateChanged(pjsua_acc_id accountIdentifier) {
NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSAutoreleasePool *pool = [NSAutoreleasePool new];
MGMSIPAccount *account = [[MGMSIP sharedSIP] accountWithIdentifier:accountIdentifier]; MGMSIPAccount *account = [[MGMSIP sharedSIP] accountWithIdentifier:accountIdentifier];
if ([account delegate]!=nil && [[account delegate] respondsToSelector:@selector(registrationChanged)]) [(NSObject *)[account delegate] performSelectorOnMainThread:@selector(registrationChanged) withObject:nil waitUntilDone:NO]; [account registrationStateChanged];
if ([account delegate]!=nil && [[account delegate] respondsToSelector:@selector(registrationChanged)]) [(NSObject *)[account delegate] performSelectorOnMainThread:@selector(registrationChanged) withObject:nil waitUntilDone:YES];
[pool drain]; [pool drain];
} }
@ -265,7 +267,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
return MGMSIPSingleton; return MGMSIPSingleton;
} }
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
[self registerDefaults]; [self registerDefaults];
port = [[NSUserDefaults standardUserDefaults] integerForKey:MGMSIPPort]; port = [[NSUserDefaults standardUserDefaults] integerForKey:MGMSIPPort];
lock = [NSLock new]; lock = [NSLock new];
@ -310,9 +312,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
if (store!=NULL) if (store!=NULL)
CFRelease(store); CFRelease(store);
#endif #endif
if (lock!=nil)
[lock release]; [lock release];
if (accounts!=nil)
[accounts release]; [accounts release];
[super dealloc]; [super dealloc];
} }
@ -387,11 +387,9 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
if (state>MGMSIPStoppedState) if (state>MGMSIPStoppedState)
return; return;
if (restartTimer!=nil) {
[restartTimer invalidate]; [restartTimer invalidate];
[restartTimer release]; [restartTimer release];
restartTimer = nil; restartTimer = nil;
}
[NSThread detachNewThreadSelector:@selector(startBackground) toTarget:self withObject:nil]; [NSThread detachNewThreadSelector:@selector(startBackground) toTarget:self withObject:nil];
} }
@ -431,7 +429,10 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
pjsua_config sipConfig; pjsua_config sipConfig;
pjsua_config_default(&sipConfig); pjsua_config_default(&sipConfig);
if ([defaults objectForKey:MGMSIPUserAgent]==nil || [[defaults objectForKey:MGMSIPUserAgent] isEqual:@""])
sipConfig.user_agent = [[NSString stringWithFormat:@"%@ %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey], [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]] PJString]; sipConfig.user_agent = [[NSString stringWithFormat:@"%@ %@", [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleNameKey], [[NSBundle mainBundle] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]] PJString];
else
sipConfig.user_agent = [[defaults objectForKey:MGMSIPUserAgent] PJString];
sipConfig.cb.on_incoming_call = &MGMSIPIncomingCallReceived; sipConfig.cb.on_incoming_call = &MGMSIPIncomingCallReceived;
sipConfig.cb.on_call_media_state = &MGMSIPCallMediaStateChanged; sipConfig.cb.on_call_media_state = &MGMSIPCallMediaStateChanged;
@ -454,7 +455,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
} }
CFRelease(dynamicStore); CFRelease(dynamicStore);
if ([nameServers count]>=0) { if ([nameServers count]>0) {
sipConfig.nameserver_count = ([nameServers count]>4 ? 4 : [nameServers count]); sipConfig.nameserver_count = ([nameServers count]>4 ? 4 : [nameServers count]);
for (int i=0; i<[nameServers count] && i<4; i++) for (int i=0; i<[nameServers count] && i<4; i++)
sipConfig.nameserver[i] = [[nameServers objectAtIndex:i] PJString]; sipConfig.nameserver[i] = [[nameServers objectAtIndex:i] PJString];
@ -541,7 +542,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, &transportConfig, &TCPTransport); status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, &transportConfig, &TCPTransport);
if (status!=PJ_SUCCESS) { if (status!=PJ_SUCCESS) {
NSLog(@"Error creating TCP transport"); NSLog(@"Error creating tcp transport");
} else { } else {
pjsua_acc_add_local(TCPTransport, PJ_TRUE, &TCPAccount); pjsua_acc_add_local(TCPTransport, PJ_TRUE, &TCPAccount);
pjsua_acc_set_online_status(pjsua_acc_get_default(), PJ_TRUE); pjsua_acc_set_online_status(pjsua_acc_get_default(), PJ_TRUE);
@ -646,11 +647,9 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
[pool drain]; [pool drain];
} }
- (void)startRestartTimer { - (void)startRestartTimer {
if (restartTimer!=nil) {
[restartTimer invalidate]; [restartTimer invalidate];
[restartTimer release]; [restartTimer release];
restartTimer = nil; restartTimer = nil;
}
restartTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(start) userInfo:nil repeats:NO] retain]; restartTimer = [[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(start) userInfo:nil repeats:NO] retain];
} }
- (void)restart { - (void)restart {
@ -672,12 +671,10 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
#if !TARGET_OS_IPHONE #if !TARGET_OS_IPHONE
[self updateAudioDevices]; [self updateAudioDevices];
#endif #endif
if (restartAccounts!=nil) {
[restartAccounts makeObjectsPerformSelector:@selector(login)]; [restartAccounts makeObjectsPerformSelector:@selector(login)];
[restartAccounts release]; [restartAccounts release];
restartAccounts = nil; restartAccounts = nil;
} }
}
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
- (void)keepAlive { - (void)keepAlive {
@ -744,7 +741,12 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
else else
accountConfig.id = [[NSString stringWithFormat:@"<sip:%@>", [theAccount SIPAddress]] PJString]; accountConfig.id = [[NSString stringWithFormat:@"<sip:%@>", [theAccount SIPAddress]] PJString];
NSString *registerURI = [NSString stringWithFormat:@"sip:%@", [theAccount registrar]]; NSString *registerURI = [NSString stringWithFormat:@"sip:%@", [theAccount registrar]];
accountConfig.reg_uri = [[registerURI stringByAppendingString:@";transport=tcp"] PJString]; NSString *transport = @"";
if ([theAccount transport]==1)
transport = @";transport=tcp";
else if ([theAccount transport]==2)
transport = @";transport=udp";
accountConfig.reg_uri = [[registerURI stringByAppendingString:transport] PJString];
if ([theAccount proxy]!=nil && ![[theAccount proxy] isEqual:@""]) { if ([theAccount proxy]!=nil && ![[theAccount proxy] isEqual:@""]) {
accountConfig.proxy_cnt = 1; accountConfig.proxy_cnt = 1;
@ -761,9 +763,6 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
pjsua_acc_id identifier; pjsua_acc_id identifier;
pj_status_t status = pjsua_acc_add(&accountConfig, PJ_FALSE, &identifier); pj_status_t status = pjsua_acc_add(&accountConfig, PJ_FALSE, &identifier);
if (status!=PJ_SUCCESS) {
accountConfig.reg_uri = [registerURI PJString];
pj_status_t status = pjsua_acc_add(&accountConfig, PJ_FALSE, &identifier);
if (status!=PJ_SUCCESS) { if (status!=PJ_SUCCESS) {
[theAccount setLastError:[NSString stringWithFormat:@"Unable to login with status %d.", status]]; [theAccount setLastError:[NSString stringWithFormat:@"Unable to login with status %d.", status]];
[theAccount loginErrored]; [theAccount loginErrored];
@ -773,7 +772,6 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
[pool drain]; [pool drain];
return; return;
} }
}
[theAccount setIdentifier:identifier]; [theAccount setIdentifier:identifier];
[theAccount setOnline:YES]; [theAccount setOnline:YES];
bzero(&PJThreadDesc, sizeof(pj_thread_desc)); bzero(&PJThreadDesc, sizeof(pj_thread_desc));
@ -837,7 +835,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
} }
} }
if ([accounts count]<=1) if ([accounts count]<=1)
return [[accounts objectAtIndex:0] identifier]; return [(MGMSIPAccount *)[accounts objectAtIndex:0] identifier];
return PJSUA_INVALID_ID; return PJSUA_INVALID_ID;
} }
- (MGMSIPAccount *)accountWithIdentifier:(pjsua_acc_id)theIdentifier { - (MGMSIPAccount *)accountWithIdentifier:(pjsua_acc_id)theIdentifier {
@ -1073,7 +1071,7 @@ static OSStatus MGMAudioDevicesChanged(AudioHardwarePropertyID propertyID, void
} }
free(devices); free(devices);
if (audioDevices!=nil) [audioDevices release]; [audioDevices release];
audioDevices = [devicesArray copy]; audioDevices = [devicesArray copy];
//if ((currentInput==-1 ? defaultInputIndex!=lastInputDevice : currentInput!=lastInputDevice) && (currentOutput==-1 ? defaultOutputIndex!=lastOutputDevice : currentOutput!=lastOutputDevice)) { //if ((currentInput==-1 ? defaultInputIndex!=lastInputDevice : currentInput!=lastInputDevice) && (currentOutput==-1 ? defaultOutputIndex!=lastOutputDevice : currentOutput!=lastOutputDevice)) {

View File

@ -22,6 +22,8 @@ extern NSString * const MGMSIPAccountSIPAddress;
extern NSString * const MGMSIPAccountProxy; extern NSString * const MGMSIPAccountProxy;
extern NSString * const MGMSIPAccountProxyPort; extern NSString * const MGMSIPAccountProxyPort;
extern NSString * const MGMSIPAccountRegisterTimeout; extern NSString * const MGMSIPAccountRegisterTimeout;
extern NSString * const MGMSIPAccountTransport;
extern NSString * const MGMSIPAccountDTMFToneType;
extern const int MGMSIPAccountDefaultProxyPort; extern const int MGMSIPAccountDefaultProxyPort;
@class MGMSIPCall, MGMSIPURL; @class MGMSIPCall, MGMSIPURL;
@ -49,8 +51,11 @@ extern const int MGMSIPAccountDefaultProxyPort;
int proxyPort; int proxyPort;
int reregisterTimeout; int reregisterTimeout;
NSTimer *reregisterTimer; NSTimer *reregisterTimer;
int transport;
int dtmfToneType;
pjsua_acc_id identifier; pjsua_acc_id identifier;
BOOL registered;
NSMutableArray *calls; NSMutableArray *calls;
@ -79,6 +84,10 @@ extern const int MGMSIPAccountDefaultProxyPort;
- (void)setProxyPort:(int)theProxyPort; - (void)setProxyPort:(int)theProxyPort;
- (int)reregisterTimeout; - (int)reregisterTimeout;
- (void)setReregisterTimeout:(int)theReregisterTimeout; - (void)setReregisterTimeout:(int)theReregisterTimeout;
- (int)transport;
- (void)setTransport:(int)theTransport;
- (int)dtmfToneType;
- (void)setDTMFToneType:(int)theType;
- (pjsua_acc_id)identifier; - (pjsua_acc_id)identifier;
- (void)setIdentifier:(pjsua_acc_id)theIdentifier; - (void)setIdentifier:(pjsua_acc_id)theIdentifier;
- (NSString *)password; - (NSString *)password;
@ -93,6 +102,7 @@ extern const int MGMSIPAccountDefaultProxyPort;
- (void)logout; - (void)logout;
- (void)logoutErrored; - (void)logoutErrored;
- (void)registrationStateChanged;
- (BOOL)isRegistered; - (BOOL)isRegistered;
- (void)reregister; - (void)reregister;
- (void)setRegistered:(BOOL)isRegistered; - (void)setRegistered:(BOOL)isRegistered;

View File

@ -21,6 +21,9 @@ NSString * const MGMSIPAccountSIPAddress = @"MGMSIPAccountSIPAddress";
NSString * const MGMSIPAccountProxy = @"MGMSIPAccountProxy"; NSString * const MGMSIPAccountProxy = @"MGMSIPAccountProxy";
NSString * const MGMSIPAccountProxyPort = @"MGMSIPAccountProxyPort"; NSString * const MGMSIPAccountProxyPort = @"MGMSIPAccountProxyPort";
NSString * const MGMSIPAccountRegisterTimeout = @"MGMSIPAccountRegisterTimeout"; NSString * const MGMSIPAccountRegisterTimeout = @"MGMSIPAccountRegisterTimeout";
NSString * const MGMSIPAccountTransport = @"MGMSIPAccountTransport";
NSString * const MGMSIPAccountDTMFToneType = @"MGMSIPAccountDTMFToneType";
const int MGMSIPAccountDefaultProxyPort = 5060; const int MGMSIPAccountDefaultProxyPort = 5060;
const int MGMSIPAccountReregisterTimeoutMin = 60; const int MGMSIPAccountReregisterTimeoutMin = 60;
@ -29,7 +32,7 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
@implementation MGMSIPAccount @implementation MGMSIPAccount
- (id)initWithSettings:(NSDictionary *)theSettings { - (id)initWithSettings:(NSDictionary *)theSettings {
if (self = [self init]) { if ((self = [self init])) {
if ([theSettings objectForKey:MGMSIPAccountUserName]==nil || [[theSettings objectForKey:MGMSIPAccountUserName] isEqual:@""] || [theSettings objectForKey:MGMSIPAccountDomain]==nil || [[theSettings objectForKey:MGMSIPAccountDomain] isEqual:@""]) { if ([theSettings objectForKey:MGMSIPAccountUserName]==nil || [[theSettings objectForKey:MGMSIPAccountUserName] isEqual:@""] || [theSettings objectForKey:MGMSIPAccountDomain]==nil || [[theSettings objectForKey:MGMSIPAccountDomain] isEqual:@""]) {
[self release]; [self release];
self = nil; self = nil;
@ -50,6 +53,14 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
proxyPort = 0; proxyPort = 0;
if ([theSettings objectForKey:MGMSIPAccountRegisterTimeout]!=nil && [[theSettings objectForKey:MGMSIPAccountRegisterTimeout] intValue]!=0) if ([theSettings objectForKey:MGMSIPAccountRegisterTimeout]!=nil && [[theSettings objectForKey:MGMSIPAccountRegisterTimeout] intValue]!=0)
reregisterTimeout = [[theSettings objectForKey:MGMSIPAccountRegisterTimeout] intValue]; reregisterTimeout = [[theSettings objectForKey:MGMSIPAccountRegisterTimeout] intValue];
if ([theSettings objectForKey:MGMSIPAccountTransport]!=nil)
transport = [[theSettings objectForKey:MGMSIPAccountTransport] intValue];
#if TARGET_OS_IPHONE
else
transport = 1;
#endif
if ([theSettings objectForKey:MGMSIPAccountDTMFToneType]!=nil)
dtmfToneType = [[theSettings objectForKey:MGMSIPAccountDTMFToneType] intValue];
} }
} }
return self; return self;
@ -74,30 +85,23 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
return [self initWithSettings:settings]; return [self initWithSettings:settings];
} }
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
reregisterTimeout = MGMSIPAccountReregisterTimeoutDefault; reregisterTimeout = MGMSIPAccountReregisterTimeoutDefault;
identifier = PJSUA_INVALID_ID; identifier = PJSUA_INVALID_ID;
registered = NO;
calls = [NSMutableArray new]; calls = [NSMutableArray new];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkConnected:) name:MGMNetworkConnectedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkConnected:) name:MGMNetworkConnectedNotification object:nil];
} }
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
NSLog(@"Releasing SIP Account");
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (calls!=nil)
[calls release]; [calls release];
if (fullName!=nil)
[fullName release]; [fullName release];
if (userName!=nil)
[userName release]; [userName release];
if (domain!=nil)
[domain release]; [domain release];
if (registrar!=nil)
[registrar release]; [registrar release];
if (SIPAddress!=nil)
[SIPAddress release]; [SIPAddress release];
if (proxy!=nil)
[proxy release]; [proxy release];
[super dealloc]; [super dealloc];
} }
@ -118,7 +122,7 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
return fullName; return fullName;
} }
- (void)setFullName:(NSString *)theFullName { - (void)setFullName:(NSString *)theFullName {
if (fullName!=nil) [fullName release]; [fullName release];
fullName = [theFullName copy]; fullName = [theFullName copy];
} }
- (NSString *)userName { - (NSString *)userName {
@ -126,14 +130,14 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
} }
- (void)setUserName:(NSString *)theUserName { - (void)setUserName:(NSString *)theUserName {
if (theUserName==nil || [theUserName isEqual:@""]) return; if (theUserName==nil || [theUserName isEqual:@""]) return;
if (userName!=nil) [userName release]; [userName release];
userName = [theUserName copy]; userName = [theUserName copy];
} }
- (NSString *)domain { - (NSString *)domain {
return domain; return domain;
} }
- (void)setDomain:(NSString *)theDomain { - (void)setDomain:(NSString *)theDomain {
if (domain!=nil) [domain release]; [domain release];
domain = [theDomain copy]; domain = [theDomain copy];
} }
- (NSString *)registrar { - (NSString *)registrar {
@ -141,7 +145,7 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
return registrar; return registrar;
} }
- (void)setRegistrar:(NSString *)theRegistrar { - (void)setRegistrar:(NSString *)theRegistrar {
if (registrar!=nil) [registrar release]; [registrar release];
registrar = [theRegistrar copy]; registrar = [theRegistrar copy];
} }
- (NSString *)SIPAddress { - (NSString *)SIPAddress {
@ -150,14 +154,14 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
return SIPAddress; return SIPAddress;
} }
- (void)setSIPAddress:(NSString *)theSIPAddress { - (void)setSIPAddress:(NSString *)theSIPAddress {
if (SIPAddress!=nil) [SIPAddress release]; [SIPAddress release];
SIPAddress = [theSIPAddress copy]; SIPAddress = [theSIPAddress copy];
} }
- (NSString *)proxy { - (NSString *)proxy {
return proxy; return proxy;
} }
- (void)setProxy:(NSString *)theProxy { - (void)setProxy:(NSString *)theProxy {
if (proxy!=nil) [proxy release]; [proxy release];
proxy = [theProxy copy]; proxy = [theProxy copy];
} }
- (int)proxyPort { - (int)proxyPort {
@ -180,6 +184,18 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
else else
reregisterTimeout = theReregisterTimeout; reregisterTimeout = theReregisterTimeout;
} }
- (int)transport {
return transport;
}
- (void)setTransport:(int)theTransport {
transport = theTransport;
}
- (int)dtmfToneType {
return dtmfToneType;
}
- (void)setDTMFToneType:(int)theType {
dtmfToneType = theType;
}
- (pjsua_acc_id)identifier { - (pjsua_acc_id)identifier {
return identifier; return identifier;
} }
@ -210,11 +226,13 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
[settings setObject:[NSNumber numberWithInt:proxyPort] forKey:MGMSIPAccountProxyPort]; [settings setObject:[NSNumber numberWithInt:proxyPort] forKey:MGMSIPAccountProxyPort];
if (reregisterTimeout!=0) if (reregisterTimeout!=0)
[settings setObject:[NSNumber numberWithInt:reregisterTimeout] forKey:MGMSIPAccountRegisterTimeout]; [settings setObject:[NSNumber numberWithInt:reregisterTimeout] forKey:MGMSIPAccountRegisterTimeout];
[settings setObject:[NSNumber numberWithInt:transport] forKey:MGMSIPAccountTransport];
[settings setObject:[NSNumber numberWithInt:dtmfToneType] forKey:MGMSIPAccountDTMFToneType];
return settings; return settings;
} }
- (void)setLastError:(NSString *)theError { - (void)setLastError:(NSString *)theError {
if (lastError!=nil) [lastError release]; [lastError release];
lastError = [theError copy]; lastError = [theError copy];
} }
- (NSString *)lastError { - (NSString *)lastError {
@ -237,8 +255,11 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
if (delegate!=nil && [delegate respondsToSelector:@selector(logoutErrored)]) [delegate logoutErrored]; if (delegate!=nil && [delegate respondsToSelector:@selector(logoutErrored)]) [delegate logoutErrored];
} }
- (void)registrationStateChanged {
registered = (([self registrationStatus]/100)==2 && [self registrationExpireTime]>0);
}
- (BOOL)isRegistered { - (BOOL)isRegistered {
return (([self registrationStatus]/100)==2 && [self registrationExpireTime]>0); return registered;
} }
- (void)reregister { - (void)reregister {
[self setRegistered:YES]; [self setRegistered:YES];
@ -324,11 +345,9 @@ const int MGMSIPAccountReregisterTimeoutDefault = 300;
pj_status_t status = pjsua_acc_set_online_status(identifier, (isOnline ? PJ_TRUE : PJ_FALSE)); pj_status_t status = pjsua_acc_set_online_status(identifier, (isOnline ? PJ_TRUE : PJ_FALSE));
if (status==PJ_SUCCESS) { if (status==PJ_SUCCESS) {
if (reregisterTimer!=nil) {
[reregisterTimer invalidate]; [reregisterTimer invalidate];
[reregisterTimer release]; [reregisterTimer release];
reregisterTimer = nil; reregisterTimer = nil;
}
if (isOnline) if (isOnline)
reregisterTimer = [[NSTimer scheduledTimerWithTimeInterval:(float)reregisterTimeout target:self selector:@selector(reregister) userInfo:nil repeats:YES] retain]; reregisterTimer = [[NSTimer scheduledTimerWithTimeInterval:(float)reregisterTimeout target:self selector:@selector(reregister) userInfo:nil repeats:YES] retain];
} }

View File

@ -16,7 +16,7 @@
@implementation MGMSIPCall @implementation MGMSIPCall
- (id)initWithIdentifier:(pjsua_call_id)theIdentifier account:(MGMSIPAccount *)theAccount { - (id)initWithIdentifier:(pjsua_call_id)theIdentifier account:(MGMSIPAccount *)theAccount {
if (self = [super init]) { if ((self = [super init])) {
account = theAccount; account = theAccount;
identifier = theIdentifier; identifier = theIdentifier;
@ -52,17 +52,11 @@
if (isRingbackOn) if (isRingbackOn)
[self stopRingback]; [self stopRingback];
[self hangUp]; [self hangUp];
if (remoteURL!=nil)
[remoteURL release]; [remoteURL release];
if (localURL!=nil)
[localURL release]; [localURL release];
if (stateText!=nil)
[stateText release]; [stateText release];
if (lastStatusText!=nil)
[lastStatusText release]; [lastStatusText release];
if (transferStatusText!=nil)
[transferStatusText release]; [transferStatusText release];
if (holdMusicPath!=nil)
[holdMusicPath release]; [holdMusicPath release];
if (toneGenSlot!=PJSUA_INVALID_ID) { if (toneGenSlot!=PJSUA_INVALID_ID) {
pjsua_conf_remove_port(toneGenSlot); pjsua_conf_remove_port(toneGenSlot);
@ -110,9 +104,9 @@
if (isRingbackOn) if (isRingbackOn)
[self stopRingback]; [self stopRingback];
if (holdMusicPlayer!=PJSUA_INVALID_ID) if (holdMusicPlayer!=PJSUA_INVALID_ID)
[self performSelectorOnMainThread:@selector(stopHoldMusic) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(stopHoldMusic) withObject:nil waitUntilDone:YES];
if (recorderID!=PJSUA_INVALID_ID) if (recorderID!=PJSUA_INVALID_ID)
[self performSelectorOnMainThread:@selector(stopRecordingMain) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(stopRecordingMain) withObject:nil waitUntilDone:YES];
} }
state = theState; state = theState;
} }
@ -120,7 +114,7 @@
return stateText; return stateText;
} }
- (void)setStateText:(NSString *)theStateText { - (void)setStateText:(NSString *)theStateText {
if (stateText!=nil) [stateText release]; [stateText release];
stateText = [theStateText copy]; stateText = [theStateText copy];
} }
- (int)lastStatus { - (int)lastStatus {
@ -133,7 +127,7 @@
return lastStatusText; return lastStatusText;
} }
- (void)setLastStatusText:(NSString *)theLastStatusText { - (void)setLastStatusText:(NSString *)theLastStatusText {
if (lastStatusText!=nil) [lastStatusText release]; [lastStatusText release];
lastStatusText = [theLastStatusText copy]; lastStatusText = [theLastStatusText copy];
} }
- (int)transferStatus { - (int)transferStatus {
@ -146,7 +140,7 @@
return transferStatusText; return transferStatusText;
} }
- (void)setTransferStatusText:(NSString *)theTransferStatusText { - (void)setTransferStatusText:(NSString *)theTransferStatusText {
if (transferStatusText!=nil) [transferStatusText release]; [transferStatusText release];
transferStatusText = [theTransferStatusText copy]; transferStatusText = [theTransferStatusText copy];
} }
- (BOOL)isIncoming { - (BOOL)isIncoming {
@ -207,7 +201,7 @@
return (callInfo.media_status==PJSUA_CALL_MEDIA_REMOTE_HOLD); return (callInfo.media_status==PJSUA_CALL_MEDIA_REMOTE_HOLD);
} }
- (void)setHoldMusicPath:(NSString *)thePath { - (void)setHoldMusicPath:(NSString *)thePath {
if (holdMusicPath!=nil) [holdMusicPath release]; [holdMusicPath release];
holdMusicPath = [thePath copy]; holdMusicPath = [thePath copy];
} }
- (void)hold { - (void)hold {
@ -220,12 +214,12 @@
onHold = YES; onHold = YES;
pjsua_conf_disconnect(0, conf_port); pjsua_conf_disconnect(0, conf_port);
pjsua_conf_adjust_rx_level(conf_port, 0); pjsua_conf_adjust_rx_level(conf_port, 0);
[self performSelectorOnMainThread:@selector(startHoldMusic) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(startHoldMusic) withObject:nil waitUntilDone:YES];
} else { } else {
onHold = NO; onHold = NO;
pjsua_conf_connect(0, conf_port); pjsua_conf_connect(0, conf_port);
pjsua_conf_adjust_rx_level(conf_port, [[MGMSIP sharedSIP] micVolume]); pjsua_conf_adjust_rx_level(conf_port, [[MGMSIP sharedSIP] micVolume]);
[self performSelectorOnMainThread:@selector(stopHoldMusic) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(stopHoldMusic) withObject:nil waitUntilDone:YES];
} }
} }
bzero(&PJThreadDesc, sizeof(pj_thread_desc)); bzero(&PJThreadDesc, sizeof(pj_thread_desc));
@ -331,15 +325,17 @@
if (identifier==PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState) if (identifier==PJSUA_INVALID_ID || state!=MGMSIPCallConfirmedState)
return; return;
BOOL sendSuccessful = NO;
pj_thread_desc PJThreadDesc; pj_thread_desc PJThreadDesc;
[[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; [[MGMSIP sharedSIP] registerThread:&PJThreadDesc];
NSLog(@"%@", theDigits);
if ([account dtmfToneType]==0) {
pj_str_t digits = [theDigits PJString]; pj_str_t digits = [theDigits PJString];
pj_status_t status = pjsua_call_dial_dtmf(identifier, &digits); pj_status_t status = pjsua_call_dial_dtmf(identifier, &digits);
sendSuccessful = (status==PJ_SUCCESS); if (status!=PJ_SUCCESS)
if (!sendSuccessful) { NSLog(@"Unable to send DTMF tone.");
} else if ([account dtmfToneType]==1) {
const pj_str_t INFO = pj_str("INFO"); const pj_str_t INFO = pj_str("INFO");
for (unsigned int i=0; i<[theDigits length]; i++) { for (unsigned int i=0; i<[theDigits length]; i++) {
pjsua_msg_data messageData; pjsua_msg_data messageData;
@ -347,8 +343,9 @@
messageData.content_type = pj_str("application/dtmf-relay"); messageData.content_type = pj_str("application/dtmf-relay");
messageData.msg_body = [[NSString stringWithFormat:@"Signal=%C\r\nDuration=300", [theDigits characterAtIndex:i]] PJString]; messageData.msg_body = [[NSString stringWithFormat:@"Signal=%C\r\nDuration=300", [theDigits characterAtIndex:i]] PJString];
status = pjsua_call_send_request(identifier, &INFO, &messageData); pj_status_t status = pjsua_call_send_request(identifier, &INFO, &messageData);
sendSuccessful = (status==PJ_SUCCESS); if (status!=PJ_SUCCESS)
NSLog(@"Unable to send DTMF tone.");
} }
} }
@ -366,22 +363,22 @@
pjsua_conf_connect(toneGenSlot, 0); pjsua_conf_connect(toneGenSlot, 0);
} }
} }
if (!sendSuccessful) if ([account dtmfToneType]==2) {
NSLog(@"Using Tone Generator.");
pjsua_conf_connect(toneGenSlot, pjsua_call_get_conf_port(identifier)); pjsua_conf_connect(toneGenSlot, pjsua_call_get_conf_port(identifier));
}
for (unsigned int i=0; i<[theDigits length]; i++) { for (unsigned int i=0; i<[theDigits length]; i++) {
pjmedia_tonegen_stop(toneGenPort); pjmedia_tonegen_stop(toneGenPort);
pjmedia_tone_digit digit[1]; pjmedia_tone_digit digit[1];
digit[0].digit = [theDigits characterAtIndex:i]; digit[0].digit = [theDigits characterAtIndex:i];
digit[0].on_msec = 100; digit[0].on_msec = 300;
digit[0].off_msec = 100; digit[0].off_msec = 300;
digit[0].volume = 16383; digit[0].volume = 16383;
pjmedia_tonegen_play_digits(toneGenPort, 1, digit, 0); pjmedia_tonegen_play_digits(toneGenPort, 1, digit, 0);
if ([theDigits length]!=1 && (i+1)<[theDigits length]) [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; if ([theDigits length]!=1 && (i+1)<[theDigits length]) [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]];
} }
if (!sendSuccessful)
pjsua_conf_disconnect(toneGenSlot, pjsua_call_get_conf_port(identifier));
bzero(&PJThreadDesc, sizeof(pj_thread_desc)); bzero(&PJThreadDesc, sizeof(pj_thread_desc));
} }
- (void)receivedDTMFDigit:(int)theDigit { - (void)receivedDTMFDigit:(int)theDigit {
@ -393,7 +390,23 @@
pj_thread_desc PJThreadDesc; pj_thread_desc PJThreadDesc;
[[MGMSIP sharedSIP] registerThread:&PJThreadDesc]; [[MGMSIP sharedSIP] registerThread:&PJThreadDesc];
if (toneGenSlot==PJSUA_INVALID_ID) {
pjsua_media_config mediaConfig = [[MGMSIP sharedSIP] mediaConfig];
unsigned int samplesPerFrame = mediaConfig.audio_frame_ptime * mediaConfig.clock_rate * mediaConfig.channel_count / 1000;
pj_status_t status = pjmedia_tonegen_create([[MGMSIP sharedSIP] PJPool], mediaConfig.clock_rate, mediaConfig.channel_count, samplesPerFrame, 16, 0, &toneGenPort);
if (status!=PJ_SUCCESS) {
NSLog(@"Error creating tone generator");
} else {
status = pjsua_conf_add_port([[MGMSIP sharedSIP] PJPool], toneGenPort, &toneGenSlot);
if (status!=PJ_SUCCESS)
NSLog(@"Error adding tone generator");
else
pjsua_conf_connect(toneGenSlot, 0);
}
}
pjmedia_tonegen_stop(toneGenPort); pjmedia_tonegen_stop(toneGenPort);
pjsua_conf_disconnect(toneGenSlot, pjsua_call_get_conf_port(identifier));
pjmedia_tone_digit digit[1]; pjmedia_tone_digit digit[1];
digit[0].digit = theDigit; digit[0].digit = theDigit;

View File

@ -14,7 +14,7 @@
return [[[self alloc] initWithFullName:theFullName userName:theUserName host:theHost] autorelease]; return [[[self alloc] initWithFullName:theFullName userName:theUserName host:theHost] autorelease];
} }
- (id)initWithFullName:(NSString *)theFullName userName:(NSString *)theUserName host:(NSString *)theHost { - (id)initWithFullName:(NSString *)theFullName userName:(NSString *)theUserName host:(NSString *)theHost {
if (self = [super init]) { if ((self = [super init])) {
if (theHost==nil || [theHost isEqual:@""]) { if (theHost==nil || [theHost isEqual:@""]) {
[self release]; [self release];
self = nil; self = nil;
@ -37,7 +37,7 @@
return [[[self alloc] initWithSIPID:theSIPID] autorelease]; return [[[self alloc] initWithSIPID:theSIPID] autorelease];
} }
- (id)initWithSIPID:(NSString *)theSIPID { - (id)initWithSIPID:(NSString *)theSIPID {
if (self = [super init]) { if ((self = [super init])) {
NSString *fullNameString, *addressString; NSString *fullNameString, *addressString;
NSRange range = [theSIPID rangeOfString:@"<sip:"]; NSRange range = [theSIPID rangeOfString:@"<sip:"];
if (range.location==NSNotFound) { if (range.location==NSNotFound) {
@ -72,11 +72,8 @@
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (fullName!=nil)
[fullName release]; [fullName release];
if (userName!=nil)
[userName release]; [userName release];
if (host!=nil)
[host release]; [host release];
[super dealloc]; [super dealloc];
} }

View File

@ -21,7 +21,7 @@
return [self initWithData:data options:mask error:error]; return [self initWithData:data options:mask error:error];
} }
- (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)error { - (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)error {
if (self = [super init]) { if ((self = [super init])) {
if (data==nil || [data length]<=0) { if (data==nil || [data length]<=0) {
if (error!=nil) *error = [NSError errorWithDomain:MGMXMLErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObject:@"Data has no length." forKey:NSLocalizedDescriptionKey]]; if (error!=nil) *error = [NSError errorWithDomain:MGMXMLErrorDomain code:0 userInfo:[NSDictionary dictionaryWithObject:@"Data has no length." forKey:NSLocalizedDescriptionKey]];
[self release]; [self release];

View File

@ -39,7 +39,7 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
} }
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
commonXML = NULL; commonXML = NULL;
namespaceXML = NULL; namespaceXML = NULL;
parentNode = NULL; parentNode = NULL;
@ -51,7 +51,7 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
return [[[self alloc] initWithTypeXMLPtr:theXMLPtr] autorelease]; return [[[self alloc] initWithTypeXMLPtr:theXMLPtr] autorelease];
} }
- (id)initWithTypeXMLPtr:(xmlTypPtr)theXMLPtr { - (id)initWithTypeXMLPtr:(xmlTypPtr)theXMLPtr {
if (self = [self init]) { if ((self = [self init])) {
if (theXMLPtr->type==MGMXMLNamespaceKind) { if (theXMLPtr->type==MGMXMLNamespaceKind) {
xmlNsPtr xmlPtr = (xmlNsPtr)theXMLPtr; xmlNsPtr xmlPtr = (xmlNsPtr)theXMLPtr;
if (xmlPtr->_private!=NULL) { if (xmlPtr->_private!=NULL) {
@ -229,11 +229,9 @@ static void MGMXMLErrorHandler(void *userData, xmlErrorPtr error) {
} }
} }
- (void)releaseDocument { - (void)releaseDocument {
if (documentNode!=nil) {
[documentNode release]; [documentNode release];
documentNode = nil; documentNode = nil;
} }
}
+ (BOOL)isNode:(MGMXMLNodeKind)theType { + (BOOL)isNode:(MGMXMLNodeKind)theType {
switch (theType) { switch (theType) {
case MGMXMLElementKind: case MGMXMLElementKind:

View File

@ -10,7 +10,7 @@
@class MGMInstance, MGMURLConnectionManager, QTMovieView; @class MGMInstance, MGMURLConnectionManager, QTMovieView;
@interface MGMInboxPlayWindow : NSWindow { @interface MGMInboxPlayWindow : NSWindow <NSWindowDelegate> {
MGMInstance *instance; MGMInstance *instance;
MGMURLConnectionManager *connectionManager; MGMURLConnectionManager *connectionManager;
IBOutlet NSView *view; IBOutlet NSView *view;

View File

@ -14,7 +14,7 @@
@implementation MGMInboxPlayWindow @implementation MGMInboxPlayWindow
- (id)initWithNibNamed:(NSString *)theNib data:(NSDictionary *)theData instance:(MGMInstance *)theInstance { - (id)initWithNibNamed:(NSString *)theNib data:(NSDictionary *)theData instance:(MGMInstance *)theInstance {
if (self = [super initWithContentRect:NSMakeRect(34, 34, 0, 0) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES]) { if ((self = [super initWithContentRect:NSMakeRect(34, 34, 0, 0) styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES])) {
if (![NSBundle loadNibNamed:theNib owner:self]) { if (![NSBundle loadNibNamed:theNib owner:self]) {
NSLog(@"Unable to load nib for the Play Window"); NSLog(@"Unable to load nib for the Play Window");
[self release]; [self release];
@ -63,7 +63,6 @@
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (connectionManager!=nil)
[connectionManager release]; [connectionManager release];
[super dealloc]; [super dealloc];
} }
@ -118,9 +117,7 @@
return [NSColor colorWithPatternImage:[bg autorelease]]; return [NSColor colorWithPatternImage:[bg autorelease]];
} }
- (void)windowDidResignKey:(NSNotification *)notification { - (void)windowDidResignKey:(NSNotification *)notification {
if (connectionManager!=nil)
[connectionManager cancelAll]; [connectionManager cancelAll];
if (audioPlayer!=nil)
[audioPlayer setMovie:nil]; [audioPlayer setMovie:nil];
[self setContentView:nil]; [self setContentView:nil];
[view release]; [view release];

View File

@ -43,6 +43,8 @@
- (void)checkVoicemail; - (void)checkVoicemail;
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item;
- (IBAction)next:(id)sender; - (IBAction)next:(id)sender;
- (IBAction)previous:(id)sender; - (IBAction)previous:(id)sender;

View File

@ -27,7 +27,7 @@ NSString * const MGMSID = @"id";
return [[[self alloc] initWithInstance:theInstance] autorelease]; return [[[self alloc] initWithInstance:theInstance] autorelease];
} }
- (id)initWithInstance:(MGMInstance *)theInstance { - (id)initWithInstance:(MGMInstance *)theInstance {
if (self = [super init]) { if ((self = [super init])) {
if (sideItems==nil) { if (sideItems==nil) {
sideItems = [NSMutableArray new]; sideItems = [NSMutableArray new];
[sideItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Inbox", MGMSName, [NSNumber numberWithBool:YES], MGMSSelectable, [NSNumber numberWithInt:0], MGMSID, nil]]; [sideItems addObject:[NSDictionary dictionaryWithObjectsAndKeys:@"Inbox", MGMSName, [NSNumber numberWithBool:YES], MGMSSelectable, [NSNumber numberWithInt:0], MGMSID, nil]];
@ -62,9 +62,7 @@ NSString * const MGMSID = @"id";
[sidebarView setAutosaveExpandedItems:YES]; [sidebarView setAutosaveExpandedItems:YES];
} }
- (void)dealloc { - (void)dealloc {
if (inboxWindow!=nil)
[inboxWindow close]; [inboxWindow close];
if (currentData!=nil)
[currentData release]; [currentData release];
[super dealloc]; [super dealloc];
} }
@ -125,22 +123,17 @@ NSString * const MGMSID = @"id";
[inboxWindow makeKeyAndOrderFront:self]; [inboxWindow makeKeyAndOrderFront:self];
} }
- (void)closeWindow { - (void)closeWindow {
if (inboxWindow!=nil)
[inboxWindow close]; [inboxWindow close];
} }
- (void)startProgress { - (void)startProgress {
if (progress!=nil) {
if (progressStartCount==0) if (progressStartCount==0)
[progress startAnimation:self]; [progress startAnimation:self];
}
progressStartCount++; progressStartCount++;
} }
- (void)stopProgress { - (void)stopProgress {
if (progress!=nil) {
if (progressStartCount==1) if (progressStartCount==1)
[progress stopAnimation:self]; [progress stopAnimation:self];
}
progressStartCount--; progressStartCount--;
} }
@ -162,7 +155,7 @@ NSString * const MGMSID = @"id";
} }
} }
if (newMessage) { if (newMessage) {
if (lastDate!=nil) [lastDate release]; [lastDate release];
lastDate = [newestDate copy]; lastDate = [newestDate copy];
[self setCurrentData:theMessages]; [self setCurrentData:theMessages];
[self showWindow:self]; [self showWindow:self];
@ -266,7 +259,7 @@ NSString * const MGMSID = @"id";
return currentInbox; return currentInbox;
} }
- (void)setCurrentData:(NSArray *)theData { - (void)setCurrentData:(NSArray *)theData {
if (currentData!=nil) [currentData release]; [currentData release];
currentData = [theData mutableCopy]; currentData = [theData mutableCopy];
resultsCount = [currentData count]; resultsCount = [currentData count];

View File

@ -32,7 +32,7 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
@implementation MGMAccountSetup @implementation MGMAccountSetup
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
if (![NSBundle loadNibNamed:@"AccountSetup" owner:self]) { if (![NSBundle loadNibNamed:@"AccountSetup" owner:self]) {
NSLog(@"Unable to load Account Set Up!"); NSLog(@"Unable to load Account Set Up!");
[self release]; [self release];
@ -49,21 +49,14 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (setupWindow!=nil)
[setupWindow release]; [setupWindow release];
if (accountsCreated!=nil)
[accountsCreated release]; [accountsCreated release];
if (S7CheckUser!=nil)
[S7CheckUser release]; [S7CheckUser release];
if (S7CheckInstance!=nil)
[S7CheckInstance release]; [S7CheckInstance release];
if (S7ConnectionManager!=nil)
[S7ConnectionManager release]; [S7ConnectionManager release];
#if MGMSIPENABLED #if MGMSIPENABLED
if (S7CheckSIPAccount!=nil)
[S7CheckSIPAccount release]; [S7CheckSIPAccount release];
#endif #endif
if (S8Message!=nil)
[S8Message release]; [S8Message release];
[super dealloc]; [super dealloc];
} }
@ -155,10 +148,8 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
[continueButton setTitle:MGMSContinue]; [continueButton setTitle:MGMSContinue];
[continueButton setEnabled:NO]; [continueButton setEnabled:NO];
[S8MessageField setStringValue:[NSString stringWithFormat:@"Unable to set up your %@ account, the error we receviced was \"%@\" Please go back and correct the problem.", type, S8Message]]; [S8MessageField setStringValue:[NSString stringWithFormat:@"Unable to set up your %@ account, the error we receviced was \"%@\" Please go back and correct the problem.", type, S8Message]];
if (S8Message!=nil) {
[S8Message release]; [S8Message release];
S8Message = nil; S8Message = nil;
}
NSBeep(); NSBeep();
break; break;
} }
@ -324,15 +315,11 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
S7CheckInstance = [[MGMInstance instanceWithUser:S7CheckUser delegate:self isCheck:YES] retain]; S7CheckInstance = [[MGMInstance instanceWithUser:S7CheckUser delegate:self isCheck:YES] retain];
} }
- (void)loginError:(NSError *)theError { - (void)loginError:(NSError *)theError {
if (S7CheckUser!=nil) {
[S7CheckUser remove]; [S7CheckUser remove];
[S7CheckUser release]; [S7CheckUser release];
S7CheckUser = nil; S7CheckUser = nil;
}
if (S7CheckInstance!=nil) {
[S7CheckInstance release]; [S7CheckInstance release];
S7CheckInstance = nil; S7CheckInstance = nil;
}
NSLog(@"Login Failed %@", theError); NSLog(@"Login Failed %@", theError);
S8Message = [[theError localizedDescription] copy]; S8Message = [[theError localizedDescription] copy];
step = 8; step = 8;
@ -347,10 +334,8 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
[S7CheckUser release]; [S7CheckUser release];
S7CheckUser = nil; S7CheckUser = nil;
} }
if (S7CheckInstance!=nil) {
[S7CheckInstance release]; [S7CheckInstance release];
S7CheckInstance = nil; S7CheckInstance = nil;
}
[self S4Reset]; [self S4Reset];
step = 9; step = 9;
[self displayStep]; [self displayStep];
@ -373,12 +358,9 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
[S7ConnectionManager connectionWithRequest:request delegate:self didFailWithError:@selector(authentication:didFailWithError:) didFinish:@selector(authenticationDidFinish:) invisible:NO object:nil]; [S7ConnectionManager connectionWithRequest:request delegate:self didFailWithError:@selector(authentication:didFailWithError:) didFinish:@selector(authenticationDidFinish:) invisible:NO object:nil];
} }
- (void)authentication:(NSDictionary *)theInfo didFailWithError:(NSError *)theError { - (void)authentication:(NSDictionary *)theInfo didFailWithError:(NSError *)theError {
if (S7CheckUser!=nil) {
[S7CheckUser remove]; [S7CheckUser remove];
[S7CheckUser release]; [S7CheckUser release];
S7CheckUser = nil; S7CheckUser = nil;
}
if (S7ConnectionManager!=nil)
[S7ConnectionManager setCookieStorage:nil]; [S7ConnectionManager setCookieStorage:nil];
NSLog(@"Login Failed %@", theError); NSLog(@"Login Failed %@", theError);
S8Message = [[theError localizedDescription] copy]; S8Message = [[theError localizedDescription] copy];
@ -387,9 +369,7 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
} }
- (void)authenticationDidFinish:(NSDictionary *)theInfo { - (void)authenticationDidFinish:(NSDictionary *)theInfo {
NSDictionary *info = [MGMGoogleContacts dictionaryWithData:[theInfo objectForKey:MGMConnectionData]]; NSDictionary *info = [MGMGoogleContacts dictionaryWithData:[theInfo objectForKey:MGMConnectionData]];
if (S7ConnectionManager!=nil)
[S7ConnectionManager setCookieStorage:nil]; [S7ConnectionManager setCookieStorage:nil];
if (S7CheckUser!=nil) {
if ([info objectForKey:@"Error"]!=nil) { if ([info objectForKey:@"Error"]!=nil) {
[S7CheckUser remove]; [S7CheckUser remove];
[S7CheckUser release]; [S7CheckUser release];
@ -402,7 +382,6 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
[S7CheckUser done]; [S7CheckUser done];
[S7CheckUser release]; [S7CheckUser release];
S7CheckUser = nil; S7CheckUser = nil;
}
[self S5Reset]; [self S5Reset];
step = 9; step = 9;
@ -441,12 +420,9 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
} }
- (void)S7RegistrationChanged { - (void)S7RegistrationChanged {
#if MGMSIPENABLED #if MGMSIPENABLED
if (S7SIPRegistrationTimeout!=nil) {
[S7SIPRegistrationTimeout invalidate]; [S7SIPRegistrationTimeout invalidate];
[S7SIPRegistrationTimeout release]; [S7SIPRegistrationTimeout release];
S7SIPRegistrationTimeout = nil; S7SIPRegistrationTimeout = nil;
}
if (S7CheckSIPAccount!=nil) {
if (![S7CheckSIPAccount isRegistered]) { if (![S7CheckSIPAccount isRegistered]) {
[S7CheckSIPAccount setLastError:@"Unable to Register with Server. Please check your credentials."]; [S7CheckSIPAccount setLastError:@"Unable to Register with Server. Please check your credentials."];
[self loginErrored]; [self loginErrored];
@ -456,7 +432,6 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
[S7CheckSIPAccount logout]; [S7CheckSIPAccount logout];
[S7CheckSIPAccount release]; [S7CheckSIPAccount release];
S7CheckSIPAccount = nil; S7CheckSIPAccount = nil;
}
if (S7CheckUser!=nil) { if (S7CheckUser!=nil) {
[accountsCreated addObject:S7CheckUser]; [accountsCreated addObject:S7CheckUser];
[S7CheckUser release]; [S7CheckUser release];
@ -470,11 +445,9 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
} }
#if MGMSIPENABLED #if MGMSIPENABLED
- (void)S7SIPTimeout { - (void)S7SIPTimeout {
if (S7SIPRegistrationTimeout!=nil) {
[S7SIPRegistrationTimeout invalidate]; [S7SIPRegistrationTimeout invalidate];
[S7SIPRegistrationTimeout release]; [S7SIPRegistrationTimeout release];
S7SIPRegistrationTimeout = nil; S7SIPRegistrationTimeout = nil;
}
[S7CheckSIPAccount setLastError:@"Registration Timeout."]; [S7CheckSIPAccount setLastError:@"Registration Timeout."];
[self loginErrored]; [self loginErrored];
} }
@ -487,19 +460,15 @@ NSString * const MGMSIPDefaultDomain = @"proxy01.sipphone.com";
S7SIPRegistrationTimeout = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(S7SIPTimeout) userInfo:nil repeats:NO] retain]; S7SIPRegistrationTimeout = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(S7SIPTimeout) userInfo:nil repeats:NO] retain];
} }
- (void)loginErrored { - (void)loginErrored {
if (S7CheckUser!=nil) {
[S7CheckUser remove]; [S7CheckUser remove];
[S7CheckUser release]; [S7CheckUser release];
S7CheckUser = nil; S7CheckUser = nil;
}
if (S7CheckSIPAccount!=nil) {
NSLog(@"Login Failed %@", [S7CheckSIPAccount lastError]); NSLog(@"Login Failed %@", [S7CheckSIPAccount lastError]);
S8Message = [[S7CheckSIPAccount lastError] copy]; S8Message = [[S7CheckSIPAccount lastError] copy];
[S7CheckSIPAccount setDelegate:nil]; [S7CheckSIPAccount setDelegate:nil];
[S7CheckSIPAccount logout]; [S7CheckSIPAccount logout];
[S7CheckSIPAccount release]; [S7CheckSIPAccount release];
S7CheckSIPAccount = nil; S7CheckSIPAccount = nil;
}
step = 8; step = 8;
[self displayStep]; [self displayStep];
} }

View File

@ -10,16 +10,14 @@
@implementation MGMBadge @implementation MGMBadge
- (id)init { - (id)init {
if (self = [super init]) { if ((self = [super init])) {
applicationIcon = [[[NSApplication sharedApplication] applicationIconImage] copy]; applicationIcon = [[[NSApplication sharedApplication] applicationIconImage] copy];
visable = NO; visable = NO;
} }
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (label!=nil)
[label release]; [label release];
if (applicationIcon!=nil)
[applicationIcon release]; [applicationIcon release];
[super dealloc]; [super dealloc];
} }
@ -55,7 +53,7 @@
} }
- (void)setLabel:(NSString *)badgeLabel { - (void)setLabel:(NSString *)badgeLabel {
if (label!=nil) [label release]; [label release];
label = [badgeLabel copy]; label = [badgeLabel copy];
if (label==nil || [label isEqual:@""]) if (label==nil || [label isEqual:@""])
[self setVisable:NO]; [self setVisable:NO];

View File

@ -12,7 +12,7 @@
extern NSString *MGMContactsWindowOpen; extern NSString *MGMContactsWindowOpen;
@interface MGMContactsController : NSObject { @interface MGMContactsController : NSObject <NSTextFieldDelegate> {
MGMController *controller; MGMController *controller;
IBOutlet NSWindow *contactsWindow; IBOutlet NSWindow *contactsWindow;
BOOL closingWindow; BOOL closingWindow;
@ -63,6 +63,7 @@ extern NSString *MGMContactsWindowOpen;
- (IBAction)runAction:(id)sender; - (IBAction)runAction:(id)sender;
- (IBAction)call:(id)sender; - (IBAction)call:(id)sender;
- (void)windowDidBecomeKey:(NSNotification *)notification;
- (void)windowWillClose:(NSNotification *)notification; - (void)windowWillClose:(NSNotification *)notification;
@end @end

View File

@ -17,7 +17,7 @@ NSString *MGMContactsWindowOpen = @"MGMContactsWindowOpen";
@implementation MGMContactsController @implementation MGMContactsController
- (id)initWithController:(MGMController *)theController { - (id)initWithController:(MGMController *)theController {
if (self = [super init]) { if ((self = [super init])) {
controller = theController; controller = theController;
filterLock = [NSLock new]; filterLock = [NSLock new];
filterWaiting = 0; filterWaiting = 0;
@ -43,14 +43,10 @@ NSString *MGMContactsWindowOpen = @"MGMContactsWindowOpen";
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (contactsWindow!=nil)
[contactsWindow close]; [contactsWindow close];
if (filterLock!=nil) {
[filterLock lock]; [filterLock lock];
[filterLock unlock]; [filterLock unlock];
[filterLock release]; [filterLock release];
}
if (contactViews!=nil)
[contactViews release]; [contactViews release];
[super dealloc]; [super dealloc];
} }
@ -113,12 +109,8 @@ NSString *MGMContactsWindowOpen = @"MGMContactsWindowOpen";
if (row>=contactsCount) return; if (row>=contactsCount) return;
[self checkContactRow:row]; [self checkContactRow:row];
[filterLock lock]; [filterLock lock];
@try { if ((row-contactsVisible.location)<[contactViews count])
[(MGMViewCell *)cell addSubview:[contactViews objectAtIndex:row-contactsVisible.location]]; [(MGMViewCell *)cell addSubview:[contactViews objectAtIndex:row-contactsVisible.location]];
}
@catch (NSException *e) {
NSLog(@"Contact error, ignoring. %@", e);
}
[filterLock unlock]; [filterLock unlock];
} }
- (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row { - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(int)row {
@ -158,7 +150,7 @@ NSString *MGMContactsWindowOpen = @"MGMContactsWindowOpen";
filterWaiting--; filterWaiting--;
contactsCount = 0; contactsCount = 0;
[contactViews removeAllObjects]; [contactViews removeAllObjects];
if (contactsMatchString!=nil) [contactsMatchString release]; [contactsMatchString release];
contactsMatchString = [[self filterString] copy]; contactsMatchString = [[self filterString] copy];
int count = [[[self contacts] countContactsMatching:contactsMatchString] intValue]; int count = [[[self contacts] countContactsMatching:contactsMatchString] intValue];
[contactsTable scrollRowToVisible:0]; [contactsTable scrollRowToVisible:0];
@ -256,16 +248,12 @@ NSString *MGMContactsWindowOpen = @"MGMContactsWindowOpen";
[controller contactsControllerBecameCurrent:self]; [controller contactsControllerBecameCurrent:self];
} }
- (void)windowWillClose:(NSNotification *)notification { - (void)windowWillClose:(NSNotification *)notification {
[contactViews removeAllObjects];
contactsCount = 0;
[self reloadData];
[contactsWindow setDelegate:nil]; [contactsWindow setDelegate:nil];
contactsWindow = nil; contactsWindow = nil;
[contactViews removeAllObjects];
contactsCount = 0;
contactsTable = nil; contactsTable = nil;
if (phoneFieldView!=nil) {
[phoneFieldView release];
phoneFieldView = nil; phoneFieldView = nil;
}
phoneField = nil; phoneField = nil;
} }
@end @end

View File

@ -138,6 +138,14 @@ NSString * const MGMLoading = @"Loading...";
[[MGMAccountSetup new] showSetupWindow:self]; // This is not a leak, it'll auto release it self when done. [[MGMAccountSetup new] showSetupWindow:self]; // This is not a leak, it'll auto release it self when done.
else else
[self preferences:self]; [self preferences:self];
} else {
BOOL windows = NO;
for (int i=0; i<[contactsControllers count]; i++) {
if ([[(MGMUser *)[[contactsControllers objectAtIndex:i] user] settingForKey:MGMContactsWindowOpen] boolValue])
windows = YES;
}
if (!windows)
[contactsControllers makeObjectsPerformSelector:@selector(showContactsWindow)];
} }
[[RLMap mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"map" ofType:@"html"]]]]; [[RLMap mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"map" ofType:@"html"]]]];
@ -150,24 +158,17 @@ NSString * const MGMLoading = @"Loading...";
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (contactsControllers!=nil)
[contactsControllers release]; [contactsControllers release];
if (multipleSMS!=nil)
[multipleSMS release]; [multipleSMS release];
if (preferences!=nil)
[preferences release]; [preferences release];
if (taskManager!=nil)
[taskManager release]; [taskManager release];
if (whitePages!=nil)
[whitePages release]; [whitePages release];
if (themeManager!=nil)
[themeManager release]; [themeManager release];
if (SMSManager!=nil)
[SMSManager release]; [SMSManager release];
if (badge!=nil)
[badge release]; [badge release];
if (badgeValues!=nil)
[badgeValues release]; [badgeValues release];
[aboutWindow release];
[RLWindow release];
[super dealloc]; [super dealloc];
} }
@ -323,9 +324,9 @@ NSString * const MGMLoading = @"Loading...";
[[contactsController phoneField] setStringValue:[phoneNumber readableNumber]]; [[contactsController phoneField] setStringValue:[phoneNumber readableNumber]];
[self sms:self]; [self sms:self];
} else if ([scheme isEqualToString:@"vmtheme"]) { } else if ([scheme isEqualToString:@"vmtheme"]) {
[taskManager addTask:nil withURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", data]]]; [taskManager addTask:nil withURL:[NSURL URLWithString:[@"http://" stringByAppendingString:data]]];
} else if ([scheme isEqualToString:@"vmsound"]) { } else if ([scheme isEqualToString:@"vmsound"]) {
[taskManager addTask:nil withURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@", data]]]; [taskManager addTask:nil withURL:[NSURL URLWithString:[@"http://" stringByAppendingString:data]]];
} }
} }
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {

View File

@ -15,7 +15,7 @@
@implementation MGMNumberOptions @implementation MGMNumberOptions
- (id)initWithContactsController:(MGMContactsController *)theContactsController controller:(MGMController *)theController number:(NSString *)theNumber { - (id)initWithContactsController:(MGMContactsController *)theContactsController controller:(MGMController *)theController number:(NSString *)theNumber {
if (self = [super init]) { if ((self = [super init])) {
if (![NSBundle loadNibNamed:@"NumberOptions" owner:self]) { if (![NSBundle loadNibNamed:@"NumberOptions" owner:self]) {
NSLog(@"Unable to load the Number Options Window"); NSLog(@"Unable to load the Number Options Window");
[self release]; [self release];
@ -45,7 +45,6 @@
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (whitePages!=nil)
[whitePages release]; [whitePages release];
[super dealloc]; [super dealloc];
} }
@ -100,7 +99,6 @@
} }
} }
- (IBAction)cancel:(id)sender { - (IBAction)cancel:(id)sender {
if (whitePages!=nil)
[whitePages cancelAll]; [whitePages cancelAll];
[optionsWindow close]; [optionsWindow close];
[self release]; [self release];

View File

@ -13,7 +13,7 @@ extern NSString *MGMLastUserPhoneKey;
@class MGMController, MGMUser, MGMInstance, MGMInboxWindow, MGMProgressView, MGMPhoneField, MGMPhoneFieldView, MGMContactsTableView; @class MGMController, MGMUser, MGMInstance, MGMInboxWindow, MGMProgressView, MGMPhoneField, MGMPhoneFieldView, MGMContactsTableView;
@interface MGMVoiceUser : MGMContactsController { @interface MGMVoiceUser : MGMContactsController <NSAnimationDelegate> {
MGMInstance *instance; MGMInstance *instance;
MGMUser *user; MGMUser *user;
MGMInboxWindow *inboxWindow; MGMInboxWindow *inboxWindow;

View File

@ -26,7 +26,7 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
return [[[self alloc] initUser:theUser controller:theController instance:theInstance] autorelease]; return [[[self alloc] initUser:theUser controller:theController instance:theInstance] autorelease];
} }
- (id)initUser:(MGMUser *)theUser controller:(MGMController *)theController instance:(MGMInstance *)theInstance { - (id)initUser:(MGMUser *)theUser controller:(MGMController *)theController instance:(MGMInstance *)theInstance {
if (self = [super initWithController:theController]) { if ((self = [super initWithController:theController])) {
user = [theUser retain]; user = [theUser retain];
[self registerSettings]; [self registerSettings];
if (theInstance==nil) { if (theInstance==nil) {
@ -60,30 +60,19 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
} }
} }
- (void)dealloc { - (void)dealloc {
if (progressFadeAnimation!=nil) {
[progressFadeAnimation stopAnimation]; [progressFadeAnimation stopAnimation];
[progressFadeAnimation release]; [progressFadeAnimation release];
progressFadeAnimation = nil; progressFadeAnimation = nil;
}
[super dealloc]; [super dealloc];
if (inboxWindow!=nil) {
[inboxWindow closeWindow]; [inboxWindow closeWindow];
[inboxWindow release]; [inboxWindow release];
}
if (instance!=nil) {
[instance setDelegate:nil]; [instance setDelegate:nil];
[instance stop]; [instance stop];
[instance release]; [instance release];
}
if (progressView!=nil) {
[progressView removeFromSuperview]; [progressView removeFromSuperview];
[progressView release]; [progressView release];
}
if (callTimer!=nil) {
[callTimer invalidate]; [callTimer invalidate];
[callTimer release]; [callTimer release];
}
if (user!=nil)
[user release]; [user release];
} }
@ -123,18 +112,14 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
[theAlert setInformativeText:[theError localizedDescription]]; [theAlert setInformativeText:[theError localizedDescription]];
[theAlert runModal]; [theAlert runModal];
if (progressView!=nil) {
[progressView stopProgess]; [progressView stopProgess];
[progressView removeFromSuperview]; [progressView removeFromSuperview];
[progressView release]; [progressView release];
progressView = nil; progressView = nil;
} }
}
- (void)loginSuccessful { - (void)loginSuccessful {
if (progressView!=nil) {
[progressView stopProgess]; [progressView stopProgess];
[progressView display]; [progressView display];
}
[self setInstanceInfo]; [self setInstanceInfo];
@ -163,16 +148,12 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
} }
} }
- (void)animationDidEnd:(NSAnimation *)animation { - (void)animationDidEnd:(NSAnimation *)animation {
if (progressFadeAnimation!=nil) {
[progressFadeAnimation release]; [progressFadeAnimation release];
progressFadeAnimation = nil; progressFadeAnimation = nil;
}
if (progressView!=nil) {
[progressView removeFromSuperview]; [progressView removeFromSuperview];
[progressView release]; [progressView release];
progressView = nil; progressView = nil;
} }
}
- (MGMContacts *)contacts { - (MGMContacts *)contacts {
return [instance contacts]; return [instance contacts];
@ -180,7 +161,7 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
- (void)reloadData { - (void)reloadData {
[super reloadData]; [super reloadData];
if (progressView!=nil) [progressView display]; [progressView display];
} }
- (NSString *)areaCode { - (NSString *)areaCode {
@ -246,7 +227,6 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
[alert setInformativeText:[theError localizedDescription]]; [alert setInformativeText:[theError localizedDescription]];
[alert runModal]; [alert runModal];
placingCall = NO; placingCall = NO;
if (callTimer!=nil)
[callTimer fire]; [callTimer fire];
} }
- (void)callDidFinish:(NSDictionary *)theInfo { - (void)callDidFinish:(NSDictionary *)theInfo {
@ -260,11 +240,9 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
[alert runModal]; [alert runModal];
} }
- (void)callTimer { - (void)callTimer {
if (callTimer!=nil) {
[callTimer invalidate]; [callTimer invalidate];
[callTimer release]; [callTimer release];
callTimer = nil; callTimer = nil;
}
[callButton setImage:[NSImage imageNamed:@"placeCall"]]; [callButton setImage:[NSImage imageNamed:@"placeCall"]];
} }
@ -298,16 +276,14 @@ NSString *MGMLastUserPhoneKey = @"MGMLastUserPhone";
- (void)windowWillClose:(NSNotification *)notification { - (void)windowWillClose:(NSNotification *)notification {
if (![controller isQuitting]) if (![controller isQuitting])
[user setSetting:[NSNumber numberWithBool:NO] forKey:MGMContactsWindowOpen]; [user setSetting:[NSNumber numberWithBool:NO] forKey:MGMContactsWindowOpen];
[super windowWillClose:notification];
if (progressFadeAnimation!=nil) {
[progressFadeAnimation stopAnimation]; [progressFadeAnimation stopAnimation];
[progressFadeAnimation release]; [progressFadeAnimation release];
progressFadeAnimation = nil; progressFadeAnimation = nil;
}
creditField = nil; creditField = nil;
userNumberButton = nil; userNumberButton = nil;
userPhonesButton = nil; userPhonesButton = nil;
callButton = nil; callButton = nil;
smsButton = nil; smsButton = nil;
[super windowWillClose:notification];
} }
@end @end

View File

@ -44,6 +44,8 @@
IBOutlet NSTextField *SIPProxyPortField; IBOutlet NSTextField *SIPProxyPortField;
IBOutlet NSTextField *SIPSIPAddressField; IBOutlet NSTextField *SIPSIPAddressField;
IBOutlet NSTextField *SIPRegistrarTimeoutField; IBOutlet NSTextField *SIPRegistrarTimeoutField;
IBOutlet NSPopUpButton *SIPTransportPopUp;
IBOutlet NSPopUpButton *SIPToneTypePopUp;
IBOutlet NSMatrix *SIPContactsMatrix; IBOutlet NSMatrix *SIPContactsMatrix;
IBOutlet NSPopUpButton *SIPGoogleContactsPopUp; IBOutlet NSPopUpButton *SIPGoogleContactsPopUp;
} }
@ -55,6 +57,7 @@
- (IBAction)loginout:(id)sender; - (IBAction)loginout:(id)sender;
- (IBAction)add:(id)sender; - (IBAction)add:(id)sender;
- (IBAction)remove:(id)sender; - (IBAction)remove:(id)sender;
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification;
- (IBAction)saveGV:(id)sender; - (IBAction)saveGV:(id)sender;
- (IBAction)saveGC:(id)sender; - (IBAction)saveGC:(id)sender;

View File

@ -18,7 +18,7 @@ NSString * const MGMLogout = @"Logout";
@implementation MGMAccountsPane @implementation MGMAccountsPane
- (id)initWithPreferences:(MGMPreferences *)thePreferences { - (id)initWithPreferences:(MGMPreferences *)thePreferences {
if (self = [super initWithPreferences:thePreferences]) { if ((self = [super initWithPreferences:thePreferences])) {
if (![NSBundle loadNibNamed:@"AccountsPane" owner:self]) { if (![NSBundle loadNibNamed:@"AccountsPane" owner:self]) {
NSLog(@"Unable to load Nib for Account Preferences"); NSLog(@"Unable to load Nib for Account Preferences");
[self release]; [self release];
@ -48,6 +48,8 @@ NSString * const MGMLogout = @"Logout";
[SIPProxyPortField setEnabled:NO]; [SIPProxyPortField setEnabled:NO];
[SIPSIPAddressField setEnabled:NO]; [SIPSIPAddressField setEnabled:NO];
[SIPRegistrarTimeoutField setEnabled:NO]; [SIPRegistrarTimeoutField setEnabled:NO];
[SIPTransportPopUp setEnabled:NO];
[SIPToneTypePopUp setEnabled:NO];
[SIPContactsMatrix setEnabled:NO]; [SIPContactsMatrix setEnabled:NO];
[SIPGoogleContactsPopUp setEnabled:NO]; [SIPGoogleContactsPopUp setEnabled:NO];
[settingsTab selectTabViewItemAtIndex:0]; [settingsTab selectTabViewItemAtIndex:0];
@ -58,9 +60,7 @@ NSString * const MGMLogout = @"Logout";
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] removeObserver:usersTable]; [[NSNotificationCenter defaultCenter] removeObserver:usersTable];
if (checkInstance!=nil)
[checkInstance release]; [checkInstance release];
if (mainView!=nil)
[mainView release]; [mainView release];
[super dealloc]; [super dealloc];
} }
@ -153,6 +153,8 @@ NSString * const MGMLogout = @"Logout";
[SIPProxyPortField setEnabled:NO]; [SIPProxyPortField setEnabled:NO];
[SIPSIPAddressField setEnabled:NO]; [SIPSIPAddressField setEnabled:NO];
[SIPRegistrarTimeoutField setEnabled:NO]; [SIPRegistrarTimeoutField setEnabled:NO];
[SIPTransportPopUp setEnabled:NO];
[SIPToneTypePopUp setEnabled:NO];
[SIPContactsMatrix setEnabled:NO]; [SIPContactsMatrix setEnabled:NO];
[SIPGoogleContactsPopUp setEnabled:NO]; [SIPGoogleContactsPopUp setEnabled:NO];
if (selected==-1) if (selected==-1)
@ -240,6 +242,8 @@ NSString * const MGMLogout = @"Logout";
[SIPProxyPortField setEnabled:YES]; [SIPProxyPortField setEnabled:YES];
[SIPSIPAddressField setEnabled:YES]; [SIPSIPAddressField setEnabled:YES];
[SIPRegistrarTimeoutField setEnabled:YES]; [SIPRegistrarTimeoutField setEnabled:YES];
[SIPTransportPopUp setEnabled:YES];
[SIPToneTypePopUp setEnabled:YES];
} }
if ([user settingForKey:MGMSIPAccountFullName]!=nil) if ([user settingForKey:MGMSIPAccountFullName]!=nil)
[SIPFullNameField setStringValue:[user settingForKey:MGMSIPAccountFullName]]; [SIPFullNameField setStringValue:[user settingForKey:MGMSIPAccountFullName]];
@ -282,6 +286,10 @@ NSString * const MGMLogout = @"Logout";
[SIPRegistrarTimeoutField setIntValue:[[user settingForKey:MGMSIPAccountRegisterTimeout] intValue]]; [SIPRegistrarTimeoutField setIntValue:[[user settingForKey:MGMSIPAccountRegisterTimeout] intValue]];
else else
[SIPRegistrarTimeoutField setStringValue:@""]; [SIPRegistrarTimeoutField setStringValue:@""];
int transport = [[user settingForKey:MGMSIPAccountTransport] intValue];
[SIPTransportPopUp selectItemAtIndex:transport];
int dtmfToneType = [[user settingForKey:MGMSIPAccountDTMFToneType] intValue];
[SIPToneTypePopUp selectItemAtIndex:dtmfToneType];
NSArray *users = [MGMUser users]; NSArray *users = [MGMUser users];
NSMenu *menu = [[NSMenu new] autorelease]; NSMenu *menu = [[NSMenu new] autorelease];
@ -376,6 +384,8 @@ NSString * const MGMLogout = @"Logout";
[user setSetting:[SIPSIPAddressField stringValue] forKey:MGMSIPAccountSIPAddress]; [user setSetting:[SIPSIPAddressField stringValue] forKey:MGMSIPAccountSIPAddress];
[[SIPSIPAddressField cell] setPlaceholderString:[NSString stringWithFormat:@"%@@%@", [user settingForKey:MGMSIPAccountUserName], [user settingForKey:MGMSIPAccountDomain]]]; [[SIPSIPAddressField cell] setPlaceholderString:[NSString stringWithFormat:@"%@@%@", [user settingForKey:MGMSIPAccountUserName], [user settingForKey:MGMSIPAccountDomain]]];
[user setSetting:[NSNumber numberWithInt:[SIPRegistrarTimeoutField intValue]] forKey:MGMSIPAccountRegisterTimeout]; [user setSetting:[NSNumber numberWithInt:[SIPRegistrarTimeoutField intValue]] forKey:MGMSIPAccountRegisterTimeout];
[user setSetting:[NSNumber numberWithInt:[SIPTransportPopUp indexOfSelectedItem]] forKey:MGMSIPAccountTransport];
[user setSetting:[NSNumber numberWithInt:[SIPToneTypePopUp indexOfSelectedItem]] forKey:MGMSIPAccountDTMFToneType];
#endif #endif
} }

View File

@ -37,6 +37,7 @@
IBOutlet NSTextField *logFileLevelField; IBOutlet NSTextField *logFileLevelField;
IBOutlet NSTextField *consoleLogLevelField; IBOutlet NSTextField *consoleLogLevelField;
IBOutlet NSTextField *publicAddressField; IBOutlet NSTextField *publicAddressField;
IBOutlet NSTextField *userAgentField;
} }
- (id)initWithPreferences:(MGMPreferences *)thePreferences; - (id)initWithPreferences:(MGMPreferences *)thePreferences;
+ (void)setUpToolbarItem:(NSToolbarItem *)theItem; + (void)setUpToolbarItem:(NSToolbarItem *)theItem;
@ -66,5 +67,6 @@
- (IBAction)logFileLevel:(id)sender; - (IBAction)logFileLevel:(id)sender;
- (IBAction)consoleLogLevel:(id)sender; - (IBAction)consoleLogLevel:(id)sender;
- (IBAction)publicAddress:(id)sender; - (IBAction)publicAddress:(id)sender;
- (IBAction)userAgent:(id)sender;
@end @end
#endif #endif

View File

@ -12,7 +12,7 @@
@implementation MGMSIPPane @implementation MGMSIPPane
- (id)initWithPreferences:(MGMPreferences *)thePreferences { - (id)initWithPreferences:(MGMPreferences *)thePreferences {
if (self = [super initWithPreferences:thePreferences]) { if ((self = [super initWithPreferences:thePreferences])) {
if (![NSBundle loadNibNamed:@"SIPPane" owner:self]) { if (![NSBundle loadNibNamed:@"SIPPane" owner:self]) {
NSLog(@"Unable to load Nib for SIP Preferences"); NSLog(@"Unable to load Nib for SIP Preferences");
[self release]; [self release];
@ -49,6 +49,8 @@
[consoleLogLevelField setIntValue:[defaults integerForKey:MGMSIPConsoleLogLevel]]; [consoleLogLevelField setIntValue:[defaults integerForKey:MGMSIPConsoleLogLevel]];
if ([defaults objectForKey:MGMSIPPublicAddress]!=nil && ![[defaults objectForKey:MGMSIPPublicAddress] isEqual:@""]) if ([defaults objectForKey:MGMSIPPublicAddress]!=nil && ![[defaults objectForKey:MGMSIPPublicAddress] isEqual:@""])
[publicAddressField setStringValue:[defaults objectForKey:MGMSIPPublicAddress]]; [publicAddressField setStringValue:[defaults objectForKey:MGMSIPPublicAddress]];
if ([defaults objectForKey:MGMSIPUserAgent]!=nil)
[userAgentField setStringValue:[defaults objectForKey:MGMSIPUserAgent]];
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(volumeChanged:) name:MGMSIPVolumeChangedNotification object:nil]; [notificationCenter addObserver:self selector:@selector(volumeChanged:) name:MGMSIPVolumeChangedNotification object:nil];
@ -76,7 +78,6 @@
} }
//[[MGMSIP sharedSIP] restart]; //[[MGMSIP sharedSIP] restart];
} }
if (mainView!=nil)
[mainView release]; [mainView release];
[super dealloc]; [super dealloc];
} }
@ -228,5 +229,9 @@
[[NSUserDefaults standardUserDefaults] setObject:[publicAddressField stringValue] forKey:MGMSIPPublicAddress]; [[NSUserDefaults standardUserDefaults] setObject:[publicAddressField stringValue] forKey:MGMSIPPublicAddress];
shouldRestart = YES; shouldRestart = YES;
} }
- (IBAction)userAgent:(id)sender {
[[NSUserDefaults standardUserDefaults] setObject:[userAgentField stringValue] forKey:MGMSIPUserAgent];
shouldRestart = YES;
}
@end @end
#endif #endif

View File

@ -15,7 +15,7 @@ NSString * const MGMTestTTPhoto = @"tPhoto";
@implementation MGMSMSThemesPane @implementation MGMSMSThemesPane
- (id)initWithPreferences:(MGMPreferences *)thePreferences { - (id)initWithPreferences:(MGMPreferences *)thePreferences {
if (self = [super initWithPreferences:thePreferences]) { if ((self = [super initWithPreferences:thePreferences])) {
if (![NSBundle loadNibNamed:@"SMSThemesPane" owner:self]) { if (![NSBundle loadNibNamed:@"SMSThemesPane" owner:self]) {
NSLog(@"Unable to load Nib for SMS Themes Preferences"); NSLog(@"Unable to load Nib for SMS Themes Preferences");
[self release]; [self release];
@ -50,15 +50,10 @@ NSString * const MGMTestTTPhoto = @"tPhoto";
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (themeManager!=nil)
[themeManager release]; [themeManager release];
if (testMessages!=nil)
[testMessages release]; [testMessages release];
if (testMessageInfo!=nil)
[testMessageInfo release]; [testMessageInfo release];
if (mainView!=nil)
[mainView release]; [mainView release];
if (browserWindow!=nil)
[browserWindow release]; [browserWindow release];
[super dealloc]; [super dealloc];
} }

View File

@ -15,7 +15,7 @@ NSString * const MGMNoAuthor = @"No Author Found";
@implementation MGMSoundsPane @implementation MGMSoundsPane
- (id)initWithPreferences:(MGMPreferences *)thePreferences { - (id)initWithPreferences:(MGMPreferences *)thePreferences {
if (self = [super initWithPreferences:thePreferences]) { if ((self = [super initWithPreferences:thePreferences])) {
if (![NSBundle loadNibNamed:@"SoundsPane" owner:self]) { if (![NSBundle loadNibNamed:@"SoundsPane" owner:self]) {
NSLog(@"Unable to load Nib for Sounds Preferences"); NSLog(@"Unable to load Nib for Sounds Preferences");
[self release]; [self release];
@ -30,13 +30,9 @@ NSString * const MGMNoAuthor = @"No Author Found";
} }
- (void)dealloc { - (void)dealloc {
[self stopSound:self]; [self stopSound:self];
if (themeManager!=nil)
[themeManager release]; [themeManager release];
if (mainView!=nil)
[mainView release]; [mainView release];
if (sounds!=nil)
[sounds release]; [sounds release];
if (browserWindow!=nil)
[browserWindow release]; [browserWindow release];
[super dealloc]; [super dealloc];
} }
@ -190,11 +186,9 @@ NSString * const MGMNoAuthor = @"No Author Found";
if (![themeManager setSound:soundName withPath:[sound objectForKey:MGMTSPath]]) { if (![themeManager setSound:soundName withPath:[sound objectForKey:MGMTSPath]]) {
NSBeep(); NSBeep();
} else { } else {
if (soundPlayer!=nil) {
[soundPlayer stop]; [soundPlayer stop];
[soundPlayer release]; [soundPlayer release];
soundPlayer = nil; soundPlayer = nil;
}
soundPlayer = [themeManager playSound:soundName]; soundPlayer = [themeManager playSound:soundName];
[soundPlayer setDelegate:self]; [soundPlayer setDelegate:self];
} }
@ -205,18 +199,14 @@ NSString * const MGMNoAuthor = @"No Author Found";
[self reload:soundName]; [self reload:soundName];
} }
- (void)soundDidFinishPlaying:(MGMSound *)theSound { - (void)soundDidFinishPlaying:(MGMSound *)theSound {
if (soundPlayer!=nil) {
[soundPlayer release]; [soundPlayer release];
soundPlayer = nil; soundPlayer = nil;
} }
}
- (IBAction)stopSound:(id)sender { - (IBAction)stopSound:(id)sender {
if (soundPlayer!=nil) {
[soundPlayer stop]; [soundPlayer stop];
[soundPlayer release]; [soundPlayer release];
soundPlayer = nil; soundPlayer = nil;
} }
}
- (IBAction)authorSite:(id)sender { - (IBAction)authorSite:(id)sender {
NSFileManager *manager = [NSFileManager defaultManager]; NSFileManager *manager = [NSFileManager defaultManager];

View File

@ -22,7 +22,7 @@ NSString * const MGMSCTitleNoNameFormat = @"Call With %@";
return [[[self alloc] initWithCall:theCall SIPUser:theSIPUser] autorelease]; return [[[self alloc] initWithCall:theCall SIPUser:theSIPUser] autorelease];
} }
- (id)initWithCall:(MGMSIPCall *)theCall SIPUser:(MGMSIPUser *)theSIPUser { - (id)initWithCall:(MGMSIPCall *)theCall SIPUser:(MGMSIPUser *)theSIPUser {
if (self = [super init]) { if ((self = [super init])) {
if (![NSBundle loadNibNamed:@"SIPCallWindow" owner:self]) { if (![NSBundle loadNibNamed:@"SIPCallWindow" owner:self]) {
NSLog(@"Unable to load SIP Call Window!"); NSLog(@"Unable to load SIP Call Window!");
[self release]; [self release];
@ -104,12 +104,10 @@ NSString * const MGMSCTitleNoNameFormat = @"Call With %@";
} }
if ([call state]==MGMSIPCallDisconnectedState) { if ([call state]==MGMSIPCallDisconnectedState) {
if (ringtone!=nil) {
[ringtone stop]; [ringtone stop];
[ringtone release]; [ringtone release];
ringtone = nil; ringtone = nil;
} }
}
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserver:self selector:@selector(soundChanged:) name:MGMTSoundChangedNotification object:nil]; [notificationCenter addObserver:self selector:@selector(soundChanged:) name:MGMTSoundChangedNotification object:nil];
@ -122,49 +120,31 @@ NSString * const MGMSCTitleNoNameFormat = @"Call With %@";
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
[self hidePad]; [self hidePad];
if (call!=nil) {
[call setDelegate:nil]; [call setDelegate:nil];
[call release]; [call release];
}
if (whitePages!=nil)
[whitePages release]; [whitePages release];
if (incomingWindow!=nil)
[incomingWindow release]; [incomingWindow release];
if (callWindow!=nil)
[callWindow release]; [callWindow release];
if (fullName!=nil)
[fullName release]; [fullName release];
if (phoneNumber!=nil)
[phoneNumber release]; [phoneNumber release];
if (ringtone!=nil) {
[ringtone stop]; [ringtone stop];
[ringtone release]; [ringtone release];
}
if (startTime!=nil)
[startTime release];
if (durationUpdater!=nil) {
[durationUpdater invalidate]; [durationUpdater invalidate];
[durationUpdater release]; [durationUpdater release];
} [startTime release];
[super dealloc]; [super dealloc];
} }
- (void)disconnected:(MGMSIPCall *)theCall { - (void)disconnected:(MGMSIPCall *)theCall {
if (ringtone!=nil) {
[ringtone stop]; [ringtone stop];
[ringtone release]; [ringtone release];
ringtone = nil; ringtone = nil;
}
if ([callWindow isVisible]) { if ([callWindow isVisible]) {
if (durationUpdater!=nil) {
[durationUpdater invalidate]; [durationUpdater invalidate];
[durationUpdater release]; [durationUpdater release];
durationUpdater = nil; durationUpdater = nil;
}
if (startTime!=nil) {
[startTime release]; [startTime release];
startTime = nil; startTime = nil;
}
[statusField setStringValue:@"Disconnected"]; [statusField setStringValue:@"Disconnected"];
[[[SIPUser controller] themeManager] playSound:MGMTSSIPDisconnected]; [[[SIPUser controller] themeManager] playSound:MGMTSSIPDisconnected];
} else { } else {
@ -176,7 +156,7 @@ NSString * const MGMSCTitleNoNameFormat = @"Call With %@";
- (void)confirmed:(MGMSIPCall *)theCall { - (void)confirmed:(MGMSIPCall *)theCall {
[statusField setStringValue:@"Connected"]; [statusField setStringValue:@"Connected"];
[[[SIPUser controller] themeManager] playSound:MGMTSSIPConnected]; [[[SIPUser controller] themeManager] playSound:MGMTSSIPConnected];
[self performSelectorOnMainThread:@selector(startDurationTimer) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(startDurationTimer) withObject:nil waitUntilDone:YES];
} }
- (void)startDurationTimer { - (void)startDurationTimer {
startTime = [NSDate new]; startTime = [NSDate new];
@ -216,22 +196,18 @@ NSString * const MGMSCTitleNoNameFormat = @"Call With %@";
[sound5Button setTitle:[[[SIPUser controller] themeManager] nameOfSound:MGMTSSIPSound5]]; [sound5Button setTitle:[[[SIPUser controller] themeManager] nameOfSound:MGMTSSIPSound5]];
} }
- (IBAction)answer:(id)sender { - (IBAction)answer:(id)sender {
if (ringtone!=nil) {
[ringtone stop]; [ringtone stop];
[ringtone release]; [ringtone release];
ringtone = nil; ringtone = nil;
}
[incomingWindow close]; [incomingWindow close];
[call answer]; [call answer];
[self fillCallWindow]; [self fillCallWindow];
[callWindow makeKeyAndOrderFront:self]; [callWindow makeKeyAndOrderFront:self];
} }
- (IBAction)ignore:(id)sender { - (IBAction)ignore:(id)sender {
if (ringtone!=nil) {
[ringtone stop]; [ringtone stop];
[ringtone release]; [ringtone release];
ringtone = nil; ringtone = nil;
}
[incomingWindow close]; [incomingWindow close];
[SIPUser callDone:self]; [SIPUser callDone:self];
} }
@ -286,15 +262,11 @@ NSString * const MGMSCTitleNoNameFormat = @"Call With %@";
} }
- (IBAction)hangUp:(id)sender { - (IBAction)hangUp:(id)sender {
[callWindow close]; [callWindow close];
if (durationUpdater!=nil) {
[durationUpdater invalidate]; [durationUpdater invalidate];
[durationUpdater release]; [durationUpdater release];
durationUpdater = nil; durationUpdater = nil;
}
if (startTime!=nil) {
[startTime release]; [startTime release];
startTime = nil; startTime = nil;
}
[call hangUp]; [call hangUp];
[SIPUser callDone:self]; [SIPUser callDone:self];
} }

View File

@ -14,7 +14,7 @@
extern NSString * const MGMSIPUserAreaCode; extern NSString * const MGMSIPUserAreaCode;
@interface MGMSIPUser : MGMContactsController { @interface MGMSIPUser : MGMContactsController <NSAnimationDelegate> {
MGMUser *user; MGMUser *user;
MGMSIPAccount *account; MGMSIPAccount *account;
NSMutableArray *calls; NSMutableArray *calls;

View File

@ -23,7 +23,7 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
return [[[self alloc] initUser:theUser controller:theController] autorelease]; return [[[self alloc] initUser:theUser controller:theController] autorelease];
} }
- (id)initUser:(MGMUser *)theUser controller:(MGMController *)theController { - (id)initUser:(MGMUser *)theUser controller:(MGMController *)theController {
if (self = [super initWithController:theController]) { if ((self = [super initWithController:theController])) {
user = [theUser retain]; user = [theUser retain];
[user setDelegate:self]; [user setDelegate:self];
[self registerSettings]; [self registerSettings];
@ -52,7 +52,7 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
userName = [user settingForKey:MGMSIPAccountFullName]; userName = [user settingForKey:MGMSIPAccountFullName];
[userNameField setStringValue:userName]; [userNameField setStringValue:userName];
if (![account isLoggedIn]) { if (![account isRegistered]) {
NSSize contentSize = [[contactsWindow contentView] frame].size; NSSize contentSize = [[contactsWindow contentView] frame].size;
progressView = [[MGMProgressView alloc] initWithFrame:NSMakeRect(0, 0, contentSize.width, contentSize.height)]; progressView = [[MGMProgressView alloc] initWithFrame:NSMakeRect(0, 0, contentSize.width, contentSize.height)];
[progressView setProgressTitle:@"Logging In"]; [progressView setProgressTitle:@"Logging In"];
@ -62,35 +62,22 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
} }
} }
- (void)dealloc { - (void)dealloc {
if (progressFadeAnimation!=nil) { [account setDelegate:nil];
[contacts setDelegate:nil];
[progressFadeAnimation stopAnimation]; [progressFadeAnimation stopAnimation];
[progressFadeAnimation release]; [progressFadeAnimation release];
progressFadeAnimation = nil; progressFadeAnimation = nil;
}
if (progressView!=nil) {
[progressView stopProgess]; [progressView stopProgess];
[progressView release]; [progressView release];
}
if (SIPRegistrationTimeout!=nil) {
[SIPRegistrationTimeout invalidate]; [SIPRegistrationTimeout invalidate];
[SIPRegistrationTimeout release]; [SIPRegistrationTimeout release];
}
[super dealloc]; [super dealloc];
if (calls!=nil) {
[calls removeAllObjects]; [calls removeAllObjects];
[calls release]; [calls release];
}
if (account!=nil) {
[account setDelegate:nil];
[account logout]; [account logout];
[account release]; [account release];
}
if (contacts!=nil) {
[contacts stop]; [contacts stop];
[contacts setDelegate:nil];
[contacts release]; [contacts release];
}
if (user!=nil)
[user release]; [user release];
} }
@ -131,11 +118,9 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
} }
- (void)registrationChanged { - (void)registrationChanged {
if (SIPRegistrationTimeout!=nil) {
[SIPRegistrationTimeout invalidate]; [SIPRegistrationTimeout invalidate];
[SIPRegistrationTimeout release]; [SIPRegistrationTimeout release];
SIPRegistrationTimeout = nil; SIPRegistrationTimeout = nil;
}
if (!acountRegistered) { if (!acountRegistered) {
if (![account isRegistered]) { if (![account isRegistered]) {
NSAlert *theAlert = [[NSAlert new] autorelease]; NSAlert *theAlert = [[NSAlert new] autorelease];
@ -144,23 +129,21 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
[theAlert runModal]; [theAlert runModal];
} }
acountRegistered = YES; acountRegistered = YES;
[self performSelectorOnMainThread:@selector(removeLoginProgress) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(removeLoginProgress) withObject:nil waitUntilDone:YES];
} }
} }
- (void)loggedIn { - (void)loggedIn {
loggingIn = NO; loggingIn = NO;
[self performSelectorOnMainThread:@selector(startRegistrationTimeoutTimer) withObject:nil waitUntilDone:NO]; [self performSelectorOnMainThread:@selector(startRegistrationTimeoutTimer) withObject:nil waitUntilDone:YES];
} }
- (void)startRegistrationTimeoutTimer { - (void)startRegistrationTimeoutTimer {
if (!acountRegistered) if (!acountRegistered)
SIPRegistrationTimeout = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(SIPTimeout) userInfo:nil repeats:NO] retain]; SIPRegistrationTimeout = [[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(SIPTimeout) userInfo:nil repeats:NO] retain];
} }
- (void)SIPTimeout { - (void)SIPTimeout {
if (SIPRegistrationTimeout!=nil) {
[SIPRegistrationTimeout invalidate]; [SIPRegistrationTimeout invalidate];
[SIPRegistrationTimeout release]; [SIPRegistrationTimeout release];
SIPRegistrationTimeout = nil; SIPRegistrationTimeout = nil;
}
[account setLastError:@"Registration Timeout."]; [account setLastError:@"Registration Timeout."];
[self loginErrored]; [self loginErrored];
} }
@ -185,13 +168,11 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
[theAlert setInformativeText:[account lastError]]; [theAlert setInformativeText:[account lastError]];
[theAlert runModal]; [theAlert runModal];
if (progressView!=nil) {
[progressView stopProgess]; [progressView stopProgess];
[progressView removeFromSuperview]; [progressView removeFromSuperview];
[progressView release]; [progressView release];
progressView = nil; progressView = nil;
} [self performSelectorOnMainThread:@selector(removeLoginProgress) withObject:nil waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(removeLoginProgress) withObject:nil waitUntilDone:NO];
} }
- (void)logoutErrored { - (void)logoutErrored {
NSAlert *theAlert = [[NSAlert new] autorelease]; NSAlert *theAlert = [[NSAlert new] autorelease];
@ -200,16 +181,12 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
[theAlert runModal]; [theAlert runModal];
} }
- (void)animationDidEnd:(NSAnimation *)animation { - (void)animationDidEnd:(NSAnimation *)animation {
if (progressFadeAnimation!=nil) {
[progressFadeAnimation release]; [progressFadeAnimation release];
progressFadeAnimation = nil; progressFadeAnimation = nil;
}
if (progressView!=nil) {
[progressView removeFromSuperview]; [progressView removeFromSuperview];
[progressView release]; [progressView release];
progressView = nil; progressView = nil;
} }
}
- (MGMContacts *)contacts { - (MGMContacts *)contacts {
return contacts; return contacts;
@ -217,7 +194,7 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
- (void)reloadData { - (void)reloadData {
[super reloadData]; [super reloadData];
if (progressView!=nil) [progressView display]; [progressView display];
} }
- (NSString *)areaCode { - (NSString *)areaCode {
@ -274,11 +251,9 @@ NSString * const MGMSIPUserAreaCode = @"MGMVSIPUserAreaCode";
if (![controller isQuitting]) if (![controller isQuitting])
[user setSetting:[NSNumber numberWithBool:NO] forKey:MGMContactsWindowOpen]; [user setSetting:[NSNumber numberWithBool:NO] forKey:MGMContactsWindowOpen];
[super windowWillClose:notification]; [super windowWillClose:notification];
if (progressFadeAnimation!=nil) {
[progressFadeAnimation stopAnimation]; [progressFadeAnimation stopAnimation];
[progressFadeAnimation release]; [progressFadeAnimation release];
progressFadeAnimation = nil; progressFadeAnimation = nil;
} }
}
@end @end
#endif #endif

View File

@ -13,7 +13,7 @@
@implementation MGMSIPWavConverter @implementation MGMSIPWavConverter
- (id)initWithSoundName:(NSString *)theSoundname fileConverting:(NSString *)theFile { - (id)initWithSoundName:(NSString *)theSoundname fileConverting:(NSString *)theFile {
if (self = [super init]) { if ((self = [super init])) {
fileConverting = [theFile copy]; fileConverting = [theFile copy];
soundName = [theSoundname copy]; soundName = [theSoundname copy];
cancel = NO; cancel = NO;
@ -34,15 +34,11 @@
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (fileConverting!=nil)
[fileConverting release]; [fileConverting release];
if (soundName!=nil)
[soundName release]; [soundName release];
if (movie!=nil)
[movie release]; [movie release];
if (backgroundThread!=nil) { if (backgroundThread!=nil)
while (backgroundThread!=nil) [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.2]]; while (backgroundThread!=nil) [NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.2]];
}
[super dealloc]; [super dealloc];
} }
@ -71,7 +67,7 @@
finalPath = [finalPath stringByAppendingPathComponent:soundName]; finalPath = [finalPath stringByAppendingPathComponent:soundName];
NSString *convertFinalPath = [[finalPath stringByAppendingPathExtension:@".tmp"] stringByAppendingPathExtension:MGMWavExt]; NSString *convertFinalPath = [[finalPath stringByAppendingPathExtension:@".tmp"] stringByAppendingPathExtension:MGMWavExt];
finalPath = [finalPath stringByAppendingPathExtension:MGMWavExt]; finalPath = [finalPath stringByAppendingPathExtension:MGMWavExt];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], QTMovieExport, [NSNumber numberWithLong:kQTFileTypeWave], QTMovieExportType, [NSNumber numberWithLong:SoundMediaType], QTMovieExportManufacturer, nil]; NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], QTMovieExport, [NSNumber numberWithLong:kQTFileTypeWave], QTMovieExportType, [NSNumber numberWithLong:'soun'], QTMovieExportManufacturer, nil];
if (!cancel) { if (!cancel) {
if (![movie writeToFile:convertFinalPath withAttributes:dictionary]) if (![movie writeToFile:convertFinalPath withAttributes:dictionary])
NSLog(@"Could not convert audio %@", fileConverting); NSLog(@"Could not convert audio %@", fileConverting);

View File

@ -17,7 +17,7 @@
return [[[self alloc] initWithInstance:theInstance controller:theController] autorelease]; return [[[self alloc] initWithInstance:theInstance controller:theController] autorelease];
} }
- (id)initWithInstance:(MGMInstance *)theInstance controller:(MGMController *)theController { - (id)initWithInstance:(MGMInstance *)theInstance controller:(MGMController *)theController {
if (self = [super init]) { if ((self = [super init])) {
if (![NSBundle loadNibNamed:@"MultiSMS" owner:self]) { if (![NSBundle loadNibNamed:@"MultiSMS" owner:self]) {
NSLog(@"Unable to load Multiple SMS Window."); NSLog(@"Unable to load Multiple SMS Window.");
[self release]; [self release];

View File

@ -40,4 +40,5 @@
- (void)messageWithNumber:(NSString *)theNumber instance:(MGMInstance *)theInstance; - (void)messageWithNumber:(NSString *)theNumber instance:(MGMInstance *)theInstance;
- (void)messageWithData:(NSDictionary *)theData instance:(MGMInstance *)theInstance; - (void)messageWithData:(NSDictionary *)theData instance:(MGMInstance *)theInstance;
- (NSString *)currentPhoneNumber; - (NSString *)currentPhoneNumber;
- (void)windowDidBecomeKey:(NSNotification *)notification;
@end @end

View File

@ -23,7 +23,7 @@ const float updateTimeInterval = 300.0;
return [[[self alloc] initWithController:theController] autorelease]; return [[[self alloc] initWithController:theController] autorelease];
} }
- (id)initWithController:(MGMController *)theController { - (id)initWithController:(MGMController *)theController {
if (self = [super init]) { if ((self = [super init])) {
controller = theController; controller = theController;
SMSMessages = [NSMutableArray new]; SMSMessages = [NSMutableArray new];
lastDates = [NSMutableDictionary new]; lastDates = [NSMutableDictionary new];
@ -35,15 +35,10 @@ const float updateTimeInterval = 300.0;
[[[messagesTable tableColumns] objectAtIndex:0] setDataCell:[[[MGMViewCell alloc] initGradientCell] autorelease]]; [[[messagesTable tableColumns] objectAtIndex:0] setDataCell:[[[MGMViewCell alloc] initGradientCell] autorelease]];
} }
- (void)dealloc { - (void)dealloc {
if (SMSWindow!=nil)
[SMSWindow close]; [SMSWindow close];
if (updateTimer!=nil) {
[updateTimer invalidate]; [updateTimer invalidate];
[updateTimer release]; [updateTimer release];
}
if (SMSMessages!=nil)
[SMSMessages release]; [SMSMessages release];
if (lastDates!=nil)
[lastDates release]; [lastDates release];
[super dealloc]; [super dealloc];
} }

View File

@ -20,7 +20,7 @@
return [[[self alloc] initWithManager:theManager messages:theMessages messageInfo:theMessageInfo instance:theInstance] autorelease]; return [[[self alloc] initWithManager:theManager messages:theMessages messageInfo:theMessageInfo instance:theInstance] autorelease];
} }
- (id)initWithManager:(MGMSMSManager *)theManager messages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo instance:(MGMInstance *)theInstance { - (id)initWithManager:(MGMSMSManager *)theManager messages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo instance:(MGMInstance *)theInstance {
if (self = [super init]) { if ((self = [super init])) {
if (![NSBundle loadNibNamed:@"SMSMessageView" owner:self]) { if (![NSBundle loadNibNamed:@"SMSMessageView" owner:self]) {
NSLog(@"Error: Unable to load SMS Message View."); NSLog(@"Error: Unable to load SMS Message View.");
[self release]; [self release];
@ -48,11 +48,8 @@
} }
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
if (SMSSplitView!=nil)
[SMSSplitView release]; [SMSSplitView release];
if (messages!=nil)
[messages release]; [messages release];
if (messageInfo!=nil)
[messageInfo release]; [messageInfo release];
[super dealloc]; [super dealloc];
} }
@ -100,7 +97,7 @@
- (BOOL)updateWithMessages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo { - (BOOL)updateWithMessages:(NSArray *)theMessages messageInfo:(NSDictionary *)theMessageInfo {
BOOL newIncomingMessages = NO; BOOL newIncomingMessages = NO;
if (![[theMessageInfo objectForKey:MGMITime] isEqual:[messageInfo objectForKey:MGMITime]]) { if (![[theMessageInfo objectForKey:MGMITime] isEqual:[messageInfo objectForKey:MGMITime]]) {
if (messageInfo!=nil) [messageInfo release]; [messageInfo release];
messageInfo = [theMessageInfo mutableCopy]; messageInfo = [theMessageInfo mutableCopy];
[self setRead:[[messageInfo objectForKey:MGMIRead] boolValue]]; [self setRead:[[messageInfo objectForKey:MGMIRead] boolValue]];

View File

@ -17,7 +17,7 @@
return [[[self alloc] initWithMessageView:theMessageView] autorelease]; return [[[self alloc] initWithMessageView:theMessageView] autorelease];
} }
- (id)initWithMessageView:(MGMSMSMessageView *)theMessageView { - (id)initWithMessageView:(MGMSMSMessageView *)theMessageView {
if (self = [super initWithFrame:NSMakeRect(0, 0, 100, 40)]) { if ((self = [super initWithFrame:NSMakeRect(0, 0, 100, 40)])) {
messageView = theMessageView; messageView = theMessageView;
[self setToolTip:[[messageView messageInfo] objectForKey:MGMTInName]]; [self setToolTip:[[messageView messageInfo] objectForKey:MGMTInName]];
NSRect frameRect = [self frame]; NSRect frameRect = [self frame];
@ -57,11 +57,8 @@
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (photoView!=nil)
[photoView release]; [photoView release];
if (nameField!=nil)
[nameField release]; [nameField release];
if (closeButton!=nil)
[closeButton release]; [closeButton release];
[super dealloc]; [super dealloc];
} }

View File

@ -11,7 +11,7 @@
@implementation MGMBlackWindow @implementation MGMBlackWindow
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation { - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)deferCreation {
if (self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:deferCreation]) { if ((self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:deferCreation])) {
forceDisplay = NO; forceDisplay = NO;
[self setLevel:NSStatusWindowLevel]; [self setLevel:NSStatusWindowLevel];
[self setBackgroundColor:[NSColor clearColor]]; [self setBackgroundColor:[NSColor clearColor]];

View File

@ -15,7 +15,7 @@
} }
- (id)initWithFrame:(NSRect)frameRect themeManager:(MGMThemeManager *)theThemeManager { - (id)initWithFrame:(NSRect)frameRect themeManager:(MGMThemeManager *)theThemeManager {
themeManager = theThemeManager; themeManager = theThemeManager;
if (self = [super initWithFrame:frameRect]) { if ((self = [super initWithFrame:frameRect])) {
photoView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, frameRect.size.height, frameRect.size.height)]; photoView = [[NSImageView alloc] initWithFrame:NSMakeRect(0, 0, frameRect.size.height, frameRect.size.height)];
[photoView setRefusesFirstResponder:YES]; [photoView setRefusesFirstResponder:YES];
[self addSubview:photoView]; [self addSubview:photoView];
@ -39,13 +39,9 @@
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (photoView!=nil)
[photoView release]; [photoView release];
if (nameField!=nil)
[nameField release]; [nameField release];
if (phoneField!=nil)
[phoneField release]; [phoneField release];
if (contact!=nil)
[contact release]; [contact release];
[super dealloc]; [super dealloc];
} }
@ -61,7 +57,7 @@
return contact; return contact;
} }
- (void)setContact:(NSDictionary *)theContact { - (void)setContact:(NSDictionary *)theContact {
if (contact!=nil) [contact release]; [contact release];
contact = [theContact mutableCopy]; contact = [theContact mutableCopy];
if ([contact objectForKey:MGMCPhoto]==nil || [[contact objectForKey:MGMCPhoto] isKindOfClass:[NSNull class]]) if ([contact objectForKey:MGMCPhoto]==nil || [[contact objectForKey:MGMCPhoto] isKindOfClass:[NSNull class]])
[photoView setImage:[[[NSImage alloc] initWithContentsOfFile:[themeManager incomingIconPath]] autorelease]]; [photoView setImage:[[[NSImage alloc] initWithContentsOfFile:[themeManager incomingIconPath]] autorelease]];

View File

@ -10,7 +10,7 @@
@implementation MGMPhoneField @implementation MGMPhoneField
- (id)initWithCoder:(NSCoder*)coder { - (id)initWithCoder:(NSCoder*)coder {
if (self = [super initWithCoder:coder]) { if ((self = [super initWithCoder:coder])) {
NSTextFieldCell *cell = [self cell]; NSTextFieldCell *cell = [self cell];
MGMPhoneFieldCell *phoneCell = [[MGMPhoneFieldCell alloc] initTextCell:[cell stringValue]]; MGMPhoneFieldCell *phoneCell = [[MGMPhoneFieldCell alloc] initTextCell:[cell stringValue]];
//NSTextFieldCell //NSTextFieldCell

View File

@ -10,7 +10,7 @@
@implementation MGMProgressView @implementation MGMProgressView
- (id)initWithFrame:(NSRect)frameRect { - (id)initWithFrame:(NSRect)frameRect {
if (self = [super initWithFrame:frameRect]) { if ((self = [super initWithFrame:frameRect])) {
progress = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect((frameRect.size.width-32)/2, (frameRect.size.height-32)/2, 32, 32)]; progress = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect((frameRect.size.width-32)/2, (frameRect.size.height-32)/2, 32, 32)];
[progress setStyle:NSProgressIndicatorSpinningStyle]; [progress setStyle:NSProgressIndicatorSpinningStyle];
[progress setControlSize:NSRegularControlSize]; [progress setControlSize:NSRegularControlSize];
@ -39,11 +39,8 @@
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (progress)
[progress release]; [progress release];
if (pleaseWaitField!=nil)
[pleaseWaitField release]; [pleaseWaitField release];
if (progressField!=nil)
[progressField release]; [progressField release];
[super dealloc]; [super dealloc];
} }

View File

@ -9,13 +9,6 @@
#import "MGMTranslucentTabView.h" #import "MGMTranslucentTabView.h"
@implementation MGMTranslucentTabView @implementation MGMTranslucentTabView
- (id)initWithFrame:(NSRect)frameRect {
if (self = [super initWithFrame:frameRect]) {
}
return self;
}
- (void)awakeFromNib { - (void)awakeFromNib {
[self setTabViewType:NSNoTabsNoBorder]; [self setTabViewType:NSNoTabsNoBorder];
[self setDrawsBackground:NO]; [self setDrawsBackground:NO];

View File

@ -11,7 +11,7 @@
@implementation MGMViewCell @implementation MGMViewCell
- (id)initGradientCell { - (id)initGradientCell {
if (self = [super init]) { if ((self = [super init])) {
gradient = YES; gradient = YES;
} }
return self; return self;

View File

@ -3,7 +3,7 @@
// VoiceMac // VoiceMac
// //
// Created by Mr. Gecko on 7/24/09. // Created by Mr. Gecko on 7/24/09.
// Copyright Mr. Gecko's Media 2009. All rights reserved. // Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -4,4 +4,4 @@ Contributing to MGMSIP and MGMXML is exactly the same as VoiceMac. However there
Terms for adding: Terms for adding:
1. The patch must not disrupt up the functionality of VoiceMac. 2. The patch must provide useful changes. 1. The patch must not disrupt up the functionality of VoiceMac. 2. The patch must provide useful changes.
3. Anything that you add to the source code of VoiceMac will be under the terms of my licenses. 3. Anything that you add to the source code of VoiceMac will be under the terms of my licenses.
4. If you add changes to VoiceMac's main source code, you may not have them removed, but you will get credit for the changes in the history of the application. To contribute: 1. Create a patch file using this command “diff -crB VoiceMacOriginal VoiceMac > VoiceMac.patch”. 2. Send the patch to voicemac@mrgeckosmedia.com with your name, email/website (if you want that information), and what you changed so I can add it to the about and change. 4. If you add changes to VoiceMac's source code, you may not have them removed, but you will get credit for the changes in the history of the application. To contribute: 1. Create a patch file using this command “diff -crB VoiceMacOriginal VoiceMac > VoiceMac.patch”. 2. Send the patch to voicemac@mrgeckosmedia.com with your name, email/website (if you want that information), and what you changed so I can add it to the about and change.

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 12/27/09. // Created by Mr. Gecko on 12/27/09.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import "MGMReporter.h" #import "MGMReporter.h"

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 1/2/10. // Created by Mr. Gecko on 1/2/10.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 1/1/10. // Created by Mr. Gecko on 1/1/10.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 12/27/09. // Created by Mr. Gecko on 12/27/09.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 12/28/09. // Created by Mr. Gecko on 12/28/09.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 1/2/10. // Created by Mr. Gecko on 1/2/10.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -3,7 +3,7 @@
// GeckoReporter // GeckoReporter
// //
// Created by Mr. Gecko on 12/31/09. // Created by Mr. Gecko on 12/31/09.
// Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/ // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/
// //
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>BuildMachineOSBuild</key>
<string>10J567</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>English</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
@ -15,12 +17,26 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.1</string> <string>0.2</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.1</string> <string>0.2</string>
<key>DTCompiler</key>
<string>4.2</string>
<key>DTPlatformBuild</key>
<string>4A278b</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>4A278b</string>
<key>DTSDKName</key>
<string>macosx10.6</string>
<key>DTXcode</key>
<string>0400</string>
<key>DTXcodeBuild</key>
<string>4A278b</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright (c) 2010 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/</string> <string>Copyright (c) 2011 Mr. Gecko's Media (James Coleman). All rights reserved. http://mrgeckosmedia.com/</string>
</dict> </dict>
</plist> </plist>

View File

@ -17,6 +17,7 @@ extern NSString * const MGMUserDoneNotification;
extern NSString * const MGMUserUpdatedNotification; extern NSString * const MGMUserUpdatedNotification;
extern NSString * const MGMUserID; extern NSString * const MGMUserID;
extern NSString * const MGMUserName; extern NSString * const MGMUserName;
extern NSString * const MGMUserPassword;
@class MGMUser, MGMKeychainItem, MGMHTTPCookieStorage; @class MGMUser, MGMKeychainItem, MGMHTTPCookieStorage;

View File

@ -1,59 +0,0 @@
//
// NSBundle+SUAdditions.h
// Sparkle
//
// Created by Andy Matuschak on 12/21/07.
// Copyright 2007 Andy Matuschak. All rights reserved.
//
#ifndef NSBUNDLE_PLUS_ADDITIONS_H
#define NSBUNDLE_PLUS_ADDITIONS_H
#import <Cocoa/Cocoa.h>
@interface NSBundle (SUAdditions)
/*!
@method
@abstract Returns a name for the bundle suitable for display to the user.
@discussion This is performed by asking NSFileManager for the display name of the bundle.
*/
- (NSString *)name;
/*!
@method
@abstract Returns the current internal version of the bundle.
@discussion This uses the CFBundleVersion info value. This string is not appropriate for display to users: use -displayVersion instead.
*/
- (NSString *)version;
/*!
@method
@abstract Returns the bundle's version, suitable for display to the user.
@discussion If the CFBundleShortVersionString is available and different from the CFBundleVersion, this looks like CFBundleShortVersionString (CFBundleVersion). If the version strings are the same or CFBundleShortVersionString is not defined, this is equivalent to -version.
*/
- (NSString *)displayVersion;
/*!
@method
@abstract Returns a suitable icon for this bundle.
@discussion Uses the CFBundleIconFile icon if defined; otherwise, uses the default application icon.
*/
- (NSImage *)icon;
/*!
@method
@abstract Returns whether the application is running from a disk image.
*/
- (BOOL)isRunningFromDiskImage;
/*!
@method
@abstract Returns a profile of the users system useful for statistical purposes.
@discussion Returns an array of dictionaries; each dictionary represents a piece of data and has keys "key", "visibleKey", "value", and "visibleValue".
*/
- (NSArray *)systemProfile;
- (NSString *)publicDSAKey;
@end
#endif

View File

@ -1,18 +0,0 @@
//
// NSFileManager+Aliases.h
// Sparkle
//
// Created by Andy Matuschak on 2/4/08.
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#ifndef NSFILEMANAGER_PLUS_ALIASES_H
#define NSFILEMANAGER_PLUS_ALIASES_H
#import <Cocoa/Cocoa.h>
@interface NSFileManager (SUAliases)
- (BOOL)isAliasFolderAtPath:(NSString *)path;
@end
#endif

View File

@ -1,16 +0,0 @@
//
// NSFileManager+Authentication.m
// Sparkle
//
// Created by Andy Matuschak on 3/9/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#ifndef NSFILEMANAGER_PLUS_AUTHENTICATION_H
#define NSFILEMANAGER_PLUS_AUTHENTICATION_H
@interface NSFileManager (SUAuthenticationAdditions)
- (BOOL)copyPathWithAuthentication:(NSString *)src overPath:(NSString *)dst error:(NSError **)error;
@end
#endif

View File

@ -1,53 +0,0 @@
//
// NSFileManager+ExtendedAttributes.h
// Sparkle
//
// Created by Mark Mentovai on 2008-01-22.
// Copyright 2008 Mark Mentovai. All rights reserved.
//
#ifndef NSFILEMANAGER_PLUS_EXTENDEDATTRIBUTES
#define NSFILEMANAGER_PLUS_EXTENDEDATTRIBUTES
#import <Cocoa/Cocoa.h>
@interface NSFileManager (MMExtendedAttributes)
// Wraps the removexattr system call, allowing an AppKit-style NSString* to
// be used for the pathname argument. Note that the order of the arguments
// has changed from what removexattr accepts, so that code reads more
// naturally.
//
// removexattr is only available on Mac OS X 10.4 ("Tiger") and later. If
// built with an SDK that includes removexattr, this method will link against
// removexattr directly. When using earlier SDKs, this method will dynamically
// look up the removexattr symbol at runtime. If the symbol is not present,
// as will be the case when running on 10.3, this method returns -1 and sets
// errno to ENOSYS.
- (int)removeXAttr:(const char*)name
fromFile:(NSString*)file
options:(int)options;
// Removes the directory tree rooted at |root| from the file quarantine.
// The quarantine was introduced on Mac OS X 10.5 and is described at:
//
// http://developer.apple.com/releasenotes/Carbon/RN-LaunchServices/index.html
//#apple_ref/doc/uid/TP40001369-DontLinkElementID_2
//
// If |root| is not a directory, then it alone is removed from the quarantine.
// Symbolic links, including |root| if it is a symbolic link, will not be
// traversed.
//
// Ordinarily, the quarantine is managed by calling LSSetItemAttribute
// to set the kLSItemQuarantineProperties attribute to a dictionary specifying
// the quarantine properties to be applied. However, it does not appear to be
// possible to remove an item from the quarantine directly through any public
// Launch Services calls. Instead, this method takes advantage of the fact
// that the quarantine is implemented in part by setting an extended attribute,
// "com.apple.quarantine", on affected files. Removing this attribute is
// sufficient to remove files from the quarantine.
- (void)releaseFromQuarantine:(NSString*)root;
@end
#endif

View File

@ -1,17 +0,0 @@
//
// NSFileManager+Verification.h
// Sparkle
//
// Created by Andy Matuschak on 3/16/06.
// Copyright 2006 Andy Matuschak. All rights reserved.
//
#ifndef NSFILEMANAGER_PLUS_VERIFICATION_H
#define NSFILEMANAGER_PLUS_VERIFICATION_H
// For the paranoid folks!
@interface NSFileManager (SUVerification)
- (BOOL)validatePath:(NSString *)path withEncodedDSASignature:(NSString *)encodedSignature withPublicDSAKey:(NSString *)pkeyString;
@end
#endif

View File

@ -1,16 +0,0 @@
//
// NSNumber+Units.h
// Sparkle
//
// Created by Jonas Witt on 5/18/08.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSNumber (JWUnits)
+ (NSString *)humanReadableSizeFromDouble:(double)value;
@end

Some files were not shown because too many files have changed in this diff Show More