Adium

Changeset 23365

Show
Ignore:
Timestamp:
05/08/2008 11:54:09 PM (7 months ago)
Author:
evands
Message:
  • Get a higher resolution user icon than the one initially supplied (Patch by Zac, incorporated into this commit as I had nearby changes in progress)
  • Don't treat the 'last time status updated' field as the idleSince time. It's not. We don't use that for now, though it could be displayed in a tooltip entry at a later date.
  • Use first/last names, not first names.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Facebook Service/AIFacebookBuddyIconRequest.h

    r23362 r23365  
    1616} 
    1717 
    18 + (void)retrieveBuddyIconForContact:(AIListContact *)inContact fromURL:(NSURL *)inURL
     18+ (void)retrieveBuddyIconForContact:(AIListContact *)inContact withThumbSrc:(NSString *)thumbSrc
    1919 
    2020@end 
  • trunk/Plugins/Facebook Service/AIFacebookBuddyIconRequest.m

    r23362 r23365  
    1010 
    1111@interface AIFacebookBuddyIconRequest (PRIVATE) 
    12 - (id)initForContact:(AIListContact *)inContact fromURL:(NSURL *)inURL
     12- (id)initForContact:(AIListContact *)inContact withThumbSrc:(NSString *)thumbSrc
    1313@end  
    1414 
    1515@implementation AIFacebookBuddyIconRequest 
    1616 
    17 + (void)retrieveBuddyIconForContact:(AIListContact *)inContact fromURL:(NSURL *)inURL 
     17+ (void)retrieveBuddyIconForContact:(AIListContact *)inContact withThumbSrc:(NSString *)thumbSrc 
    1818{ 
    1919        //Will release ourselves when done 
    20         [[self alloc] initForContact:inContact fromURL:inURL]; 
     20        [[self alloc] initForContact:inContact withThumbSrc:thumbSrc]; 
    2121} 
    2222 
    23 - (id)initForContact:(AIListContact *)inContact fromURL:(NSURL *)inURL 
     23- (id)initForContact:(AIListContact *)inContact withThumbSrc:(NSString *)thumbSrc 
    2424{ 
    2525        if ((self = [super init])) { 
     
    2727                receivedData = [[NSMutableData alloc] init]; 
    2828 
    29                 NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:inURL 
     29                NSURL *URL; 
     30                NSMutableString  *fileName = [[thumbSrc lastPathComponent] mutableCopy]; 
     31 
     32                /* The file name starts with a 'q' for the small thumbnail and with an 'n' for a higher-resolution one */ 
     33                [fileName replaceOccurrencesOfString:@"q" 
     34                                  withString:@"n" 
     35                                     options:NSLiteralSearch 
     36                                       range:NSMakeRange(0, 1)]; 
     37                 
     38                URL = [NSURL URLWithString:[[thumbSrc stringByDeletingLastPathComponent] stringByAppendingPathComponent:fileName]]; 
     39                [fileName release]; 
     40 
     41                NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:URL 
    3042                                                                                                                           cachePolicy:NSURLRequestUseProtocolCachePolicy 
    3143                                                                                                                   timeoutInterval:120]; 
  • trunk/Plugins/Facebook Service/AIFacebookBuddyListManager.m

    r23362 r23365  
    6060                NSDictionary  *dict = [userInfos objectForKey:contactUID]; 
    6161                NSString          *name = [dict objectForKey:@"name"]; 
    62                 NSString          *firstName = [dict objectForKey:@"firstName"]; 
     62                /* 
     63                 NSString         *firstName = [dict objectForKey:@"firstName"]; 
     64                 if ([firstName isKindOfClass:[NSNull class]]) firstName = nil; 
     65                 */ 
    6366                NSString          *status = [dict objectForKey:@"status"]; 
    64                 NSString          *statusTime = [dict objectForKey:@"statusTime"]; 
     67                /* 
     68                 NSString         *statusTime = [dict objectForKey:@"statusTime"]; 
     69                 if ([statusTime isKindOfClass:[NSNull class]]) statusTime = nil; 
     70                 NSDate           *dateStatusLastChanged = (statusTime ? 
     71                                                                                                [NSDate dateWithTimeIntervalSince1970:([statusTime intValue])] : 
     72                                                                                                nil);            
     73                 */ 
    6574                NSString          *pictureSrc = [dict objectForKey:@"thumbSrc"]; 
    6675                 
    6776                //The parser gives us NSNull in place of a string if there is a nil value 
    6877                if ([name isKindOfClass:[NSNull class]]) name = nil; 
    69                 if ([firstName isKindOfClass:[NSNull class]]) firstName = nil; 
    7078                if ([status isKindOfClass:[NSNull class]]) status = nil; 
    71                 if ([statusTime isKindOfClass:[NSNull class]]) statusTime = nil; 
    7279 
    73                 NSDate            *idleSince = (statusTime ? 
    74                                                                         [NSDate dateWithTimeIntervalSince1970:([statusTime intValue])] : 
    75                                                                         nil); 
    7680                [listContact setFormattedUID:name notify:NotifyLater]; 
    77                 [listContact setServersideAlias:firstName asStatusMessage:NO silently:YES]; 
    7881                [listContact setStatusMessage:(status ?  
    7982                                                                           [[[NSAttributedString alloc] initWithString:status] autorelease] : 
     
    8184                                                           notify:NotifyLater]; 
    8285                [listContact setIdle:[[[nowAvailableList objectForKey:contactUID] objectForKey:@"i"] boolValue] 
    83                                    sinceDate:idleSince 
     86                                   sinceDate:nil 
    8487                                          notify:NotifyLater]; 
    8588 
    8689                if (pictureSrc) 
    8790                        [AIFacebookBuddyIconRequest retrieveBuddyIconForContact:listContact 
    88                                                                                                                        fromURL:[NSURL URLWithString:pictureSrc]]; 
     91                                                                                                           withThumbSrc:pictureSrc]; 
    8992         
    9093                [listContact setRemoteGroupName:@"Facebook"];