Plugins/Twitter Plugin/AILaconicaAccount.m
changeset 2725 9c30ee53dcef
parent 1623 be3d49c65906
child 2944 c873764d5f00
     1.1 --- a/Plugins/Twitter Plugin/AILaconicaAccount.m	Thu Apr 09 02:51:05 2009 +0000
     1.2 +++ b/Plugins/Twitter Plugin/AILaconicaAccount.m	Fri Oct 16 10:12:34 2009 -0400
     1.3 @@ -19,6 +19,15 @@
     1.4  
     1.5  @implementation AILaconicaAccount
     1.6  
     1.7 +- (void)initAccount
     1.8 +{
     1.9 +	[super initAccount];
    1.10 +	[adium.preferenceController registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
    1.11 +												  [NSNumber numberWithBool:YES], LACONICA_PREFERENCE_SSL, nil]
    1.12 +										forGroup:LACONICA_PREF_GROUP
    1.13 +										  object:self];
    1.14 +}
    1.15 +
    1.16  - (void)connect
    1.17  {	
    1.18  	if (!self.host) {
    1.19 @@ -85,6 +94,14 @@
    1.20  }
    1.21  
    1.22  /*!
    1.23 + * @brief Not all StatusNet instances support HTTPS connections.
    1.24 + */
    1.25 +- (BOOL)useSSL
    1.26 +{
    1.27 +	return [[self preferenceForKey:LACONICA_PREFERENCE_SSL group:LACONICA_PREF_GROUP] boolValue];
    1.28 +}
    1.29 +
    1.30 +/*!
    1.31   * @brief Laconica does not yet support OAuth.
    1.32   */
    1.33  - (BOOL)useOAuth
    1.34 @@ -104,14 +121,16 @@
    1.35  	
    1.36  	NSString *fullAddress = [self.host stringByAppendingPathComponent:[self preferenceForKey:LACONICA_PREFERENCE_PATH group:LACONICA_PREF_GROUP]];
    1.37  	
    1.38 +	NSString *protocol = self.useSSL ? @"https" : @"http";
    1.39 +	
    1.40  	if (linkType == AITwitterLinkStatus) {
    1.41 -		address = [NSString stringWithFormat:@"https://%@/notice/%@", fullAddress, statusID];
    1.42 +		address = [NSString stringWithFormat:@"%@://%@/notice/%@", protocol, fullAddress, statusID];
    1.43  	} else if (linkType == AITwitterLinkFriends) {
    1.44 -		address = [NSString stringWithFormat:@"https://%@/%@/subscriptions", fullAddress, userID];
    1.45 +		address = [NSString stringWithFormat:@"%@://%@/%@/subscriptions", protocol, fullAddress, userID];
    1.46  	} else if (linkType == AITwitterLinkFollowers) {
    1.47 -		address = [NSString stringWithFormat:@"https://%@/%@/subscribers", fullAddress, userID]; 
    1.48 +		address = [NSString stringWithFormat:@"%@://%@/%@/subscribers", protocol, fullAddress, userID]; 
    1.49  	} else if (linkType == AITwitterLinkUserPage) {
    1.50 -		address = [NSString stringWithFormat:@"https://%@/%@", fullAddress, userID]; 
    1.51 +		address = [NSString stringWithFormat:@"%@://%@/%@", protocol, fullAddress, userID]; 
    1.52  	} else if (linkType == AITwitterLinkSearchHash) {
    1.53  		address = [NSString stringWithFormat:@"http://%@/tag/%@", fullAddress, context];
    1.54  	} else if (linkType == AITwitterLinkGroup) {