home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------------------------------
- //
- // RemoteComposeController
- //
- // Inherits From: Object
- //
- // Declared In: RemoteComposeController.h
- //
- // Disclaimer
- //
- // You may freely copy, distribute and reuse this software and its
- // associated documentation. I disclaim any warranty of any kind,
- // expressed or implied, as to its fitness for any particular use.
- //
- //----------------------------------------------------------------------------------------------------
- #import "RemoteComposeController.h"
- #import "MailSpeaker.h"
-
-
- @implementation RemoteComposeController
-
- - suggestion: sender
- {
- // Create an instance of MailSpeaker. Get named port 'Mail' (this will launch
- // Mail.app if not already). Get named port 'MailSendDemo' (this is the one we
- // will actually talk to, so set our speaker's port to be this one). Could this be done
- // with Remote Objects? Only if NeXT's Mail.app publicly 'vends' some object in
- // Mail.app that we may connect to.
-
- id speaker = [[MailSpeaker alloc] init];
- port_t mailPort = NXPortFromName ("Mail", NULL);
- int window;
-
- mailPort = NXPortFromName ("MailSendDemo", NULL);
-
- if (mailPort == PORT_NULL)
- {
- (NXRunAlertPanel ("Accessing Mail", "Unable to connect to Mail.app",
- NULL, NULL, NULL));
- return self;
- }
-
- [speaker setSendPort: mailPort];
-
- // Example using compose methods with window not specified.
- [speaker openSend];
- [speaker setTo: (STR) NXUserName()];
- [speaker setSubject: "Comments and Suggestions"];
- [speaker setBody: "Your comments and suggestions here..."];
-
- // Example using compose methods with window specified.
- [speaker openSend: &window];
- [speaker setTo: (STR) NXUserName() inWindow: window];
- [speaker setSubject: "More Comments and Suggestions" inWindow: window];
- [speaker setBody: "More comments and suggestions here..." inWindow: window];
-
- [speaker free];
-
- return self;
- }
-
-
- @end
-