/***************************************************************************
 *                                                                         *
 *  MSGAH.CPP                                                              *
 *                                                                         *
 *  Active HTML Email-Forums Common DLL                                    *
 *                                                                         *
 *  Copyright 1998, Galacticomm, Inc., All Rights Reserved                 *
 *                                                                         *
 *                                                     6/8/98 N C Osterc   *
 *                                                            P Henning    *
 *                                                                         *
 ***************************************************************************/
#include "gcomm.h"
#include "majorbbs.h"
#include "gmetvbah.h"
#include "galmsgah.h"
#include "msgah.h"

HMCVFILE gmeAHmbk=NULL;            // message block pointer (GALMSGAH.MCV)
HMCVFILE efmbAH=NULL;              // message block pointer (GALME.MCV)
CHAR * anchorTag;                  // point 2 anchor tag message option
CHAR * hEmlKey;                    // pointer 2 pure HTML email key
CHAR * hForKey;                    // pointer to pure HTML forum key
GBOOL eUseHtml;                    // enable Active HTML Email? from .MSG
GBOOL fUseHtml;                    // enable Active HTML Forums? from .MSG
GBOOL eUseJava;                    // use Java Email? from .MSG
GBOOL fUseJava;                    // use Java Forums? from .MSG

CHAR *fTarget1;                    // Forums frame target message option 1
CHAR *fTarget2;                    // "                                " 2
CHAR *fTarget3;                    // "                                " 3
CHAR *fTarget4;                    // "                                " 4
CHAR *fTarget5;                    // "                                " 5
CHAR *fTarget6;                    // "                                " 6
CHAR *fTarget7;                    // "                                " 7
CHAR *fTarget8;                    // "                                " 8
CHAR *fTarget9;                    // "                                " 9

CHAR *eTarget1;                    // Email frame target message option 1
CHAR *eTarget2;                    // "                               " 2
CHAR *eTarget3;                    // "                               " 3
CHAR *eTarget4;                    // "                               " 4
CHAR *eTarget5;                    // "                               " 5
CHAR *eTarget6;                    // "                               " 6
CHAR *eTarget7;                    // "                               " 7
CHAR *eTarget8;                    // "                               " 8
CHAR *eTarget9;                    // "                               " 9

CHAR *noMsg1;                      // No Message from .MSG file option 1
CHAR *noMsg2;                      // "                              " 2
CHAR *noMsg3;                      // "                              " 3
CHAR *noMsg4;                      // "                              " 4
CHAR *noMsg5;                      // "                              " 5
CHAR *noMsg6;                      // "                              " 6
CHAR *noMsg7;                      // "                              " 7
CHAR *noMsg8;                      // "                              " 8
CHAR *noMsg9;                      // "                              " 9

CHAR *dispEml;                     // msg option display email header
CHAR *imgAtty;                     // msg option attachment image
CHAR *attFmt;                      // msg option attachment format
CHAR *imgAttn;                     // msg option no attachment image
CHAR *imgPrin;                     // msg option no priority image
CHAR *priDsp;                      // msg option priority text
CHAR *imgPriy;                     // msg option priority image
CHAR *imgXmtn;                     // msg option no exempt image
CHAR *xmtDsp;                      // msg option exempt display text
CHAR *rrrDsp;                      // msg option return receipt text
CHAR *imgXmty;                     // msg option image exempt
CHAR *imgrrrn;                     // msg option image no return receipt
CHAR *imgrrry;                     // msg option image return receipt

MARKSOURCE(msgah);

class galmsgah {
public:

     galmsgah();                   // constructor

     ~galmsgah();                  // destructor

     VOID
     initCGIEncodedTvbs();         // init variables that need encoding
};

