/* $Id: autoreply.h,v 1.4 1999/10/22 20:50:46 v2kea318 Exp $

$Log: autoreply.h,v $
 * Revision 1.4  1999/10/22  20:50:46  v2kea318
 * Use the OO Thread interface for thread things.
 *
 * Revision 1.3  1999/10/14  16:41:47  v2kea318
 * Use the pseudo machine independant thread.h header to define all
 * thread related things.
 *
 * Revision 1.2  1999/10/06  14:27:21  v2kea318
 * Added the cleanup method.
 *
 * Revision 1.1  1999/10/05  15:14:39  v2kea318
 * Initial revision
 *
***************************************************************************

A class to manage the data for the auto-reply mechanism.

***************************************************************************/

#ifndef MSG_AUTOREPLY_H
#define MSG_AUTOREPLY_H

#include "Thread.h"
#include <string>
#include "MutexRep.h"

class AutoReply {
  // We don't want copy or assignment.
  AutoReply& operator = (const AutoReply&);
  AutoReply(const AutoReply&);
public:
  // constructors.
  AutoReply();

  // destructor.
  ~AutoReply();

  // Do we need an autoreply?
  operator bool () const;

  // get the message.
  string message() const;

  /* Static method to start a thread to monitor for autoreply commands
     from the user. */
  static void start_autoreply_monitor_thread();

  // kill the monitor thread.
  static void kill_monitor_thread();

  // cleanup.
  static void cleanup();
private:
  static bool reply;
  static string reply_string;
  static MutexRep mutex;
  static Pointer<Thread> monitor_thread_obj;
  static string fifo_name;

  // the actual monitoring thread.
  static void* autoreply_monitor_thread(void*);
};

#endif
