Changeset 3145
- Timestamp:
- 02/23/06 22:24:40 (2 years ago)
- Files:
-
- branches/cocoa-networking/Chat Core/MVChatRoom.m (modified) (1 diff)
- branches/cocoa-networking/Chat Core/MVChatRoomPrivate.h (modified) (1 diff)
- branches/cocoa-networking/Chat Core/MVIRCChatConnection.m (modified) (3 diffs)
- branches/cocoa-networking/Chat Core/MVSILCChatConnection.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/cocoa-networking/Chat Core/MVChatRoom.m
r3140 r3145 595 595 } 596 596 597 - (void) _setTopic:(NSData *) topic byAuthor:(MVChatUser *) author withDate:(NSDate *) date{597 - (void) _setTopic:(NSData *) topic { 598 598 id old = _topicData; 599 599 _topicData = [topic copyWithZone:nil]; 600 600 [old release]; 601 602 old = _topicAuthor; 601 } 602 603 - (void) _setTopicAuthor:(MVChatUser *) author { 604 id old = _topicAuthor; 603 605 _topicAuthor = [author retain]; 604 606 [old release]; 605 606 old = _dateTopicChanged; 607 } 608 609 - (void) _setTopicDate:(NSDate *) date { 610 id old = _dateTopicChanged; 607 611 _dateTopicChanged = [date copyWithZone:nil]; 608 612 [old release]; 609 610 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:self userInfo:nil];611 613 } 612 614 branches/cocoa-networking/Chat Core/MVChatRoomPrivate.h
r3081 r3145 17 17 - (void) _setDateJoined:(NSDate *) date; 18 18 - (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; 20 22 @end branches/cocoa-networking/Chat Core/MVIRCChatConnection.m
r3144 r3145 1422 1422 if( [parameters count] == 2 ) { 1423 1423 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]; 1425 1428 } 1426 1429 } … … 1739 1742 1740 1743 #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 - 1741 1765 #pragma mark WHOIS Replies 1742 1766 … … 1770 1794 if( [parameters count] >= 3 ) { 1771 1795 MVChatUser *user = [self chatUserWithUniqueIdentifier:[parameters objectAtIndex:1]]; 1772 [user _setIdleTime:[[parameters objectAtIndex:2] intValue]];1796 [user _setIdleTime:[[parameters objectAtIndex:2] doubleValue]]; 1773 1797 [user _setDateConnected:nil]; 1774 1798 1775 1799 // parameter 4 is connection time on some servers 1776 1800 // 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]]]; 1779 1803 } 1780 1804 } branches/cocoa-networking/Chat Core/MVSILCChatConnection.m
r3140 r3145 287 287 MVChatRoom *room = [self joinedChatRoomWithName:[NSString stringWithUTF8String:channel -> channel_name]]; 288 288 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]; 290 290 [msgData release]; 291 292 [room _setTopicAuthor:authorUser]; 293 [room _setTopicDate:[NSDate date]]; 294 295 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:room userInfo:nil]; 291 296 } break; 292 297 case SILC_NOTIFY_TYPE_CMODE_CHANGE: … … 621 626 622 627 NSData *msgData = [[NSData allocWithZone:nil] initWithBytes:topic length:strlen( topic )]; 623 [room _setTopic:msgData byAuthor:nil withDate:nil];628 [room _setTopic:msgData]; 624 629 [msgData release]; 630 631 [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:MVChatRoomTopicChangedNotification object:room userInfo:nil]; 625 632 626 633 silc_client_get_clients_by_list( [self _silcClient], [self _silcConn], list_count, client_id_list, silc_channel_get_clients_per_list_callback, room );
