
#pragma once

#include "filedesc.h"
#include "vt.h"
#include "readwrite.h"

#include "CursesW.h"

#include <sys/types.h>


class User : public ReadWriteableThing
{
  FileDescState     readFD;

  VT100_Hardcopy         TermHd;
  VT100_Hardcopy_Barton  TermHdbart;
  VT100_barton           TermVTbart;
  VT100emulator         *pTerm;

  bool              dont_process_output = 0;
  bool              recievingVT100;
  bool              recievingBarton;
  bool              workingMessageShown = 0;
  bool              receivedSomething = 0;
 public:
  CursesWindow      userWindow;
  bool              lessThan25;

  bool              VTBartonHack_enabled =1;
  bool              isVT100;

  ostream&          os;

  User (char* term, char* hostname);

  void   Person_is_VT100     (bool p);
  void   Library_is_VT100    (bool p);
  void   VTBartonHack_Enable (bool p);

  void   Now_using_BARTON   (bool p);

  fd_set readfds ();
  int    read    (char* buf, int nchars);
  int    write   (String& s) { return write(s,s.length()); };
  int    write   (char* buf, int nchars);
  int    write   (char* buf) { return write(buf,strlen(buf)); };
  void   flush   ();
  void   write_ClearScreen  ();
  void   working_message  ();
  void   redraw ();
};

