//----------------------------------------------------------------------------------------------------
//
//	MailSpeaker
//
//	Inherits From:		Speaker
//
//	Declared In:		MailSpeaker.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 <appkit/appkit.h>
#import "MailSpeaker.h"
#import <mach/mach.h>
#import <mach/message.h>
#import <servers/netname.h>

extern port_t name_server_port;
extern id NXResponsibleDelegate();


@implementation  MailSpeaker

//----------------------------------------------------------------------------------------------------
//  Compose Methods (window not specified)
//----------------------------------------------------------------------------------------------------
- (int) deliver
{
	//  Deliver the compose window opened by 'openSend'.
	return [self selectorRPC:"deliver" paramTypes:""];
}

- (int) openSend
{
	//  Open a compose window in Mail.app.
	return [self selectorRPC:"openSend" paramTypes:""];
}

- (int) setBody : (const char *) aString
{
	//  Set the letter 'body' for the compose window opened by 'openSend' to aString.
	return [self selectorRPC:"setBody:" paramTypes:"c", aString];
}

- (int) setCc : (const char *) aString
{
	//  Set the 'Cc:' field for the compose window opened by 'openSend' to aString.
	return [self selectorRPC:"setCc:" paramTypes:"c", aString];
}

- (int) setSubject : (const char *) aString
{
	//  Set the 'Subject:' field for the compose window opened by 'openSend' to aString.
	return [self selectorRPC:"setSubject:" paramTypes:"c", aString];
}

- (int) setTo : (const char *) aString
{
	//  Set the 'To:' field for the compose window opened by 'openSend' to aString.
	return [self selectorRPC:"setTo:" paramTypes:"c", aString];
}


//----------------------------------------------------------------------------------------------------
//  Compose Methods (window specified) 
//----------------------------------------------------------------------------------------------------
- (int) deliver : (int) aWindow
{
	//  Deliver the window specified by aWindow (returned in openSend: ).
	return [self selectorRPC:"deliver:" paramTypes:"i", aWindow];
}

- (int) openSend : (int *) aWindow
{
	//  Open a compose window in Mail.app and returns the window number
	//  by reference in aWindow.  This is the unique identifier for this window
	//  and is used as the argument in methods that take a window parameter.
	return [self selectorRPC:"openSend:" paramTypes:"I", aWindow];
}

- (int) setBody : (const char *) aString inWindow : (int) aWindow
{
	//  Set the letter body to aString for compose window aWindow.
	return [self selectorRPC:"setBody:inWindow:" paramTypes:"ci", aString, aWindow];
}

- (int) setCc : (const char *) aString inWindow : (int) aWindow
{
	//  Set the 'Cc:' field to aString for compose window aWindow.
	return [self selectorRPC:"setCc:inWindow:" paramTypes:"ci", aString, aWindow];
}

- (int) setSubject : (const char *) aString inWindow : (int) aWindow
{
	//  Set the 'Subject:' field to aString for compose window aWindow.
	return [self selectorRPC:"setSubject:inWindow:" paramTypes:"ci", aString, aWindow];
}

- (int) setTo : (const char *) aString inWindow : (int) aWindow
{
	//  Set the 'To:' field to aString for compose window aWindow.
	return [self selectorRPC:"setTo:inWindow:" paramTypes:"ci", aString, aWindow];
}

@end
