home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1992 September / Simtel20_Sept92.cdr / msdos / telix / qmailtlx.arc / QMAIL.SLT next >
Text File  |  1988-08-06  |  7KB  |  146 lines

  1. //This script, called from the Telix directory entry for Cheers! or RFM,
  2. //will use the Qwikmail door to download a .QWK packet and then to
  3. //upload a .REP packet.  It then will return control to the user,
  4. //who may check for new files, etc., before logging off manually.
  5. //It will answer the prompts and questions in any order that they
  6. //are received.
  7.  
  8.  
  9. str buf [16],                     //used by the filefind function;
  10.     name [] = "maurice crouse";   //put your name here;
  11. int stat,                         //what state is the script in?;
  12.     upload,                       //does .REP file exist?;
  13.     t1,                           //t1-t9 track expected strings;
  14.     t2,
  15.     t3,
  16.     t4,
  17.     t5,
  18.     t6,
  19.     t7,
  20.     t8,
  21.     t9; 
  22. int moreyet = 1;                  //flag to indicate if we're all done;
  23. int cheers = 0;                   //maybe we'll connect with Cheers!;
  24. int rfm = 0;                      //or maybe we'll connect with RFM;
  25. main ()
  26.   {
  27.    clear_scr ();                             //start with clean screen
  28.    set_terminal ("ANSI-BBS");                //use ANSI-BBS emulation
  29.    _down_dir = "c:\qmail\";                  //set directories to QMAIL
  30.    _up_dir = "c:\qmail\";                    //while script runs;
  31.    t1 = track ("graphics (Enter)=no?",1);    //track the prompts that
  32.    t2 = track ("first name?",1);             //are expected from the
  33.    t3 = track ("Password",1);                //Main Board level;
  34.    t4 = track ("'Last Read' (Enter)=yes?",1);
  35.    t5 = track ("to continue?",1);
  36.    t6 = track ("Command?",1);
  37.    t7 = track ("Cheers!",1);
  38.    t8 = track ("Radio Free Memphis",1);
  39.    stat = 0;                   //make sure NO string is being tracked;
  40.    while (1)                   //loop until ready to enter Qwikmail door;
  41.     {
  42.      terminal ();              //process all characters received;
  43.      stat = track_hit (0);     //see which track (if any) was hit;
  44.      if (stat == t1)           //question about graphics;
  45.        cputs ("y q ns^M");     //get them;
  46.      else if (stat == t2)      //request for user name;
  47.       {
  48.        cputs (name);           //send name;
  49.        cputs ("^M");
  50.       }
  51.      else if (stat == t3)      //request for password;
  52.       {
  53.        cputs (_entry_pass);    //pick up password from directory entry;
  54.        cputs ("^M");
  55.       }
  56.      else if (stat == t4)      //request for scanning messages;
  57.        cputs ("^M");           //scan them;
  58.      else if (stat == t5)      //request for continuing;
  59.        cputs ("^M");           //why not? why else are we here?;
  60.      else if (stat == t6)      //request for Main Board Command;
  61.        {
  62.         if (cheers)
  63.          {
  64.           upload = filefind ("c:\qmail\cheers.rep",0,buf); //OK to upload?
  65.           cputs ("open 7");      //open door (change the number to
  66.          }                       //reflect your board's door number);
  67.         else if (rfm)
  68.          {
  69.           upload = filefind ("c:\qmail\rfm.rep",0,buf);
  70.           cputs ("open 1");
  71.          }
  72.         cputs ("^M");         
  73.         break;                 //now we're done with Main Board;
  74.        }
  75.       else if (stat == t7)    //we're connected with Cheers!;
  76.        cheers = 1;
  77.       else if (stat == t8)
  78.        rfm = 1;               //we're connected with Radio Free Memphis;
  79.     }
  80.    track_free (0);             //free all track channels;
  81.    t1 = track ("download was successful!",1); //track the prompts that 
  82.    t2 = track ("Starting",1);                 //are expected in the
  83.    t3 = track ("packet (Y or N)?",1);         //Qwikmail download
  84.    t4 = track ("nothing was found!",1);       //module;
  85.    t5 = track ("SUCCESSFULLY",1);
  86.    t6 = track ("Qwikmail command?",1);
  87.    t7 = track ("Ready to receive",1);
  88.    stat = 0;                  //make sure NO string is being tracked;
  89.    while (1)                  //loop until successful download;
  90.     {
  91.      terminal ();             //again, process all characters received;
  92.      stat = track_hit (0);    //see which track (if any) was hit;
  93.      if (stat == t1)          //we got the packet OK;
  94.        break;                 //we're done with download;
  95.      else if (stat == t2)     //Zmodem transfer is ready to start;
  96.        receive ('Z',"");      //not needed if autodownload is set;
  97.      else if (stat == t3)     //do we want to get the packet?;
  98.       {                       //erase old .QWK file--not needed with
  99.        if (cheers)            //Telix Zmodem, but recommended to prevent
  100.         dos ("del \qmail\cheers.qwk"); //having .QW0 file;
  101.        else if (rfm)
  102.         dos ("del \qmail\rfm.qwk");
  103.        cputs ("Y^M");         //of course we want the packet;
  104.       }
  105.      else if (stat == t4)     //no messages -- how can this be?;
  106.        break;                 //anyway, we're done with download;
  107.      else if (stat == t6)     //request for Qwikmail command;
  108.        cputs ("D^M");         //tell Qwikmail to give us a packet;
  109.     }                         
  110.   while (1)                   //loop until succesful upload;
  111.    {
  112.     terminal ();              //process all characters received;
  113.     stat = track_hit (0);     //see which (if any) track was hit;
  114.     if (stat == t5)           //the door got our .REP packet,
  115.       moreyet = 0;             //so we're done;
  116.     else if (stat == t7)      //door is ready to receive by Zmodem;
  117.      {
  118.       if (cheers)
  119.         send ('Z',"c:\qmail\cheers.rep");  //send the .REP file;
  120.       else if (rfm)
  121.         send ('Z',"c:\qmail\rfm.rep");
  122.      }
  123.     else if (stat == t6)      //request for Qwikmail command;
  124.      {
  125.       if (upload && moreyet)  //if .REP file exists *and* there's more,
  126.         cputs ("U^M");        //request an upload;
  127.       else                    //if either condition fails
  128.        {                      //there's nothing to do,
  129.         cputs ("Q^M");        //so we're ready to quit;
  130.         break;                
  131.        }                    
  132.      }
  133.    }
  134.   if (upload)                        //delete old .REP file to 
  135.    {                                 //prevent uploading duplicate
  136.     if (cheers)                      //messages on later call
  137.       dos ("del c:\qmail\cheers.rep");
  138.     else if (rfm)
  139.       dos ("del c:\qmail\rfm.rep");
  140.    } 
  141.   track_free (0);           //free all track channels;  
  142.   _down_dir = "c:\up\";     //restore download and upload directories
  143.   _up_dir = "c:\up\";       //to their normal settings;
  144.  
  145.  }                          //END OF SCRIPT         
  146.