Public Member Functions | |
(void) | - setShouldConnect: |
Set after Armagetron is finished initializing. | |
(id) | - init [implementation] |
(void) | - connectToServer: [implementation] |
(void) | - handleURLEvent:withReplyEvent: [implementation] |
(void) | - dealloc [implementation] |
Protected Attributes | |
NSMutableString * | _startupEvent |
BOOL | _shouldConnect |
Set when the game is started via URL. |
Definition at line 34 of file AAURLHandler.mm.
- (void) setShouldConnect: | (BOOL) | shouldConnect |
Set after Armagetron is finished initializing.
Definition at line 86 of file AAURLHandler.mm.
References _shouldConnect, _startupEvent, and connectToServer:.
Referenced by StartAAURLHandler().
00086 :(BOOL)shouldConnect 00087 { 00088 _shouldConnect = shouldConnect; 00089 if ( _shouldConnect ) 00090 { 00091 // _startupEvent is initialized to an empty string. Check if a URL event actually occured 00092 if ( ![_startupEvent isEqualToString:@""] ) 00093 { 00094 [self connectToServer:_startupEvent]; 00095 } 00096 } 00097 00098 }
- (id) init | [implementation] |
Definition at line 44 of file AAURLHandler.mm.
References _shouldConnect, and _startupEvent.
00045 { 00046 self = [super init]; 00047 if ( self ) 00048 { 00049 [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self 00050 andSelector:@selector(handleURLEvent:withReplyEvent:) 00051 forEventClass:kInternetEventClass 00052 andEventID:kAEGetURL]; 00053 _startupEvent = [[NSMutableString alloc] init]; 00054 _shouldConnect = NO; 00055 } 00056 return self; 00057 }
- (void) connectToServer: | (NSString *) | server | [implementation] |
Definition at line 59 of file AAURLHandler.mm.
References ExtractConnectionInformation(), server(), and tString::ToInt().
Referenced by handleURLEvent:withReplyEvent:, and setShouldConnect:.
00059 :(NSString *)server 00060 { 00061 if ( ![server isEqualToString:@"armagetronad://"] ) 00062 { 00063 tString raw( [server UTF8String] ); 00064 tString servername; 00065 tString port; 00066 ExtractConnectionInformation( raw, servername, port ); 00067 nServerInfoRedirect server( servername, port.ToInt() ); 00068 AAURLHandlerConnect( &server ); 00069 } 00070 }
- (void) handleURLEvent: | (NSAppleEventDescriptor *) | event | ||
withReplyEvent: | (NSAppleEventDescriptor *) | replyEvent | ||
[implementation] |
Definition at line 72 of file AAURLHandler.mm.
References _shouldConnect, _startupEvent, and connectToServer:.
00072 :(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent 00073 { 00074 if ( _shouldConnect ) 00075 { 00076 [self connectToServer:[[[event descriptorAtIndex:1] stringValue] retain]]; 00077 } 00078 // Save the event for later, we must finish initializing 00079 else 00080 { 00081 _startupEvent = [[[event descriptorAtIndex:1] stringValue] retain]; 00082 } 00083 }
- (void) dealloc | [implementation] |
- (NSMutableString*) _startupEvent [protected] |
Definition at line 36 of file AAURLHandler.mm.
Referenced by dealloc, handleURLEvent:withReplyEvent:, init, and setShouldConnect:.
- (BOOL) _shouldConnect [protected] |
Set when the game is started via URL.
Definition at line 37 of file AAURLHandler.mm.
Referenced by handleURLEvent:withReplyEvent:, init, and setShouldConnect:.