Changeset 2364

Show
Ignore:
Timestamp:
02/21/05 23:43:23 (4 years ago)
Author:
timothy
Message:

* Moved AppleScript? plugin support to a plugin like F-Script.
* Added: /as and /applescript commands to load, unload and edit plugins.
* AppleScript? editor is work in progress. Currently only lets you read the script. It will be like a mini ScriptEditor? soon.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Chat Core.xcode/project.pbxproj

    r2306 r2364  
    148148//1C3 
    149149//1C4 
    150                 1C1C564F059EA8C9002FBEFB = { 
    151                         fileEncoding = 4; 
    152                         isa = PBXFileReference; 
    153                         lastKnownFileType = sourcecode.c.h; 
    154                         path = MVChatScriptPlugin.h; 
    155                         refType = 4; 
    156                         sourceTree = "<group>"; 
    157                 }; 
    158                 1C1C5650059EA8C9002FBEFB = { 
    159                         fileEncoding = 4; 
    160                         isa = PBXFileReference; 
    161                         lastKnownFileType = sourcecode.c.objc; 
    162                         path = MVChatScriptPlugin.m; 
    163                         refType = 4; 
    164                         sourceTree = "<group>"; 
    165                 }; 
    166                 1C1C5651059EA8C9002FBEFB = { 
    167                         fileRef = 1C1C564F059EA8C9002FBEFB; 
    168                         isa = PBXBuildFile; 
    169                         settings = { 
    170                                 ATTRIBUTES = ( 
    171                                         Public, 
    172                                 ); 
    173                         }; 
    174                 }; 
    175150                1C2EF7EB0427A40B00000102 = { 
    176151                        fileEncoding = 4; 
     
    283258                        buildActionMask = 2147483647; 
    284259                        files = ( 
    285                                 1C1C5651059EA8C9002FBEFB, 
    286260                                1C9CF4FE0615091400330D8D, 
    287261                                1C943AAB063C260800618CD9, 
     
    319293                                1C3D55BC05A4CBBE00F25F5E, 
    320294                                1C3D55C205A4DC1E00F25F5E, 
    321                                 1C9CF4FD0615091400330D8D, 
    322295                                1C9CF4FF0615091500330D8D, 
    323296                                1C9CF5010615091700330D8D, 
     
    15231496                        refType = 4; 
    15241497                        sourceTree = "<group>"; 
    1525                 }; 
    1526                 1C9CF4FD0615091400330D8D = { 
    1527                         fileRef = 1C1C5650059EA8C9002FBEFB; 
    1528                         isa = PBXBuildFile; 
    1529                         settings = { 
    1530                         }; 
    15311498                }; 
    15321499                1C9CF4FE0615091400330D8D = { 
     
    35593526                                1C2EF7EC0427A40B00000102, 
    35603527                                1C2EF7EB0427A40B00000102, 
    3561                                 1C1C5650059EA8C9002FBEFB, 
    3562                                 1C1C564F059EA8C9002FBEFB, 
    35633528                        ); 
    35643529                        isa = PBXGroup; 
  • trunk/Colloquy.pch

    r2311 r2364  
    44#import <AGRegex/AGRegex.h> 
    55 
    6 // #define WebKitVersion146 1 
     6#define WebKitVersion146 1 
    77#endif 
  • trunk/Colloquy.xcode/project.pbxproj

    r2348 r2364  
    5757                        projectDirPath = ""; 
    5858                        projectReferences = ( 
     59                                { 
     60                                        ProductGroup = 1C04394707CAFC7D00304949; 
     61                                        ProjectRef = 1C04394607CAFC7D00304949; 
     62                                }, 
    5963                                { 
    6064                                        ProductGroup = 0A60C1600630D96D00DC6280; 
     
    239243//1C3 
    240244//1C4 
     245                1C04393E07CAFC5800304949 = { 
     246                        children = ( 
     247                                1C04394607CAFC7D00304949, 
     248                        ); 
     249                        isa = PBXGroup; 
     250                        name = "AppleScript Support"; 
     251                        path = ""; 
     252                        refType = 4; 
     253                        sourceTree = "<group>"; 
     254                }; 
     255                1C04394607CAFC7D00304949 = { 
     256                        isa = PBXFileReference; 
     257                        lastKnownFileType = "wrapper.pb-project"; 
     258                        name = "AppleScript Support.xcode"; 
     259                        path = "Plug-Ins/AppleScript Support/AppleScript Support.xcode"; 
     260                        refType = 4; 
     261                        sourceTree = "<group>"; 
     262                }; 
     263                1C04394707CAFC7D00304949 = { 
     264                        children = ( 
     265                                1C04394807CAFC7D00304949, 
     266                        ); 
     267                        isa = PBXGroup; 
     268                        name = Products; 
     269                        refType = 4; 
     270                        sourceTree = "<group>"; 
     271                }; 
     272                1C04394807CAFC7D00304949 = { 
     273                        fileType = wrapper.cfbundle; 
     274                        isa = PBXReferenceProxy; 
     275                        path = "AppleScript Support.plugin"; 
     276                        refType = 3; 
     277                        remoteRef = 1C04394D07CAFCAF00304949; 
     278                        sourceTree = BUILT_PRODUCTS_DIR; 
     279                }; 
     280                1C04394907CAFC9600304949 = { 
     281                        fileRef = 1C04394807CAFC7D00304949; 
     282                        isa = PBXBuildFile; 
     283                        settings = { 
     284                        }; 
     285                }; 
     286                1C04394A07CAFCA000304949 = { 
     287                        fileRef = 1C04394807CAFC7D00304949; 
     288                        isa = PBXBuildFile; 
     289                        settings = { 
     290                        }; 
     291                }; 
     292                1C04394B07CAFCA500304949 = { 
     293                        containerPortal = 1C04394607CAFC7D00304949; 
     294                        isa = PBXContainerItemProxy; 
     295                        proxyType = 1; 
     296                        remoteGlobalIDString = 8D5B49AC048680CD000E48DA; 
     297                        remoteInfo = "AppleScript Support Plugin"; 
     298                }; 
     299                1C04394C07CAFCA500304949 = { 
     300                        isa = PBXTargetDependency; 
     301                        name = "AppleScript Support Plugin (from AppleScript Support.xcode)"; 
     302                        targetProxy = 1C04394B07CAFCA500304949; 
     303                }; 
     304                1C04394D07CAFCAF00304949 = { 
     305                        containerPortal = 1C04394607CAFC7D00304949; 
     306                        isa = PBXContainerItemProxy; 
     307                        proxyType = 2; 
     308                        remoteGlobalIDString = 8D5B49B6048680CD000E48DA; 
     309                        remoteInfo = "AppleScript Support Plugin"; 
     310                }; 
    241311                1C06052306471FFB002438AF = { 
    242312                        fileEncoding = 4; 
     
    685755                        settings = { 
    686756                        }; 
    687                 }; 
    688                 1C1C569C059EAF4F002FBEFB = { 
    689                         fileEncoding = 4; 
    690                         isa = PBXFileReference; 
    691                         lastKnownFileType = sourcecode.c.h; 
    692                         path = MVChatScriptPlugin.h; 
    693                         refType = 4; 
    694                         sourceTree = "<group>"; 
    695757                }; 
    696758                1C1D19F105992D80000BB31A = { 
     
    21232185                                0A60C2B80630DA2C00DC6280, 
    21242186                                1C09DFF7052DFF6600D748CF, 
     2187                                1C04394C07CAFCA500304949, 
    21252188                                1CE3F9C307C7C2B30049A366, 
    21262189                        ); 
     
    22862349                                1C0A4C9C0799BDB00093B702, 
    22872350                                1C0A4C9D0799BDB00093B702, 
     2351                                1C04394A07CAFCA000304949, 
    22882352                        ); 
    22892353                        isa = PBXResourcesBuildPhase; 
     
    29833047                                1CD4C09A07824A010003620F, 
    29843048                                1C8CE1ED05A921AB0020D841, 
     3049                                1C04394907CAFC9600304949, 
    29853050                                1CE3F9BF07C7C2A70049A366, 
    29863051                                1C51B8F2052DFAAA00BB459B, 
     
    34113476                        children = ( 
    34123477                                1CC478480427BB5500000102, 
     3478                                1C04393E07CAFC5800304949, 
    34133479                                1CE3F7BC07C7B60A0049A366, 
    34143480                                1CA56CCD042A713E00000102, 
     
    51655231                                1C8CF8E1066530D60080A2F5, 
    51665232                                1C2EF7EB0427A40B00000102, 
    5167                                 1C1C569C059EAF4F002FBEFB, 
    51685233                                1C18CD100528DBBA000001C8, 
    51695234                                F5E98623018B412B01EE70DE, 
  • trunk/JVChatController.m

    r2360 r2364  
    22#import <ChatCore/MVChatRoom.h> 
    33#import <ChatCore/MVChatUser.h> 
    4 #import <ChatCore/MVChatScriptPlugin.h> 
    54#import <ChatCore/NSAttributedStringAdditions.h> 
    65 
     
    454453#pragma mark - 
    455454 
    456 @implementation MVChatScriptPlugin (MVChatScriptPluginCommandSupport) 
    457 - (BOOL) processUserCommand:(NSString *) command withArguments:(NSAttributedString *) arguments toConnection:(MVChatConnection *) connection inView:(id <JVChatViewController>) view { 
    458         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:command, @"----", [arguments string], @"pcC1", view, @"pcC2", nil]; 
    459         id result = [self callScriptHandler:'pcCX' withArguments:args forSelector:_cmd]; 
    460         return ( [result isKindOfClass:[NSNumber class]] ? [result boolValue] : NO ); 
    461 } 
    462 @end 
    463  
    464 #pragma mark - 
    465  
    466455@implementation JVChatWindowController (JVChatWindowControllerObjectSpecifier) 
    467456- (NSScriptObjectSpecifier *) objectSpecifier { 
  • trunk/JVChatRoomPanel.m

    r2354 r2364  
    33#import <ChatCore/MVChatUser.h> 
    44#import <ChatCore/MVChatPluginManager.h> 
    5 #import <ChatCore/MVChatScriptPlugin.h> 
    65#import <ChatCore/NSStringAdditions.h> 
    76#import <ChatCore/NSAttributedStringAdditions.h> 
     
    13031302} 
    13041303@end 
    1305  
    1306 #pragma mark - 
    1307  
    1308 @implementation MVChatScriptPlugin (MVChatScriptPluginRoomSupport) 
    1309 - (void) memberJoined:(JVChatRoomMember *) member inRoom:(JVChatRoomPanel *) room { 
    1310         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", room, @"mJr1", nil]; 
    1311         [self callScriptHandler:'mJrX' withArguments:args forSelector:_cmd]; 
    1312 } 
    1313  
    1314 - (void) memberParted:(JVChatRoomMember *) member fromRoom:(JVChatRoomPanel *) room forReason:(NSAttributedString *) reason { 
    1315         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", room, @"mPr1", [reason string], @"mPr2", nil]; 
    1316         [self callScriptHandler:'mPrX' withArguments:args forSelector:_cmd]; 
    1317 } 
    1318  
    1319 - (void) memberKicked:(JVChatRoomMember *) member fromRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) by forReason:(NSAttributedString *) reason { 
    1320         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", room, @"mKr1", by, @"mKr2", [reason string], @"mKr3", nil]; 
    1321         [self callScriptHandler:'mKrX' withArguments:args forSelector:_cmd]; 
    1322 } 
    1323  
    1324 - (void) memberPromoted:(JVChatRoomMember *) member inRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) by { 
    1325         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", [NSValue valueWithBytes:"cOpr" objCType:@encode( char * )], @"mSc1", by, @"mSc2", room, @"mSc3", nil]; 
    1326         [self callScriptHandler:'mScX' withArguments:args forSelector:_cmd]; 
    1327 } 
    1328  
    1329 - (void) memberDemoted:(JVChatRoomMember *) member inRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) by { 
    1330         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", [NSValue valueWithBytes:( [member voice] ? "VoIc" : "noRm" ) objCType:@encode( char * )], @"mSc1", by, @"mSc2", room, @"mSc3", nil]; 
    1331         [self callScriptHandler:'mScX' withArguments:args forSelector:_cmd]; 
    1332 } 
    1333  
    1334 - (void) memberVoiced:(JVChatRoomMember *) member inRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) by { 
    1335         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", [NSValue valueWithBytes:"VoIc" objCType:@encode( char * )], @"mSc1", by, @"mSc2", room, @"mSc3", nil]; 
    1336         [self callScriptHandler:'mScX' withArguments:args forSelector:_cmd]; 
    1337 } 
    1338  
    1339 - (void) memberDevoiced:(JVChatRoomMember *) member inRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) by { 
    1340         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:member, @"----", [NSValue valueWithBytes:( [member operator] ? "cOpr" : "noRm" ) objCType:@encode( char * )], @"mSc1", by, @"mSc2", room, @"mSc3", nil]; 
    1341         [self callScriptHandler:'mScX' withArguments:args forSelector:_cmd]; 
    1342 } 
    1343  
    1344 - (void) joinedRoom:(JVChatRoomPanel *) room; { 
    1345         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:room, @"----", nil]; 
    1346         [self callScriptHandler:'jRmX' withArguments:args forSelector:_cmd]; 
    1347 } 
    1348  
    1349 - (void) partingFromRoom:(JVChatRoomPanel *) room; { 
    1350         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:room, @"----", nil]; 
    1351         [self callScriptHandler:'pRmX' withArguments:args forSelector:_cmd]; 
    1352 } 
    1353  
    1354 - (void) kickedFromRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) by forReason:(NSAttributedString *) reason { 
    1355         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:room, @"----", by, @"kRm1", [reason string], @"kRm2", nil]; 
    1356         [self callScriptHandler:'kRmX' withArguments:args forSelector:_cmd]; 
    1357 } 
    1358  
    1359 - (void) topicChangedTo:(NSAttributedString *) topic inRoom:(JVChatRoomPanel *) room by:(JVChatRoomMember *) member { 
    1360         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:[topic string], @"rTc1", member, @"rTc2", room, @"rTc3", nil]; 
    1361         [self callScriptHandler:'rTcX' withArguments:args forSelector:_cmd]; 
    1362 } 
    1363 @end 
  • trunk/JVChatTranscriptPanel.m

    r2314 r2364  
    33#import <ChatCore/MVChatConnection.h> 
    44#import <ChatCore/MVChatPluginManager.h> 
    5 #import <ChatCore/MVChatScriptPlugin.h> 
    65#import <ChatCore/NSMethodSignatureAdditions.h> 
    76#import <ChatCore/NSStringAdditions.h> 
     
    803802} 
    804803@end 
    805  
    806 #pragma mark - 
    807  
    808 @implementation MVChatScriptPlugin (MVChatScriptPluginLinkClickSupport) 
    809 - (BOOL) handleClickedLink:(NSURL *) url inView:(id <JVChatViewController>) view { 
    810         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:[url absoluteString], @"----", view, @"hCl1", nil]; 
    811         id result = [self callScriptHandler:'hClX' withArguments:args forSelector:_cmd]; 
    812         return ( [result isKindOfClass:[NSNumber class]] ? [result boolValue] : NO ); 
    813 } 
    814 @end 
  • trunk/JVDirectChatPanel.m

    r2354 r2364  
    55#import <ChatCore/MVChatRoom.h> 
    66#import <ChatCore/MVChatPluginManager.h> 
    7 #import <ChatCore/MVChatScriptPlugin.h> 
    87#import <ChatCore/NSAttributedStringAdditions.h> 
    98#import <ChatCore/NSStringAdditions.h> 
     
    17931792} 
    17941793@end 
    1795  
    1796 #pragma mark - 
    1797  
    1798 @implementation MVChatScriptPlugin (MVChatScriptPluginChatSupport) 
    1799 - (void) processIncomingMessage:(JVMutableChatMessage *) message { 
    1800         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:message, @"----", [NSNumber numberWithBool:[message isAction]], @"piM1", [message sender], @"piM2", [message transcript], @"piM3", nil]; 
    1801         [self callScriptHandler:'piMX' withArguments:args forSelector:_cmd]; 
    1802 } 
    1803  
    1804 - (void) processOutgoingMessage:(JVMutableChatMessage *) message { 
    1805         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:message, @"----", [NSNumber numberWithBool:[message isAction]], @"poM1", [message transcript], @"poM2", nil]; 
    1806         [self callScriptHandler:'poMX' withArguments:args forSelector:_cmd]; 
    1807 } 
    1808  
    1809 /*- (void) userNamed:(NSString *) nickname isNowKnownAs:(NSString *) newNickname inView:(id <JVChatViewController>) view { 
    1810         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:nickname, @"----", newNickname, @"uNc1", view, @"uNc2", nil]; 
    1811         [self callScriptHandler:'uNcX' withArguments:args forSelector:_cmd]; 
    1812 }*/ 
    1813 @end 
  • trunk/JVNotificationController.m

    r2256 r2364  
    1 #import <ChatCore/MVChatScriptPlugin.h> 
     1#import <ChatCore/MVChatPluginManager.h> 
    22#import <ChatCore/NSMethodSignatureAdditions.h> 
    33#import <GrowlAppBridge/GrowlApplicationBridge.h> 
     
    181181} 
    182182@end 
    183  
    184 #pragma mark - 
    185  
    186 @implementation MVChatScriptPlugin (MVChatScriptPluginNotificationSupport) 
    187 - (void) performNotification:(NSString *) identifier withContextInfo:(NSDictionary *) context andPreferences:(NSDictionary *) preferences { 
    188         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:identifier, @"----", context, @"nOt1", preferences, @"nOt2", nil]; 
    189         [self callScriptHandler:'nOtX' withArguments:args forSelector:_cmd]; 
    190 } 
    191 @end 
  • trunk/MVApplicationController.m

    r2350 r2364  
    33#import <ChatCore/MVChatPluginManager.h> 
    44#import <ChatCore/NSMethodSignatureAdditions.h> 
    5 #import <ChatCore/MVChatScriptPlugin.h> 
    65#import <ChatCore/NSColorAdditions.h> 
    76#import "NSURLAdditions.h" 
     
    386385#pragma mark - 
    387386 
    388 @implementation MVChatScriptPlugin (MVChatPluginContextualMenuSupport) 
    389 - (IBAction) performContextualMenuItemAction:(id) sender { 
    390         id object = [sender representedObject]; 
    391         NSMutableArray *submenu = [NSMutableArray array]; 
    392  
    393         NSMenu *menu = [sender menu]; 
    394         NSMenu *parent = nil; 
    395         while( ( parent = [menu supermenu] ) ) { 
    396                 [submenu insertObject:[menu title] atIndex:0]; 
    397                 menu = parent; 
    398         } 
    399  
    400         NSString *title = [sender title]; 
    401         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:title, @"----", object, @"pcM1", submenu, @"pcM2", nil]; 
    402         [self callScriptHandler:'pcMX' withArguments:args forSelector:_cmd]; 
    403 } 
    404  
    405 - (void) buildMenuInto:(NSMutableArray *) itemList fromReturnContainer:(id) container withRepresentedObject:(id) object { 
    406         if( [container respondsToSelector:@selector( objectEnumerator )] ) { 
    407                 NSEnumerator *enumerator = [container objectEnumerator]; 
    408                 id item = nil; 
    409  
    410                 while( ( item = [enumerator nextObject] ) ) { 
    411                         if( [item isKindOfClass:[NSString class]] ) { 
    412                                 if( [item isEqualToString:@"-"] ) { 
    413                                         [itemList addObject:[NSMenuItem separatorItem]]; 
    414                                 } else { 
    415                                         NSMenuItem *mitem = [[[NSMenuItem alloc] initWithTitle:item action:@selector( performContextualMenuItemAction: ) keyEquivalent:@""] autorelease]; 
    416                                         [mitem setTarget:self]; 
    417                                         [mitem setRepresentedObject:object]; 
    418                                         [itemList addObject:mitem]; 
    419                                 } 
    420                         } else if( [item isKindOfClass:[NSDictionary class]] ) { 
    421                                 NSString *title = [item objectForKey:@"title"]; 
    422                                 NSArray *sub = [item objectForKey:@"submenu"]; 
    423                                 NSNumber *enabled = [item objectForKey:@"enabled"]; 
    424                                 NSNumber *checked = [item objectForKey:@"checked"]; 
    425                                 NSNumber *indent = [item objectForKey:@"indent"]; 
    426                                 NSNumber *alternate = [item objectForKey:@"alternate"]; 
    427                                 id iconPath = [item objectForKey:@"icon"]; 
    428                                 id iconSize = [item objectForKey:@"iconsize"]; 
    429                                 NSString *tooltip = [item objectForKey:@"tooltip"]; 
    430                                 id context = [item objectForKey:@"context"]; 
    431  
    432                                 if( ! [title isKindOfClass:[NSString class]] ) continue; 
    433                                 if( ! [tooltip isKindOfClass:[NSString class]] ) tooltip = nil; 
    434                                 if( ! [enabled isKindOfClass:[NSNumber class]] ) enabled = nil; 
    435                                 if( ! [checked isKindOfClass:[NSNumber class]] ) checked = nil; 
    436                                 if( ! [indent isKindOfClass:[NSNumber class]] ) indent = nil; 
    437                                 if( ! [alternate isKindOfClass:[NSNumber class]] ) alternate = nil; 
    438                                 if( ! [iconPath isKindOfClass:[NSString class]] && ! [iconPath isKindOfClass:[NSArray class]] ) iconPath = nil; 
    439                                 if( ! [iconSize isKindOfClass:[NSArray class]] && ! [iconSize isKindOfClass:[NSNumber class]] ) iconSize = nil; 
    440                                 if( ! [sub isKindOfClass:[NSArray class]] && ! [sub isKindOfClass:[NSDictionary class]] ) sub = nil; 
    441  
    442                                 NSMenuItem *mitem = [[[NSMenuItem alloc] initWithTitle:title action:@selector( performContextualMenuItemAction: ) keyEquivalent:@""] autorelease]; 
    443                                 if( context ) [mitem setRepresentedObject:context]; 
    444                                 else [mitem setRepresentedObject:object]; 
    445                                 if( ! enabled || ( enabled && [enabled boolValue] ) ) [mitem setTarget:self]; 
    446                                 if( enabled && ! [enabled boolValue] ) [mitem setEnabled:[enabled boolValue]]; 
    447                                 if( checked ) [mitem setState:[checked intValue]]; 
    448                                 if( indent ) [mitem setIndentationLevel:MIN( 15, [indent unsignedIntValue] )]; 
    449                                 if( tooltip ) [mitem setToolTip:tooltip]; 
    450  
    451                                 if( alternate && [alternate unsignedIntValue] == 1 ) { 
    452                                         [mitem setKeyEquivalentModifierMask:NSAlternateKeyMask]; 
    453                                         [mitem setAlternate:YES]; 
    454                                 } else if( alternate && [alternate unsignedIntValue] == 2 ) { 
    455                                         [mitem setKeyEquivalentModifierMask:( NSShiftKeyMask | NSAlternateKeyMask )]; 
    456                                         [mitem setAlternate:YES]; 
    457                                 } else if( alternate && [alternate unsignedIntValue] == 3 ) { 
    458                                         [mitem setKeyEquivalentModifierMask:( NSShiftKeyMask | NSAlternateKeyMask | NSControlKeyMask )]; 
    459                                         [mitem setAlternate:YES]; 
    460                                 } 
    461  
    462                                 if( [iconPath isKindOfClass:[NSString class]] && [(NSString *)iconPath length] ) { 
    463                                         NSURL *iconURL = nil; 
    464                                         if( [iconPath hasPrefix:@"#"] ) { 
    465                                                 NSSize size = NSZeroSize; 
    466                                                 if( [iconSize isKindOfClass:[NSArray class]] && [(NSArray *)iconSize count] == 2 ) { 
    467                                                         size = NSMakeSize( [[iconSize objectAtIndex:0] unsignedIntValue], [[iconSize objectAtIndex:1] unsignedIntValue] ); 
    468                                                 } else if( [iconSize isKindOfClass:[NSNumber class]] ) { 
    469                                                         size = NSMakeSize( [iconSize unsignedIntValue], [iconSize unsignedIntValue] ); 
    470                                                 } else size = NSMakeSize( 24., 12. ); 
    471  
    472                                                 NSColor *color = [NSColor colorWithHTMLAttributeValue:iconPath]; 
    473                                                 NSImage *icon = [[[NSImage alloc] initWithSize:size] autorelease]; 
    474  
    475                                                 [icon lockFocus]; 
    476                                                 [[color shadowWithLevel:0.1] set]; 
    477                                                 [NSBezierPath fillRect:NSMakeRect( 0., 0., size.width, size.height )]; 
    478                                                 [color drawSwatchInRect:NSMakeRect( 1., 1., size.width - 2., size.height - 2. )]; 
    479                                                 [icon unlockFocus]; 
    480  
    481                                                 [mitem setImage:icon]; 
    482                                         } else if( ( iconURL = [NSURL URLWithString:iconPath] ) ) { 
    483                                                 // NSImage *icon = [[[NSImage allocWithZone:[self zone]] initByReferencingURL:[NSURL URLWithString:iconPath]] autorelease]; 
    484                                                 // Lets download the icon with a 1-second timeout 
    485                                                 // Let's also ask for the cache if it exists rather than using protocol default 
    486                                                 NSURLRequest *iconRequest = [NSURLRequest requestWithURL:iconURL cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:1.0]; 
    487                                                 NSData *iconData = [NSURLConnection sendSynchronousRequest:iconRequest returningResponse:nil error:nil]; 
    488                                                 NSImage *icon = [[[NSImage alloc] initWithData:iconData] autorelease]; 
    489                                                 if( icon ) [mitem setImage:icon]; 
    490                                         } else { 
    491                                                 if( ! [iconPath isAbsolutePath] ) { 
    492                                                         NSString *dir = [[self scriptFilePath] stringByDeletingLastPathComponent]; 
    493                                                         iconPath = [dir stringByAppendingPathComponent:iconPath]; 
    494                                                 } 
    495  
    496                                                 NSImage *icon = [[[NSImage allocWithZone:[self zone]] initByReferencingFile:iconPath] autorelease]; 
    497                                                 if( icon ) [mitem setImage:icon]; 
    498                                         } 
    499  
    500                                         NSSize size = NSZeroSize; 
    501                                         if( [iconSize isKindOfClass:[NSArray class]] && [(NSArray *)iconSize count] == 2 ) { 
    502                                                 size = NSMakeSize( [[iconSize objectAtIndex:0] unsignedIntValue], [[iconSize objectAtIndex:1] unsignedIntValue] ); 
    503                                         } else if( [iconSize isKindOfClass:[NSNumber class]] ) { 
    504                                                 size = NSMakeSize( [iconSize unsignedIntValue], [iconSize unsignedIntValue] ); 
    505                                         } 
    506  
    507                                         if( [mitem image] && ! NSEqualSizes( size, NSZeroSize ) ) { 
    508                                                 [[mitem image] setScalesWhenResized:YES]; 
    509                                                 [[mitem image] setSize:size]; 
    510                                         } 
    511                                 } else if( [iconPath isKindOfClass:[NSArray class]] && [(NSArray *)iconPath count] == 3 ) { 
    512                                         NSSize size = NSZeroSize; 
    513                                         if( [iconSize isKindOfClass:[NSArray class]] && [(NSArray *)iconSize count] == 2 ) { 
    514                                                 size = NSMakeSize( [[iconSize objectAtIndex:0] unsignedIntValue], [[iconSize objectAtIndex:1] unsignedIntValue] ); 
    515                                         } else if( [iconSize isKindOfClass:[NSNumber class]] ) { 
    516                                                 size = NSMakeSize( [iconSize unsignedIntValue], [iconSize unsignedIntValue] ); 
    517                                         } else size = NSMakeSize( 24., 12. ); 
    518  
    519                                         NSColor *color = [NSColor colorWithCalibratedRed:( [[iconPath objectAtIndex:0] unsignedIntValue] / 65535. ) green:( [[iconPath objectAtIndex:1] unsignedIntValue] / 65535. ) blue:( [[iconPath objectAtIndex:2] unsignedIntValue] / 65535. ) alpha:1.]; 
    520                                         NSImage *icon = [[[NSImage alloc] initWithSize:size] autorelease]; 
    521  
    522                                         [icon lockFocus]; 
    523                                         [[color shadowWithLevel:0.1] set]; 
    524                                         [NSBezierPath fillRect:NSMakeRect( 0., 0., size.width, size.height )]; 
    525                                         [color drawSwatchInRect:NSMakeRect( 1., 1., size.width - 2., size.height - 2. )]; 
    526                                         [icon unlockFocus]; 
    527  
    528                                         [mitem setImage:icon]; 
    529                                 } 
    530  
    531                                 [itemList addObject:mitem]; 
    532  
    533                                 if( [sub respondsToSelector:@selector( objectEnumerator )] && [sub respondsToSelector:@selector( count )] && [sub count] ) { 
    534                                         NSMenu *submenu = [[[NSMenu allocWithZone:[self zone]] initWithTitle:title] autorelease]; 
    535                                         NSMutableArray *subArray = [NSMutableArray array]; 
    536  
    537                                         [self buildMenuInto:subArray fromReturnContainer:sub withRepresentedObject:object]; 
    538  
    539                                         id subItem = nil; 
    540                                         NSEnumerator *subenumerator = [subArray objectEnumerator]; 
    541                                         while( ( subItem = [subenumerator nextObject] ) ) 
    542                                                 [submenu addItem:subItem]; 
    543  
    544                                         [mitem setSubmenu:submenu]; 
    545                                 } 
    546                         } 
    547                 } 
    548         } 
    549 } 
    550  
    551 - (NSArray *) contextualMenuItemsForObject:(id) object inView:(id <JVChatViewController>) view { 
    552         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:object, @"----", view, @"cMi1", nil]; 
    553         id result = [self callScriptHandler:'cMiX' withArguments:args forSelector:_cmd]; 
    554         NSMutableArray *ret = [NSMutableArray array]; 
    555  
    556         if( ! result ) return nil; 
    557         if( ! [result isKindOfClass:[NSArray class]] ) 
    558                 result = [NSArray arrayWithObject:result]; 
    559  
    560         [self buildMenuInto:ret fromReturnContainer:result withRepresentedObject:object]; 
    561  
    562         if( [ret count] ) return ret; 
    563         return nil; 
    564 } 
    565 @end 
    566  
    567 #pragma mark - 
    568  
    569387@implementation NSApplication (NSApplicationScripting) 
    570388- (void) newConnection:(NSScriptCommand *) command { 
  • trunk/MVChatConnection.m

    r2327 r2364  
    66#import "MVFileTransfer.h" 
    77#import "MVChatPluginManager.h" 
    8 #import "MVChatScriptPlugin.h" 
    98#import "NSStringAdditions.h" 
    109#import "NSAttributedStringAdditions.h" 
     
    832831} 
    833832@end 
    834  
    835 #pragma mark - 
    836  
    837 @implementation MVChatScriptPlugin (MVChatScriptPluginConnectionSupport) 
    838 - (BOOL) processSubcodeRequest:(NSString *) command withArguments:(NSString *) arguments fromUser:(MVChatUser *) user { 
    839         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:command, @"----", ( arguments ? (id)arguments : (id)[NSNull null] ), @"psR1", user, @"psR2", [user connection], @"psR3", nil]; 
    840         id result = [self callScriptHandler:'psRX' withArguments:args forSelector:_cmd]; 
    841         return ( [result isKindOfClass:[NSNumber class]] ? [result boolValue] : NO ); 
    842 } 
    843  
    844 - (BOOL) processSubcodeReply:(NSString *) command withArguments:(NSString *) arguments fromUser:(MVChatUser *) user { 
    845         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:command, @"----", ( arguments ? (id)arguments : (id)[NSNull null] ), @"psL1", user, @"psL2", [user connection], @"psL3", nil]; 
    846         id result = [self callScriptHandler:'psLX' withArguments:args forSelector:_cmd]; 
    847         return ( [result isKindOfClass:[NSNumber class]] ? [result boolValue] : NO ); 
    848 } 
    849  
    850 - (void) connected:(MVChatConnection *) connection { 
    851         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:connection, @"----", nil]; 
    852         [self callScriptHandler:'cTsX' withArguments:args forSelector:_cmd]; 
    853 } 
    854  
    855 - (void) disconnecting:(MVChatConnection *) connection { 
    856         NSDictionary *args = [NSDictionary dictionaryWithObjectsAndKeys:connection, @"----", nil]; 
    857         [self callScriptHandler:'dFsX' withArguments:args forSelector:_cmd]; 
    858 } 
    859 @end 
  • trunk/MVChatPluginManager.m

    r2337 r2364  
    11#import "MVChatPluginManager.h" 
    2 #import "MVChatScriptPlugin.h" 
    32#import "NSNumberAdditions.h" 
    43#import "NSMethodSignatureAdditions.h" 
     
    7069                                        if( plugin ) [_plugins addObject:plugin]; 
    7170                                } 
    72                         } else if( [[file pathExtension] isEqualToString:@"scpt"] || [[file pathExtension] isEqualToString:@"scptd"] || [[file pathExtension] isEqualToString:@"applescript"] ) { 
    73                                 NSAppleScript *script = [[[NSAppleScript alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@", path, file]] error:NULL] autorelease]; 
    74                                 if( ! [script compileAndReturnError:nil] ) continue; 
    75                                 MVChatScriptPlugin *plugin = [[[MVChatScriptPlugin alloc] initWithScript:script atPath:[NSString stringWithFormat:@"%@/%@", path, file] withManager:self] autorelease]; 
    76                                 if( plugin ) [_plugins addObject:plugin]; 
    7771                        } 
    7872                } 
  • trunk/MVIRCChatConnection.m

    r2329 r2364  
    1111 
    1212#import "MVChatPluginManager.h" 
    13 #import "MVChatScriptPlugin.h" 
    14  
    1513#import "NSAttributedStringAdditions.h" 
    1614#import "NSColorAdditions.h" 
  • trunk/Plug-Ins/AppleScript Support/JVAppleScriptChatPlugin.h

    r2194 r2364  
    1 #import <ChatCore/MVChatPluginManager.h> 
     1#import "MVChatPluginManager.h" 
    22 
    3 @interface MVChatScriptPlugin : NSObject <MVChatPlugin> { 
     3@interface JVAppleScriptChatPlugin : NSObject <MVChatPlugin> { 
     4        MVChatPluginManager *_manager; 
    45        NSAppleScript *_script; 
    56        NSString *_path; 
     
    1011 
    1112- (NSAppleScript *) script; 
     13- (MVChatPluginManager *) pluginManager; 
    1214- (NSString *) scriptFilePath; 
    1315- (id) callScriptHandler:(unsigned long) handler withArguments:(NSDictionary *) arguments forSelector:(SEL) selector; 
  • trunk/Plug-Ins/AppleScript Support/JVAppleScriptChatPlugin.m

    r2194 r2364  
    11#import "MVChatPluginManager.h" 
    2 #import "MVChatScriptPlugin.h" 
     2#import "JVAppleScriptChatPlugin.h" 
     3#import "MVChatUser.h" 
     4#import "MVChatRoom.h" 
     5#import "JVChatWindowController.h" 
     6#import "JVChatMessage.h" 
     7#import "JVChatRoomPanel.h" 
     8#import "JVChatRoomMember.h" 
     9#import "NSColorAdditions.h" 
    310 
    411@interface NSScriptObjectSpecifier (NSScriptObjectSpecifierPrivate) // Private Foundation Methods 
     
    7784#pragma mark - 
    7885 
    79 @implementation MVChatScriptPlugin 
     86@implementation JVAppleScriptChatPlugin 
    8087- (id) initWithManager:(MVChatPluginManager *) manager { 
    8188        if( ( self = [self init] ) ) { 
     89                _manager = manager; 
    8290                _doseNotRespond = [[NSMutableSet set] retain]; 
    8391                _script = nil; 
     
    121129