Adium

Changeset 18360

Show
Ignore:
Timestamp:
12/07/2006 11:54:56 AM (2 years ago)
Author:
evands
Message:

Retrieve Libgaim AIM profiles properly, and remove a special implementation of allowFileTransferWithListObject: - there's no reason to be implementing this in an oscar specific manner. See the next commit for info.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/Gaim Service/CBGaimOscarAccount.m

    r18340 r18360  
    3030#define DELAYED_UPDATE_INTERVAL                 2.0 
    3131 
     32extern gchar *oscar_encoding_extract(const char *encoding); 
     33 
    3234@implementation CBGaimOscarAccount 
    3335 
     
    139141- (oneway void)updateUserInfo:(AIListContact *)theContact withData:(NSString *)userInfoString 
    140142{ 
    141         //For AIM contacts, we get profiles by themselves and don't want this userInfo with all its fields, so 
    142         //we override this method to prevent the information from reaching the rest of Adium. 
    143          
    144         //For ICQ contacts, however, we want to pass this data on as the profile 
    145         const char      firstCharacter = [[theContact UID] characterAtIndex:0]; 
    146          
    147         if ((firstCharacter >= '0' && firstCharacter <= '9') || [theContact isStranger]) { 
     143        NSString        *contactUID = [theContact UID]; 
     144        const char      firstCharacter = [contactUID characterAtIndex:0]; 
     145 
     146        if ((firstCharacter >= '0' && firstCharacter <= '9')) { 
     147                //For ICQ contacts, however, we want to pass this data on as the profile 
    148148                [super updateUserInfo:theContact withData:userInfoString]; 
     149 
     150        } else { 
     151                //For AIM contacts, get the profile directly and pass it on rather than using the libgaim-formatted string 
     152                OscarData *od = ((account && account->gc) ? account->gc->proto_data : NULL); 
     153 
     154                if (od) { 
     155                        aim_userinfo_t *userinfo; 
     156                        userinfo = aim_locate_finduserinfo(od, [contactUID UTF8String]); 
     157                        if (userinfo && 
     158                                (userinfo->info_len > 0) && (userinfo->info) && (userinfo->info_encoding)) { 
     159                                gchar *tmp, *info_utf8; 
     160                                 
     161                                tmp = oscar_encoding_extract(userinfo->info_encoding); 
     162                                info_utf8 = oscar_encoding_to_utf8(tmp, userinfo->info, userinfo->info_len); 
     163                                g_free(tmp); 
     164                                if (info_utf8) { 
     165                                        [super updateUserInfo:theContact withData:[NSString stringWithUTF8String:info_utf8]]; 
     166                                        g_free(info_utf8); 
     167                                } 
     168                        }                                
     169                } 
    149170        } 
    150171} 
     
    289310#pragma mark File transfer 
    290311 
    291 /*! 
    292 * @brief Allow a file transfer with an object? 
    293  * 
    294  * Only return YES if the user's capabilities include OSCAR_CAPABILITY_SENDFILE indicating support for file transfer 
    295  */ 
    296 - (BOOL)allowFileTransferWithListObject:(AIListObject *)inListObject 
    297 { 
    298         OscarData                       *od; 
    299         aim_userinfo_t          *userinfo; 
    300          
    301         if ((gaim_account_is_connected(account)) && 
    302                 (od = account->gc->proto_data) && 
    303                 (userinfo = aim_locate_finduserinfo(od, [[inListObject UID] UTF8String]))) { 
    304                  
    305                 return (userinfo->capabilities & OSCAR_CAPABILITY_SENDFILE); 
    306         } 
    307          
    308         return NO; 
    309 } 
    310  
    311312- (void)acceptFileTransferRequest:(ESFileTransfer *)fileTransfer 
    312313{