[Adium-devl] [Adium-svn] rev 23712 - trunk/Plugins/Facebook Service

Juan Manuel Palacios jmpp at macports.org
Thu May 29 05:30:13 UTC 2008


On May 28, 2008, at 6:30 AM, evands at adiumx.com wrote:

> Author: evands
> Date: 2008-05-28 07:00:54 -0400 (Wed, 28 May 2008)
> New Revision: 23712
>
> Modified:
>   trunk/Plugins/Facebook Service/AIFacebookAccount.m
> Log:
> Reverted attempted to use https://login.facebook.com/login.php; I  
> don't understand why it doesn't work for us but does for pidgin- 
> facebook. Retained disconnection ability and sending typing  
> notifications gleaned from pidgin-facebook.
>


	Just a small question, hoping I'm not out of line asking this (in  
case it's already common knowledge): why isn't Adium using (or waiting  
to use, in case it's not mainline yet) libpurple's Facebook prpl? This  
is about the third or fourth commit attesting to Adium's lower  
Facebook-fu as compared to libpurple's, so it got me wondering why the  
functionality is being re-implemented in house.

	Just a question... Regards,...


-jmpp



> Modified: trunk/Plugins/Facebook Service/AIFacebookAccount.m
> ===================================================================
> --- trunk/Plugins/Facebook Service/AIFacebookAccount.m	2008-05-28  
> 03:49:20 UTC (rev 23711)
> +++ trunk/Plugins/Facebook Service/AIFacebookAccount.m	2008-05-28  
> 11:00:54 UTC (rev 23712)
> @@ -15,7 +15,7 @@
> #import "AIFacebookIncomingMessageManager.h"
> #import "AIFacebookStatusManager.h"
>
> -#define LOGIN_PAGE	@"https://login.facebook.com/login.php"
> +#define LOGIN_PAGE	@"http://www.facebook.com/login.php"
> #define FACEBOOK_HOME_PAGE	@"http://www.facebook.com/home.php"
>
> #define CONNECTION_DEBUG	TRUE
> @@ -70,14 +70,10 @@
>
> 	[super connect];
>
> -	[self postDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
> -						  [self UID], @"email",
> -						  password, @"pass",
> -						  @"0", @"persistent",
> -						  @"Login", @"login",
> -						  @"%%E2%%AC%%C2%%B4%%E2%%82%%AC%%C2%%B4%%E6%%B0%%B4%%D0%%94% 
> %D0%%84", @"charset_test",
> -						  nil]
> -				   toURL:[NSURL URLWithString:LOGIN_PAGE]];
> +	NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: 
> [NSURL URLWithString:LOGIN_PAGE]
> +														   cachePolicy:NSURLRequestUseProtocolCachePolicy
> +													   timeoutInterval:120];
> +	[[webView mainFrame] loadRequest:request];
> }
>
> - (NSString *)host
> @@ -153,6 +149,7 @@
> 	[AIFacebookOutgoingMessageManager sendTypingObject:inContentTyping];
> }
>
> +
> - (NSString *)encodedAttributedStringForSendingContentMessage: 
> (AIContentMessage *)inContentMessage
> {
> 	return [[inContentMessage message] string];
> @@ -226,12 +223,12 @@
> 													   timeoutInterval:120];	
> 	
> 	NSData *postData = [AIFacebookAccount postDataForDictionary:inDict];
> +	
> 	[request setHTTPMethod:@"POST"];
> 	[request setValue:[NSString stringWithFormat:@"%d", [postData  
> length]] forHTTPHeaderField:@"Content-Length"];
> 	[request setHTTPBody:postData];
> 	[request setValue:@"application/x-www-form-urlencoded"  
> forHTTPHeaderField:@"Content-Type"];
> -	[request addValue:@"test_cookie=1;" forHTTPHeaderField:@"Cookie"];	
> -	[request setValue:@"*/*" forHTTPHeaderField:@"Accept"];
> +	
> 	[[webView mainFrame] loadRequest:request];
> }
>
> @@ -251,6 +248,7 @@
> 	AILogWithSignature(@"%@ resource %@ finished loading %@", sender,  
> identifier, dataSource);
>
> 	if ([identifier isEqualToString:@"Logging in"]) {
> +		if (sentLogin) {
> #ifdef CONNECTION_DEBUG
> 			AILogWithSignature(@"Should now be logged in; login.php result is  
> %@", [[dataSource representation] documentSource]);
> #endif
> @@ -262,7 +260,22 @@
> 															   timeoutInterval:120];	
> 			
> 			[[webView mainFrame] loadRequest:request];
> -
> +			
> +		} else {
> +#ifdef CONNECTION_DEBUG
> +			AILogWithSignature(@"Loaded login.php initially: %@",  
> [[dataSource representation] documentSource]);
> +#endif
> +			//We loaded login.php; now we can send the email and password
> +			sentLogin = YES;
> +			[sender stopLoading:self];
> +			
> +			[self postDictionary:[NSDictionary dictionaryWithObjectsAndKeys:
> +								  [self UID], @"email",
> +								  password, @"pass",
> +								  @"Login", @"login",
> +								  nil]
> +						   toURL:[NSURL URLWithString:LOGIN_PAGE]];
> +		}
> 	} else if ([identifier isEqualToString:@"Home"]) {
> 		//We finished logging in and got the home page
> 		[self extractLoginInfoFromHomePage:[[dataSource representation]  
> documentSource]];
>
>
> _______________________________________________
> Adium-svn mailing list
> Adium-svn at adiumx.com
> http://adiumx.com/mailman/listinfo/adium-svn_adiumx.com





More information about the devel mailing list