galmsgah::galmsgah()               // constructor
{
          char *mPtr;
          gmeAHmbk=opnmsg("GALMSGAH.MCV");
          efmbAH=opnmsg("GALMSG.MCV");
          initCGIEncodedTvbs();
          setmbk(gmeAHmbk);
          mPtr=stpans(getmsg(ANCHOR));
          anchorTag=new CHAR[strlen(mPtr)+1];
          stlcpy(anchorTag,mPtr,strlen(mPtr)+1);
          eUseHtml=ynopt(EUSEHTML);
          fUseHtml=ynopt(FUSEHTML);
          eUseJava=ynopt(EUSEJAVA);
          fUseJava=ynopt(FUSEJAVA);
          mPtr=getmsg(HEMLKEY);
          hEmlKey=new CHAR[strlen(mPtr)+1];
          stlcpy(hEmlKey,mPtr,strlen(mPtr)+1);
          mPtr=getmsg(HFORKEY);
          hForKey=new CHAR[strlen(mPtr)+1];
          stlcpy(hForKey,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET1));
          fTarget1=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget1,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET2));
          fTarget2=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget2,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET3));
          fTarget3=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget3,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET4));
          fTarget4=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget4,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET5));
          fTarget5=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget5,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET6));
          fTarget6=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget6,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET7));
          fTarget7=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget7,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET8));
          fTarget8=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget8,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(FTARGET9));
          fTarget9=new CHAR[strlen(mPtr)+1];
          stlcpy(fTarget9,mPtr,strlen(mPtr)+1);

          mPtr=stpans(getmsg(ETARGET1));
          eTarget1=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget1,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET2));
          eTarget2=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget2,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET3));
          eTarget3=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget3,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET4));
          eTarget4=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget4,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET5));
          eTarget5=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget5,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET6));
          eTarget6=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget6,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET7));
          eTarget7=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget7,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET8));
          eTarget8=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget8,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ETARGET9));
          eTarget9=new CHAR[strlen(mPtr)+1];
          stlcpy(eTarget9,mPtr,strlen(mPtr)+1);

          mPtr=stpans(getmsg(NOMSG1));
          noMsg1=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg1,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG2));
          noMsg2=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg2,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG3));
          noMsg3=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg3,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG4));
          noMsg4=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg4,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG5));
          noMsg5=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg5,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG6));
          noMsg6=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg6,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG7));
          noMsg7=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg7,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG8));
          noMsg8=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg8,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(NOMSG9));
          noMsg9=new CHAR[strlen(mPtr)+1];
          stlcpy(noMsg9,mPtr,strlen(mPtr)+1);

          mPtr=stpans(getmsg(DISPEML));
          dispEml=new CHAR[strlen(mPtr)+1];
          stlcpy(dispEml,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGATTY));
          imgAtty=new CHAR[strlen(mPtr)+1];
          stlcpy(imgAtty,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(ATTFMT));
          attFmt=new CHAR[strlen(mPtr)+1];
          stlcpy(attFmt,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGATTN));
          imgAttn=new CHAR[strlen(mPtr)+1];
          stlcpy(imgAttn,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGPRIN));
          imgPrin=new CHAR[strlen(mPtr)+1];
          stlcpy(imgPrin,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(PRIDSP));
          priDsp=new CHAR[strlen(mPtr)+1];
          stlcpy(priDsp,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGPRIY));
          imgPriy=new CHAR[strlen(mPtr)+1];
          stlcpy(imgPriy,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGXMTN));
          imgXmtn=new CHAR[strlen(mPtr)+1];
          stlcpy(imgXmtn,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(XMTDSP));
          xmtDsp=new CHAR[strlen(mPtr)+1];
          stlcpy(xmtDsp,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(RRRDSP));
          rrrDsp=new CHAR[strlen(mPtr)+1];
          stlcpy(rrrDsp,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGXMTY));
          imgXmty=new CHAR[strlen(mPtr)+1];
          stlcpy(imgXmty,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGRRRN));
          imgrrrn=new CHAR[strlen(mPtr)+1];
          stlcpy(imgrrrn,mPtr,strlen(mPtr)+1);
          mPtr=stpans(getmsg(IMGRRRY));
          imgrrry=new CHAR[strlen(mPtr)+1];
          stlcpy(imgrrry,mPtr,strlen(mPtr)+1);
}

galmsgah::~galmsgah()              // destructor
{
     delete [] anchorTag;
     delete [] hEmlKey;
     delete [] hForKey;
     delete [] fTarget1;
     delete [] fTarget2;
     delete [] fTarget3;
     delete [] fTarget4;
     delete [] fTarget5;
     delete [] fTarget6;
     delete [] fTarget7;
     delete [] fTarget8;
     delete [] fTarget9;
     delete [] eTarget1;
     delete [] eTarget2;
     delete [] eTarget3;
     delete [] eTarget4;
     delete [] eTarget5;
     delete [] eTarget6;
     delete [] eTarget7;
     delete [] eTarget8;
     delete [] eTarget9;
     delete [] noMsg1;
     delete [] noMsg2;
     delete [] noMsg3;
     delete [] noMsg4;
     delete [] noMsg5;
     delete [] noMsg6;
     delete [] noMsg7;
     delete [] noMsg8;
     delete [] noMsg9;
     delete [] dispEml;
     delete [] imgAtty;
     delete [] attFmt;
     delete [] imgAttn;
     delete [] imgPrin;
     delete [] priDsp;
     delete [] imgPriy;
     delete [] imgXmtn;
     delete [] xmtDsp;
     delete [] rrrDsp;
     delete [] imgXmty;
     delete [] imgrrrn;
     delete [] imgrrry;
}

VOID
galmsgah::initCGIEncodedTvbs()     // set up tvbs that need cgi encode
{
     mForNameUrl.setCgiEncode(TRUE);
     mToUrl.setCgiEncode(TRUE);
     mFromUrl.setCgiEncode(TRUE);
}

galmsgah theMsgAHDLL;              // one-and-only instance of this class

