1.1 --- a/Plugins/Displays/MailMe/GrowlMailMeDisplay.m Tue Jul 07 11:42:50 2009 -0400
1.2 +++ b/Plugins/Displays/MailMe/GrowlMailMeDisplay.m Sat Aug 01 20:43:39 2009 -0400
1.3 @@ -40,38 +40,42 @@
1.4 READ_GROWL_PREF_VALUE(destAddressKey, @"com.Growl.MailMe", NSString *, &destAddress);
1.5 NSDictionary *noteDict = [notification dictionaryRepresentation];
1.6
1.7 - if (destAddress && [destAddress length]) {
1.8 - NSString *title = [noteDict objectForKey:GROWL_NOTIFICATION_TITLE];
1.9 - NSString *desc = [noteDict objectForKey:GROWL_NOTIFICATION_DESCRIPTION];
1.10 - //hopefully something can be worked out to use the imageData.
1.11 - //documentation, Apple, documentation!
1.12 - // NSData *imageData = [noteDict objectForKey:GROWL_NOTIFICATION_ICON];
1.13 -
1.14 + if (destAddress) {
1.15 + CFMakeCollectable(destAddress);
1.16 + if([destAddress length]) {
1.17 + NSString *title = [noteDict objectForKey:GROWL_NOTIFICATION_TITLE];
1.18 + NSString *desc = [noteDict objectForKey:GROWL_NOTIFICATION_DESCRIPTION];
1.19 + //hopefully something can be worked out to use the imageData.
1.20 + //documentation, Apple, documentation!
1.21 + // NSData *imageData = [noteDict objectForKey:GROWL_NOTIFICATION_ICON];
1.22 +
1.23 #ifdef __LP64__
1.24 - // On 64-bit, the Message framework is not available. Instead, use the Scripting Bridge.
1.25 - MailApplication *Mail = [SBApplication applicationWithBundleIdentifier:@"com.apple.Mail"];
1.26 - MailOutgoingMessage *message = [[[[Mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:title, @"subject", [NSString stringWithFormat:plainTextMessageFormat, desc], @"content", nil]] autorelease];
1.27 - MailToRecipient *recipient = [[[[Mail classForScriptingClass:@"to recipient"] alloc] initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:destAddress, @"address", nil]] autorelease];
1.28 - BOOL success;
1.29 -
1.30 - [[Mail outgoingMessages] addObject:message];
1.31 - [message.toRecipients addObject:recipient]; // don't ask me, I'm only following the sample code's example
1.32 - success = [message send];
1.33 + // On 64-bit, the Message framework is not available. Instead, use the Scripting Bridge.
1.34 + MailApplication *Mail = [SBApplication applicationWithBundleIdentifier:@"com.apple.Mail"];
1.35 + MailOutgoingMessage *message = [[[[Mail classForScriptingClass:@"outgoing message"] alloc] initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:title, @"subject", [NSString stringWithFormat:plainTextMessageFormat, desc], @"content", nil]] autorelease];
1.36 + MailToRecipient *recipient = [[[[Mail classForScriptingClass:@"to recipient"] alloc] initWithProperties:[NSDictionary dictionaryWithObjectsAndKeys:destAddress, @"address", nil]] autorelease];
1.37 + BOOL success;
1.38 +
1.39 + [[Mail outgoingMessages] addObject:message];
1.40 + [message.toRecipients addObject:recipient]; // don't ask me, I'm only following the sample code's example
1.41 + success = [message send];
1.42 #else
1.43 - BOOL success = [NSMailDelivery deliverMessage:[NSString stringWithFormat:plainTextMessageFormat, desc]
1.44 - subject:title
1.45 - to:destAddress];
1.46 + BOOL success = [NSMailDelivery deliverMessage:[NSString stringWithFormat:plainTextMessageFormat, desc]
1.47 + subject:title
1.48 + to:destAddress];
1.49 #endif
1.50 -
1.51 - if (!success) {
1.52 - NSLog(@"(MailMe) WARNING: Could not send email message \"%@\" to address %@", title, destAddress);
1.53 - NSLog(@"(MailMe) description of notification:\n%@", desc);
1.54 - } else
1.55 - NSLog(@"(MailMe) Successfully sent message \"%@\" to address %@", title, destAddress);
1.56 +
1.57 + if (!success) {
1.58 + NSLog(@"(MailMe) WARNING: Could not send email message \"%@\" to address %@", title, destAddress);
1.59 + NSLog(@"(MailMe) description of notification:\n%@", desc);
1.60 + } else
1.61 + NSLog(@"(MailMe) Successfully sent message \"%@\" to address %@", title, destAddress);
1.62 + } else {
1.63 + NSLog(@"(MailMe) WARNING: No destination address set");
1.64 + }
1.65 } else {
1.66 NSLog(@"(MailMe) WARNING: No destination address set");
1.67 }
1.68 -
1.69 [destAddress release];
1.70
1.71 id clickContext = [noteDict objectForKey:GROWL_NOTIFICATION_CLICK_CONTEXT];