home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / lora299s.zip / LC.CPP < prev    next >
C/C++ Source or Header  |  1996-10-31  |  52KB  |  1,692 lines

  1.  
  2. // ----------------------------------------------------------------------
  3. // LoraBBS Professional Edition - Version 3.00.12
  4. // Copyright (c) 1996 by Marco Maccaferri. All rights reserved.
  5. //
  6. // History:
  7. //    07/17/96 - Initial coding.
  8. // ----------------------------------------------------------------------
  9.  
  10. #include "_ldefs.h"
  11. #include "lora_api.h"
  12. #include "menu.h"
  13.  
  14. USHORT MsgPending = FALSE, MsgUpdate = FALSE, FilePending = FALSE, FileUpdate;
  15. USHORT PackerPending = FALSE, PackerUpdate, NodesPending = FALSE, NodesUpdate;
  16. USHORT LastOp, ChannelPending = FALSE, MenuPending = FALSE;
  17. CHAR MenuName[128];
  18. class TConfig *Cfg = NULL;
  19. class TMsgData *Msg = NULL;
  20. class TFileData *File = NULL;
  21. class TPacker *Packer = NULL;
  22. class TNodes *Nodes = NULL;
  23. class TMenu *Menu = NULL;
  24.  
  25. void copyPath (char *dst, char *src)
  26. {
  27.    strcpy (dst, src);
  28.    if (dst[strlen (dst) - 1] == '\\' || dst[strlen (dst) - 1] == '/')
  29.       dst[strlen (dst) - 1] = '\0';
  30. #if defined(__LINUX__)
  31.    strcat (dst, "/");
  32. #else
  33.    strcat (dst, "\\");
  34. #endif
  35. }
  36.  
  37. int checkSystemConfiguration (char *p)
  38. {
  39.    int retval = FALSE;
  40.  
  41.    if (!stricmp (p, "system")) {
  42.       if ((p = strtok (NULL, " ")) != NULL) {
  43.          if (!stricmp (p, "path")) {
  44.             retval = TRUE;
  45.             if ((p = strtok (NULL, " ")) != NULL)
  46.                copyPath (Cfg->SystemPath, p);
  47.          }
  48.          else if (!stricmp (p, "name")) {
  49.             retval = TRUE;
  50.             if ((p = strtok (NULL, "")) != NULL) {
  51.                while (*p == ' ')
  52.                   p++;
  53.                strcpy (Cfg->SystemName, p);
  54.             }
  55.          }
  56.       }
  57.    }
  58.    else if (!stricmp (p, "sysop")) {
  59.       if ((p = strtok (NULL, " ")) != NULL) {
  60.          if (!stricmp (p, "name")) {
  61.             retval = TRUE;
  62.             if ((p = strtok (NULL, "")) != NULL) {
  63.                while (*p == ' ')
  64.                   p++;
  65.                strcpy (Cfg->SysopName, p);
  66.             }
  67.          }
  68.       }
  69.    }
  70.    else if (!stricmp (p, "normal")) {
  71.       if ((p = strtok (NULL, " ")) != NULL) {
  72.          if (!stricmp (p, "inbound")) {
  73.             retval = TRUE;
  74.             if ((p = strtok (NULL, " ")) != NULL)
  75.                copyPath (Cfg->NormalInbound, p);
  76.          }
  77.       }
  78.    }
  79.    else if (!stricmp (p, "protected")) {
  80.       if ((p = strtok (NULL, " ")) != NULL) {
  81.          if (!stricmp (p, "inbound")) {
  82.             retval = TRUE;
  83.             if ((p = strtok (NULL, " ")) != NULL)
  84.                copyPath (Cfg->ProtectedInbound, p);
  85.          }
  86.       }
  87.    }
  88.    else if (!stricmp (p, "known")) {
  89.       if ((p = strtok (NULL, " ")) != NULL) {
  90.          if (!stricmp (p, "inbound")) {
  91.             retval = TRUE;
  92.             if ((p = strtok (NULL, " ")) != NULL)
  93.                copyPath (Cfg->KnownInbound, p);
  94.          }
  95.       }
  96.    }
  97.    else if (!stricmp (p, "outbound")) {
  98.       retval = TRUE;
  99.       if ((p = strtok (NULL, " ")) != NULL)
  100.          copyPath (Cfg->Outbound, p);
  101.    }
  102.    else if (!stricmp (p, "log")) {
  103.       if ((p = strtok (NULL, " ")) != NULL) {
  104.          if (!stricmp (p, "file")) {
  105.             retval = TRUE;
  106.             if ((p = strtok (NULL, " ")) != NULL)
  107.                strcpy (Cfg->LogFile, p);
  108.          }
  109.       }
  110.    }
  111.    else if (!stricmp (p, "main")) {
  112.       if ((p = strtok (NULL, " ")) != NULL) {
  113.          if (!stricmp (p, "menu")) {
  114.             retval = TRUE;
  115.             if ((p = strtok (NULL, " ")) != NULL)
  116.                strcpy (Cfg->MainMenu, p);
  117.          }
  118.       }
  119.    }
  120.    else if (!stricmp (p, "nodelist")) {
  121.       if ((p = strtok (NULL, " ")) != NULL) {
  122.          if (!stricmp (p, "flags")) {
  123.             retval = TRUE;
  124.             if ((p = strtok (NULL, "")) != NULL) {
  125.                while (*p == ' ')
  126.                   p++;
  127.                strcpy (Cfg->NodelistFlags, p);
  128.             }
  129.          }
  130.          else if (!stricmp (p, "path")) {
  131.             retval = TRUE;
  132.             if ((p = strtok (NULL, " ")) != NULL)
  133.                copyPath (Cfg->NodelistPath, p);
  134.          }
  135.       }
  136.    }
  137.    else if (!stricmp (p, "location")) {
  138.       retval = TRUE;
  139.       if ((p = strtok (NULL, "")) != NULL) {
  140.          while (*p == ' ')
  141.             p++;
  142.          strcpy (Cfg->Location, p);
  143.       }
  144.    }
  145.    else if (!stricmp (p, "phone")) {
  146.       retval = TRUE;
  147.       if ((p = strtok (NULL, "")) != NULL) {
  148.          while (*p == ' ')
  149.             p++;
  150.          strcpy (Cfg->Phone, p);
  151.       }
  152.    }
  153.    else if (!stricmp (p, "menu")) {
  154.       if ((p = strtok (NULL, " ")) != NULL) {
  155.          if (!stricmp (p, "path")) {
  156.             retval = TRUE;
  157.             if ((p = strtok (NULL, " ")) != NULL)
  158.                copyPath (Cfg->MenuPath, p);
  159.          }
  160.       }
  161.    }
  162.    else if (!stricmp (p, "text")) {
  163.       if ((p = strtok (NULL, " ")) != NULL) {
  164.          if (!stricmp (p, "files")) {
  165.             if ((p = strtok (NULL, " ")) != NULL) {
  166.                if (!stricmp (p, "path")) {
  167.                   retval = TRUE;
  168.                   if ((p = strtok (NULL, " ")) != NULL)
  169.                      copyPath (Cfg->TextFiles, p);
  170.                }
  171.             }
  172.          }
  173.       }
  174.    }
  175.    else if (!stricmp (p, "temp")) {
  176.       if ((p = strtok (NULL, " ")) != NULL) {
  177.          if (!stricmp (p, "path")) {
  178.             retval = TRUE;
  179.             if ((p = strtok (NULL, " ")) != NULL)
  180.                copyPath (Cfg->TempPath, p);
  181.          }
  182.       }
  183.    }
  184.    else if (!stricmp (p, "olr")) {
  185.       if ((p = strtok (NULL, " ")) != NULL) {
  186.          if (!stricmp (p, "packet")) {
  187.             retval = TRUE;
  188.             if ((p = strtok (NULL, " ")) != NULL)
  189.                copyPath (Cfg->OLRPacketName, p);
  190.          }
  191.       }
  192.    }
  193.    else if (!stricmp (p, "olr")) {
  194.       if ((p = strtok (NULL, " ")) != NULL) {
  195.          if (!stricmp (p, "max")) {
  196.             if ((p = strtok (NULL, " ")) != NULL) {
  197.                if (!stricmp (p, "messages")) {
  198.                   retval = TRUE;
  199.                   Cfg->OLRMaxMessages = (USHORT)atoi (p);
  200.                }
  201.             }
  202.          }
  203.       }
  204.    }
  205.    else if (!stricmp (p, "users")) {
  206.       if ((p = strtok (NULL, " ")) != NULL) {
  207.          if (!stricmp (p, "file")) {
  208.             retval = TRUE;
  209.             if ((p = strtok (NULL, " ")) != NULL)
  210.                strcpy (Cfg->UserFile, p);
  211.          }
  212.          else if (!stricmp (p, "home")) {
  213.             retval = TRUE;
  214.             if ((p = strtok (NULL, " ")) != NULL)
  215.                copyPath (Cfg->UsersHomePath, p);
  216.          }
  217.       }
  218.    }
  219.    else if (!stricmp (p, "address")) {
  220.       retval = TRUE;
  221.       if ((p = strtok (NULL, " ")) != NULL)
  222.          Cfg->MailAddress.Add (p);
  223.    }
  224.    else if (!stricmp (p, "scheduler")) {
  225.       if ((p = strtok (NULL, " ")) != NULL) {
  226.          if (!stricmp (p, "file")) {
  227.             retval = TRUE;
  228.             if ((p = strtok (NULL, " ")) != NULL)
  229.                strcpy (Cfg->SchedulerFile, p);
  230.          }
  231.       }
  232.    }
  233.    else if (!stricmp (p, "new")) {
  234.       if ((p = strtok (NULL, " ")) != NULL) {
  235.          if (!stricmp (p, "user")) {
  236.             if ((p = strtok (NULL, " ")) != NULL) {
  237.                if (!stricmp (p, "level")) {
  238.                   retval = TRUE;
  239.                   if ((p = strtok (NULL, " ")) != NULL)
  240.                      Cfg->NewUserLevel = (USHORT)atoi (p);
  241.                }
  242.                else if (!stricmp (p, "limits")) {
  243.                   retval = TRUE;
  244.                   if ((p = strtok (NULL, " ")) != NULL)
  245.                      strcpy (Cfg->NewUserLimits, p);
  246.                }
  247.             }
  248.          }
  249.          else if (!stricmp (p, "areas")) {
  250.             if ((p = strtok (NULL, " ")) != NULL) {
  251.                if (!stricmp (p, "path")) {
  252.                   retval = TRUE;
  253.                   if ((p = strtok (NULL, " ")) != NULL)
  254.                      copyPath (Cfg->NewAreasPath, p);
  255.                }
  256.                else if (!stricmp (p, "type")) {
  257.                   retval = TRUE;
  258.                   if ((p = strtok (NULL, " ")) != NULL) {
  259.                      if (!stricmp (p, "squish"))
  260.                         Cfg->NewAreasStorage = ST_SQUISH;
  261.                      else if (!stricmp (p, "fido"))
  262.                         Cfg->NewAreasStorage = ST_FIDO;
  263.                      else if (!stricmp (p, "jam"))
  264.                         Cfg->NewAreasStorage = ST_JAM;
  265.                      else if (!stricmp (p, "adept"))
  266.                         Cfg->NewAreasStorage = ST_ADEPT;
  267.                      else if (!stricmp (p, "usenet"))
  268.                         Cfg->NewAreasStorage = ST_USENET;
  269.                   }
  270.                }
  271.             }
  272.          }
  273.       }
  274.    }
  275.    else if (!stricmp (p, "ask")) {
  276.       if ((p = strtok (NULL, " ")) != NULL) {
  277.          if (!stricmp (p, "ansi")) {
  278.             if ((p = strtok (NULL, " ")) != NULL) {
  279.                if (!stricmp (p, "yes")) {
  280.                   retval = TRUE;
  281.                   Cfg->CheckAnsi = YES;
  282.                }
  283.                else if (!stricmp (p, "no")) {
  284.                   retval = TRUE;
  285.                   Cfg->CheckAnsi = NO;
  286.                }
  287.                else if (!stricmp (p, "required")) {
  288.                   retval = TRUE;
  289.                   Cfg->CheckAnsi = REQUIRED;
  290.                }
  291.             }
  292.          }
  293.          else if (!stricmp (p, "realname")) {
  294.             if ((p = strtok (NULL, " ")) != NULL) {
  295.                if (!stricmp (p, "yes")) {
  296.                   retval = TRUE;
  297.                   Cfg->RealName = YES;
  298.                }
  299.                else if (!stricmp (p, "no")) {
  300.                   retval = TRUE;
  301.                   Cfg->RealName = NO;
  302.                }
  303.                else if (!stricmp (p, "required")) {
  304.                   retval = TRUE;
  305.                   Cfg->RealName = REQUIRED;
  306.                }
  307.             }
  308.          }
  309.          else if (!stricmp (p, "company")) {
  310.             if ((p = strtok (NULL, " ")) != NULL) {
  311.                if (!stricmp (p, "yes")) {
  312.                   retval = TRUE;
  313.                   Cfg->CompanyName = YES;
  314.                }
  315.                else if (!stricmp (p, "no")) {
  316.                   retval = TRUE;
  317.                   Cfg->CompanyName = NO;
  318.                }
  319.                else if (!stricmp (p, "required")) {
  320.                   retval = TRUE;
  321.                   Cfg->CompanyName = REQUIRED;
  322.                }
  323.             }
  324.          }
  325.          else if (!stricmp (p, "address")) {
  326.             if ((p = strtok (NULL, " ")) != NULL) {
  327.                if (!stricmp (p, "yes")) {
  328.                   retval = TRUE;
  329.                   Cfg->Address = YES;
  330.                }
  331.                else if (!stricmp (p, "no")) {
  332.                   retval = TRUE;
  333.                   Cfg->Address = NO;
  334.                }
  335.                else if (!stricmp (p, "required")) {
  336.                   retval = TRUE;
  337.                   Cfg->Address = REQUIRED;
  338.                }
  339.             }
  340.          }
  341.          else if (!stricmp (p, "city")) {
  342.             if ((p = strtok (NULL, " ")) != NULL) {
  343.                if (!stricmp (p, "yes")) {
  344.                   retval = TRUE;
  345.                   Cfg->City = YES;
  346.                }
  347.                else if (!stricmp (p, "no")) {
  348.                   retval = TRUE;
  349.                   Cfg->City = NO;
  350.                }
  351.                else if (!stricmp (p, "required")) {
  352.                   retval = TRUE;
  353.                   Cfg->City = REQUIRED;
  354.                }
  355.             }
  356.          }
  357.          else if (!stricmp (p, "phone")) {
  358.             if ((p = strtok (NULL, " ")) != NULL) {
  359.                if (!stricmp (p, "yes")) {
  360.                   retval = TRUE;
  361.                   Cfg->PhoneNumber = YES;
  362.                }
  363.                else if (!stricmp (p, "no")) {
  364.                   retval = TRUE;
  365.                   Cfg->PhoneNumber = NO;
  366.                }
  367.                else if (!stricmp (p, "required")) {
  368.                   retval = TRUE;
  369.                   Cfg->PhoneNumber = REQUIRED;
  370.                }
  371.             }
  372.          }
  373.          else if (!stricmp (p, "gender")) {
  374.             if ((p = strtok (NULL, " ")) != NULL) {
  375.                if (!stricmp (p, "yes")) {
  376.                   retval = TRUE;
  377.                   Cfg->Gender = YES;
  378.                }
  379.                else if (!stricmp (p, "no")) {
  380.                   retval = TRUE;
  381.                   Cfg->Gender = NO;
  382.                }
  383.                else if (!stricmp (p, "required")) {
  384.                   retval = TRUE;
  385.                   Cfg->Gender = REQUIRED;
  386.                }
  387.             }
  388.          }
  389.       }
  390.    }
  391.    else if (!stricmp (p, "ansi")) {
  392.       if ((p = strtok (NULL, " ")) != NULL) {
  393.          if (!stricmp (p, "login")) {
  394.             if ((p = strtok (NULL, " ")) != NULL) {
  395.                if (!stricmp (p, "yes")) {
  396.                   retval = TRUE;
  397.                   Cfg->Ansi = YES;
  398.                }
  399.                else if (!stricmp (p, "no")) {
  400.                   retval = TRUE;
  401.                   Cfg->Ansi = NO;
  402.                }
  403.                else if (!stricmp (p, "detect") || !stricmp (p, "auto")) {
  404.                   retval = TRUE;
  405.                   Cfg->Ansi = AUTO;
  406.                }
  407.             }
  408.          }
  409.       }
  410.    }
  411.    else if (!stricmp (p, "iemsi")) {
  412.       if ((p = strtok (NULL, " ")) != NULL) {
  413.          if (!stricmp (p, "login")) {
  414.             if ((p = strtok (NULL, " ")) != NULL) {
  415.                if (!stricmp (p, "yes")) {
  416.                   retval = TRUE;
  417.                   Cfg->IEMSI = YES;
  418.                }
  419.                else if (!stricmp (p, "no")) {
  420.                   retval = TRUE;
  421.                   Cfg->IEMSI = NO;
  422.                }
  423.             }
  424.          }
  425.       }
  426.    }
  427.    else if (!stricmp (p, "netmail")) {
  428.       if ((p = strtok (NULL, " ")) != NULL) {
  429.          if (!stricmp (p, "path")) {
  430.             retval = TRUE;
  431.             if ((p = strtok (NULL, " ")) != NULL)
  432.                strcpy (Cfg->NetMailPath, p);
  433.          }
  434.          else if (!stricmp (p, "type")) {
  435.             retval = TRUE;
  436.             if ((p = strtok (NULL, " ")) != NULL) {
  437.                if (!stricmp (p, "squish"))
  438.                   Cfg->NetMailStorage = ST_SQUISH;
  439.                else if (!stricmp (p, "fido"))
  440.                   Cfg->NetMailStorage = ST_FIDO;
  441.                else if (!stricmp (p, "jam"))
  442.                   Cfg->NetMailStorage = ST_JAM;
  443.                else if (!stricmp (p, "adept"))
  444.                   Cfg->NetMailStorage = ST_ADEPT;
  445.                else if (!stricmp (p, "usenet"))
  446.                   Cfg->NetMailStorage = ST_USENET;
  447.             }
  448.          }
  449.       }
  450.    }
  451.    else if (!stricmp (p, "mail")) {
  452.       if ((p = strtok (NULL, " ")) != NULL) {
  453.          if (!stricmp (p, "path")) {
  454.             retval = TRUE;
  455.             if ((p = strtok (NULL, " ")) != NULL)
  456.                strcpy (Cfg->MailPath, p);
  457.          }
  458.          else if (!stricmp (p, "type")) {
  459.             retval = TRUE;
  460.             if ((p = strtok (NULL, " ")) != NULL) {
  461.                if (!stricmp (p, "squish"))
  462.                   Cfg->MailStorage = ST_SQUISH;
  463.                else if (!stricmp (p, "fido"))
  464.                   Cfg->MailStorage = ST_FIDO;
  465.                else if (!stricmp (p, "jam"))
  466.                   Cfg->MailStorage = ST_JAM;
  467.                else if (!stricmp (p, "adept"))
  468.                   Cfg->MailStorage = ST_ADEPT;
  469.                else if (!stricmp (p, "usenet"))
  470.                   Cfg->MailStorage = ST_USENET;
  471.             }
  472.          }
  473.          else if (!stricmp (p, "server")) {
  474.             retval = TRUE;
  475.             if ((p = strtok (NULL, " ")) != NULL)
  476.                strcpy (Cfg->MailServer, p);
  477.          }
  478.       }
  479.    }
  480.    else if (!stricmp (p, "duplicate")) {
  481.       if ((p = strtok (NULL, " ")) != NULL) {
  482.          if (!stricmp (p, "path")) {
  483.             retval = TRUE;
  484.             if ((p = strtok (NULL, " ")) != NULL)
  485.                strcpy (Cfg->DupePath, p);
  486.          }
  487.          else if (!stricmp (p, "type")) {
  488.             retval = TRUE;
  489.             if ((p = strtok (NULL, " ")) != NULL) {
  490.                if (!stricmp (p, "squish"))
  491.                   Cfg->DupeStorage = ST_SQUISH;
  492.                else if (!stricmp (p, "fido"))
  493.                   Cfg->DupeStorage = ST_FIDO;
  494.                else if (!stricmp (p, "jam"))
  495.                   Cfg->DupeStorage = ST_JAM;
  496.                else if (!stricmp (p, "adept"))
  497.                   Cfg->DupeStorage = ST_ADEPT;
  498.                else if (!stricmp (p, "usenet"))
  499.                   Cfg->DupeStorage = ST_USENET;
  500.             }
  501.          }
  502.       }
  503.    }
  504.    else if (!stricmp (p, "bad")) {
  505.       if ((p = strtok (NULL, " ")) != NULL) {
  506.          if (!stricmp (p, "path")) {
  507.             retval = TRUE;
  508.             if ((p = strtok (NULL, " ")) != NULL)
  509.                strcpy (Cfg->BadPath, p);
  510.          }
  511.          else if (!stricmp (p, "type")) {
  512.             retval = TRUE;
  513.             if ((p = strtok (NULL, " ")) != NULL) {
  514.                if (!stricmp (p, "squish"))
  515.                   Cfg->BadStorage = ST_SQUISH;
  516.                else if (!stricmp (p, "fido"))
  517.                   Cfg->BadStorage = ST_FIDO;
  518.                else if (!stricmp (p, "jam"))
  519.                   Cfg->BadStorage = ST_JAM;
  520.                else if (!stricmp (p, "adept"))
  521.                   Cfg->BadStorage = ST_ADEPT;
  522.                else if (!stricmp (p, "usenet"))
  523.                   Cfg->BadStorage = ST_USENET;
  524.             }
  525.          }
  526.       }
  527.    }
  528.    else if (!stricmp (p, "news")) {
  529.       if ((p = strtok (NULL, " ")) != NULL) {
  530.          if (!stricmp (p, "server")) {
  531.             retval = TRUE;
  532.             if ((p = strtok (NULL, " ")) != NULL)
  533.                strcpy (Cfg->NewsServer, p);
  534.          }
  535.       }
  536.    }
  537.    else if (!stricmp (p, "host")) {
  538.       if ((p = strtok (NULL, " ")) != NULL) {
  539.          if (!stricmp (p, "name")) {
  540.             retval = TRUE;
  541.             if ((p = strtok (NULL, " ")) != NULL)
  542.                strcpy (Cfg->HostName, p);
  543.          }
  544.       }
  545.    }
  546.    else if (!stricmp (p, "keep")) {
  547.       if ((p = strtok (NULL, " ")) != NULL) {
  548.          if (!stricmp (p, "netmail")) {
  549.             retval = TRUE;
  550.             Cfg->KeepNetMail = TRUE;
  551.          }
  552.       }
  553.    }
  554.    else if (!stricmp (p, "secure")) {
  555.       if ((p = strtok (NULL, " ")) != NULL) {
  556.          if (!stricmp (p, "mail")) {
  557.             retval = TRUE;
  558.             Cfg->Secure = TRUE;
  559.          }
  560.       }
  561.    }
  562.    else if (!stricmp (p, "wazoo")) {
  563.       retval = TRUE;
  564.       Cfg->WaZoo = TRUE;
  565.    }
  566.    else if (!stricmp (p, "EMSI")) {
  567.       retval = TRUE;
  568.       Cfg->EMSI = TRUE;
  569.    }
  570.    else if (!stricmp (p, "Janus")) {
  571.       retval = TRUE;
  572.       Cfg->Janus = TRUE;
  573.    }
  574.    else if (!stricmp (p, "mail")) {
  575.       if ((p = strtok (NULL, " ")) != NULL) {
  576.          if (!stricmp (p, "only")) {
  577.             retval = TRUE;
  578.             if ((p = strtok (NULL, "")) != NULL) {
  579.                while (*p == ' ')
  580.                   p++;
  581.                strcpy (Cfg->MailOnly, p);
  582.             }
  583.          }
  584.       }
  585.    }
  586.    else if (!stricmp (p, "enter")) {
  587.       if ((p = strtok (NULL, " ")) != NULL) {
  588.          if (!stricmp (p, "bbs")) {
  589.             retval = TRUE;
  590.             if ((p = strtok (NULL, "")) != NULL) {
  591.                while (*p == ' ')
  592.                   p++;
  593.                strcpy (Cfg->EnterBBS, p);
  594.             }
  595.          }
  596.       }
  597.    }
  598.    else if (!stricmp (p, "tear")) {
  599.       if ((p = strtok (NULL, " ")) != NULL) {
  600.          if (!stricmp (p, "line")) {
  601.             retval = TRUE;
  602.             if ((p = strtok (NULL, "")) != NULL) {
  603.                while (*p == ' ')
  604.                   p++;
  605.                strcpy (Cfg->TearLine, p);
  606.             }
  607.          }
  608.       }
  609.    }
  610.    else if (!stricmp (p, "force")) {
  611.       if ((p = strtok (NULL, " ")) != NULL) {
  612.          if (!stricmp (p, "intl")) {
  613.             retval = TRUE;
  614.             Cfg->ForceIntl = TRUE;
  615.          }
  616.       }
  617.    }
  618.    else if (!stricmp (p, "import")) {
  619.       if ((p = strtok (NULL, " ")) != NULL) {
  620.          if (!stricmp (p, "empty")) {
  621.             retval = TRUE;
  622.             Cfg->ImportEmpty = TRUE;
  623.          }
  624.       }
  625.    }
  626.    else if (!stricmp (p, "replace")) {
  627.       if ((p = strtok (NULL, " ")) != NULL) {
  628.          if (!stricmp (p, "tear")) {
  629.             retval = TRUE;
  630.             Cfg->ReplaceTear = TRUE;
  631.          }
  632.       }
  633.    }
  634.    else if (!stricmp (p, "use")) {
  635.       if ((p = strtok (NULL, " ")) != NULL) {
  636.          if (!stricmp (p, "areasbbs")) {
  637.             retval = TRUE;
  638.             Cfg->UseAreasBBS = TRUE;
  639.          }
  640.       }
  641.    }
  642.    else if (!stricmp (p, "update")) {
  643.       if ((p = strtok (NULL, " ")) != NULL) {
  644.          if (!stricmp (p, "areasbbs")) {
  645.             retval = TRUE;
  646.             Cfg->UpdateAreasBBS = TRUE;
  647.          }
  648.       }
  649.    }
  650.    else if (!stricmp (p, "separate")) {
  651.       if ((p = strtok (NULL, " ")) != NULL) {
  652.          if (!stricmp (p, "netmail")) {
  653.             retval = TRUE;
  654.             Cfg->SeparateNetMail = TRUE;
  655.          }
  656.       }
  657.    }
  658.    else if (!stricmp (p, "zmodem")) {
  659.       if ((p = strtok (NULL, " ")) != NULL) {
  660.          if (!stricmp (p, "telnet")) {
  661.             retval = TRUE;
  662.             Cfg->ZModemTelnet = TRUE;
  663.          }
  664.       }
  665.    }
  666.    else if (!stricmp (p, "detect")) {
  667.       if ((p = strtok (NULL, " ")) != NULL) {
  668.          if (!stricmp (p, "ppp")) {
  669.             retval = TRUE;
  670.             Cfg->EnablePPP = TRUE;
  671.          }
  672.       }
  673.    }
  674.    else if (!stricmp (p, "ppp")) {
  675.       if ((p = strtok (NULL, " ")) != NULL) {
  676.          if (!stricmp (p, "command")) {
  677.             if ((p = strtok (NULL, "")) != NULL) {
  678.                while (*p == ' ')
  679.                   p++;
  680.                strcpy (Cfg->PPPCmd, p);
  681.                retval = TRUE;
  682.             }
  683.          }
  684.          else if (!stricmp (p, "limit")) {
  685.             if ((p = strtok (NULL, " ")) != NULL) {
  686.                Cfg->PPPTimeLimit = (USHORT)atoi (p);
  687.                retval = TRUE;
  688.             }
  689.          }
  690.       }
  691.    }
  692.    else if (!stricmp (p, "areas")) {
  693.       if ((p = strtok (NULL, " ")) != NULL) {
  694.          if (!stricmp (p, "bbs")) {
  695.             retval = TRUE;
  696.             if ((p = strtok (NULL, " ")) != NULL)
  697.                strcpy (Cfg->AreasBBS, p);
  698.          }
  699.       }
  700.    }
  701.    else if (!stricmp (p, "after")) {
  702.       if ((p = strtok (NULL, " ")) != NULL) {
  703.          if (!stricmp (p, "caller")) {
  704.             if ((p = strtok (NULL, "")) != NULL) {
  705.                while (*p == ' ')
  706.                   p++;
  707.                strcpy (Cfg->AfterCallerCmd, p);
  708.                retval = TRUE;
  709.             }
  710.          }
  711.       }
  712.    }
  713.    else if (!stricmp (p, "after")) {
  714.       if ((p = strtok (NULL, " ")) != NULL) {
  715.          if (!stricmp (p, "mail")) {
  716.             if ((p = strtok (NULL, "")) != NULL) {
  717.                while (*p == ' ')
  718.                   p++;
  719.                strcpy (Cfg->AfterMailCmd, p);
  720.                retval = TRUE;
  721.             }
  722.          }
  723.       }
  724.    }
  725.    else if (!stricmp (p, "import")) {
  726.       if ((p = strtok (NULL, " ")) != NULL) {
  727.          if (!stricmp (p, "command")) {
  728.             retval = TRUE;
  729.             if ((p = strtok (NULL, "")) != NULL) {
  730.                while (*p == ' ')
  731.                   p++;
  732.                strcpy (Cfg->ImportCmd, p);
  733.             }
  734.          }
  735.       }
  736.    }
  737.    else if (!stricmp (p, "export")) {
  738.       if ((p = strtok (NULL, " ")) != NULL) {
  739.          if (!stricmp (p, "command")) {
  740.             retval = TRUE;
  741.             if ((p = strtok (NULL, "")) != NULL) {
  742.                while (*p == ' ')
  743.                   p++;
  744.                strcpy (Cfg->ExportCmd, p);
  745.             }
  746.          }
  747.       }
  748.    }
  749.    else if (!stricmp (p, "pack")) {
  750.       if ((p = strtok (NULL, " ")) != NULL) {
  751.          if (!stricmp (p, "command")) {
  752.             retval = TRUE;
  753.             if ((p = strtok (NULL, "")) != NULL) {
  754.                while (*p == ' ')
  755.                   p++;
  756.                strcpy (Cfg->PackCmd, p);
  757.             }
  758.          }
  759.       }
  760.    }
  761.    else if (!stricmp (p, "single")) {
  762.       if ((p = strtok (NULL, " ")) != NULL) {
  763.          if (!stricmp (p, "pass")) {
  764.             retval = TRUE;
  765.             if ((p = strtok (NULL, "")) != NULL) {
  766.                while (*p == ' ')
  767.                   p++;
  768.                strcpy (Cfg->SinglePassCmd, p);
  769.             }
  770.          }
  771.       }
  772.    }
  773.    else if (!stricmp (p, "newsgroup")) {
  774.       if ((p = strtok (NULL, " ")) != NULL) {
  775.          if (!stricmp (p, "command")) {
  776.             retval = TRUE;
  777.             if ((p = strtok (NULL, "")) != NULL) {
  778.                while (*p == ' ')
  779.                   p++;
  780.                strcpy (Cfg->NewsgroupCmd, p);
  781.             }
  782.          }
  783.       }
  784.    }
  785.  
  786.    return (retval);
  787. }
  788.  
  789. int checkMessageAreas (char *p)
  790. {
  791.    int retval = FALSE;
  792.    ULONG HWM, Highest;
  793.    class TEchoLink *Link;
  794.  
  795.    if (!stricmp (p, "message")) {
  796.       if ((p = strtok (NULL, " ")) != NULL) {
  797.          if (!stricmp (p, "area")) {
  798.             retval = TRUE;
  799.             if (Msg != NULL && MsgPending == TRUE) {
  800.                if (MsgUpdate == TRUE)
  801.                   Msg->Update ();
  802.                else
  803.                   Msg->Add ();
  804.                MsgUpdate = MsgPending = FALSE;
  805.             }
  806.             if (Msg == NULL)
  807.                Msg = new TMsgData (Cfg->SystemPath);
  808.             if ((p = strtok (NULL, " ")) != NULL) {
  809.                if ((MsgUpdate = Msg->Read (p)) == TRUE) {
  810.                   HWM = Msg->HighWaterMark;
  811.                   Highest = Msg->Highest;
  812.                }
  813.                Msg->New ();
  814.                strcpy (Msg->Key, p);
  815.                if (MsgUpdate == TRUE) {
  816.                   Msg->HighWaterMark = HWM;
  817.                   Msg->Highest = Highest;
  818.                }
  819.                MsgPending = TRUE;
  820.  
  821.                if (LastOp != 1 && LastOp != 0)
  822.                   cprintf ("\r\n");
  823.                cprintf ("\r +-- Message area '%s' ", Msg->Key);
  824.                LastOp = 1;
  825.             }
  826.          }
  827.       }
  828.    }
  829.  
  830.    if (MsgPending == TRUE) {
  831.       if (!stricmp (p, "display")) {
  832.          retval = TRUE;
  833.          if ((p = strtok (NULL, "")) != NULL) {
  834.             while (*p == ' ')
  835.                p++;
  836.             strcpy (Msg->Display, p);
  837.          }
  838.       }
  839.       else if (!stricmp (p, "type")) {
  840.          retval = TRUE;
  841.          if ((p = strtok (NULL, " ")) != NULL) {
  842.             if (!stricmp (p, "squish"))
  843.                Msg->Storage = ST_SQUISH;
  844.             else if (!stricmp (p, "fido"))
  845.                Msg->Storage = ST_FIDO;
  846.             else if (!stricmp (p, "jam"))
  847.                Msg->Storage = ST_JAM;
  848.             else if (!stricmp (p, "adept"))
  849.                Msg->Storage = ST_ADEPT;
  850.             else if (!stricmp (p, "usenet"))
  851.                Msg->Storage = ST_USENET;
  852.          }
  853.       }
  854.       else if (!stricmp (p, "path")) {
  855.          retval = TRUE;
  856.          if ((p = strtok (NULL, " ")) != NULL)
  857.             strcpy (Msg->Path, p);
  858.       }
  859.       else if (!stricmp (p, "echotag")) {
  860.          retval = TRUE;
  861.          if ((p = strtok (NULL, " ")) != NULL)
  862.             strcpy (Msg->EchoTag, p);
  863.          Msg->EchoMail = TRUE;
  864.       }
  865.       else if (!stricmp (p, "newsgroup")) {
  866.          retval = TRUE;
  867.          if ((p = strtok (NULL, " ")) != NULL)
  868.             strcpy (Msg->NewsGroup, p);
  869.       }
  870.       else if (!stricmp (p, "level")) {
  871.          retval = TRUE;
  872.          if ((p = strtok (NULL, " ")) != NULL)
  873.             Msg->Level = (USHORT)atoi (p);
  874.       }
  875.       else if (!stricmp (p, "write")) {
  876.          if ((p = strtok (NULL, " ")) != NULL) {
  877.             if (!stricmp (p, "level")) {
  878.                retval = TRUE;
  879.                if ((p = strtok (NULL, " ")) != NULL)
  880.                   Msg->WriteLevel = (USHORT)atoi (p);
  881.             }
  882.          }
  883.       }
  884.       else if (!stricmp (p, "forward")) {
  885.          if ((p = strtok (NULL, " ")) != NULL) {
  886.             if (!stricmp (p, "to")) {
  887.                retval = TRUE;
  888.                if ((p = strtok (NULL, "")) != NULL) {
  889.                   while (*p == ' ')
  890.                      p++;
  891.                   if ((Link = new TEchoLink (Cfg->SystemPath)) != NULL) {
  892.                      Link->Load (Msg->EchoTag);
  893.                      Link->AddString (p);
  894.                      Link->Save ();
  895.                      delete Link;
  896.                   }
  897.                }
  898.             }
  899.          }
  900.       }
  901.       else if (!stricmp (p, "update")) {
  902.          retval = TRUE;
  903.          if ((p = strtok (NULL, " ")) != NULL) {
  904.             if (!stricmp (p, "from")) {
  905.                if ((p = strtok (NULL, " ")) != NULL) {
  906.                   if (!stricmp (p, "newsgroup"))
  907.                      Msg->UpdateNews = TRUE;
  908.                }
  909.             }
  910.          }
  911.       }
  912.       else if (!stricmp (p, "max")) {
  913.          retval = TRUE;
  914.          if ((p = strtok (NULL, " ")) != NULL) {
  915.             if (!stricmp (p, "messages")) {
  916.                if ((p = strtok (NULL, " ")) != NULL)
  917.                   Msg->MaxMessages = (USHORT)atoi (p);
  918.             }
  919.             else if (!stricmp (p, "days")) {
  920.                if ((p = strtok (NULL, " ")) != NULL)
  921.                   Msg->DaysOld = (USHORT)atoi (p);
  922.             }
  923.          }
  924.       }
  925.       else if (!stricmp (p, "show")) {
  926.          retval = TRUE;
  927.          if ((p = strtok (NULL, " ")) != NULL) {
  928.             if (!stricmp (p, "global")) {
  929.                if ((p = strtok (NULL, " ")) != NULL)
  930.                   Msg->ShowGlobal = TRUE;
  931.             }
  932.          }
  933.       }
  934.       else if (!stricmp (p, "use")) {
  935.          retval = TRUE;
  936.          if ((p = strtok (NULL, " ")) != NULL) {
  937.             if (!stricmp (p, "offline")) {
  938.                if ((p = strtok (NULL, " ")) != NULL) {
  939.                   if (!stricmp (p, "reader"))
  940.                      Msg->Offline = TRUE;
  941.                }
  942.             }
  943.          }
  944.       }
  945.  
  946.       if (retval == FALSE) {
  947.          if (Msg != NULL && MsgPending == TRUE) {
  948.             if (MsgUpdate == TRUE)
  949.                Msg->Update ();
  950.             else
  951.                Msg->Add ();
  952.             MsgUpdate = MsgPending = FALSE;
  953.          }
  954.       }
  955.    }
  956.  
  957.    return (retval);
  958. }
  959.  
  960. int checkFileAreas (char *p)
  961. {
  962.    int retval = FALSE;
  963.    class TFilechoLink *Link;
  964.  
  965.    if (!stricmp (p, "file")) {
  966.       if ((p = strtok (NULL, " ")) != NULL) {
  967.          if (!stricmp (p, "area")) {
  968.             retval = TRUE;
  969.             if (File != NULL && FilePending == TRUE) {
  970.                if (FileUpdate == TRUE)
  971.                   File->Update ();
  972.                else
  973.                   File->Add ();
  974.                FileUpdate = FilePending = FALSE;
  975.             }
  976.             if (File == NULL)
  977.                File = new TFileData (Cfg->SystemPath);
  978.             if ((p = strtok (NULL, " ")) != NULL) {
  979.                FileUpdate = File->Read (p);
  980.                File->New ();
  981.                strcpy (File->Key, p);
  982.                FilePending = TRUE;
  983.  
  984.                if (LastOp != 2 && LastOp != 0)
  985.                   cprintf ("\r\n");
  986.                cprintf ("\r +-- File area '%s' ", File->Key);
  987.                LastOp = 2;
  988.             }
  989.          }
  990.       }
  991.    }
  992.  
  993.    if (FilePending == TRUE) {
  994.       if (!stricmp (p, "display")) {
  995.          retval = TRUE;
  996.          if ((p = strtok (NULL, "")) != NULL) {
  997.             while (*p == ' ')
  998.                p++;
  999.             strcpy (File->Display, p);
  1000.          }
  1001.       }
  1002.       else if (!stricmp (p, "level")) {
  1003.          retval = TRUE;
  1004.          if ((p = strtok (NULL, " ")) != NULL)
  1005.             File->Level = (USHORT)atoi (p);
  1006.       }
  1007.       else if (!stricmp (p, "download")) {
  1008.          if ((p = strtok (NULL, " ")) != NULL) {
  1009.             if (!stricmp (p, "level")) {
  1010.                retval = TRUE;
  1011.                if ((p = strtok (NULL, " ")) != NULL)
  1012.                   File->DownloadLevel = (USHORT)atoi (p);
  1013.             }
  1014.             else if (!stricmp (p, "path")) {
  1015.                retval = TRUE;
  1016.                if ((p = strtok (NULL, " ")) != NULL)
  1017.                   copyPath (File->Download, p);
  1018.             }
  1019.          }
  1020.       }
  1021.       else if (!stricmp (p, "upload")) {
  1022.          if ((p = strtok (NULL, " ")) != NULL) {
  1023.             if (!stricmp (p, "level")) {
  1024.                retval = TRUE;
  1025.                if ((p = strtok (NULL, " ")) != NULL)
  1026.                   File->UploadLevel = (USHORT)atoi (p);
  1027.             }
  1028.             else if (!stricmp (p, "path")) {
  1029.                retval = TRUE;
  1030.                if ((p = strtok (NULL, " ")) != NULL)
  1031.                   copyPath (File->Upload, p);
  1032.             }
  1033.          }
  1034.       }
  1035.       else if (!stricmp (p, "echotag")) {
  1036.          retval = TRUE;
  1037.          if ((p = strtok (NULL, " ")) != NULL)
  1038.             strcpy (File->EchoTag, p);
  1039.       }
  1040.       else if (!stricmp (p, "forward")) {
  1041.          if ((p = strtok (NULL, " ")) != NULL) {
  1042.             if (!stricmp (p, "to")) {
  1043.                retval = TRUE;
  1044.                if ((p = strtok (NULL, "")) != NULL) {
  1045.                   while (*p == ' ')
  1046.                      p++;
  1047.                   if ((Link = new TFilechoLink (Cfg->SystemPath)) != NULL) {
  1048.                      Link->Load (File->EchoTag);
  1049.                      Link->AddString (p);
  1050.                      Link->Save ();
  1051.                      delete Link;
  1052.                   }
  1053.                }
  1054.             }
  1055.          }
  1056.       }
  1057.       else if (!stricmp (p, "show")) {
  1058.          retval = TRUE;
  1059.          if ((p = strtok (NULL, " ")) != NULL) {
  1060.             if (!stricmp (p, "global")) {
  1061.                if ((p = strtok (NULL, " ")) != NULL)
  1062.                   File->ShowGlobal = TRUE;
  1063.             }
  1064.          }
  1065.       }
  1066.       else if (!stricmp (p, "cdrom")) {
  1067.          retval = TRUE;
  1068.          if ((p = strtok (NULL, " ")) != NULL)
  1069.             File->CdRom = TRUE;
  1070.       }
  1071.  
  1072.       if (retval == FALSE) {
  1073.          if (File != NULL && FilePending == TRUE) {
  1074.             if (FileUpdate == TRUE)
  1075.                File->Update ();
  1076.             else
  1077.                File->Add ();
  1078.             FileUpdate = FilePending = FALSE;
  1079.          }
  1080.       }
  1081.    }
  1082.  
  1083.    return (retval);
  1084. }
  1085.  
  1086. int checkCompressor (char *p)
  1087. {
  1088.    int retval = FALSE;
  1089.  
  1090.    if (!stricmp (p, "compressor")) {
  1091.       retval = TRUE;
  1092.       if (Packer != NULL && PackerPending == TRUE) {
  1093.          if (PackerUpdate == TRUE)
  1094.             Packer->Update ();
  1095.          else
  1096.             Packer->Add ();
  1097.          PackerUpdate = PackerPending = FALSE;
  1098.       }
  1099.       if (Packer == NULL)
  1100.          Packer = new TPacker (Cfg->SystemPath);
  1101.       if ((p = strtok (NULL, " ")) != NULL) {
  1102.          PackerUpdate = Packer->Read (p, FALSE);
  1103.          Packer->New ();
  1104.          strcpy (Packer->Key, p);
  1105.          PackerPending = TRUE;
  1106.  
  1107.          if (LastOp != 3 && LastOp != 0)
  1108.             cprintf ("\r\n");
  1109.          cprintf ("\r +-- Compressor '%s' ", Packer->Key);
  1110.          LastOp = 3;
  1111.       }
  1112.    }
  1113.  
  1114.    if (PackerPending == TRUE) {
  1115.       if (!stricmp (p, "display")) {
  1116.          retval = TRUE;
  1117.          if ((p = strtok (NULL, "")) != NULL) {
  1118.             while (*p == ' ')
  1119.                p++;
  1120.             strcpy (Packer->Display, p);
  1121.          }
  1122.       }
  1123.       else if (!stricmp (p, "pack")) {
  1124.          if ((p = strtok (NULL, " ")) != NULL) {
  1125.             if (!stricmp (p, "command")) {
  1126.                retval = TRUE;
  1127.                if ((p = strtok (NULL, "")) != NULL) {
  1128.                   while (*p == ' ')
  1129.                      p++;
  1130.                   strcpy (Packer->PackCmd, p);
  1131.                }
  1132.             }
  1133.          }
  1134.       }
  1135.       else if (!stricmp (p, "unpack")) {
  1136.          if ((p = strtok (NULL, " ")) != NULL) {
  1137.             if (!stricmp (p, "command")) {
  1138.                retval = TRUE;
  1139.                if ((p = strtok (NULL, "")) != NULL) {
  1140.                   while (*p == ' ')
  1141.                      p++;
  1142.                   strcpy (Packer->UnpackCmd, p);
  1143.                }
  1144.             }
  1145.          }
  1146.       }
  1147.       else if (!stricmp (p, "position")) {
  1148.          if ((p = strtok (NULL, " ")) != NULL) {
  1149.             retval = TRUE;
  1150.             Packer->Position = atol (p);
  1151.          }
  1152.       }
  1153.       else if (!stricmp (p, "id")) {
  1154.          if ((p = strtok (NULL, " ")) != NULL) {
  1155.             retval = TRUE;
  1156.             strcpy (Packer->Id, p);
  1157.          }
  1158.       }
  1159.       else if (!stricmp (p, "dos")) {
  1160.          retval = TRUE;
  1161.          Packer->Dos = TRUE;
  1162.       }
  1163.       else if (!stricmp (p, "os/2")) {
  1164.          retval = TRUE;
  1165.          Packer->OS2 = TRUE;
  1166.       }
  1167.       else if (!stricmp (p, "windows")) {
  1168.          retval = TRUE;
  1169.          Packer->Windows = TRUE;
  1170.       }
  1171.       else if (!stricmp (p, "linux")) {
  1172.          retval = TRUE;
  1173.          Packer->Linux = TRUE;
  1174.       }
  1175.  
  1176.       if (retval == FALSE) {
  1177.          if (Packer != NULL && PackerPending == TRUE) {
  1178.             if (PackerUpdate == TRUE)
  1179.                Packer->Update ();
  1180.             else
  1181.                Packer->Add ();
  1182.             PackerUpdate = PackerPending = FALSE;
  1183.          }
  1184.       }
  1185.    }
  1186.  
  1187.    return (retval);
  1188. }
  1189.  
  1190. int checkNodes (char *p)
  1191. {
  1192.    int retval = FALSE;
  1193.  
  1194.    if (!stricmp (p, "node")) {
  1195.       retval = TRUE;
  1196.       if (Nodes != NULL && NodesPending == TRUE) {
  1197.          if (NodesUpdate == TRUE)
  1198.             Nodes->Update ();
  1199.          else
  1200.             Nodes->Add ();
  1201.          NodesUpdate = NodesPending = FALSE;
  1202.       }
  1203.       if (Nodes == NULL)
  1204.          Nodes = new TNodes (Cfg->NodelistPath);
  1205.       if ((p = strtok (NULL, " ")) != NULL) {
  1206.          NodesUpdate = Nodes->Read (p, FALSE);
  1207.          Nodes->New ();
  1208.          strcpy (Nodes->Address, p);
  1209.          NodesPending = TRUE;
  1210.  
  1211.          if (LastOp != 4 && LastOp != 0)
  1212.             cprintf ("\r\n");
  1213.          cprintf ("\r +-- Node '%s' ", Nodes->Address);
  1214.          LastOp = 4;
  1215.       }
  1216.    }
  1217.  
  1218.    if (NodesPending == TRUE) {
  1219.       if (!stricmp (p, "name")) {
  1220.          retval = TRUE;
  1221.          if ((p = strtok (NULL, "")) != NULL) {
  1222.             while (*p == ' ')
  1223.                p++;
  1224.             strcpy (Nodes->SystemName, p);
  1225.          }
  1226.       }
  1227.       else if (!stricmp (p, "sysop")) {
  1228.          retval = TRUE;
  1229.          if ((p = strtok (NULL, "")) != NULL) {
  1230.             while (*p == ' ')
  1231.                p++;
  1232.             strcpy (Nodes->SysopName, p);
  1233.          }
  1234.       }
  1235.       else if (!stricmp (p, "location")) {
  1236.          retval = TRUE;
  1237.          if ((p = strtok (NULL, "")) != NULL) {
  1238.             while (*p == ' ')
  1239.                p++;
  1240.             strcpy (Nodes->Location, p);
  1241.          }
  1242.       }
  1243.       else if (!stricmp (p, "phone")) {
  1244.          retval = TRUE;
  1245.          if ((p = strtok (NULL, "")) != NULL) {
  1246.             while (*p == ' ')
  1247.                p++;
  1248.             strcpy (Nodes->Phone, p);
  1249.          }
  1250.       }
  1251.       else if (!stricmp (p, "flags")) {
  1252.          retval = TRUE;
  1253.          if ((p = strtok (NULL, "")) != NULL) {
  1254.             while (*p == ' ')
  1255.                p++;
  1256.             strcpy (Nodes->Flags, p);
  1257.          }
  1258.       }
  1259.       else if (!stricmp (p, "remap")) {
  1260.          if ((p = strtok (NULL, " ")) != NULL) {
  1261.             if (!stricmp (p, "netmail")) {
  1262.                retval = TRUE;
  1263.                Nodes->RemapMail = TRUE;
  1264.             }
  1265.          }
  1266.       }
  1267.       else if (!stricmp (p, "compressor")) {
  1268.          retval = TRUE;
  1269.          if ((p = strtok (NULL, " ")) != NULL)
  1270.             strcpy (Nodes->Packer, p);
  1271.       }
  1272.       else if (!stricmp (p, "session")) {
  1273.          if ((p = strtok (NULL, " ")) != NULL) {
  1274.             if (!stricmp (p, "password") || !stricmp (p, "pwd")) {
  1275.                retval = TRUE;
  1276.                if ((p = strtok (NULL, " ")) != NULL)
  1277.                   strcpy (Nodes->SessionPwd, p);
  1278.             }
  1279.          }
  1280.       }
  1281.       else if (!stricmp (p, "areamgr") || !stricmp (p, "areafix")) {
  1282.          if ((p = strtok (NULL, " ")) != NULL) {
  1283.             if (!stricmp (p, "password") || !stricmp (p, "pwd")) {
  1284.                retval = TRUE;
  1285.                if ((p = strtok (NULL, " ")) != NULL)
  1286.                   strcpy (Nodes->AreaMgrPwd, p);
  1287.             }
  1288.          }
  1289.       }
  1290.       else if (!stricmp (p, "in")) {
  1291.          if ((p = strtok (NULL, " ")) != NULL) {
  1292.             if (!stricmp (p, "packet")) {
  1293.                if ((p = strtok (NULL, " ")) != NULL) {
  1294.                   if (!stricmp (p, "password") || !stricmp (p, "pwd")) {
  1295.                      retval = TRUE;
  1296.                      if ((p = strtok (NULL, " ")) != NULL)
  1297.                         strcpy (Nodes->InPktPwd, p);
  1298.                   }
  1299.                }
  1300.             }
  1301.          }
  1302.       }
  1303.       else if (!stricmp (p, "out")) {
  1304.          if ((p = strtok (NULL, " ")) != NULL) {
  1305.             if (!stricmp (p, "packet")) {
  1306.                if ((p = strtok (NULL, " ")) != NULL) {
  1307.                   if (!stricmp (p, "password") || !stricmp (p, "pwd")) {
  1308.                      retval = TRUE;
  1309.                      if ((p = strtok (NULL, " ")) != NULL)
  1310.                         strcpy (Nodes->OutPktPwd, p);
  1311.                   }
  1312.                }
  1313.             }
  1314.          }
  1315.       }
  1316.       else if (!stricmp (p, "create")) {
  1317.          if ((p = strtok (NULL, " ")) != NULL) {
  1318.             if (!stricmp (p, "new")) {
  1319.                if ((p = strtok (NULL, " ")) != NULL) {
  1320.                   if (!stricmp (p, "areas")) {
  1321.                      retval = TRUE;
  1322.                      Nodes->CreateNewAreas = TRUE;
  1323.                   }
  1324.                }
  1325.             }
  1326.          }
  1327.       }
  1328.       else if (!stricmp (p, "new")) {
  1329.          if ((p = strtok (NULL, " ")) != NULL) {
  1330.             if (!stricmp (p, "areas")) {
  1331.                if ((p = strtok (NULL, " ")) != NULL) {
  1332.                   if (!stricmp (p, "filter")) {
  1333.                      retval = TRUE;
  1334.                      if ((p = strtok (NULL, "")) != NULL) {
  1335.                         while (*p == ' ')
  1336.                            p++;
  1337.                         strcpy (Nodes->NewAreasFilter, p);
  1338.                      }
  1339.                   }
  1340.                }
  1341.             }
  1342.          }
  1343.       }
  1344.  
  1345.       if (retval == FALSE) {
  1346.          if (Nodes != NULL && NodesPending == TRUE) {
  1347.             if (NodesUpdate == TRUE)
  1348.                Nodes->Update ();
  1349.             else
  1350.                Nodes->Add ();
  1351.             NodesUpdate = NodesPending = FALSE;
  1352.          }
  1353.       }
  1354.    }
  1355.  
  1356.    return (retval);
  1357. }
  1358.  
  1359. int checkChannel (char *p)
  1360. {
  1361.    static int init = 0;
  1362.    int retval = FALSE;
  1363.  
  1364.    if (!stricmp (p, "channel")) {
  1365.       if ((p = strtok (NULL, " ")) != NULL) {
  1366.          retval = TRUE;
  1367.          if (ChannelPending == TRUE)
  1368.             Cfg->Save ();
  1369.          Cfg->NewChannel ();
  1370.          Cfg->TaskNumber = (USHORT)atoi (p);
  1371.          ChannelPending = TRUE;
  1372.          init = 0;
  1373.       }
  1374.    }
  1375.  
  1376.    if (ChannelPending == TRUE) {
  1377.       if (!stricmp (p, "port")) {
  1378.          retval = TRUE;
  1379.          if ((p = strtok (NULL, " ")) != NULL)
  1380.             strcpy (Cfg->Device, p);
  1381.       }
  1382.       else if (!stricmp (p, "speed")) {
  1383.          retval = TRUE;
  1384.          if ((p = strtok (NULL, " ")) != NULL)
  1385.             Cfg->Speed = atol (p);
  1386.       }
  1387.       else if (!stricmp (p, "lock")) {
  1388.          retval = TRUE;
  1389.          Cfg->LockSpeed = TRUE;
  1390.       }
  1391.       else if (!stricmp (p, "initialize")) {
  1392.          retval = TRUE;
  1393.          if ((p = strtok (NULL, "")) != NULL) {
  1394.             while (*p == ' ')
  1395.                p++;
  1396.             if (init < 3)
  1397.                strcpy (Cfg->Initialize[init++], p);
  1398.          }
  1399.       }
  1400.       else if (!stricmp (p, "answer")) {
  1401.          retval = TRUE;
  1402.          if ((p = strtok (NULL, " ")) != NULL)
  1403.             strcpy (Cfg->Answer, p);
  1404.       }
  1405.       else if (!stricmp (p, "ring")) {
  1406.          retval = TRUE;
  1407.          if ((p = strtok (NULL, " ")) != NULL)
  1408.             strcpy (Cfg->Ring, p);
  1409.       }
  1410.       else if (!stricmp (p, "dial")) {
  1411.          retval = TRUE;
  1412.          if ((p = strtok (NULL, " ")) != NULL) {
  1413.             if (!stricmp (p, "timeout")) {
  1414.                if ((p = strtok (NULL, " ")) != NULL)
  1415.                   Cfg->DialTimeout = (USHORT)atoi (p);
  1416.             }
  1417.             else
  1418.                strcpy (Cfg->Dial, p);
  1419.          }
  1420.       }
  1421.       else if (!stricmp (p, "hangup")) {
  1422.          retval = TRUE;
  1423.          if ((p = strtok (NULL, " ")) != NULL)
  1424.             strcpy (Cfg->Hangup, p);
  1425.       }
  1426.       else if (!stricmp (p, "offhook")) {
  1427.          retval = TRUE;
  1428.          if ((p = strtok (NULL, " ")) != NULL)
  1429.             strcpy (Cfg->OffHook, p);
  1430.       }
  1431.       else if (!stricmp (p, "fax")) {
  1432.          if ((p = strtok (NULL, " ")) != NULL) {
  1433.             if (!stricmp (p, "message")) {
  1434.                retval = TRUE;
  1435.                if ((p = strtok (NULL, " ")) != NULL)
  1436.                   strcpy (Cfg->FaxMessage, p);
  1437.             }
  1438.             else if (!stricmp (p, "command")) {
  1439.                retval = TRUE;
  1440.                if ((p = strtok (NULL, "")) != NULL) {
  1441.                   while (*p == ' ')
  1442.                      p++;
  1443.                   strcpy (Cfg->FaxCommand, p);
  1444.                }
  1445.             }
  1446.          }
  1447.       }
  1448.  
  1449.       if (retval == FALSE) {
  1450.          if (ChannelPending == TRUE) {
  1451.             Cfg->Save ();
  1452.             ChannelPending = FALSE;
  1453.          }
  1454.       }
  1455.    }
  1456.  
  1457.    return (retval);
  1458. }
  1459.  
  1460. int checkMenu (char *p)
  1461. {
  1462.    int retval = FALSE;
  1463.    char *a;
  1464.  
  1465.    if (!stricmp (p, "menu")) {
  1466.       if (Menu == NULL)
  1467.          Menu = new TMenu;
  1468.       if ((p = strtok (NULL, " ")) != NULL) {
  1469.          retval = TRUE;
  1470.          if (MenuPending == TRUE)
  1471.             Menu->Save (MenuName);
  1472.          delete Menu;
  1473.          Menu = new TMenu;
  1474.          Menu->New (TRUE);
  1475.          strcpy (MenuName, p);
  1476.          MenuPending = TRUE;
  1477.  
  1478.          if (LastOp != 5 && LastOp != 0)
  1479.             cprintf ("\r\n");
  1480.          cprintf ("\r +-- Menu '%s' ", MenuName);
  1481.          LastOp = 5;
  1482.       }
  1483.    }
  1484.  
  1485.    if (MenuPending == TRUE) {
  1486.       if (!stricmp (p, "prompt")) {
  1487.          retval = TRUE;
  1488.          if ((p = strtok (NULL, "")) != NULL) {
  1489.             while (*p == ' ' || *p == '"')
  1490.                p++;
  1491.             a = p;
  1492.             while (*p != '"') {
  1493.                if (*p == '\\' && p[1] == '"')
  1494.                   p++;
  1495.                p++;
  1496.             }
  1497.             *p++ = '\0';
  1498.             strcpy (Menu->Prompt, a);
  1499.             if ((p = strtok (p, " ")) != NULL)
  1500.                Menu->PromptColor = (UCHAR)atoi (p);
  1501.             if ((p = strtok (NULL, " ")) != NULL)
  1502.                Menu->PromptHilight = (UCHAR)atoi (p);
  1503.          }
  1504.       }
  1505.       else if (!stricmp (p, "item")) {
  1506.          retval = TRUE;
  1507.          Menu->New ();
  1508.  
  1509.          p = strtok (NULL, "");
  1510.          while (*p == ' ')
  1511.             p++;
  1512.          if (*p != '"') {
  1513.             a = p;
  1514.             while (*p != ' ')
  1515.                p++;
  1516.             *p++ = '\0';
  1517.             strcpy (Menu->Key, a);
  1518.             while (*p == ' ')
  1519.                p++;
  1520.          }
  1521.          if (*p == '"') {
  1522.             a = ++p;
  1523.             while (*p != '"') {
  1524.                if (*p == '\\' && p[1] == '"')
  1525.                   p++;
  1526.                p++;
  1527.             }
  1528.             *p++ = '\0';
  1529.             strcpy (Menu->Display, a);
  1530.          }
  1531.          if ((p = strtok (p, " ")) != NULL)
  1532.             Menu->Level = (UCHAR)atoi (p);
  1533.          if ((p = strtok (NULL, " ")) != NULL)
  1534.             Menu->Color = (UCHAR)atoi (p);
  1535.          if ((p = strtok (NULL, " ")) != NULL)
  1536.             Menu->Hilight = (UCHAR)atoi (p);
  1537.          Menu->Command = 0;
  1538.          Menu->Argument[0] = '\0';
  1539.          if ((p = strtok (NULL, " ")) != NULL)
  1540.             Menu->Command = (USHORT)atoi (p);
  1541.          if ((p = strtok (NULL, "")) != NULL) {
  1542.             while (*p == ' ')
  1543.                p++;
  1544.             strcpy (Menu->Argument, p);
  1545.          }
  1546.          Menu->Add ();
  1547.       }
  1548.  
  1549.       if (retval == FALSE) {
  1550.          if (MenuPending == TRUE) {
  1551.             Menu->Save (MenuName);
  1552.             MenuPending = FALSE;
  1553.          }
  1554.       }
  1555.    }
  1556.  
  1557.    return (retval);
  1558. }
  1559.  
  1560. void processFile (char *file)
  1561. {
  1562.    FILE *fp;
  1563.    CHAR Temp[512], *p;
  1564.  
  1565.    printf (" * Compiling '%s'\n", file);
  1566.    if ((fp = fopen (file, "rt")) != NULL) {
  1567.       while (fgets (Temp, sizeof (Temp) - 1, fp) != NULL) {
  1568.          if ((p = strchr (Temp, '\r')) != NULL)
  1569.             *p = '\0';
  1570.          if ((p = strchr (Temp, '\n')) != NULL)
  1571.             *p = '\0';
  1572.          if ((p = strtok (Temp, " ")) != NULL) {
  1573.             if (*p == '%' || *p == ';' || *p == '\0')
  1574.                continue;
  1575.             if (!stricmp (p, "include")) {
  1576.                if ((p = strtok (NULL, " ")) != NULL) {
  1577.                   if (LastOp != 0)
  1578.                      printf ("\n");
  1579.                   LastOp = 0;
  1580.                   processFile (p);
  1581.                }
  1582.             }
  1583.             else if (!stricmp (p, "define")) {
  1584.                if ((p = strtok (NULL, " ")) != NULL) {
  1585.                   if (checkCompressor (p) == FALSE) {
  1586.                      if (checkNodes (p) == FALSE)
  1587.                         checkMenu (p);
  1588.                   }
  1589.                }
  1590.             }
  1591.             else if (NodesPending == TRUE)
  1592.                checkNodes (p);
  1593.             else if (PackerPending == TRUE)
  1594.                checkCompressor (p);
  1595.             else if (MenuPending == TRUE)
  1596.                checkMenu (p);
  1597.             else if (checkSystemConfiguration (p) == FALSE) {
  1598.                if (checkChannel (p) == FALSE) {
  1599.                   if (checkMessageAreas (p) == FALSE)
  1600.                      checkFileAreas (p);
  1601.                }
  1602.             }
  1603.          }
  1604.       }
  1605.       fclose (fp);
  1606.    }
  1607. }
  1608.  
  1609. void main (void)
  1610. {
  1611.    int i;
  1612.    FILE *fp;
  1613.  
  1614.    if ((Cfg = new TConfig) != NULL)
  1615.       Cfg->New ();
  1616. //      Cfg->Default ();
  1617.    Msg = NULL;
  1618.    File = NULL;
  1619.    LastOp = 0;
  1620.  
  1621.    printf ("\nLC; %s v%s - Configuration file compiler\n", NAME, VERSION);
  1622.    printf ("    Copyright (c) 1991-96 by Marco Maccaferri. All Rights Reserved.\n\n");
  1623.  
  1624.    if (ValidateKey ("bbs", NULL, NULL) == KEY_UNREGISTERED) {
  1625.       printf ("* * *     WARNING: No license key found    * * *\n");
  1626.       if ((i = CheckExpiration ()) == 0) {
  1627.          printf ("* * *   This evaluation copy has expired   * * *\n\a\n");
  1628.           exit (0);
  1629.       }
  1630.       else
  1631.          printf ("* * * You have %2d days left for evaluation * * * \n\a\n", i);
  1632.    }
  1633.  
  1634.    processFile ("lora.cfg");
  1635.  
  1636.    if (Msg != NULL && MsgPending == TRUE) {
  1637.       if (MsgUpdate == TRUE)
  1638.          Msg->Update ();
  1639.       else
  1640.          Msg->Add ();
  1641.    }
  1642.    if (File != NULL && FilePending == TRUE) {
  1643.       if (FileUpdate == TRUE)
  1644.          File->Update ();
  1645.       else
  1646.          File->Add ();
  1647.    }
  1648.    if (Packer != NULL && PackerPending == TRUE) {
  1649.       if (PackerUpdate == TRUE)
  1650.          Packer->Update ();
  1651.       else
  1652.          Packer->Add ();
  1653.    }
  1654.    if (Nodes != NULL && NodesPending == TRUE) {
  1655.       if (NodesUpdate == TRUE)
  1656.          Nodes->Update ();
  1657.       else
  1658.          Nodes->Add ();
  1659.    }
  1660.    if (Menu != NULL && MenuPending == TRUE)
  1661.       Menu->Save (MenuName);
  1662.    if (Cfg != NULL)
  1663.       Cfg->Save ();
  1664.  
  1665.    printf ("\r\n * Done\n\n");
  1666. }
  1667.  
  1668. /*
  1669. void main (int argc, char *argv[])
  1670. {
  1671.    FILE *fp;
  1672.    class TMenu *Menu;
  1673.  
  1674.    if ((Menu = new TMenu) != NULL) {
  1675.       Menu->Load (argv[1]);
  1676.       if ((fp = fopen ("m.cfg", "at")) != NULL) {
  1677.          fprintf (fp, "\ndefine menu %s\n", argv[1]);
  1678.          fprintf (fp, "   text color    %d\n", Menu->PromptColor);
  1679.          fprintf (fp, "   hilight color %d\n", Menu->PromptHilight);
  1680.          fprintf (fp, "   prompt        \"%s\"\n\n", Menu->Prompt);
  1681.  
  1682.          if (Menu->First () == TRUE)
  1683.             do {
  1684.                fprintf (fp, "   item   %s \"%s\" %d %d %d %s\n", Menu->Key, Menu->Display, Menu->Color, Menu->Hilight, Menu->Command, Menu->Argument);
  1685.             } while (Menu->Next () == TRUE);
  1686.          fclose (fp);
  1687.       }
  1688.       delete Menu;
  1689.    }
  1690. }
  1691. */
  1692.