Changeset 4775
- Timestamp:
- 05/19/07 17:13:28 (2 years ago)
- Files:
-
- WiredClient/trunk/WCAccountEditor.m (modified) (1 diff)
- WiredClient/trunk/WCAccounts.m (modified) (1 diff)
- WiredClient/trunk/WCConnectionController.h (modified) (1 diff)
- WiredClient/trunk/WCConnectionController.m (modified) (5 diffs)
- WiredClient/trunk/WCConsole.m (modified) (1 diff)
- WiredClient/trunk/WCDock.m (modified) (1 diff)
- WiredClient/trunk/WCFileInfo.m (modified) (1 diff)
- WiredClient/trunk/WCFiles.m (modified) (1 diff)
- WiredClient/trunk/WCMessages.h (modified) (2 diffs)
- WiredClient/trunk/WCMessages.m (modified) (8 diffs)
- WiredClient/trunk/WCNews.h (modified) (2 diffs)
- WiredClient/trunk/WCNews.m (modified) (4 diffs)
- WiredClient/trunk/WCPreview.m (modified) (1 diff)
- WiredClient/trunk/WCPrivateChat.m (modified) (1 diff)
- WiredClient/trunk/WCPublicChat.m (modified) (1 diff)
- WiredClient/trunk/WCSearch.m (modified) (1 diff)
- WiredClient/trunk/WCServerConnection.m (modified) (1 diff)
- WiredClient/trunk/WCServerInfo.m (modified) (1 diff)
- WiredClient/trunk/WCTransfers.m (modified) (1 diff)
- WiredClient/trunk/WCUserInfo.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
WiredClient/trunk/WCAccountEditor.m
r4439 r4775 308 308 - (void)connectionWillTerminate:(NSNotification *)notification { 309 309 [self close]; 310 311 [super connectionWillTerminate:notification]; 310 312 } 311 313 WiredClient/trunk/WCAccounts.m
r4439 r4775 273 273 [self close]; 274 274 [self autorelease]; 275 276 [super connectionWillTerminate:notification]; 275 277 } 276 278 WiredClient/trunk/WCConnectionController.h
r4466 r4775 44 44 - (void)windowTemplateShouldLoad:(NSMutableDictionary *)windowTemplate; 45 45 - (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate; 46 - (void)connectionWillTerminate:(NSNotification *)notification; 47 - (void)connectionDidTerminate:(NSNotification *)notification; 48 - (void)serverConnectionShouldHide:(NSNotification *)notification; 49 - (void)serverConnectionShouldUnhide:(NSNotification *)notification; 46 50 47 51 - (void)setName:(NSString *)name; WiredClient/trunk/WCConnectionController.m
r4466 r4775 116 116 117 117 118 - (void)_connectionWillTerminate:(NSNotification *)notification {119 [self _saveWindowTemplate];120 }121 122 123 124 - (void)_connectionDidTerminate:(NSNotification *)notification {125 [_connection removeObserver:self];126 _connection = NULL;127 }128 129 130 131 - (void)_serverConnectionShouldHide:(NSNotification *)notification {132 NSWindow *sheet;133 134 _wasVisible = [[self window] isVisible];135 _hidden = YES;136 137 if(_wasVisible) {138 sheet = [[self window] attachedSheet];139 140 if(sheet)141 [NSApp endSheet:sheet returnCode:NSAlertAlternateReturn];142 143 [[self window] orderOut:self];144 }145 }146 147 148 149 - (void)_serverConnectionShouldUnhide:(NSNotification *)notification {150 if(_wasVisible)151 [[self window] orderFront:self];152 153 _hidden = NO;154 }155 156 157 158 118 159 119 - (void)_disconnectSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { … … 185 145 186 146 [_connection addObserver:self 147 selector:@selector(connectionWillTerminate:) 148 name:WCConnectionWillTerminate]; 149 150 [_connection addObserver:self 151 selector:@selector(connectionDidTerminate:) 152 name:WCConnectionDidTerminate]; 153 154 [_connection addObserver:self 155 selector:@selector(serverConnectionShouldHide:) 156 name:WCServerConnectionShouldHide]; 157 158 [_connection addObserver:self 159 selector:@selector(serverConnectionShouldUnhide:) 160 name:WCServerConnectionShouldUnhide]; 161 162 [_connection addObserver:self 187 163 selector:@selector(_serverConnectionShouldLoadWindowTemplate:) 188 164 name:WCServerConnectionShouldLoadWindowTemplate]; … … 192 168 name:WCServerConnectionShouldSaveWindowTemplate]; 193 169 194 [_connection addObserver:self195 selector:@selector(_connectionWillTerminate:)196 name:WCConnectionWillTerminate];197 198 [_connection addObserver:self199 selector:@selector(_connectionDidTerminate:)200 name:WCConnectionDidTerminate];201 202 [_connection addObserver:self203 selector:@selector(_serverConnectionShouldHide:)204 name:WCServerConnectionShouldHide];205 206 [_connection addObserver:self207 selector:@selector(_serverConnectionShouldUnhide:)208 name:WCServerConnectionShouldUnhide];209 210 170 if([self respondsToSelector:@selector(connectionDidConnect:)]) { 211 171 [_connection addObserver:self … … 218 178 selector:@selector(connectionDidClose:) 219 179 name:WCConnectionDidClose]; 220 }221 222 if([self respondsToSelector:@selector(connectionWillTerminate:)]) {223 [_connection addObserver:self224 selector:@selector(connectionWillTerminate:)225 name:WCConnectionWillTerminate];226 }227 228 if([self respondsToSelector:@selector(connectionDidTerminate:)]) {229 [_connection addObserver:self230 selector:@selector(connectionDidTerminate:)231 name:WCConnectionDidTerminate];232 180 } 233 181 … … 299 247 300 248 - (void)windowTemplateShouldSave:(NSMutableDictionary *)windowTemplate { 249 } 250 251 252 253 - (void)connectionWillTerminate:(NSNotification *)notification { 254 [self _saveWindowTemplate]; 255 } 256 257 258 259 - (void)connectionDidTerminate:(NSNotification *)notification { 260 [_connection removeObserver:self]; 261 _connection = NULL; 262 } 263 264 265 266 - (void)serverConnectionShouldHide:(NSNotification *)notification { 267 NSWindow *sheet; 268 269 _wasVisible = [[self window] isVisible]; 270 _hidden = YES; 271 272 if(_wasVisible) { 273 sheet = [[self window] attachedSheet]; 274 275 if(sheet) 276 [NSApp endSheet:sheet returnCode:NSAlertAlternateReturn]; 277 278 [[self window] orderOut:self]; 279 } 280 } 281 282 283 284 - (void)serverConnectionShouldUnhide:(NSNotification *)notification { 285 if(_wasVisible) 286 [[self window] orderFront:self]; 287 288 _hidden = NO; 301 289 } 302 290 WiredClient/trunk/WCConsole.m
r4439 r4775 150 150 [self close]; 151 151 [self autorelease]; 152 153 [super connectionWillTerminate:notification]; 152 154 } 153 155 WiredClient/trunk/WCDock.m
r4751 r4775 329 329 selector = [item action]; 330 330 331 if(selector == @selector(hideConnection:) || 332 selector == @selector(nextConnection:) || 333 selector == @selector(previousConnection:)) 331 if(selector == @selector(hideConnection:)) 332 return [[[NSApp keyWindow] windowController] isKindOfClass:[WCConnectionController class]]; 333 else if(selector == @selector(nextConnection:) || 334 selector == @selector(previousConnection:)) 334 335 return ([_shownConnections count] > 0); 335 336 else if(selector == @selector(disconnect:)) WiredClient/trunk/WCFileInfo.m
r4481 r4775 214 214 - (void)connectionWillTerminate:(NSNotification *)notification { 215 215 [self close]; 216 217 [super connectionWillTerminate:notification]; 216 218 } 217 219 WiredClient/trunk/WCFiles.m
r4466 r4775 473 473 - (void)connectionWillTerminate:(NSNotification *)notification { 474 474 [self close]; 475 476 [super connectionWillTerminate:notification]; 475 477 } 476 478 WiredClient/trunk/WCMessages.h
r4481 r4775 66 66 unsigned int _unread; 67 67 68 WCUser *_messageUser; 69 68 70 WIDateFormatter *_tableDateFormatter; 69 71 WIDateFormatter *_dialogDateFormatter; 72 73 NSString *_hiddenMessage; 74 NSString *_hiddenBroadcast; 70 75 } 71 76 … … 78 83 79 84 - (void)showPrivateMessageToUser:(WCUser *)user; 85 - (void)showPrivateMessageToUser:(WCUser *)user message:(NSString *)message; 86 - (void)showBroadcast:(NSString *)broadcast; 80 87 - (unsigned int)numberOfUnreadMessages; 81 88 WiredClient/trunk/WCMessages.m
r4751 r4775 569 569 [self close]; 570 570 [self autorelease]; 571 572 [super connectionWillTerminate:notification]; 571 573 } 572 574 … … 583 585 584 586 [self _validate]; 587 } 588 589 590 591 - (void)serverConnectionShouldHide:(NSNotification *)notification { 592 NSWindow *sheet; 593 594 sheet = [[self window] attachedSheet]; 595 596 if(sheet == _replyPanel) 597 _hiddenMessage = [[_replyTextView string] copy]; 598 else if(sheet == _broadcastPanel) 599 _hiddenBroadcast = [[_broadcastTextView string] copy]; 600 601 [super serverConnectionShouldHide:notification]; 602 } 603 604 605 606 - (void)serverConnectionShouldUnhide:(NSNotification *)notification { 607 [super serverConnectionShouldUnhide:notification]; 608 609 if(_hiddenMessage) { 610 [self showPrivateMessageToUser:_messageUser message:_hiddenMessage]; 611 612 [_hiddenMessage release]; 613 _hiddenMessage = NULL; 614 } 615 else if(_hiddenBroadcast) { 616 [self showBroadcast:_hiddenBroadcast]; 617 618 [_hiddenBroadcast release]; 619 _hiddenBroadcast = NULL; 620 } 585 621 } 586 622 … … 804 840 805 841 - (void)showPrivateMessageToUser:(WCUser *)user { 806 [_userTextField setStringValue:[user nick]]; 842 [self showPrivateMessageToUser:user message:@""]; 843 } 844 845 846 847 - (void)showPrivateMessageToUser:(WCUser *)user message:(NSString *)message { 848 [user retain]; 849 [_messageUser release]; 850 _messageUser = user; 851 852 [_userTextField setStringValue:[_messageUser nick]]; 853 854 [_replyTextView setString:message]; 807 855 808 856 [self showWindow:self]; … … 812 860 modalDelegate:self 813 861 didEndSelector:@selector(replySheetDidEnd:returnCode:contextInfo:) 814 contextInfo:[user retain]]; 815 } 816 817 818 819 - (void)showPrivateMessageReply { 820 if([_replyButton isEnabled]) 821 [self reply:self]; 822 } 823 824 825 826 - (unsigned int)numberOfUnreadMessages { 827 return _unread; 828 } 829 830 831 832 #pragma mark - 833 834 - (IBAction)broadcast:(id)sender { 862 contextInfo:NULL]; 863 } 864 865 866 867 - (void)showBroadcast:(NSString *)broadcast { 835 868 [self showWindow:self]; 869 870 [_broadcastTextView setString:broadcast]; 836 871 837 872 [NSApp beginSheet:_broadcastPanel … … 844 879 845 880 881 - (unsigned int)numberOfUnreadMessages { 882 return _unread; 883 } 884 885 886 887 #pragma mark - 888 889 - (IBAction)broadcast:(id)sender { 890 [self showBroadcast:@""]; 891 } 892 893 894 846 895 - (void)broadcastSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 847 896 if(returnCode == NSAlertDefaultReturn) … … 862 911 return; 863 912 864 [_userTextField setStringValue:[[message user] nick]]; 865 866 [NSApp beginSheet:_replyPanel 867 modalForWindow:[self window] 868 modalDelegate:self 869 didEndSelector:@selector(replySheetDidEnd:returnCode:contextInfo:) 870 contextInfo:[[message user] retain]]; 913 [self showPrivateMessageToUser:[message user]]; 871 914 } 872 915 … … 874 917 875 918 - (void)replySheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo { 876 WCUser *user = (WCUser *) contextInfo;877 919 WCMessage *message; 878 920 WCConversation *conversation; 879 921 880 922 if(returnCode == NSAlertDefaultReturn) { 881 message = [WCMessage messageToUser: user string:[[[_replyTextView string] copy] autorelease]];923 message = [WCMessage messageToUser:_messageUser string:[[[_replyTextView string] copy] autorelease]]; 882 924 [_allMessages addObject:message]; 883 925 884 conversation = [WCConversation messageConversationWithUser: user];926 conversation = [WCConversation messageConversationWithUser:_messageUser]; 885 927 886 928 if(![_conversations containsObject:conversation]) … … 899 941 [_replyPanel close]; 900 942 [_replyTextView setString:@""]; 943 944 [_messageUser release]; 901 945 } 902 946 WiredClient/trunk/WCNews.h
r4481 r4775 43 43 WIDateFormatter *_dateFormatter; 44 44 unsigned int _unread; 45 46 NSString *_hiddenNews; 45 47 } 46 48 … … 52 54 + (id)newsWithConnection:(WCServerConnection *)connection; 53 55 56 - (void)showPost:(NSString *)post; 54 57 - (unsigned int)numberOfUnreadPosts; 55 58 WiredClient/trunk/WCNews.m
r4751 r4775 226 226 [self close]; 227 227 [self autorelease]; 228 229 [super connectionWillTerminate:notification]; 228 230 } 229 231 … … 247 249 - (void)serverConnectionPrivilegesDidChange:(NSNotification *)notification { 248 250 [self _validate]; 251 } 252 253 254 255 - (void)serverConnectionShouldHide:(NSNotification *)notification { 256 NSWindow *sheet; 257 258 sheet = [[self window] attachedSheet]; 259 260 if(sheet == _postPanel) 261 _hiddenNews = [[_postTextView string] copy]; 262 263 [super serverConnectionShouldHide:notification]; 264 } 265 266 267 268 - (void)serverConnectionShouldUnhide:(NSNotification *)notification { 269 [super serverConnectionShouldUnhide:notification]; 270 271 if(_hiddenNews) { 272 [self showPost:_hiddenNews]; 273 274 [_hiddenNews release]; 275 _hiddenNews = NULL; 276 } 249 277 } 250 278 … … 336 364 #pragma mark - 337 365 338 - (unsigned int)numberOfUnreadPosts { 339 return _unread; 340 } 341 342 343 344 #pragma mark - 345 346 - (IBAction)postNews:(id)sender { 366 - (void)showPost:(NSString *)post { 347 367 [self showWindow:self]; 368 369 [_postTextView setString:post]; 348 370 349 371 [NSApp beginSheet:_postPanel … … 352 374 didEndSelector:@selector(postSheetDidEnd:returnCode:contextInfo:) 353 375 contextInfo:NULL]; 376 } 377 378 379 380 - (unsigned int)numberOfUnreadPosts { 381 return _unread; 382 } 383 384 385 386 #pragma mark - 387 388 - (IBAction)postNews:(id)sender { 389 [self showPost:@""]; 354 390 } 355 391 WiredClient/trunk/WCPreview.m
r4439 r4775 409 409 - (void)connectionWillTerminate:(NSNotification *)notification { 410 410 [self close]; 411 412 [super connectionWillTerminate:notification]; 411 413 } 412 414 WiredClient/trunk/WCPrivateChat.m
r4439 r4775 122 122 - (void)connectionWillTerminate:(NSNotification *)notification { 123 123 [self close]; 124 125 [super connectionWillTerminate:notification]; 124 126 } 125 127 WiredClient/trunk/WCPublicChat.m
r4751 r4775 331 331 332 332 [self autorelease]; 333 334 [super connectionWillTerminate:notification]; 333 335 } 334 336 WiredClient/trunk/WCSearch.m
r4439 r4775 171 171 [self close]; 172 172 [self autorelease]; 173 174 [super connectionWillTerminate:notification]; 173 175 } 174 176 WiredClient/trunk/WCServerConnection.m
r4752 r4775 927 927 928 928 - (void)triggerEvent:(int)tag info1:(id)info1 info2:(id)info2 { 929 NSDictionary *event, *userInfo; 929 NSMutableDictionary *userInfo; 930 NSDictionary *event; 930 931 931 932 event = [WCSettings eventForTag:tag]; 932 userInfo = [NSDictionary dictionaryWithObjectsAndKeys: 933 self, WCServerConnectionEventConnectionKey, 934 info1, WCServerConnectionEventInfo1Key, 935 info2, WCServerConnectionEventInfo2Key, 936 NULL]; 933 userInfo = [NSMutableDictionary dictionaryWithObject:self forKey:WCServerConnectionEventConnectionKey]; 934 935 if(info1) 936 [userInfo setObject:info1 forKey:WCServerConnectionEventInfo1Key]; 937 938 if(info2) 939 [userInfo setObject:info2 forKey:WCServerConnectionEventInfo2Key]; 937 940 938 941 [self postNotificationName:WCServerConnectionTriggeredEvent object:event userInfo:userInfo]; WiredClient/trunk/WCServerInfo.m
r4481 r4775 230 230 231 231 [self autorelease]; 232 233 [super connectionWillTerminate:notification]; 232 234 } 233 235 WiredClient/trunk/WCTransfers.m
r4756 r4775 1157 1157 [self close]; 1158 1158 [self autorelease]; 1159 1160 [super connectionWillTerminate:notification]; 1159 1161 } 1160 1162 WiredClient/trunk/WCUserInfo.m
r4481 r4775 247 247 - (void)connectionWillTerminate:(NSNotification *)notification { 248 248 [self close]; 249 250 [super connectionWillTerminate:notification]; 249 251 } 250 252
