Changeset 3300

Show
Ignore:
Timestamp:
06/13/06 02:21:08 (2 years ago)
Author:
rinoa
Message:

Adds the away message to the whois dialog. Fixes #307

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Chat Core/MVIRCChatConnection.m

    r3293 r3300  
    20442044        if( [parameters count] == 3 ) { 
    20452045                MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; 
    2046                 if( [[user awayStatusMessage] isEqual:[parameters objectAtIndex:2]] ) { 
    2047                         [sender _setStatus:MVChatUserAwayStatus]; 
     2046                if( ! [[user awayStatusMessage] isEqual:[parameters objectAtIndex:2]] ) { 
     2047                        [user _setStatus:MVChatUserAwayStatus]; 
    20482048                        [user _setAwayStatusMessage:[parameters objectAtIndex:2]]; 
    20492049                        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatUserAwayStatusMessageChangedNotification object:user userInfo:nil]; 
     
    22332233                [user _setRealName:[self _stringFromPossibleData:[parameters objectAtIndex:5]]]; 
    22342234                [user _setDateDisconnected:nil]; 
     2235                [user _setAwayStatusMessage:nil]; // set this to nil, we will get it if we get a 301 
    22352236 
    22362237                [self _sendPossibleOnlineNotificationForUser:user]; 
  • trunk/Inspectors/JVChatMemberInspector.m

    r3297 r3300  
    8989#pragma mark - 
    9090 
     91- (NSMutableAttributedString *) _convertRawMessage:(NSData *) message withBaseFont:(NSFont *) baseFont { 
     92        if( ! message || ! [message length] ) return nil; 
     93        if( ! baseFont ) baseFont = [NSFont labelFontOfSize:11.]; 
     94 
     95        NSMutableDictionary *options = [NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:[[_member connection] encoding]], @"StringEncoding", [NSNumber numberWithBool:[[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatStripMessageColors"]], @"IgnoreFontColors", [NSNumber numberWithBool:[[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatStripMessageFormatting"]], @"IgnoreFontTraits", baseFont, @"BaseFont", nil]; 
     96        NSMutableAttributedString *messageString = [NSMutableAttributedString attributedStringWithChatFormat:message options:options]; 
     97 
     98        if( ! messageString ) { 
     99                [options setObject:[NSNumber numberWithUnsignedInt:NSISOLatin1StringEncoding] forKey:@"StringEncoding"]; 
     100                messageString = [NSMutableAttributedString attributedStringWithChatFormat:message options:options]; 
     101        } 
     102 
     103        return messageString; 
     104} 
     105 
    91106- (void) gotAddress:(NSString *) ip { 
    92107        [address setObjectValue:( ip ? ip : NSLocalizedString( @"n/a", "not applicable or not available" ) )]; 
     
    111126                [class setObjectValue:NSLocalizedString( @"Normal user", "normal user class" )]; 
    112127        } 
     128         
     129        NSData *awayData = [[_member user] awayStatusMessage]; 
     130        NSAttributedString *awayString = [self _convertRawMessage:awayData withBaseFont:nil]; 
     131        if( ! awayString || ! [awayString length] ) [away setObjectValue:NSLocalizedString( @"n/a", "not applicable or not available" )]; 
     132        else [away setObjectValue:awayString]; 
    113133 
    114134        [username setObjectValue:[[_member user] username]];