Changeset 1139
- Timestamp:
- 05/06/04 00:08:09 (5 years ago)
- Files:
-
- WiredClient/trunk/WCChat.h (modified) (2 diffs)
- WiredClient/trunk/WCChat.m (modified) (11 diffs)
- WiredClient/trunk/WCPrivateChat.m (modified) (2 diffs)
- WiredClient/trunk/WCPublicChat.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCChat.h
r1120 r1139 1 /* $Id: WCChat.h,v 1. 6 2004/04/01 12:18:59 morris Exp $ */1 /* $Id: WCChat.h,v 1.7 2004/05/05 22:08:09 morris Exp $ */ 2 2 3 3 /* … … 74 74 unsigned int _cid; 75 75 76 NSTimer *_timestampTimer; 77 NSDate *_lastChat; 76 NSDate *_timestamp; 78 77 } 79 78 WiredClient/trunk/WCChat.m
r1136 r1139 1 /* $Id: WCChat.m,v 1.2 6 2004/05/05 21:06:20morris Exp $ */1 /* $Id: WCChat.m,v 1.27 2004/05/05 22:08:09 morris Exp $ */ 2 2 3 3 /* … … 64 64 _sortedUsers = [[NSArray alloc] init]; 65 65 66 // --- initiate timestamp date 67 _timestamp = [[NSDate dateWithTimeIntervalSinceNow:0] retain]; 68 66 69 // --- subscribe to these 67 70 [[NSNotificationCenter defaultCenter] … … 143 146 object:NULL]; 144 147 145 // --- ping at intervals146 _timestampTimer = [NSTimer scheduledTimerWithTimeInterval:[[WCSettings objectForKey:WCTimestampChatInterval] doubleValue]147 target:self148 selector:@selector(timestampTimer:)149 userInfo:NULL150 repeats:YES];151 [_timestampTimer retain];152 153 148 return self; 154 149 } … … 165 160 [_commandHistory release]; 166 161 167 [_timestampTimer release]; 168 [_lastChat release]; 162 [_timestamp release]; 169 163 170 164 [super dealloc]; … … 554 548 WCConnection *connection; 555 549 WCUser *user; 550 NSDate *date; 556 551 NSRange range; 552 double interval; 557 553 int i, length, offset; 554 558 555 559 556 // --- get objects … … 579 576 if([user ignore]) 580 577 return; 578 579 // --- insert a timestamp 580 interval = [[WCSettings objectForKey:WCTimestampChatInterval] doubleValue]; 581 date = [NSDate dateWithTimeIntervalSinceNow:0 - interval]; 582 583 if([date compare:_timestamp] == NSOrderedDescending) { 584 [self printEvent:[[NSDate date] localizedDateWithFormat:NSShortTimeDateFormatString]]; 585 586 [_timestamp release]; 587 _timestamp = [NSDate date]; 588 [_timestamp retain]; 589 } 581 590 582 591 // --- lower the prepend offset a bit when using timestamps … … 653 662 if([(NSString *) [WCSettings objectForKey:WCChatEventSound] length] > 0) 654 663 [[NSSound soundNamed:[WCSettings objectForKey:WCChatEventSound]] play]; 655 656 // --- update timestamp657 [_lastChat release];658 _lastChat = [[NSDate date] retain];659 664 } 660 665 … … 667 672 NSMutableString *format; 668 673 NSRange range; 674 NSDate *date; 669 675 WCConnection *connection; 670 676 WCUser *user; 677 double interval; 671 678 672 679 // --- get objects … … 692 699 if([user ignore]) 693 700 return; 701 702 // --- insert a timestamp 703 interval = [[WCSettings objectForKey:WCTimestampChatInterval] doubleValue]; 704 date = [NSDate dateWithTimeIntervalSinceNow:0 - interval]; 705 706 if([date compare:_timestamp] == NSOrderedDescending) { 707 [self printEvent:[[NSDate date] localizedDateWithFormat:NSShortTimeDateFormatString]]; 708 709 [_timestamp release]; 710 _timestamp = [NSDate date]; 711 [_timestamp retain]; 712 } 694 713 695 714 // --- get nick … … 751 770 if([(NSString *) [WCSettings objectForKey:WCChatEventSound] length] > 0) 752 771 [[NSSound soundNamed:[WCSettings objectForKey:WCChatEventSound]] play]; 753 754 // --- update timestamp755 [_lastChat release];756 _lastChat = [[NSDate date] retain];757 772 } 758 773 … … 1324 1339 1325 1340 1326 - (void)timestampTimer:(NSTimer *)timer {1327 NSDate *date;1328 double interval;1329 1330 // --- get interval1331 interval = [[WCSettings objectForKey:WCTimestampChatInterval] doubleValue];1332 date = [NSDate dateWithTimeIntervalSinceNow:0 - interval];1333 1334 // --- print a timed timestamp1335 if([[WCSettings objectForKey:WCTimestampChat] boolValue]) {1336 if([date compare:_lastChat] == NSOrderedAscending)1337 [self printEvent:[[NSDate date] localizedDateWithFormat:NSShortTimeDateFormatString]];1338 }1339 1340 // --- re-schedule timer1341 [timer setFireDate:[NSDate dateWithTimeIntervalSinceNow:interval]];1342 }1343 1344 1345 1346 1341 - (void)saveChatToURL:(NSURL *)url { 1347 1342 NSData *data; WiredClient/trunk/WCPrivateChat.m
r1120 r1139 1 /* $Id: WCPrivateChat.m,v 1. 8 2004/04/01 12:18:59 morris Exp $ */1 /* $Id: WCPrivateChat.m,v 1.9 2004/05/05 22:08:09 morris Exp $ */ 2 2 3 3 /* … … 122 122 @"%u", _cid]]; 123 123 124 [_timestampTimer invalidate];125 126 124 [_userListTableView setDataSource:NULL]; 127 125 WiredClient/trunk/WCPublicChat.m
r1135 r1139 1 /* $Id: WCPublicChat.m,v 1. 19 2004/05/05 16:46:14morris Exp $ */1 /* $Id: WCPublicChat.m,v 1.20 2004/05/05 22:08:09 morris Exp $ */ 2 2 3 3 /* … … 190 190 return; 191 191 192 [_timestampTimer invalidate];193 194 192 [_userListTableView setDataSource:NULL]; 195 193
