Changeset 4121

Show
Ignore:
Timestamp:
05/11/06 09:45:09 (3 years ago)
Author:
morris
Message:

Add graphical smileys

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/English.lproj/MainMenu.nib/classes.nib

    r3996 r4121  
    6161                "_deleteMenuItem" = NSMenuItem;  
    6262                "_disconnectMenuItem" = NSMenuItem;  
     63                "_insertSmileyMenu" = NSMenu;  
    6364            };  
    6465            SUPERCLASS = WIObject;  
  • WiredClient/trunk/English.lproj/MainMenu.nib/info.nib

    r3963 r4121  
    44<dict> 
    55        <key>IBDocumentLocation</key> 
    6         <string>271 132 412 357 0 0 1280 1002 </string> 
     6        <string>344 140 412 357 0 0 1280 1002 </string> 
    77        <key>IBEditorPositions</key> 
    88        <dict> 
    99                <key>29</key> 
    10                 <string>128 723 614 44 0 0 1280 1002 </string> 
     10                <string>158 773 614 44 0 0 1280 1002 </string> 
    1111        </dict> 
    1212        <key>IBFramework Version</key> 
     
    2323        </array> 
    2424        <key>IBSystem Version</key> 
    25         <string>8H14</string> 
     25        <string>8I127</string> 
    2626</dict> 
    2727</plist> 
  • WiredClient/trunk/English.lproj/Preferences.nib/classes.nib

    r4084 r4121  
    104104                "_showDialogButton" = NSButton;  
    105105                "_showDockAtStartupButton" = NSButton;  
     106                "_showSmileysButton" = NSButton;  
    106107                "_showTrackersAtStartupButton" = NSButton;  
    107108                "_soundsPopUpButton" = NSPopUpButton;  
  • WiredClient/trunk/English.lproj/Preferences.nib/info.nib

    r4084 r4121  
    66        <string>344 47 481 528 0 0 1280 1002 </string> 
    77        <key>IBFramework Version</key> 
    8         <string>443.0</string> 
     8        <string>446.0</string> 
    99        <key>IBLockedObjects</key> 
    1010        <array/> 
  • WiredClient/trunk/English.lproj/PublicChat.nib/info.nib

    r3620 r4121  
    88        <dict> 
    99                <key>105</key> 
    10                 <string>1171 269 196 187 0 0 1920 1178 </string> 
     10                <string>736 221 196 187 0 0 1280 1002 </string> 
    1111        </dict> 
    1212        <key>IBFramework Version</key> 
     
    2424        </array> 
    2525        <key>IBSystem Version</key> 
    26         <string>8G32</string> 
     26        <string>8I127</string> 
    2727</dict> 
    2828</plist> 
  • WiredClient/trunk/English.lproj/ReleaseNotes.rtf

    r4114 r4121  
    3030\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 
    3131 
    32 \f1\b0 \cf0 - Can now save chat as RTF, and select encoding when saving as plain text\ 
     32\f1\b0 \cf0 - Can use graphical smileys in chat\ 
     33- Can now save chat as RTF, and select encoding when saving as plain text\ 
    3334- Add option to show a dialog for messages and broadcasts\ 
    3435- Show tooltips in user list\ 
     36- Make sure find panel is enabled for all relevant text views\ 
    3537\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\ql\qnatural 
    3638 
  • WiredClient/trunk/NSString-WCAdditions.m

    r3712 r4121  
    2828 
    2929#import "NSString-WCAdditions.h" 
     30#import "WCApplicationController.h" 
    3031 
    3132@implementation NSMutableAttributedString(WCAdditions) 
     
    4546 
    4647        if(!whitespaceSet) { 
    47                 whitespaceSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain]; 
    48                 nonwhitespaceSet = [[whitespaceSet invertedSet] retain]; 
    49                  
    50                 characterSet = [[NSMutableCharacterSet decimalDigitCharacterSet] mutableCopy]; 
     48                whitespaceSet          = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain]; 
     49                nonwhitespaceSet       = [[whitespaceSet invertedSet] retain]; 
     50                 
     51                characterSet           = [[NSMutableCharacterSet decimalDigitCharacterSet] mutableCopy]; 
    5152                [characterSet addCharactersInString:@":."]; 
    5253                [characterSet invert]; 
    53                 nontimestampSet = [characterSet copy]; 
     54                nontimestampSet                = [characterSet copy]; 
    5455                [characterSet release]; 
    5556        } 
    5657 
    57         eventsTextColor = [WCSettings objectForKey:WCChatEventsColor]; 
    58         timestampEveryLineColor = [WCSettings objectForKey:WCTimestampEveryLineColor]; 
    59  
    60         highlightPatterns = [NSMutableArray array]; 
    61         highlightStrings = [NSMutableArray array]; 
    62         highlightColors = [NSMutableArray array]; 
    63         enumerator = [[WCSettings objectForKey:WCHighlights] objectEnumerator]; 
     58        eventsTextColor                        = [WCSettings objectForKey:WCChatEventsColor]; 
     59        timestampEveryLineColor        = [WCSettings objectForKey:WCTimestampEveryLineColor]; 
     60 
     61        highlightPatterns              = [NSMutableArray array]; 
     62        highlightStrings               = [NSMutableArray array]; 
     63        highlightColors                        = [NSMutableArray array]; 
     64        enumerator                             = [[WCSettings objectForKey:WCHighlights] objectEnumerator]; 
    6465         
    6566        while((highlight = [enumerator nextObject])) { 
     
    176177#pragma mark - 
    177178 
     179- (void)_filterWiredSmilies:(WITextFilter *)filter small:(BOOL)small { 
     180        WCApplicationController         *controller; 
     181        NSDictionary                            *attributes; 
     182        NSMutableString                         *string; 
     183        NSAttributedString                      *attributedString; 
     184        NSFileWrapper                           *wrapper; 
     185        NSTextAttachment                        *attachment; 
     186        NSEnumerator                            *enumerator; 
     187        NSString                                        *key, *substring, *smiley, *character; 
     188        NSRange                                         range, searchRange; 
     189        unsigned int                            length; 
     190         
     191        if(![WCSettings boolForKey:WCShowSmileys]) 
     192                return; 
     193                 
     194        controller      = [WCApplicationController sharedController]; 
     195        string          = [self mutableString]; 
     196        length          = [self length]; 
     197        enumerator      = [[controller allSmileys] objectEnumerator]; 
     198         
     199        while((key = [enumerator nextObject])) { 
     200                searchRange.location = 0; 
     201                searchRange.length = length; 
     202                 
     203                while((range = [string rangeOfString:key options:NSCaseInsensitiveSearch range:searchRange]).location != NSNotFound) { 
     204                        substring       = [string substringWithRange:range]; 
     205                        smiley          = [controller pathForSmiley:substring]; 
     206                         
     207                        if(smiley) { 
     208                                attributes = [self attributesAtIndex:range.location effectiveRange:NULL]; 
     209                                 
     210                                if(![attributes objectForKey:NSLinkAttributeName]) { 
     211                                        wrapper                                 = [[NSFileWrapper alloc] initWithPath:smiley]; 
     212                                        attachment                              = [[NSTextAttachment alloc] initWithFileWrapper:wrapper]; 
     213                                         
     214                                        if(small) 
     215                                                [[(NSTextAttachmentCell *) [attachment attachmentCell] image] setSize:NSMakeSize(14.0, 14.0)]; 
     216                                         
     217                                        attributedString                = [NSAttributedString attributedStringWithAttachment:attachment]; 
     218                                         
     219                                        [self replaceCharactersInRange:range withAttributedString:attributedString]; 
     220                                         
     221                                        length                                  -= range.length - 1; 
     222                                        searchRange.location    = range.location + 1; 
     223                                        searchRange.length              = length - searchRange.location; 
     224                                         
     225                                        range.length                    = 1; 
     226                                        character                               = [substring substringFromIndex:[substring length] - 1]; 
     227                                         
     228                                        while((range = [string rangeOfString:character options:NSCaseInsensitiveSearch | NSAnchoredSearch range:searchRange]).location != NSNotFound) { 
     229                                                [self replaceCharactersInRange:range withAttributedString:attributedString]; 
     230                                                 
     231                                                searchRange.location++; 
     232                                                searchRange.length--; 
     233                                        } 
     234                                         
     235                                        [attachment release]; 
     236                                        [wrapper release]; 
     237                                } else { 
     238                                        searchRange.location = range.location + range.length; 
     239                                        searchRange.length = length - searchRange.location; 
     240                                } 
     241                        } 
     242                } 
     243        } 
     244} 
     245 
     246 
     247 
     248- (void)filterWiredSmallSmilies:(WITextFilter *)filter { 
     249        [self _filterWiredSmilies:filter small:YES]; 
     250} 
     251 
     252 
     253 
     254- (void)filterWiredSmilies:(WITextFilter *)filter { 
     255        [self _filterWiredSmilies:filter small:NO]; 
     256} 
     257 
     258 
     259 
     260#pragma mark - 
     261 
    178262#define _WCURLFilterInterestingLength           8 
    179263 
     
    210294         
    211295        if(!whitespaceSet) { 
    212                 whitespaceSet = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain]; 
    213                 nonWhitespaceSet = [[whitespaceSet invertedSet] retain]; 
    214                 skipSet = [[NSCharacterSet characterSetWithCharactersInString:@",.?()[]{}<>"] retain]; 
     296                whitespaceSet          = [[NSCharacterSet whitespaceAndNewlineCharacterSet] retain]; 
     297                nonWhitespaceSet       = [[whitespaceSet invertedSet] retain]; 
     298                skipSet                                = [[NSCharacterSet characterSetWithCharactersInString:@",.?()[]{}<>"] retain]; 
    215299        } 
    216300         
  • WiredClient/trunk/WCApplicationController.h

    r3996 r4121  
    2929@interface WCApplicationController : WIObject { 
    3030        IBOutlet NSMenu                                         *_bookmarksMenu; 
     31        IBOutlet NSMenu                                         *_insertSmileyMenu; 
    3132        IBOutlet NSMenu                                         *_debugMenu; 
    3233         
    3334        IBOutlet NSMenuItem                                     *_disconnectMenuItem; 
    3435        IBOutlet NSMenuItem                                     *_deleteMenuItem; 
    35  
     36         
    3637        NSString                                                        *_clientVersion; 
     38        NSMutableDictionary                                     *_smileys; 
     39        NSArray                                                         *_sortedSmileys; 
    3740        unsigned int                                            _unread; 
    3841} 
     
    4750 
    4851- (NSString *)clientVersion; 
     52 
     53- (NSArray *)allSmileys; 
     54- (NSString *)pathForSmiley:(NSString *)smiley; 
    4955 
    5056- (IBAction)about:(id)sender; 
  • WiredClient/trunk/WCApplicationController.m

    r4084 r4121  
    4444- (void)_update; 
    4545- (void)_updateApplicationIcon; 
     46- (void)_updateSmileysMenu; 
    4647- (void)_updateBookmarksMenu; 
     48 
     49- (void)_loadSmileys; 
    4750 
    4851@end 
     
    6568        [NSApp setApplicationIconImage: 
    6669                [[NSImage imageNamed:@"NSApplicationIcon"] badgedImageWithInt:_unread]]; 
     70} 
     71 
     72 
     73 
     74- (void)_updateSmileysMenu { 
    6775} 
    6876 
     
    100108                i++; 
    101109        } 
     110} 
     111 
     112 
     113 
     114#pragma mark - 
     115 
     116static int _WCCompareSmileyLength(id object1, id object2, void *context) { 
     117        unsigned int    length1 = [object1 length]; 
     118        unsigned int    length2 = [object2 length]; 
     119         
     120        if(length1 > length2) 
     121                return -1; 
     122        else if(length1 < length2) 
     123                return 1; 
     124         
     125        return 0; 
     126} 
     127 
     128 
     129 
     130- (void)_loadSmileys { 
     131        NSBundle                        *bundle; 
     132        NSMenuItem                      *item; 
     133        NSMutableArray          *array; 
     134        NSDictionary            *dictionary, *list, *map, *names; 
     135        NSEnumerator            *enumerator; 
     136        NSString                        *path, *file, *name, *smiley, *title; 
     137         
     138        bundle                  = [self bundle]; 
     139        path                    = [bundle pathForResource:@"Smileys" ofType:@"plist"]; 
     140        dictionary              = [NSDictionary dictionaryWithContentsOfFile:path]; 
     141        list                    = [dictionary objectForKey:@"List"]; 
     142        map                             = [dictionary objectForKey:@"Map"]; 
     143        enumerator              = [map keyEnumerator]; 
     144        _smileys                = [[NSMutableDictionary alloc] initWithCapacity:[map count]]; 
     145 
     146        while((smiley = [enumerator nextObject])) { 
     147                file = [map objectForKey:smiley]; 
     148                path = [bundle pathForResource:file ofType:NULL]; 
     149                 
     150                if(path) 
     151                        [_smileys setObject:path forKey:[smiley lowercaseString]]; 
     152                else 
     153                        NSLog(@"*** -[%@ %@]: could not find image \"%@\"", [self class], NSStringFromSelector(_cmd), file); 
     154        } 
     155         
     156         
     157        array = [NSMutableArray arrayWithObjects: 
     158                @"Smile.tiff", 
     159                @"Wink.tiff", 
     160                @"Frown.tiff", 
     161                @"Slant.tiff", 
     162                @"Gasp.tiff", 
     163                @"Laugh.tiff", 
     164                @"Kiss.tiff", 
     165                @"Yuck.tiff", 
     166                @"Embarrassed.tiff", 
     167                @"Footinmouth.tiff", 
     168                @"Cool.tiff", 
     169                @"Angry.tiff", 
     170                @"Innocent.tiff", 
     171                @"Cry.tiff", 
     172                @"Sealed.tiff", 
     173                @"Moneymouth.tiff", 
     174                NULL]; 
     175         
     176        names = [NSDictionary dictionaryWithObjectsAndKeys: 
     177                NSLS(@"Smile", @"Smiley"),                                      @"Smile.tiff", 
     178                NSLS(@"Wink", @"Smiley"),                                       @"Wink.tiff", 
     179                NSLS(@"Frown", @"Smiley"),                                      @"Frown.tiff", 
     180                NSLS(@"Undecided", @"Smiley"),                          @"Slant.tiff", 
     181                NSLS(@"Gasp", @"Smiley"),                                       @"Gasp.tiff", 
     182                NSLS(@"Laugh", @"Smiley"),                                      @"Laugh.tiff", 
     183                NSLS(@"Kiss", @"Smiley"),                                       @"Kiss.tiff", 
     184                NSLS(@"Sticking out tongue", @"Smiley"),        @"Yuck.tiff", 
     185                NSLS(@"Embarrassed", @"Smiley"),                        @"Embarrassed.tiff", 
     186                NSLS(@"Foot in mouth", @"Smiley"),                      @"Footinmouth.tiff", 
     187                NSLS(@"Cool", @"Smiley"),                                       @"Cool.tiff", 
     188                NSLS(@"Angry", @"Smiley"),                                      @"Angry.tiff", 
     189                NSLS(@"Innocent", @"Smiley"),                           @"Innocent.tiff", 
     190                NSLS(@"Cry", @"Smiley"),                                        @"Cry.tiff", 
     191                NSLS(@"Lips are sealed", @"Smiley"),            @"Sealed.tiff", 
     192                NSLS(@"Money-mouth", @"Smiley"),                        @"Moneymouth.tiff", 
     193                NULL]; 
     194 
     195        [array addObjectsFromArray:[[[[NSSet setWithArray:[list allKeys]] setByMinusingSet:[NSSet setWithArray:array]] allObjects] sortedArrayUsingSelector:@selector(compare:)]]; 
     196         
     197        enumerator = [array objectEnumerator]; 
     198         
     199        while((name = [enumerator nextObject])) { 
     200                smiley  = [list objectForKey:name]; 
     201                path    = [_smileys objectForKey:[smiley lowercaseString]]; 
     202                title   = [names objectForKey:name]; 
     203                 
     204                if(!title) 
     205                        title = [name stringByDeletingPathExtension]; 
     206                 
     207                item = [NSMenuItem itemWithTitle:title]; 
     208                [item setRepresentedObject:path]; 
     209                [item setImage:[[[NSImage alloc] initWithContentsOfFile:path] autorelease]]; 
     210                [item setAction:@selector(insertSmiley:)]; 
     211                [item setToolTip:smiley]; 
     212                [_insertSmileyMenu addItem:item]; 
     213        } 
     214         
     215        _sortedSmileys = [[[_smileys allKeys] sortedArrayUsingFunction:_WCCompareSmileyLength context:NULL] retain]; 
    102216} 
    103217 
     
    201315        [_deleteMenuItem setKeyEquivalentModifierMask:NSCommandKeyMask]; 
    202316         
     317        [self _loadSmileys]; 
     318         
    203319        [self _update]; 
     320        [self _updateSmileysMenu]; 
    204321        [self _updateBookmarksMenu]; 
    205322 
     
    385502 
    386503 
     504#pragma mark - 
     505 
     506- (NSArray *)allSmileys { 
     507        return _sortedSmileys; 
     508} 
     509 
     510 
     511 
     512- (NSString *)pathForSmiley:(NSString *)smiley { 
     513        return [_smileys objectForKey:[smiley lowercaseString]]; 
     514} 
     515 
     516 
    387517 
    388518#pragma mark - 
  • WiredClient/trunk/WCChat.h

    r4114 r4121  
    6868 
    6969        WITextFilter                                            *_chatFilter; 
     70        WITextFilter                                            *_topicFilter; 
    7071        NSDate                                                          *_timestamp; 
    7172        WCTopic                                                         *_topic; 
  • WiredClient/trunk/WCChat.m

    r4114 r4121  
    7474- (BOOL)_runCommand:(NSString *)command; 
    7575 
    76 - (NSString *)_completeString:(NSString *)string; 
     76- (NSString *)_stringByCompletingString:(NSString *)string; 
     77- (NSString *)_stringByDecomposingAttributedString:(NSAttributedString *)attributedString; 
    7778 
    7879@end 
     
    144145 
    145146- (void)_updateTopic { 
     147        NSMutableAttributedString       *string; 
     148         
    146149        if(_topic) { 
     150                string = [NSMutableAttributedString attributedStringWithString:[_topic topic]]; 
     151                 
    147152                [_topicTextField setToolTip:[_topic topic]]; 
    148                 [_topicTextField setStringValue:[_topic topic]]; 
     153                [_topicTextField setAttributedStringValue:[string attributedStringByApplyingFilter:_topicFilter]]; 
    149154                [_topicNickTextField setStringValue:[NSSWF: 
    150155                        NSLS(@"%@ %C %@", @"Chat topic set by (nick, time)"), 
     
    509514#pragma mark - 
    510515 
    511 - (NSString *)_completeString:(NSString *)string { 
     516- (NSString *)_stringByCompletingString:(NSString *)string { 
    512517        NSEnumerator    *enumerator, *setEnumerator; 
    513518        NSArray                 *nicks, *commands, *set, *matchingSet = NULL; 
     
    551556} 
    552557 
     558 
     559 
     560- (NSString *)_stringByDecomposingAttributedString:(NSAttributedString *)attributedString { 
     561        if(![attributedString containsAttachments]) 
     562                return [attributedString string]; 
     563         
     564        return [[attributedString attributedStringByReplacingAttachmentsWithStrings] string]; 
     565} 
     566 
    553567@end 
    554568 
     
    655669 
    656670        [_chatFilter release]; 
     671        [_topicFilter release]; 
    657672        [_timestamp release]; 
    658673        [_topic release]; 
     
    678693 
    679694        [_chatOutputTextView setEditable:NO]; 
     695        [_chatOutputTextView setUsesFindPanel:YES]; 
    680696        [_userListTableView setDoubleAction:@selector(sendPrivateMessage:)]; 
    681697 
    682         _chatFilter = [[WITextFilter alloc] initWithSelectors:@selector(filterWiredChat:), @selector(filterURLs:), 0]; 
     698        _chatFilter = [[WITextFilter alloc] initWithSelectors:@selector(filterWiredChat:), @selector(filterURLs:), @selector(filterWiredSmilies:), 0]; 
     699        _topicFilter = [[WITextFilter alloc] initWithSelectors:@selector(filterURLs:), @selector(filterWiredSmallSmilies:), 0]; 
    683700 
    684701        [self _update]; 
     
    11241141                unsigned int    length; 
    11251142 
    1126                 string = [_chatInputTextView string]; 
     1143                string = [self _stringByDecomposingAttributedString:[_chatInputTextView textStorage]]; 
    11271144                length = [string length]; 
    11281145                 
     
    11621179        else if(selector == @selector(insertTab:)) { 
    11631180                if([WCSettings boolForKey:WCTabCompleteNicks]) { 
    1164                         [_chatInputTextView setString:[self _completeString:[_chatInputTextView string]]]; 
     1181                        [_chatInputTextView setString:[self _stringByCompletingString:[_chatInputTextView string]]]; 
    11651182                         
    11661183                        return YES; 
     
    16301647#pragma mark - 
    16311648 
     1649- (void)insertSmiley:(id)sender { 
     1650        NSFileWrapper           *wrapper; 
     1651        NSTextAttachment        *attachment; 
     1652        NSAttributedString      *attributedString; 
     1653         
     1654        wrapper                         = [[NSFileWrapper alloc] initWithPath:[sender representedObject]]; 
     1655        attachment                      = [[WITextAttachment alloc] initWithFileWrapper:wrapper string:[sender toolTip]]; 
     1656        attributedString        = [NSAttributedString attributedStringWithAttachment:attachment]; 
     1657         
     1658        [_chatInputTextView insertText:attributedString]; 
     1659         
     1660        [attachment release]; 
     1661        [wrapper release]; 
     1662} 
     1663 
     1664 
     1665 
     1666#pragma mark - 
     1667 
    16321668- (int)numberOfRowsInTableView:(NSTableView *)sender { 
    16331669        return [_shownUsers count]; 
  • WiredClient/trunk/WCMessages.h

    r3655 r4121  
    6262         
    6363        WITextFilter                                            *_messageFilter; 
     64        WITextFilter                                            *_userFilter; 
    6465        NSImage                                                         *_conversationIcon; 
    6566        unsigned int                                            _unread; 
  • WiredClient/trunk/WCMessages.m

    r4084 r4121  
    9191        [_titles addObject:NSLS(@"Broadcasts", @"Messages item")]; 
    9292 
    93         _conversations = [[NSMutableArray alloc] init]; 
    94         _allMessages = [[NSMutableArray alloc] init]; 
    95         _shownMessages = [[NSMutableArray alloc] init]; 
    96         _conversationIcon = [[NSImage imageNamed:@"Conversation"] retain]; 
    97          
    98         _messageFilter = [[WITextFilter alloc] initWithSelectors:@selector(filterURLs:), 0]; 
     93        _conversations          = [[NSMutableArray alloc] init]; 
     94        _allMessages            = [[NSMutableArray alloc] init]; 
     95        _shownMessages          = [[NSMutableArray alloc] init]; 
     96        _conversationIcon       = [[NSImage imageNamed:@"Conversation"] retain]; 
     97         
     98        _messageFilter  = [[WITextFilter alloc] initWithSelectors:@selector(filterURLs:), @selector(filterWiredSmilies:), 0]; 
     99        _userFilter             = [[WITextFilter alloc] initWithSelectors:@selector(filterWiredSmallSmilies:), 0]; 
    99100 
    100101        [self window]; 
     
    493494         
    494495        [_messageFilter release]; 
     496        [_userFilter release]; 
    495497        [_conversationIcon release]; 
    496498 
     
    517519         
    518520        [_messageTextView setEditable:NO]; 
     521        [_messageTextView setUsesFindPanel:YES]; 
    519522         
    520523        [self _update]; 
     
    976979        if(count > 0) 
    977980                name = [name stringByAppendingFormat:@" (%u)", count]; 
    978  
     981         
    979982        return [NSDictionary dictionaryWithObjectsAndKeys: 
    980                 name,           WIIconCellTitleKey, 
    981                 image,          WIIconCellIconKey, 
     983                [[NSAttributedString attributedStringWithString:name] attributedStringByApplyingFilter:_userFilter], 
     984                        WIIconCellAttributedTitleKey, 
     985                image, 
     986                        WIIconCellIconKey, 
    982987                NULL]; 
    983988} 
     
    10571062 
    10581063- (id)tableView:(NSTableView *)sender objectValueForTableColumn:(NSTableColumn *)column row:(int)row { 
    1059         WCMessage               *message; 
     1064        NSString                        *string; 
     1065        WCMessage                       *message; 
    10601066         
    10611067        message = [self _messageAtIndex:row]; 
     
    10631069        if(column == _userTableColumn) { 
    10641070                if([message direction] == WCMessageTo) 
    1065                         return [NSSWF:NSLS(@"To: %@", @"Message to (nick)"), [[message user] nick]]; 
     1071                        string = [NSSWF:NSLS(@"To: %@", @"Message to (nick)"), [[message user] nick]]; 
    10661072                else 
    1067                         return [NSSWF:NSLS(@"From: %@", @"Message from (nick)"), [[message user] nick]]; 
     1073                        string = [NSSWF:NSLS(@"From: %@", @"Message from (nick)"), [[message user] nick]]; 
     1074 
     1075                return [[NSAttributedString attributedStringWithString:string] attributedStringByApplyingFilter:_userFilter]; 
    10681076        } 
    10691077        else if(column == _timeTableColumn) { 
  • WiredClient/trunk/WCNews.m

    r3996 r4121  
    3737- (void)_validate; 
    3838 
    39 - (NSMutableAttributedString *)_postWithNick:(NSString *)nick date:(NSDate *)date message:(NSString *)message; 
     39- (NSAttributedString *)_postWithNick:(NSString *)nick date:(NSDate *)date message:(NSString *)message; 
    4040 
    4141@end 
     
    5050 
    5151        _news = [[NSMutableAttributedString alloc] init]; 
    52         _newsFilter = [[WITextFilter alloc] initWithSelectors:@selector(filterURLs:), 0]; 
     52        _newsFilter = [[WITextFilter alloc] initWithSelectors:@selector(filterURLs:), @selector(filterWiredSmilies:), 0]; 
    5353 
    5454        [self window]; 
     
    109109#pragma mark - 
    110110 
    111 - (NSMutableAttributedString *)_postWithNick:(NSString *)nick date:(NSDate *)date message:(NSString *)message { 
     111- (NSAttributedString *)_postWithNick:(NSString *)nick date:(NSDate *)date message:(NSString *)message { 
    112112        NSMutableAttributedString       *post; 
    113113        NSAttributedString                      *header, *entry; 
     
    161161- (void)windowDidLoad { 
    162162        [_newsTextView setEditable:NO]; 
     163        [_newsTextView setUsesFindPanel:YES]; 
    163164         
    164165        [self _update]; 
     
    228229 
    229230- (void)newsShouldAddNews:(NSNotification *)notification { 
    230         NSArray                                        *fields; 
    231         NSString                                       *nick, *date, *message; 
    232         NSMutableAttributedString     *post; 
     231        NSArray                                 *fields; 
     232        NSString                                *nick, *date, *message; 
     233        NSAttributedString            *post; 
    233234 
    234235        fields = [[notification userInfo] objectForKey:WCArgumentsKey]; 
     
    256257        } 
    257258 
    258         [_newsFilter filter:_news]; 
    259         [[_newsTextView textStorage] setAttributedString:_news]; 
     259        [[_newsTextView textStorage] setAttributedString:[_news attributedStringByApplyingFilter:_newsFilter]]; 
    260260        [_progressIndicator stopAnimation:self]; 
    261261} 
     
    264264 
    265265- (void)newsShouldAddNewNews:(NSNotification *)notification { 
    266         NSArray                                        *fields; 
    267         NSString                                       *nick, *date, *message; 
    268         NSMutableAttributedString     *post; 
     266        NSArray                                 *fields; 
     267        NSString                                *nick, *date, *message; 
     268        NSAttributedString            *post; 
    269269 
    270270        fields  = [[notification userInfo] objectForKey:WCArgumentsKey]; 
     
    274274 
    275275        post = [self _postWithNick:nick date:[NSDate dateWithISO8601String:date] message:message]; 
    276         [_newsFilter filter:post]; 
    277276        [[_news mutableString] insertString:@"\n\n" atIndex:0]; 
    278         [_news insertAttributedString:post atIndex:0]; 
     277        [_news insertAttributedString:[post attributedStringByApplyingFilter:_newsFilter] atIndex:0]; 
    279278        [[_newsTextView textStorage] setAttributedString:_news]; 
    280279         
  • WiredClient/trunk/WCPreferences.h

    r4084 r4121  
    9898        IBOutlet NSButton                                       *_timestampEveryLineButton; 
    9999        IBOutlet NSColorWell                            *_timestampEveryLineColorWell; 
     100        IBOutlet NSButton                                       *_showSmileysButton; 
    100101         
    101102        IBOutlet NSTableView                            *_highlightsTableView; 
  • WiredClient/trunk/WCPreferences.m

    r4103 r4121  
    394394        [_timestampEveryLineButton setState:[WCSettings boolForKey:WCTimestampEveryLine]]; 
    395395        [_timestampEveryLineColorWell setColor:[WCSettings objectForKey:WCTimestampEveryLineColor]]; 
     396        [_showSmileysButton setState:[WCSettings boolForKey:WCShowSmileys]]; 
    396397         
    397398        [_highlightsTableView reloadData]; 
     
    482483        [WCSettings setBool:[_timestampEveryLineButton state] forKey:WCTimestampEveryLine]; 
    483484        [WCSettings setObject:[_timestampEveryLineColorWell color] forKey:WCTimestampEveryLineColor]; 
     485        [WCSettings setBool:[_showSmileysButton state] forKey:WCShowSmileys]; 
    484486         
    485487        // --- events 
  • WiredClient/trunk/WCSettings.h

    r4084 r4121  
    9999#define WCTimestampEveryLine