//** Craig Laurent
#import "Communication.h"
#import "MessageProtocol.h"
#import "Converse.h"
#import "User.h"
//** SERVERNAME used in Communication and Converse
#define SERVERNAME "ConverseCommunicationServer"

@implementation Communication

//** Communications SERVER!! *****


//****************************************
- init
{
	return [self initWithCtlr:nil];
}

//** designated initializer
- initWithCtlr:ctlr
{
	if (self = [super init]) {
		[self setController:ctlr];
		return self;
	}
	return nil;
}

- (void)dealloc
{
	[super dealloc];
}


//****************************************
//** instance methods
- (Converse*)controller
{	return controller; }
- (void)setController:(Converse*)ctlr
{
	controller = ctlr;
}


//****************************************
//** methods
/* postMessage: - post message to another machine, indicating who sent it. */
- (oneway void)postMessage:(bycopy in const char *)msg fromAuthor:(bycopy in User*)author
{
	[[self controller] logMessage:[NSString stringWithCString:msg] fromAuthor:author alert:YES];
}

/* author - pass the user information to a requesting machine. */
- (bycopy User*)author
{
	return [[self controller] userInfo];
}


//** create list of machines running this application on the network
- createNetworkNameList:nameList forMachine:(const char *)originator
{
//** future enhancement
	return self;
}


@end
