Changeset 3145

Show
Ignore:
Timestamp:
02/23/06 22:24:40 (2 years ago)
Author:
timothy
Message:

The topic is now displayed when joining a room.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/cocoa-networking/Chat Core/MVChatRoom.m

    r3140 r3145  
    595595} 
    596596 
    597 - (void) _setTopic:(NSData *) topic byAuthor:(MVChatUser *) author withDate:(NSDate *) date
     597- (void) _setTopic:(NSData *) topic
    598598        id old = _topicData; 
    599599        _topicData = [topic copyWithZone:nil]; 
    600600        [old release]; 
    601  
    602         old = _topicAuthor; 
     601
     602 
     603- (void) _setTopicAuthor:(MVChatUser *) author { 
     604        id old = _topicAuthor; 
    603605        _topicAuthor = [author retain]; 
    604606        [old release]; 
    605  
    606         old = _dateTopicChanged; 
     607
     608 
     609- (void) _setTopicDate:(NSDate *) date { 
     610        id old = _dateTopicChanged; 
    607611        _dateTopicChanged = [date copyWithZone:nil]; 
    608612        [old release]; 
    609  
    610         [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:self userInfo:nil]; 
    611613} 
    612614 
  • branches/cocoa-networking/Chat Core/MVChatRoomPrivate.h

    r3081 r3145  
    1717- (void) _setDateJoined:(NSDate *) date; 
    1818- (void) _setDateParted:(NSDate *) date; 
    19 - (void) _setTopic:(NSData *) topic byAuthor:(MVChatUser *) author withDate:(NSDate *) date; 
     19- (void) _setTopic:(NSData *) topic; 
     20- (void) _setTopicAuthor:(MVChatUser *) author; 
     21- (void) _setTopicDate:(NSDate *) date; 
    2022@end 
  • branches/cocoa-networking/Chat Core/MVIRCChatConnection.m

    r3144 r3145  
    14221422        if( [parameters count] == 2 ) { 
    14231423                MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:0]]; 
    1424                 [room _setTopic:[parameters objectAtIndex:1] byAuthor:sender withDate:[NSDate date]]; 
     1424                [room _setTopic:[parameters objectAtIndex:1]]; 
     1425                [room _setTopicAuthor:sender]; 
     1426                [room _setTopicDate:[NSDate date]]; 
     1427                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:room userInfo:nil]; 
    14251428        } 
    14261429} 
     
    17391742 
    17401743#pragma mark - 
     1744#pragma mark Topic Replies 
     1745 
     1746- (void) _handle332WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_TOPIC 
     1747        if( [parameters count] == 3 ) { 
     1748                MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; 
     1749                [room _setTopic:[parameters objectAtIndex:2]]; 
     1750        } 
     1751} 
     1752 
     1753- (void) _handle333WithParameters:(NSArray *) parameters fromSender:(id) sender { // RPL_TOPICWHOTIME_IRCU 
     1754        if( [parameters count] >= 4 ) { 
     1755                MVChatRoom *room = [self joinedChatRoomWithName:[parameters objectAtIndex:1]]; 
     1756                MVChatUser *author = [MVChatUser wildcardUserFromString:[parameters objectAtIndex:2]]; 
     1757                [room _setTopicAuthor:author]; 
     1758                if( [[parameters objectAtIndex:3] doubleValue] > 631138520 ) 
     1759                        [room _setTopicDate:[NSDate dateWithTimeIntervalSince1970:[[parameters objectAtIndex:3] doubleValue]]]; 
     1760                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:room userInfo:nil]; 
     1761        } 
     1762} 
     1763 
     1764#pragma mark - 
    17411765#pragma mark WHOIS Replies 
    17421766 
     
    17701794        if( [parameters count] >= 3 ) { 
    17711795                MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; 
    1772                 [user _setIdleTime:[[parameters objectAtIndex:2] intValue]]; 
     1796                [user _setIdleTime:[[parameters objectAtIndex:2] doubleValue]]; 
    17731797                [user _setDateConnected:nil]; 
    17741798 
    17751799                // parameter 4 is connection time on some servers 
    17761800                // prevent showing 34+ years connected time, this makes sure it is a viable date 
    1777                 if( [parameters count] >= 4 && [[parameters objectAtIndex:3] intValue] > 631138520 ) 
    1778                         [user _setDateConnected:[NSDate dateWithTimeIntervalSince1970:[[parameters objectAtIndex:3] intValue]]]; 
     1801                if( [parameters count] >= 4 && [[parameters objectAtIndex:3] doubleValue] > 631138520 ) 
     1802                        [user _setDateConnected:[NSDate dateWithTimeIntervalSince1970:[[parameters objectAtIndex:3] doubleValue]]]; 
    17791803        } 
    17801804} 
  • branches/cocoa-networking/Chat Core/MVSILCChatConnection.m

    r3140 r3145  
    287287                        MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 
    288288                        NSData *msgData = ( topic ? [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )] : nil ); 
    289                         [room _setTopic:msgData byAuthor:authorUser withDate:[NSDate date]]; 
     289                        [room _setTopic:msgData]; 
    290290                        [msgData release]; 
     291 
     292                        [room _setTopicAuthor:authorUser]; 
     293                        [room _setTopicDate:[NSDate date]]; 
     294 
     295                        [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:room userInfo:nil]; 
    291296                }       break; 
    292297                case SILC_NOTIFY_TYPE_CMODE_CHANGE: 
     
    621626 
    622627                NSData *msgData = [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )]; 
    623                 [room _setTopic:msgData byAuthor:nil withDate:nil]; 
     628                [room _setTopic:msgData]; 
    624629                [msgData release]; 
     630 
     631                [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:room userInfo:nil]; 
    625632 
    626633                silc_client_get_clients_by_list( [self _silcClient], [self _silcConn], list_count, client_id_list, silc_channel_get_clients_per_list_callback, room );