Changeset 4834

Show
Ignore:
Timestamp:
06/09/07 20:10:18 (1 year ago)
Author:
morris
Message:

Mark all news posts as read when disconnecting from a server, like we do with messages

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredClient/trunk/WCNews.m

    r4799 r4834  
    3838- (void)_validate; 
    3939- (void)_reloadNews; 
     40- (void)_readAllPosts; 
    4041 
    4142- (NSAttributedString *)_postWithNick:(NSString *)nick date:(NSDate *)date message:(NSString *)message; 
     
    121122 
    122123        [[self connection] sendCommand:WCNewsCommand]; 
     124} 
     125 
     126 
     127 
     128- (void)_readAllPosts { 
     129        while(_unread > 0) { 
     130                _unread--; 
     131                 
     132                [[self connection] postNotificationName:WCNewsDidReadPost object:[self connection]]; 
     133        } 
    123134} 
    124135 
     
    196207 
    197208- (void)windowDidBecomeKey:(NSNotification *)notification { 
    198         while(_unread > 0) { 
    199                 _unread--; 
    200                  
    201                 [[self connection] postNotificationName:WCNewsDidReadPost object:[self connection]]; 
    202         } 
     209        [self _readAllPosts]; 
    203210} 
    204211 
     
    224231 
    225232- (void)connectionWillTerminate:(NSNotification *)notification { 
     233        [self _readAllPosts]; 
     234 
    226235        [self close]; 
    227236        [self autorelease];