#include <stdlib.h>
#include <stdio.h>
#include <exec/exec.h>
#include <exec/types.h>
#include <clib/exec_protos.h>
#include <exec/memory.h>
#include <doorheader.h>
#include "MultiChat.h"

char GetInput(void)
{
	struct StatusStruct
	{
		UWORD	Status;
		char		Text[1];
		char		Sender[30];
	};
	struct StatusStruct *Status;

	char		Input;
	char		MyChar[1];
	char		NodeNr_char[200];

	UWORD	NodeNr;

	BOOL		DidIGetIt = FALSE;


	getuserstring(NodeNr_char, BB_NODEID);
	NodeNr = atoi(NodeNr_char);

	Status = AllocMem(sizeof(struct StatusStruct), MEMF_FAST | MEMF_CLEAR);

	while(DidIGetIt != TRUE)
	{
		CheckMsg(Status);
		if (Status->Status == CHATMSG)
		{
			sendmessage(Status->Text, 0);
		}
		DidIGetIt = getkey();

		// Do a pause here?
		// Delay(30L);
	}

	hotkey("", MyChar);
	Input = MyChar[0];
	sendmessage(MyChar, 0);
		
	FreeMem(Status, sizeof(struct StatusStruct));

	return(Input);
}
