Ticket #1567: encoding.patch

File encoding.patch, 2.0 KB (added by tru, 3 years ago)

Patch against svn revision 4285

  • Panels/JVDirectChatPanel.m

    diff --git a/Panels/JVDirectChatPanel.m b/Panels/JVDirectChatPanel.m
    index df2e5c1..3e65de3 100644
    a b  
    776776        [options setObject:[NSNumber numberWithUnsignedInt:NSISOLatin1StringEncoding] forKey:@"StringEncoding"]; 
    777777        messageString = [NSMutableAttributedString attributedStringWithChatFormat:message options:options]; 
    778778 
    779         NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:baseFont, NSFontAttributeName, nil]; 
    780         NSMutableAttributedString *error = [[[NSMutableAttributedString alloc] initWithString:[@" " stringByAppendingString:NSLocalizedString( @"incompatible encoding", "encoding of the message different than your current encoding" )] attributes:attributes] autorelease]; 
    781         [error addAttribute:@"CSSClasses" value:[NSSet setWithObjects:@"error", @"encoding", nil] range:NSMakeRange( 1, ( [error length] - 1 ) )]; 
    782         [messageString appendAttributedString:error]; 
     779        /* Some of us don't want the (Incompatible Encoding) at the end of each line. So this option makes it hideable */ 
     780        /* To hide the string, just do defaults write info.colloquy JVChatHideIncompatibleEncoding -bool true */ 
     781        if (![[NSUserDefaults standardUserDefaults] boolForKey:@"JVChatHideIncompatibleEncoding"]) { 
     782            NSMutableDictionary *attributes = [NSMutableDictionary dictionaryWithObjectsAndKeys:baseFont, NSFontAttributeName, nil]; 
     783            NSMutableAttributedString *error = [[[NSMutableAttributedString alloc] initWithString:[@" " stringByAppendingString:NSLocalizedString( @"incompatible encoding", "encoding of the message different than your current encoding" )] attributes:attributes] autorelease]; 
     784            [error addAttribute:@"CSSClasses" value:[NSSet setWithObjects:@"error", @"encoding", nil] range:NSMakeRange( 1, ( [error length] - 1 ) )]; 
     785            [messageString appendAttributedString:error]; 
     786        } 
    783787    } 
    784788 
    785789    if( ! [messageString length] ) {