#include <applicat.h>
#include <mask.h>
#include <mailbox.h>    
#include <urldefid.h>
#include "ba2100a.h"

class TestMessages : public TApplication
{
  virtual bool menu(MENU_TAG);                              
  virtual bool create(); 
public: 
  TestMessages() : TApplication() {}
  virtual ~TestMessages() {}
};
 
                         
bool TestMessages::create()
{ 
	TApplication::create();
	dispatch_e_menu(BAR_ITEM(1)); 
	return TRUE; 
}
                         
                         
                         
bool TestMessages::menu(MENU_TAG)
{
	TMask m("ba2100a");  
	TMailbox mb;
	
	while (m.run() != K_ESC)
	{
		TString from(12);
		TString to(12);
		TString body(60);
		TString subj(12); 
		
		from = m.get(FLD_FROM);
		to   = m.get(FLD_TO);
		body = m.get(FLD_BODY);
		subj = m.get(FLD_SUBJ);
		
		TMessage msg(to, subj, body, from);           
		mb.send(msg);
	}                  
	return FALSE;
} 
 
int test_messages(int argc, char** argv)
{
  TestMessages app;
  app.run(argc, argv, "Prova invio messaggi");
  return 0;
}

