Changeset 3568
- Timestamp:
- 01/24/07 23:37:01 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Plug-Ins/Web Interface/JVWebInterfacePlugin.m
r3567 r3568 24 24 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 25 25 26 static NSSet *threadSafeCommands = nil; 27 if( ! threadSafeCommands ) 28 threadSafeCommands = [[NSSet alloc] initWithObjects:@"checkActivity", @"logout", nil]; 29 26 30 JVWebInterfacePlugin *self = (JVWebInterfacePlugin *) server -> context; 27 31 NSURL *url = [NSURL URLWithString:[NSString stringWithUTF8String:req -> uri]]; … … 51 55 command = [command substringFromIndex:9]; 52 56 53 command = [command stringByAppendingString:@"Command:"];54 SEL selector = NSSelectorFromString( command );55 56 57 char *ident = req -> get_cookie( req, "identifier" ); 57 58 NSString *identifier = ( ident ? [NSString stringWithUTF8String:ident] : nil ); … … 60 61 if( identifier ) [arguments setObject:identifier forKey:JVWebInterfaceClientIdentifier]; 61 62 62 if( [self respondsToSelector:selector] ) 63 [self performSelectorOnMainThread:selector withObject:arguments waitUntilDone:YES]; 63 SEL selector = NSSelectorFromString( [command stringByAppendingString:@"Command:"] ); 64 if( [self respondsToSelector:selector] ) { 65 if( [threadSafeCommands containsObject:command] ) 66 [self performSelector:selector withObject:arguments]; 67 else [self performSelectorOnMainThread:selector withObject:arguments waitUntilDone:YES]; 68 } 64 69 65 70 resp -> write( resp, "", 0 ); … … 340 345 NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; 341 346 NSEnumerator *enumerator = [chats objectEnumerator]; 342 JV ChatRoomPanel *panel = nil;347 JVDirectChatPanel *panel = nil; 343 348 344 349 while( ( panel = [enumerator nextObject] ) ) { … … 357 362 while( ( member = [members nextObject] ) ) { 358 363 NSXMLElement *memberNode = [[NSXMLElement alloc] initWithXMLString:[member xmlDescription] error:NULL]; 359 [chat addChild:memberNode];364 if( memberNode ) [chat addChild:memberNode]; 360 365 [memberNode release]; 361 366 } trunk/Plug-Ins/Web Interface/Resources/common.js
r3567 r3568 18 18 var currentActivityCheckInterval = ( UserDefaults.maximumActivityCheckInterval / 2 ); 19 19 var foreground = true; 20 var finished = false; 20 21 21 22 var ChatController = { … … 403 404 404 405 window.addEventListener( "load", setup, false ); 406 window.addEventListener( "beforeunload", teardown, false ); 407 window.addEventListener( "unload", teardown, false ); 405 408 406 409 function setup() { … … 429 432 } 430 433 434 function teardown() { 435 if( finished ) return; 436 finished = true; 437 new Ajax.Request( "/command/logout", { 438 method: "get", 439 asynchronous: false, 440 onException: function( transport, exception ) { 441 throw exception; 442 } 443 } ); 444 } 445 431 446 function windowBlured() { 432 447 foreground = false; trunk/Plug-Ins/Web Interface/Web Interface.xcodeproj/project.pbxproj
r3567 r3568 241 241 isa = PBXProject; 242 242 buildConfigurationList = 1C7F30420855482D00D41FB0 /* Build configuration list for PBXProject "Web Interface" */; 243 compatibilityVersion = "Xcode 2.4"; 243 244 hasScannedForEncodings = 1; 244 245 mainGroup = 089C166AFE841209C02AAC07 /* FScript Plugin */; 245 246 projectDirPath = ""; 246 247 projectRoot = ../..; 248 shouldCheckCompatibility = 1; 247 249 targets = ( 248 250 8D5B49AC048680CD000E48DA /* Web Interface Plugin */,
