Changeset 3568

Show
Ignore:
Timestamp:
01/24/07 23:37:01 (2 years ago)
Author:
timothy
Message:

When closing the Web Interface we now logout to prevent queuing up content that needs to be viewed. Also marks some commands as thread safe, so they fire as fast as possible.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plug-Ins/Web Interface/JVWebInterfacePlugin.m

    r3567 r3568  
    2424        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
    2525 
     26        static NSSet *threadSafeCommands = nil; 
     27        if( ! threadSafeCommands ) 
     28                threadSafeCommands = [[NSSet alloc] initWithObjects:@"checkActivity", @"logout", nil]; 
     29 
    2630        JVWebInterfacePlugin *self = (JVWebInterfacePlugin *) server -> context; 
    2731        NSURL *url = [NSURL URLWithString:[NSString stringWithUTF8String:req -> uri]]; 
     
    5155                command = [command substringFromIndex:9]; 
    5256 
    53         command = [command stringByAppendingString:@"Command:"]; 
    54         SEL selector = NSSelectorFromString( command ); 
    55  
    5657        char *ident = req -> get_cookie( req, "identifier" ); 
    5758        NSString *identifier = ( ident ? [NSString stringWithUTF8String:ident] : nil ); 
     
    6061        if( identifier ) [arguments setObject:identifier forKey:JVWebInterfaceClientIdentifier]; 
    6162 
    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        } 
    6469 
    6570        resp -> write( resp, "", 0 ); 
     
    340345        NSMutableDictionary *attributes = [NSMutableDictionary dictionary]; 
    341346        NSEnumerator *enumerator = [chats objectEnumerator]; 
    342         JVChatRoomPanel *panel = nil; 
     347        JVDirectChatPanel *panel = nil; 
    343348 
    344349        while( ( panel = [enumerator nextObject] ) ) { 
     
    357362                        while( ( member = [members nextObject] ) ) { 
    358363                                NSXMLElement *memberNode = [[NSXMLElement alloc] initWithXMLString:[member xmlDescription] error:NULL]; 
    359                                 [chat addChild:memberNode]; 
     364                                if( memberNode ) [chat addChild:memberNode]; 
    360365                                [memberNode release]; 
    361366                        } 
  • trunk/Plug-Ins/Web Interface/Resources/common.js

    r3567 r3568  
    1818var currentActivityCheckInterval = ( UserDefaults.maximumActivityCheckInterval / 2 ); 
    1919var foreground = true; 
     20var finished = false; 
    2021 
    2122var ChatController = { 
     
    403404 
    404405window.addEventListener( "load", setup, false ); 
     406window.addEventListener( "beforeunload", teardown, false ); 
     407window.addEventListener( "unload", teardown, false ); 
    405408 
    406409function setup() { 
     
    429432} 
    430433 
     434function 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 
    431446function windowBlured() { 
    432447        foreground = false; 
  • trunk/Plug-Ins/Web Interface/Web Interface.xcodeproj/project.pbxproj

    r3567 r3568  
    241241                        isa = PBXProject; 
    242242                        buildConfigurationList = 1C7F30420855482D00D41FB0 /* Build configuration list for PBXProject "Web Interface" */; 
     243                        compatibilityVersion = "Xcode 2.4"; 
    243244                        hasScannedForEncodings = 1; 
    244245                        mainGroup = 089C166AFE841209C02AAC07 /* FScript Plugin */; 
    245246                        projectDirPath = ""; 
    246247                        projectRoot = ../..; 
     248                        shouldCheckCompatibility = 1; 
    247249                        targets = ( 
    248250                                8D5B49AC048680CD000E48DA /* Web Interface Plugin */,