Changeset 3449

Show
Ignore:
Timestamp:
12/10/06 02:44:18 (2 years ago)
Author:
timothy
Message:

Allow JavaScript? plugins to create JVMutableChatMessages so they can send chat messages using the normal functions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plug-Ins/JavaScript Support/JVJavaScriptChatPlugin.m

    r3448 r3449  
    106106} 
    107107 
     108- (void) release { 
     109        if( ( [self retainCount] - 1 ) == 1 ) 
     110                [[_webview windowScriptObject] removeWebScriptKey:@"Plugin"]; 
     111        [super release]; 
     112} 
     113 
    108114- (void) dealloc { 
    109115        [[NSNotificationCenter defaultCenter] removeObserver:self]; 
     
    245251 
    246252- (void) setupScriptGlobalsForWebView:(WebView *) webView { 
     253        [[webView windowScriptObject] setValue:self forKey:@"Plugin"]; 
    247254        [[webView windowScriptObject] setValue:[JVChatController defaultController] forKey:@"ChatController"]; 
    248255        [[webView windowScriptObject] setValue:[MVConnectionsController defaultController] forKey:@"ConnectionsController"]; 
     
    252259        [[webView windowScriptObject] setValue:[JVNotificationController defaultController] forKey:@"NotificationController"]; 
    253260        [[webView windowScriptObject] setValue:[MVChatPluginManager defaultManager] forKey:@"ChatPluginManager"]; 
     261} 
     262 
     263#pragma mark - 
     264 
     265- (id) allocInstance:(NSString *) class { 
     266        return [NSClassFromString(class) allocWithZone:nil]; 
    254267} 
    255268 
  • trunk/Plug-Ins/JavaScript Support/plugin.html

    r3446 r3449  
    33<html xmlns="http://www.w3.org/1999/xhtml"> 
    44<head> 
    5         <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
     5<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
     6<script> 
     7function JVMutableChatMessage(text, sender) { 
     8        var obj = Plugin.allocInstance('JVMutableChatMessage'); 
     9        return obj.initWithText(text, sender); 
     10
     11</script> 
    612</head> 
    713<body></body>