Attempted to fix crashes that are vague. Fixed issues with logging in with 2 step verification. Fixed SIP install script for new computers. Updated PJProject to revision 3773. Updated version to 0.2.1.

This commit is contained in:
GRMrGecko 2011-09-23 23:29:16 -05:00
parent 60262c01cc
commit b8b556ed89
8 changed files with 87 additions and 42 deletions

View File

@ -82,6 +82,7 @@ extern NSString * const MGMUCVoicemail;
int webLoginTries; int webLoginTries;
BOOL loggedIn; BOOL loggedIn;
NSMutableDictionary *verificationParameters; NSMutableDictionary *verificationParameters;
NSURL *verificationURL;
NSString *XPCURL; NSString *XPCURL;
NSString *XPCCD; NSString *XPCCD;

View File

@ -30,7 +30,6 @@ NSString * const MGMVoiceBaseCopyright = @"Copyright (c) 2011 Mr. Gecko's Media
NSString * const MGMVoiceIndexURL = @"https://www.google.com/voice/"; NSString * const MGMVoiceIndexURL = @"https://www.google.com/voice/";
NSString * const MGMLoginURL = @"https://accounts.google.com/ServiceLoginAuth"; NSString * const MGMLoginURL = @"https://accounts.google.com/ServiceLoginAuth";
NSString * const MGMLoginVerifyURL = @"https://www.google.com/accounts/SmsAuth?persistent=yes";
NSString * const MGMXPCPath = @"/voice/xpc/?xpc=%7B%22cn%22%3A%22i70avDIMsA%22%2C%22tp%22%3Anull%2C%22pru%22%3A%22https%3A%2F%2Fwww.google.com%2Fvoice%2Fxpc%2Frelay%22%2C%22ppu%22%3A%22https%3A%2F%2Fwww.google.com%2Fvoice%2Fxpc%2Fblank%2F%22%2C%22lpu%22%3A%22https%3A%2F%2Fclients4.google.com%2Fvoice%2Fxpc%2Fblank%2F%22%7D"; NSString * const MGMXPCPath = @"/voice/xpc/?xpc=%7B%22cn%22%3A%22i70avDIMsA%22%2C%22tp%22%3Anull%2C%22pru%22%3A%22https%3A%2F%2Fwww.google.com%2Fvoice%2Fxpc%2Frelay%22%2C%22ppu%22%3A%22https%3A%2F%2Fwww.google.com%2Fvoice%2Fxpc%2Fblank%2F%22%2C%22lpu%22%3A%22https%3A%2F%2Fclients4.google.com%2Fvoice%2Fxpc%2Fblank%2F%22%7D";
NSString * const MGMCheckPath = @"/voice/xpc/checkMessages?r=%@"; NSString * const MGMCheckPath = @"/voice/xpc/checkMessages?r=%@";
NSString * const MGMCreditURL = @"https://www.google.com/voice/settings/billingcredit/"; NSString * const MGMCreditURL = @"https://www.google.com/voice/settings/billingcredit/";
@ -240,44 +239,87 @@ const BOOL MGMInstanceInvisible = YES;
} else if ([returnedString containsString:@"verification code"]) { } else if ([returnedString containsString:@"verification code"]) {
[verificationParameters release]; [verificationParameters release];
verificationParameters = [NSMutableDictionary new]; verificationParameters = [NSMutableDictionary new];
[verificationParameters setObject:@"yes" forKey:@"PersistentCookie"];
NSString *nameValue = @"name=\"%@\""; NSRange formRange = [returnedString rangeOfString:@"<form"];
NSString *valueStart = @"value=\""; NSRange formEndRange = [returnedString rangeOfString:@"</form>"];
NSString *valueEnd = @"\"";
NSString *valueStartQ = @"value='"; if (formRange.location==NSNotFound || formEndRange.location==NSNotFound) {
NSString *valueEndQ = @"'"; NSError *error = [NSError errorWithDomain:@"com.MrGeckosMedia.MGMInstance.Login" code:56 userInfo:[NSDictionary dictionaryWithObject:@"Unable to login. There is a bug with 2 step verification." forKey:NSLocalizedDescriptionKey]];
NSArray *names = [NSArray arrayWithObjects:@"timeStmp", @"secTok", @"smsToken", @"email", nil]; if (delegate!=nil && [delegate respondsToSelector:@selector(loginError:)]) {
for (int i=0; i<[names count]; i++) { [delegate loginError:error];
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSString *nameString = [NSString stringWithFormat:nameValue, [names objectAtIndex:i]];
NSRange range = [returnedString rangeOfString:nameString];
if (range.location==NSNotFound) {
nameString = [nameString replace:@"\"" with:@"'"];
range = [returnedString rangeOfString:nameString];
}
if (range.location==NSNotFound) {
NSLog(@"Unable to find %@", [names objectAtIndex:i]);
} else { } else {
NSString *string = [returnedString substringFromIndex:range.location+range.length]; NSLog(@"Login Error: %@", error);
range = [string rangeOfString:valueStart]; }
if (range.location==NSNotFound) { return;
range = [string rangeOfString:valueStartQ]; }
if (range.location==NSNotFound) {
NSLog(@"Unable to find value for %@", [names objectAtIndex:i]); NSString *form = [returnedString substringWithRange:NSMakeRange(formRange.location, (formEndRange.location+formEndRange.length)-formRange.location)];
[pool drain];
continue; NSString *loginURL = [@"" retain];
} NSAutoreleasePool *pool = [NSAutoreleasePool new];
string = [string substringFromIndex:range.location+range.length]; NSRange actionRange = [form rangeOfString:@"action="];
range = [string rangeOfString:valueEndQ]; if (actionRange.location!=NSNotFound) {
} else { NSString *end = [form substringWithRange:NSMakeRange(actionRange.location+actionRange.length, 1)];
string = [string substringFromIndex:range.location+range.length]; actionRange.location += 1;
range = [string rangeOfString:valueEnd]; NSString *string = [form substringFromIndex:actionRange.location+actionRange.length];
} actionRange = [string rangeOfString:end];
if (range.location==NSNotFound) NSLog(@"failed 532"); [loginURL release];
[verificationParameters setObject:[[[string substringWithRange:NSMakeRange(0, range.location)] copy] autorelease] forKey:[names objectAtIndex:i]]; loginURL = [[string substringWithRange:NSMakeRange(0, actionRange.location)] copy];
}
[pool drain];
[verificationURL release];
verificationURL = [[NSURL URLWithString:loginURL relativeToURL:[[theHandler response] URL]] retain];
[loginURL release];
NSRange range = NSMakeRange(0, [form length]);
while (range.length>1) {
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSRange inputRange = [form rangeOfString:@"<input " options:NSCaseInsensitiveSearch range:range];
if (inputRange.location!=NSNotFound) {
range.location = inputRange.location+inputRange.length;
range.length = [form length]-range.location;
NSRange endInputRange = [form rangeOfString:@">" options:NSCaseInsensitiveSearch range:range];
if (endInputRange.location==NSNotFound)
endInputRange.length = range.length;
else
endInputRange.length = endInputRange.location-range.location;
endInputRange.location = range.location;
NSRange nameRange = [form rangeOfString:@"name=" options:NSCaseInsensitiveSearch range:endInputRange];
if (nameRange.location==NSNotFound)
continue;
NSString *end = [form substringWithRange:NSMakeRange(nameRange.location+nameRange.length, 1)];
nameRange.location += 1;
NSRange endRange = nameRange;
endRange.location = nameRange.location+nameRange.length;
endRange.length = [form length]-endRange.location;
endRange = [form rangeOfString:end options:NSCaseInsensitiveSearch range:endRange];
if (endRange.location==NSNotFound)
continue;
NSString *name = [form substringWithRange:NSMakeRange(nameRange.location+nameRange.length, endRange.location-(nameRange.location+nameRange.length))];
range.location = inputRange.location+inputRange.length;
range.length = [form length]-range.location;
NSRange valueRange = [form rangeOfString:@"value=" options:NSCaseInsensitiveSearch range:endInputRange];
if (valueRange.location==NSNotFound)
continue;
end = [form substringWithRange:NSMakeRange(valueRange.location+valueRange.length, 1)];
valueRange.location += 1;
endRange = valueRange;
endRange.location = valueRange.location+valueRange.length;
endRange.length = [form length]-endRange.location;
endRange = [form rangeOfString:end options:NSCaseInsensitiveSearch range:endRange];
if (endRange.location==NSNotFound)
continue;
NSString *value = [form substringWithRange:NSMakeRange(valueRange.location+valueRange.length, endRange.location-(valueRange.location+valueRange.length))];
[verificationParameters setObject:value forKey:name];
} else {
break;
} }
[pool drain]; [pool drain];
} }
if ([delegate respondsToSelector:@selector(loginVerificationRequested)]) { if ([delegate respondsToSelector:@selector(loginVerificationRequested)]) {
#if MGMInstanceDebug #if MGMInstanceDebug
NSLog(@"%@", verificationParameters); NSLog(@"%@", verificationParameters);
@ -672,7 +714,7 @@ const BOOL MGMInstanceInvisible = YES;
} }
} }
- (void)verifyWithCode:(NSString *)theCode { - (void)verifyWithCode:(NSString *)theCode {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:MGMLoginVerifyURL]]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:verificationURL];
[request setHTTPMethod:MGMPostMethod]; [request setHTTPMethod:MGMPostMethod];
[request setValue:MGMURLForm forHTTPHeaderField:MGMContentType]; [request setValue:MGMURLForm forHTTPHeaderField:MGMContentType];
[verificationParameters setObject:theCode forKey:@"smsUserPin"]; [verificationParameters setObject:theCode forKey:@"smsUserPin"];

