Skip to content
Browse files

Causing trouble with Mail.app

  • Loading branch information...
1 parent 2b9bfa9 commit 267043dc0782910771fcf063febaebb084b6bdfb @ccgus committed Dec 8, 2010
Showing with 57 additions and 14 deletions.
  1. +7 −0 plugins/FMailApp/FMailApp.xcodeproj/project.pbxproj
  2. +50 −14 plugins/FMailApp/FMailBundle.m
View
7 plugins/FMailApp/FMailApp.xcodeproj/project.pbxproj
@@ -163,7 +163,14 @@
isa = PBXProject;
buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "FMailApp" */;
compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
mainGroup = 089C166AFE841209C02AAC07 /* FMailApp */;
projectDirPath = "";
projectRoot = "";
View
64 plugins/FMailApp/FMailBundle.m
@@ -30,7 +30,7 @@ void TSPrintMethodNamesFromClass(Class c) {
//NSString *methodName = NSStringFromSelector(method_getName(method));
- printf("%s: %s\n", [NSStringFromClass(c) UTF8String], method_getName(method));
+ printf("%s: %s\n", [NSStringFromClass(c) UTF8String], (char*)method_getName(method));
}
@@ -221,16 +221,6 @@ void TSPrintMethodNamesFromClass(Class c) {
-
-
-
-
-
-
-
-
-
-
@implementation FMailBundle
+ (void)load {
@@ -285,14 +275,16 @@ + (void)install:(id)sender {
[item setKeyEquivalentModifierMask:shortcutMask];
[item setRepresentedObject:[scriptDir stringByAppendingPathComponent:path]];
}
+
+ [JSTalk listen];
}
@end
@interface NSObject (MessageWebHTMLViewStuff)
-- (void) selectAll;
-- (void) insertText:(NSString*)shudup;
+- (void)selectAll;
+- (void)insertText:(NSString*)shudup;
@end
@@ -312,7 +304,7 @@ - (void) hackattack:(id)Sender {
}
*/
-- (void) runJSTalkScriptFromSender:(id)sender {
+- (void)runJSTalkScriptFromSender:(id)sender {
if (![sender respondsToSelector:@selector(representedObject)]) {
@@ -341,6 +333,50 @@ - (void) runJSTalkScriptFromSender:(id)sender {
}
}
+- (void)dumpMethods {
+ TSPrintMethodNamesFromClass([self class]);
+}
+
+- (Class)jstClass {
+ return [self class];
+}
+
++ (Class)jstClass {
+ return [self class];
+}
+
+@end
+
+
+@implementation NSApplication (JSTalkAdditions)
+
+- (void)doJavaScript:(NSString*)script {
+
+ JSTalk *jst = [[[JSTalk alloc] init] autorelease];
+
+ NSString *junk;
+ if ([script hasPrefix:@"/"] && (junk = [NSString stringWithContentsOfURL:[NSURL fileURLWithPath:script] encoding:NSUTF8StringEncoding error:nil])) {
+
+ NSURL *pathURL = [NSURL fileURLWithPath:script];
+ NSURL *pathDirURL = [NSURL fileURLWithPath:[script stringByDeletingLastPathComponent]];
+
+ [[jst env] setObject:pathURL forKey:@"scriptURL"];
+ [[jst env] setObject:pathDirURL forKey:@"scriptDirectoryURL"];
+
+ script = junk;
+ }
+
+ [jst executeString:script];
+}
+
+- (void)doJavaScriptAsync:(NSString*)script {
+ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [self doJavaScript:script];
+ });
+ });
+}
+
@end

0 comments on commit 267043d

Please sign in to comment.
Something went wrong with that request. Please try again.