View File

@ -134,7 +134,8 @@ NSString * const MGMSID = @"id";
[inboxWindow makeKeyAndOrderFront:self]; [inboxWindow makeKeyAndOrderFront:self];
} }
- (void)closeWindow { - (void)closeWindow {
[inboxWindow close]; if ([inboxWindow isVisible])
[inboxWindow close];
} }
- (void)startProgress { - (void)startProgress {

View File

@ -80,7 +80,8 @@ NSString * const MGMLastUserPhoneKey = @"MGMLastUserPhone";
[instance setDelegate:nil]; [instance setDelegate:nil];
[instance stop]; [instance stop];
[instance release]; [instance release];
[progressView removeFromSuperview]; if ([progressView superview]!=nil)
[progressView removeFromSuperview];
[progressView release]; [progressView release];
[callTimer invalidate]; [callTimer invalidate];
[callTimer release]; [callTimer release];

View File

@ -68,7 +68,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.2</string> <string>0.2.1</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@ -105,7 +105,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>0.2</string> <string>0.2.1</string>
<key>MGMGRBugsEmail</key> <key>MGMGRBugsEmail</key>
<string>bugs@mrgeckosmedia.com</string> <string>bugs@mrgeckosmedia.com</string>
<key>MGMGRContactEmail</key> <key>MGMGRContactEmail</key>

View File

@ -5,7 +5,7 @@ PPCCC="/usr/bin/gcc-4.0"
PPCCXX="/usr/bin/g++-4.0" PPCCXX="/usr/bin/g++-4.0"
PPCHOST="ppc-apple-darwin8" PPCHOST="ppc-apple-darwin8"
PPCPATH="${PWD}/opt-ppc" PPCPATH="${PWD}/opt-ppc"
PPCLDFLAGS="-arch ppc" PPCLDFLAGS="-arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk"
I386FLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -arch i386 -ggdb" I386FLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.4 -arch i386 -ggdb"
I386CC="/usr/bin/gcc-4.0" I386CC="/usr/bin/gcc-4.0"

View File

@ -3,7 +3,7 @@ To get the latest source to PJProject, run the command below.
svn checkout http://svn.pjsip.org/repos/pjproject/trunk pjproject svn checkout http://svn.pjsip.org/repos/pjproject/trunk pjproject
To get the revision that I am using in VoiceMac and VoiceMob, run the command below. To get the revision that I am using in VoiceMac and VoiceMob, run the command below.
svn checkout -r 3466 http://svn.pjsip.org/repos/pjproject/trunk pjproject svn checkout -r 3773 http://svn.pjsip.org/repos/pjproject/trunk pjproject
Building. Building.
To build for VoiceMac, run the command below. To build for VoiceMac, run the command below.

Binary file not shown.