home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / UTIL / WWIVSOR / LILO.C < prev    next >
Text File  |  1996-12-04  |  26KB  |  1,002 lines

  1. #include "vars.h"
  2.  
  3. #pragma hdrstop
  4.  
  5. extern char cid_num[], cid_name[];
  6.  
  7. void random_screen(char *s1)
  8. {
  9.   char s[81];
  10.   int i,ns=0;
  11.  
  12.   sprintf(s,"%s%s%s",languagedir,s1,".0");
  13.   if (exist(s) && !rip_on()) {
  14.     for (i=0;i<1000;i++) {
  15.       sprintf(s,"%s%s.%d",languagedir,s1,i);
  16.       if (exist(s))
  17.         ns++;
  18.       else
  19.         break;
  20.     }
  21.     sprintf(s,"%s.%d",s1,random(ns));
  22.   } else if (rip) {
  23.     sprintf(s,"%s%s%s",languagedir,s1,".R0");
  24.     if (exist(s)) {
  25.       for (i=0;i<100;i++) {
  26.         sprintf(s,"%s%s.R%d",languagedir,s1,i);
  27.         if (exist(s))
  28.           ns++;
  29.         else
  30.           break;
  31.       }
  32.       sprintf(s,"%s%s.R%d",languagedir, s1, random(ns));
  33.     } else
  34.       sprintf(s,"%s%s%s",languagedir, s1, ".RIP");
  35.   } else
  36.     sprintf(s,"%s%s",s1,".ANS");
  37.   printfile(s);
  38. }
  39.  
  40. int usa_phone_convention(userrec *u)
  41. {
  42.   if ((strcmp(u->country,"USA")==0) ||
  43.       (strcmp(u->country,"CAN")==0) ||
  44.       (strcmp(u->country,"MEX")==0))
  45.     return(1);
  46.   return(0);
  47. }
  48.  
  49.  
  50. void getuser(void)
  51. {
  52.   char s[161],s2[161],s3[161],s4[161],*ss;
  53.   int ok,count,net_only,ans,i;
  54.   long l;
  55.   FILE *f;
  56.  
  57.   net_only=1;
  58.   if (syscfg.netlowtime!=syscfg.nethightime) {
  59.     if (syscfg.nethightime>syscfg.netlowtime) {
  60.       if ((timer()<=(syscfg.netlowtime*60.0))
  61.           || (timer()>=(syscfg.nethightime*60.0)))
  62.         net_only=0;
  63.     } else {
  64.       if ((timer()<=(syscfg.netlowtime*60.0))
  65.           && (timer()>=(syscfg.nethightime*60.0)))
  66.         net_only=0;
  67.     }
  68.   } else
  69.     net_only=0;
  70.   count=0;
  71.   ok=0;
  72.   checkit=1;
  73.   okmacro=0;
  74.   curconfsub=curconfdir=0;
  75.   actsl=syscfg.newusersl;
  76.   if ((!net_only) && (incom)) {
  77. #ifdef OLD
  78.     outstr(get_string(1168));
  79.     thisuser.sysstatus=0;
  80.     ans=yn();
  81. #else
  82.     ans=check_ansi();
  83. #endif
  84.     ripcode = 0;
  85.     if (sysinfo.flags & OP_FLAGS_RIP_SUPPORT)
  86.       rip_detect();
  87.     else
  88.       end_rip();
  89.     sprintf(s,"%sWELCOME.ANS",languagedir);
  90.     if (exist(s) || rip) {
  91.       nl();
  92.       if (ans>0 || rip) {
  93.         thisuser.sysstatus |= sysstatus_ansi;
  94.         thisuser.sysstatus |= sysstatus_color;
  95.         if (rip)
  96.           ripcode = 1;
  97.         random_screen("WELCOME");
  98.         if (rip)
  99.           ripcode = 0;
  100.       } else if (ans==0)
  101.         printfile("WELCOME.MSG");
  102.     } else {
  103.       if (ans) {
  104.         sprintf(s,"%sWELCOME.0",languagedir);
  105.         if (exist(s))
  106.           random_screen("WELCOME");
  107.         else
  108.           printfile("WELCOME.MSG");
  109.       } else
  110.         printfile("WELCOME.MSG");
  111.     }
  112.   }
  113.   if (curatr!=7)
  114.     reset_colors();
  115.   do {
  116.       nl();
  117.       if (net_only) {
  118.         pl(get_string(353));
  119.         pl(get_string(354));
  120.       } else
  121.         pl("1Enter alias, user number, or 'NEW'");
  122.  
  123.       outstr(get_string(356));
  124.       outstr("\b\b\b\b1Alias7/1Number7:1 ");
  125.       if (rip) {
  126.         if (rip_subset) {
  127.           printmenu(353);
  128.           pl("");
  129.         } else {
  130.           sprintf(s,"\1|1\x1b""0000$%s_ID$^m|#\r ", sysinfo.ripbbsid);
  131.           comstr(s);
  132. #ifdef RIPDRIVE
  133.           if (rd_on()) {
  134.             sprintf(s,"%sMENU353.LCL", sysinfo.ripdir);
  135.             rd_str("\x1b[30;47m");
  136.             rd_print(s);
  137.             rd_str("\x1b[30;47m\n");
  138.           }
  139. #endif
  140.         }
  141.       }
  142.  
  143.       input(s,30);
  144.       if (rip && rip_subset) {
  145.         rip_rtwpcb();
  146.         comstr("\x1b[37;40m");
  147.         comnl(get_string(1435));
  148.       }
  149. #ifdef RIPDRIVE
  150.       else if (rip && rd_on()) {
  151.     rd_str("\1|1\x1b""0000$RTW$$PCB$\r");
  152.     pl(s);
  153.       }
  154. #endif
  155.  
  156.     usernum=finduser(s);
  157.     if ((net_only) && (usernum!=-2))
  158.       usernum=0;
  159.     if (usernum>0) {
  160.       read_user(usernum,&thisuser);
  161.       read_qscn(usernum,qsc,0);
  162.       if (set_language(thisuser.language)) {
  163.         thisuser.language=0;
  164.         set_language(thisuser.language);
  165.       }
  166.       if ((thisuser.sl < 255) && (user_online(usernum, &i))) {
  167.         nl();
  168.         ansic(6);
  169.         outstr(get_string(1400));
  170.         npr("%d!",i);
  171.         nl();
  172.         continue;
  173.       }
  174.       ok=1;
  175.       actsl = syscfg.newusersl;
  176.       topscreen();
  177.       outstr("1Password7:1 ");
  178.           if (rip_on()) {            /* Password dialog is special */
  179.         printmenu(355);
  180.         if (!rip_subset) {
  181.           comstr("\1|1F000000PASS.RIP|#\r ");   /* Check for PASS.RIP */
  182.           if (getkey() == '1')
  183.             comstr("\1|1R00000000PASS.RIP\r ");         /* and play if exists */
  184.         }
  185.         pl("\x1b[30;47m");
  186.       }
  187.  
  188.       echo=0;
  189.       input(s,8);
  190.           if (rip_on()) {
  191.         rip_rtwpcb();
  192.         comstr("\x1b[37;40m");
  193.         comnl(get_string(1436));     //ripstring(2));
  194.       }
  195.  
  196.       if (strcmp(s,thisuser.pw)!=0)
  197.         ok=0;
  198.       if (((syscfg.sysconfig & sysconfig_free_phone)==0)) {
  199.         if (usa_phone_convention(&thisuser) || !thisuser.country[0]) {
  200.           outstr("1Phone ■■■7-1■■■7-1");
  201.                   if (rip_on()) {
  202.             if (rip_subset) {
  203.               printmenu(354);
  204.               pl("\x1b[30;47m");
  205.             } else {
  206.               if (rip_ver >= 20000)
  207.                             comstr("\1|1\x1b""0000$PHONE$^m|#\r ");
  208.               else
  209.                             comstr("\1|1\x1b""0000$PHONE_LAST4$^m|#\r ");
  210. #ifdef RIPDRIVE
  211.                           if (rd_on()) {
  212.                                 sprintf(s,"%sMENU354.LCL", sysinfo.ripdir);
  213.                 rd_print(s);
  214.                 rd_str("\x1b[30;47m\n");
  215.               }
  216. #endif
  217.             }
  218.           } 
  219.           echo=0;
  220.           input(s2,4);
  221.                   if (rip_on() && rip_subset) {
  222.             rip_rtwpcb();
  223.             comstr("");
  224.             comnl(get_string(1437));     //ripstring(3));
  225.           }
  226. #ifdef RIPDRIVE
  227.                   if (rip_on() && rd_on()) {
  228.             rd_str("\x1b[37;40m");
  229.             rd_str("\1|1\x1b""0000$RTW$$PCB$\r");
  230.             pl(s2);
  231.           }
  232. #endif
  233.  
  234.           if (strcmp(s2,&thisuser.phone[8])!=0) {
  235.             ok=0;
  236.             if ((strlen(s2)==4) && (s2[3]=='-')) {
  237.               nl();
  238.               pl(get_string(359));
  239.               nl();
  240.             }
  241.           }
  242.         }
  243.       }
  244.       if ((thisuser.sl==255) && (incom) && (ok)) {
  245.         outstr("1SY7: ");
  246.                 if (rip_on()) {            /* Password dialog is special */
  247.           printmenu(356);
  248.           pl("\x1b[30;47m");
  249.         }
  250.         echo=0;
  251.         input(s4,20);
  252.                 if (rip_on()) {
  253.           rip_rtwpcb();
  254.           comstr("");
  255.           comnl(get_string(1438));       //ripstring(4));
  256.         }
  257.         if (strcmp(s4,syscfg.systempw)!=0)
  258.           ok=0;
  259.       }
  260.       echo=1;
  261.       if (ok) {
  262.         reset_act_sl();
  263.         changedsl();
  264.       } else {
  265.         ++thisuser.illegal;
  266.         write_user(usernum,&thisuser);
  267.         nl();
  268.         pl(get_string(360));
  269.         nl();
  270.         sprintf(s3,get_stringx(1,21),
  271.           nam(&thisuser,usernum),ctim(timer()),s);
  272.         if (((syscfg.sysconfig & sysconfig_free_phone)==0) &&
  273.            (usa_phone_convention(&thisuser))) {
  274.           sprintf(s4,get_stringx(1,22),s2);
  275.           strcat(s3,s4);
  276.         }
  277.         sl1(0,"");
  278.         sl1(0,s3);
  279.         sl1(0,"");
  280.         usernum=0;
  281.       }
  282.     } else
  283.       if (usernum==-1) {
  284.         write_inst(INST_LOC_NEWUSER, 0, INST_FLAGS_NONE);
  285.         play_sdf("NEWUSER",0);
  286.                 checkit=0;
  287.         newuser();
  288.         ok=1;
  289.       } else
  290.             if (usernum==0) {
  291.               if (net_only)
  292.                     nl();
  293.               else
  294.                     pl(get_string(8));
  295.             } else
  296.               if ((usernum==-2) || (usernum==-3) || (usernum==-4)) {
  297.                 if (incom) {
  298.                   read_status();
  299.                   time(&l);
  300.                   s2[0]=0;
  301.                   switch(usernum) {
  302.                     case -2:
  303.                       if ((instance==1) || (status.net_version>=34)) {
  304.                             sprintf(s2,"NETWORK /B%u /T%ld /F%u",
  305.                               modem_speed, l, modem_flag);
  306.                             write_inst(INST_LOC_NET, 0, INST_FLAGS_NONE);
  307.                             extern_prog(s2, EFLAG_SHRINK);
  308.                             set_net_num(0);
  309.                       }
  310.                       break;
  311.                     case -3:
  312.                       sprintf(s2,"REMOTE /B%u /F%u",
  313.                             modem_speed, modem_flag);
  314.                       extern_prog(s2, EFLAG_SHRINK);
  315.                       break;
  316.                     case -4:
  317.                       s[8]=0;
  318.                       if (s[0]) {
  319.                         sprintf(s2,"%s /B%u /F%u",
  320.                           s, modem_speed, modem_flag);
  321.                         sprintf(s3,"%sREMOTES.DAT",syscfg.datadir);
  322.                         f=fsh_open(s3,"rt");
  323.                         if (f) {
  324.                           ok=0;
  325.                           while ((!ok) && (fgets(s3,80,f))) {
  326.                                 ss=strchr(s3,'\n');
  327.                                 if (ss)
  328.                                   *ss=0;
  329.                                 if (stricmp(s3,s)==0)
  330.                                   ok=1;
  331.                           }
  332.                           fsh_close(f);
  333.                           if (ok) {
  334.                                 extern_prog(s2, EFLAG_SHRINK);
  335.                           }
  336.                         }
  337.                       }
  338.                       break;
  339.                   }
  340.                   read_status();
  341.                   hangup=1;
  342.                   dtr(0);
  343.                   global_xx=0;
  344.                   Wait(1.0);
  345.                   dtr(1);
  346.                   Wait(0.1);
  347.                   cleanup_net();
  348.                   imodem(0);
  349.                 }
  350.                 hangup=1;
  351.               }
  352.   } while ((!hangup) && (!ok) && (++count<3));
  353.   if (count==3)
  354.     hangup=1;
  355.   checkit=0;
  356.   okmacro=1;
  357.   if ((!hangup) && (usernum>0) && (thisuser.restrict & restrict_logon) &&
  358.     (strcmp(date(),thisuser.laston)==0) && (thisuser.ontoday>0)) {
  359.     nl();
  360.     pl(get_string(361));
  361.     nl();
  362.     hangup=1;
  363.   }
  364. }
  365.  
  366.  
  367. void logon(void)
  368. {
  369.   char s[255],s1[181],s2[81],*ss;
  370.   char speed[40],ch;
  371.   int i,i1,dv,win,f,ac;
  372.   long len,pos;
  373.   long l;
  374.  
  375.   if (usernum<1) {
  376.     hangup=1;
  377.     return;
  378.   }
  379.   useron=1;
  380.   write_inst(INST_LOC_LOGON,0,INST_FLAGS_NONE);
  381.   if (live_user) {
  382.     reset_colors();
  383.     ansic(0);
  384.     outchr(12);
  385.   }
  386.   if ((thisuser.num_extended) > sysinfo.max_extend_lines)
  387.     thisuser.num_extended=sysinfo.max_extend_lines;
  388.   if ((thisuser.colors[8]==0) || (thisuser.colors[9]==0)) {
  389.     thisuser.colors[8]=6;
  390.     thisuser.colors[9]=3;
  391.   }
  392.   if (incom && live_user) {
  393.     if (rip_on()) {
  394.       if (rip_subset) {
  395.         ripcode = 1;
  396.         random_screen("hello");
  397.       } else {
  398.         comstr("\1|1F000000HELLO.RIP|#\n");    /* Check for HELLO.RIP locally */
  399.         ch = getkey();
  400.         if (ch == '1') {                /* Local playback of HELLO if there */
  401.           comstr("\1|1R00000000HELLO.RIP\n");
  402.         } else {
  403.           ripcode = 1;
  404.           random_screen("hello");
  405.         }
  406.       }
  407.       ripcode = 0;
  408.     }
  409.     play_sdf("LOGON",0);
  410.     i=printfile("LOGON");
  411.     if ((!i) && (!(thisuser.sysstatus & sysstatus_pause_on_page)))
  412.       pausescr();
  413.   }
  414.   strcpy(xdate,date());
  415.   if (strcmp(xdate,thisuser.laston)==0)
  416.     ++thisuser.ontoday;
  417.   else {
  418.     thisuser.ontoday=1;
  419.     thisuser.timeontoday=0.0;
  420.     thisuser.extratime=0.0;
  421.     thisuser.posttoday=0;
  422.     thisuser.etoday=0;
  423.     thisuser.fsenttoday1=0;
  424.   }
  425.   ++thisuser.logons;
  426.   cursub=0;
  427.   msgreadlogon=0;
  428.   if ((udir[0].subnum==0) && (udir[1].subnum>0))
  429.     curdir=1;
  430.   else
  431.     curdir=0;
  432.   curdloads=0;
  433.   if (actsl!=255) {
  434.     lock_status();
  435.     ++status.callernum1;
  436.     ++status.callstoday;
  437.     save_status();
  438.   }
  439.   if (rip_on()) {
  440.     strcpy (speed, curspeed);
  441.     strcpy (curspeed, "RIP/");
  442.     strcat (curspeed, speed);
  443.   }
  444.  
  445. /*Stimpy reset your colors */
  446.       thisuser.colors[0]=sysinfo.newuser_colors[0];
  447.       thisuser.colors[3]=sysinfo.newuser_colors[3];
  448.       thisuser.colors[5]=sysinfo.newuser_colors[5];
  449.       thisuser.colors[8]=sysinfo.newuser_colors[8];
  450.       thisuser.colors[9]=sysinfo.newuser_colors[9];
  451.  
  452.     sprintf(s,"%ld: %s %s %s   %s - %d (%d)",
  453.     status.callernum1,
  454.     nam(&thisuser,usernum),
  455.     times(),
  456.     date(),
  457.     curspeed,
  458.     thisuser.ontoday,
  459.     instance);
  460.   sprintf(s2,"%sLASTON.TXT",syscfg.gfilesdir);
  461.   ss=get_file(s2,&len);
  462.   pos=0;
  463.   if (ss!=NULL) {
  464.     if (!cs())
  465.       for (i=0; i<4; i++)
  466.         copy_line(s1,ss,&pos,len);
  467.     i=1;
  468.     do {
  469.       copy_line(s1,ss,&pos,len);
  470.       if ((s1[0]) && live_user) {
  471.         if (i) {
  472.           nln(2);
  473.           outchr(12);
  474.           pl("8┌────────────────────────────∙∙∙··· ·  ·");
  475.           pl("8│3Last Few Callers8...");
  476.           pl("8└────────────────────────────∙∙∙··· ·  ·");
  477.           nl();
  478.           if (sysinfo.flags & OP_FLAGS_SHOW_CITY_ST) {
  479.             if (syscfg.sysconfig & sysconfig_extended_info)
  480.               pl(get_string(1429));
  481.             else
  482.               pl(get_string(972));
  483.           } else {
  484.             pl("            7────────══════════════════════════════════════────────");
  485.             pl("3Number  Name/Alias                City      Time  Date Speed                 ##");
  486.           }
  487.           ansic(7);
  488.           i=(okansi())?205:'=';
  489.           pl(charstr(79,i));
  490.           i=0;
  491.         }
  492.         pl(s1);
  493.       }
  494.     } while (pos<len);
  495.   }
  496.  
  497.   if ((actsl!=255) || (incom)) {
  498.     sl1(0,"");
  499.     sl1(0,stripcolors(s));
  500.     sl1(1,"");
  501.     if (cid_num[0]) {
  502.       sprintf(s,"CID NUM : %s", cid_num);
  503.       sysoplog(s);
  504.     }
  505.     if (cid_name[0]) {
  506.       sprintf(s,"CID NAME: %s", cid_name);
  507.       sysoplog(s);
  508.     }
  509.  
  510.     if (sysinfo.flags & OP_FLAGS_SHOW_CITY_ST) {
  511.       if (syscfg.sysconfig & sysconfig_extended_info)
  512.         sprintf(s,"5%-6ld %-25.25s %-5.5s %-5.5s %-15.15s %-2.2s %-3.3s %-8.8s %2d\r\n",
  513.           status.callernum1,
  514.           nam(&thisuser,usernum),
  515.           times(),
  516.           date(),
  517.           thisuser.city,
  518.           thisuser.state,
  519.           thisuser.country,
  520.           curspeed,
  521.           thisuser.ontoday);
  522.       else
  523.         sprintf(s,"5%-6ld %-25.25s %-10.10s %-5.5s %-5.5s %-20.20s %2d\r\n",
  524.           status.callernum1,
  525.           nam(&thisuser,usernum),
  526.           thisuser.city,
  527.           times(),
  528.           date(),
  529.           curspeed,
  530.           thisuser.ontoday);
  531.     } else {
  532.       sprintf(s,"5%-6ld %-25.25s %-10.10s %-5.5s %-5.5s %-20.20s %2d\r\n",
  533.         status.callernum1,
  534.         nam(&thisuser,usernum),
  535.         thisuser.city,
  536.         times(),
  537.         date(),
  538.         curspeed,
  539.         thisuser.ontoday);
  540.     }
  541.  
  542.     if (actsl!=255) {
  543.       sprintf(s1,"%sUSER.LOG",syscfg.gfilesdir);
  544.       f=sh_open(s1,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
  545.       if (f>-1) {
  546.         sh_lseek(f,0L,SEEK_END);
  547.         sh_write(f,(void *)s,strlen(s));
  548.         sh_close(f);
  549.       }
  550.  
  551.       f=sh_open(s2,O_RDWR | O_BINARY | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
  552.       if (f>-1) {
  553.         pos=0;
  554.         copy_line(s1,ss,&pos,len);
  555.         for (i=1; i<8; i++) {
  556.           copy_line(s1,ss,&pos,len);
  557.           strcat(s1,"\r\n");
  558.           sh_write(f,(void *)s1,strlen(s1));
  559.         }
  560.         sh_write(f,(void *)s,strlen(s));
  561.         sh_close(f);
  562.       }
  563.     }
  564.   }
  565.  
  566.   if (ss!=NULL)
  567.     bbsfree(ss);
  568.   if (live_user) {
  569.     read_automessage();
  570.     pausescr();
  571.     outchr(12);
  572.   }
  573.   timeon=timer();
  574.   if (live_user) {
  575.     topscreen();
  576.         if (rip_on())
  577.       rip_menus();
  578.   }
  579.   if ((syscfg.logon_c[0]) && live_user) {
  580.     nl();
  581.     stuff_in(s,syscfg.logon_c,create_chain_file(),"","","","");
  582.     extern_prog(s, sysinfo.spawn_opts[3]);
  583.     nln(2);
  584.   }
  585.   if (live_user) {
  586.     nl();
  587.     pl("3                                 ┌─────────┐");
  588.     pl("3                                 │  5Stats  3│");
  589.     pl("3          ┌──────────────────────┴─────────┴────────────────────────┐");
  590.     npr("3          │1Name3:7 %-22s3       1Caller number  3: 7%-4ld3│\r\n",nam(&thisuser,usernum),status.callernum1);
  591.     npr("3          │1Time allowed on3:7 %-12d      1Post/Call Ratio3: 7%-5.3f3│\r\n", (int) ((nsl()+30)/60.0),post_ratio(),syscfg.post_call_ratio);
  592.     npr("3          │1Illegal logons3 :6 %-12d      1Mail Waiting   3: 6%-3d  3│\r\n",thisuser.illegal,thisuser.waiting);
  593.     npr("3          │1Last on       3 :7 %-12s      1Times on today 3: 7%-3d  3│\r\n",thisuser.laston,thisuser.ontoday);
  594.     if (sysop2())
  595.       npr("3          │1Sysop is      3 :7 Watching your every move!               3│\r\n");
  596.     else
  597.       npr("3          │1Sysop is      3 :7 Out Llama tipping!                      3│\r\n");
  598. /****************************************************************************/
  599. /*
  600.  * Do NOT remove or modify this part of the code.  If the registration number
  601.  * (or an indicator that it is unregistered) is not printed out, it will
  602.  * be plainly obvious that this is a 'pirated' version of the source code.
  603.  */
  604.     if (syscfg.wwiv_reg_number)
  605.       sprintf(s,"(Reg #%ld)",syscfg.wwiv_reg_number);
  606.     else
  607.       strcpy(s,"(Unregistered)");
  608.     sprintf(s1," 3         │1System is     3 :7 %s   %s 3              │",wwiv_version,s);
  609.     pl(s1);
  610.     pl("3          └─────────────────────────────────────────────────────────┘");
  611. /****************************************************************************/
  612.  
  613.      nl();
  614.     pl("3System Stats5:");
  615.     read_status();
  616.     for (i=0; i<net_num_max; i++) {
  617.       if (net_networks[i].sysnum) {
  618.         sprintf(s,"3%s %s5",net_networks[i].name, get_string(370));
  619.         strcat(s,charstr(18-strlen(stripcolors(s)),'.'));
  620.         strcat(s,"5");
  621.         sprintf(s1,"3%s 5@3%u5",s,net_networks[i].sysnum);
  622.         if (i)
  623.           pl(s1);
  624.         else {
  625.           for (i1=strlen(s1); i1<26; i1++)
  626.             s1[i1]=' ';
  627.           s1[i1]=0;
  628.           npr("3%s  5(3net%u5)\r\n",s1,status.net_version);
  629.         }
  630.       }
  631.     }
  632.     if (multitasker) {
  633.       outstr("3Multitasker5 :3 ");
  634.       switch (multitasker) {
  635.         case 1 :
  636.           dv=get_dv_version();
  637.           npr("DESQView 1%d.%02d\r\n",dv/256,dv%256);
  638.         break;
  639.         case 2 :
  640.           win=get_win_version();
  641.           npr("3Windows %d.%02d\r\n",win%256,win/256);
  642.         break;
  643.         case 3 :
  644.           win=get_win_version();
  645.           dv=get_dv_version();
  646.           npr("Win 1%d.%02d 9and 2DV 1%d.%02d\r\n",
  647.             win%256,win/256,dv/256,dv%256);
  648.         break;
  649.         case 4 :
  650.                 case 5 :
  651.                 case 6 :
  652.                 case 7 :
  653.                   if ((_osmajor/10==2) && (_osminor==30))
  654.                     npr("OS/2 3.0 1WARP\r\n");
  655.                   else
  656.                     npr("OS/2 1%d.%2.2d\r\n",_osmajor/10,_osminor);
  657.         break;
  658.         default:
  659.           pl(get_string(1170));
  660.       }
  661.     }
  662.     npr("3Instance5    : 3%d\r\n",instance);
  663.     outstr_x1("3Total Users5 :3 "); pln(status.users);
  664.           if (num_instances() > 1)
  665.             multi_instance();
  666.  
  667.     nl();
  668.     if (thisuser.forwardusr) {
  669.       if (thisuser.forwardsys) {
  670.         set_net_num(thisuser.net_num);
  671.         if (!valid_system(thisuser.forwardsys)) {
  672.           thisuser.forwardusr=0;
  673.           thisuser.forwardsys=0;
  674.           strcpy(s1,get_string(371));
  675.         } else {
  676.           strcpy(s1,"1Mail set to be forwarded to7:1 ");
  677.           if (net_num_max>1)
  678.             sprintf(s2,"%s #%u @%u.",
  679.                 net_name,thisuser.forwardusr,thisuser.forwardsys);
  680.           else
  681.             sprintf(s2,"#%u @%u.",
  682.                 thisuser.forwardusr,thisuser.forwardsys);
  683.           strcat(s1,s2);
  684.         }
  685.       } else {
  686.         if (thisuser.forwardusr==65535)
  687.           strcpy(s1,"1Your mailbox is closed");
  688.         else {
  689.           strcpy(s1,"1Mail set to be forwarded to7:1 ");
  690.           sprintf(s2,"#%u.",thisuser.forwardusr);
  691.           strcat(s1,s2);
  692.         }
  693.       }
  694.       pl(s1);
  695.       nl();
  696.     }
  697.     if (ltime) {
  698.       nl();
  699.       pl(get_string(374));
  700.       nl();
  701.     }
  702.     fsenttoday=0;
  703.     if (thisuser.year) {
  704.       s[0]=years_old(thisuser.month,thisuser.day,thisuser.year);
  705.       if (thisuser.age!=s[0]) {
  706.         thisuser.age=s[0];
  707.         topscreen();
  708.       }
  709.     } else {
  710.       nl();
  711.       pl(get_string(375));
  712.       do {
  713.         nl();
  714.         input_age(&thisuser);
  715.         sprintf(s,"%02d/%02d/%02d",
  716.           (int) thisuser.month,
  717.           (int) thisuser.day,
  718.           (int) thisuser.year);
  719.         nl();
  720.         outstr(s);
  721.         outstr(get_string(376));
  722.         if (!yn())
  723.           thisuser.year=0;
  724.       } while ((!hangup) && (thisuser.year==0));
  725.     }
  726.     if (!thisuser.realname[0])
  727.       input_realname();
  728.     if (syscfg.sysconfig & sysconfig_extended_info) {
  729.       if (!thisuser.street[0])
  730.         input_street();
  731.       if (!thisuser.city[0])
  732.         input_city();
  733.       if (!thisuser.state[0])
  734.         input_state();
  735.       if (!thisuser.country[0])
  736.         input_country();
  737.       if (!thisuser.zipcode[0])
  738.         input_zipcode();
  739.       if (!thisuser.dataphone[0]) {
  740.         input_dataphone();
  741.       }
  742.       if (sysinfo.flags & OP_FLAGS_USER_REGIST) {
  743. #define SECS_PER_DAY 86400L
  744.         if (thisuser.registered != 0) {
  745.           time(&l);
  746.           if ((thisuser.expires < l+30*SECS_PER_DAY)
  747.             && (thisuser.expires > l+10*SECS_PER_DAY)) {
  748.             npr("%s%d %s.\r\n\r\n", get_string(1394),
  749.               (int)((thisuser.expires-l)/SECS_PER_DAY),get_string(1395));
  750.           } else if ((thisuser.expires > l) &&
  751.                      (thisuser.expires < l+10*SECS_PER_DAY)) {
  752.             ansic(6);
  753.             if ((int)((thisuser.expires-l)/SECS_PER_DAY) > 1) {
  754.               npr("%s%d %s.",get_string(1394),
  755.                 (int)((thisuser.expires-l)/SECS_PER_DAY),get_string(1395));
  756.             } else {
  757.               npr("%s%d %s.",get_string(1394),
  758.                 (int)((thisuser.expires-l)/3600L),get_string(1396));
  759.             }
  760.                         nln(2);
  761.             pausescr();
  762.           }
  763.           if (thisuser.expires < l) {
  764.             if (!so()) {
  765.               if ((thisuser.sl > syscfg.newusersl) ||
  766.                   (thisuser.dsl > syscfg.newuserdsl)) {
  767.                 thisuser.sl=syscfg.newusersl;
  768.                 thisuser.dsl=syscfg.newuserdsl;
  769.                 thisuser.exempt=0;
  770.                 sprintf(s1,"%s%s", nam(&thisuser,usernum),
  771.                     get_stringx(1,118));
  772.                 ssm(1,0,s1);
  773.                 write_user(usernum,&thisuser);
  774.                 reset_act_sl();
  775.                 changedsl();
  776.               }
  777.             }
  778.             ansic(6);
  779.             pl(get_string(1397));
  780.             nl();
  781.             pausescr();
  782.           }
  783.         }
  784.       }
  785.     }
  786.     topscreen();
  787.     create_chain_file();
  788.     rsm(usernum,&thisuser,1);
  789.     if (thisuser.waiting) {
  790.           if (menu_on()) {
  791.         printmenu(324);
  792.         rip_popup = 0;      /* Disable the Yes/No prompt */
  793.       } else
  794.         prt(5,get_string(377));
  795.       if (yn()) {
  796.         if (rip_on()) {
  797.           rip_cls();
  798.           //rmenu = 300;
  799.         }
  800.         readmail();
  801.       }
  802.     }
  803.   }
  804.   if (rip_on()) {
  805.     rip_popup = -1;      /* Re-enable */
  806.     cleared = -1;
  807.   }
  808.   nscandate=thisuser.daten;
  809.   batchtime=0.0;
  810.   numbatchdl=numbatch=0;
  811.   i1=0;
  812.   for (i=0; i<20; i++) {
  813.     if (questused[i]) {
  814.       if (thisuser.votes[i]==0) {
  815.         i1=1;
  816.       }
  817.     }
  818.   }
  819.   if (restrict_vote & thisuser.restrict)
  820.     i1=0;
  821.   if (actsl<=syscfg.newusersl)
  822.     i1=0;
  823.  
  824.   if (i1 && live_user) {
  825.     nl();
  826.     prt(3,get_string(378));
  827.     nl();
  828.     pausescr();
  829.     vote();
  830.     nl();
  831.   }
  832.   if ((incom) || (sysop1()))
  833.     broadcast(get_string(1172));
  834.   setiia(90);
  835.   prt(1,"Do you want to scan for new messages?");
  836.   if(ny())
  837.   {
  838.     write_inst(INST_LOC_SUBS,usub[cursub].subnum,INST_FLAGS_NONE);
  839.     express=0;
  840.     expressabort=0;
  841.     if ((uconfsub[1].confnum!=-1) && (okconf(&thisuser))) {
  842.       ac=1;
  843.       tmp_disable_conf(1);
  844.     }
  845.     nscan(0);
  846.     if (ac)
  847.       tmp_disable_conf(0);
  848.   }
  849.  
  850.   /* Handle case of first conf with no subs avail */
  851.   if ((usub[0].subnum==-1) && (okconf(&thisuser))) {
  852.     for (curconfsub=0;
  853.          (curconfsub<subconfnum) &&
  854.          (uconfsub[curconfsub].confnum!=-1);
  855.          curconfsub++) {
  856.       setuconf(CONF_SUBS, curconfsub, -1);
  857.       if (usub[0].subnum!=-1)
  858.         break;
  859.     }
  860.     if (usub[0].subnum==-1) {
  861.       curconfsub=0;
  862.       setuconf(CONF_SUBS, curconfsub, -1);
  863.     }
  864.   }
  865.   rip_cls();
  866.   autox = -1;
  867. }
  868.  
  869.  
  870. void logoff(void)
  871. {
  872.   long l;
  873.   int f,r,w,t,i, w1,i1;
  874.   char s[81];
  875.   mailrec m;
  876.   shortmsgrec sm;
  877.   double ton;
  878.  
  879.   if (incom)
  880.     play_sdf("LOGOFF",0);
  881.  
  882.   if (usernum>0) {
  883.     if ((incom) || (sysop1()))
  884.       broadcast(get_string(1173));
  885.   }
  886.   setiia(90);
  887.   dtr(0);
  888.   hangup=1;
  889.   if (usernum<1)
  890.     return;
  891.   thisuser.lastrate=modem_speed;
  892.   strcpy(thisuser.laston,xdate);
  893.   thisuser.illegal=0;
  894.   if ((timer()-timeon)<-30.0)
  895.     timeon-=24.0*3600.0;
  896.   ton=timer()-timeon;
  897.   thisuser.timeon += ton;
  898.   thisuser.timeontoday += (ton-extratimecall);
  899.   lock_status();
  900.   status.activetoday += (int) (ton/60.0);
  901.   save_status();
  902.   time(&l);
  903.   thisuser.daten=l;
  904.   sprintf(s,get_stringx(1,23),
  905.     msgreadlogon,
  906.     (int)((timer()-timeon)/60.0));
  907.   if ((incom) || (actsl!=255))
  908.     sl1(0,s);
  909.   if (mailcheck) {
  910.     f=open_email(1);
  911.     if (f!=-1) {
  912.       thisuser.waiting=0;
  913.       t=(int) (filelength(f)/sizeof(mailrec));
  914.       r=0;
  915.       w=0;
  916.       while (r<t) {
  917.         sh_lseek(f,(long)(sizeof(mailrec)) * (long)(r),SEEK_SET);
  918.         sh_read(f,(void *)&m,sizeof(mailrec));
  919.         if ((m.tosys!=0) || (m.touser!=0)) {
  920.           if ((m.tosys==0) && (m.touser==usernum)) {
  921.             if (thisuser.waiting!=255)
  922.               thisuser.waiting++;
  923.           }
  924.           if (r!=w) {
  925.             sh_lseek(f,(long)(sizeof(mailrec)) * (long)(w),SEEK_SET);
  926.             sh_write(f,(void *)&m,sizeof(mailrec));
  927.           }
  928.           ++w;
  929.         }
  930.         ++r;
  931.       }
  932.       if (r!=w) {
  933.         m.tosys=0;
  934.         m.touser=0;
  935.         for (w1=w; w1<r; w1++) {
  936.           sh_lseek(f,(long)(sizeof(mailrec)) * (long)(w1),SEEK_SET);
  937.           sh_write(f,(void *)&m,sizeof(mailrec));
  938.         }
  939.       }
  940.       chsize(f,(long)(sizeof(mailrec)) * (long)(w));
  941.       lock_status();
  942.       status.filechange[filechange_email]++;
  943.       save_status();
  944.       sh_close(f);
  945.     }
  946.   } else {
  947.     /* re-calculate mail waiting */
  948.     f=open_email(0);
  949.     if (f>0) {
  950.       i1=filelength(f)/sizeof(mailrec);
  951.       thisuser.waiting=0;
  952.       for (i=0; (i<i1); i++) {
  953.         read(f, &m, sizeof(mailrec));
  954.         if ((m.tosys==0) && (m.touser==usernum)) {
  955.           if (thisuser.waiting!=255)
  956.             thisuser.waiting++;
  957.         }
  958.       }
  959.       f=sh_close(f);
  960.     }
  961.   }
  962.   if (smwcheck) {
  963.     sprintf(s,"%sSMW.DAT",syscfg.datadir);
  964.     f=sh_open(s,O_RDWR|O_BINARY|O_CREAT,S_IREAD|S_IWRITE);
  965.     if (f!=-1) {
  966.       t=(int) (filelength(f)/sizeof(shortmsgrec));
  967.       r=0;
  968.       w=0;
  969.       while (r<t) {
  970.         sh_lseek(f,(long)(sizeof(shortmsgrec)) * (long)(r),SEEK_SET);
  971.         sh_read(f,(void *)&sm,sizeof(shortmsgrec));
  972.         if ((sm.tosys!=0) || (sm.touser!=0)) {
  973.           if ((sm.tosys==0) && (sm.touser==usernum))
  974.             thisuser.sysstatus |= sysstatus_smw;
  975.           if (r!=w) {
  976.             sh_lseek(f,(long)(sizeof(shortmsgrec)) * (long)(w),SEEK_SET);
  977.             sh_write(f,(void *)&sm,sizeof(shortmsgrec));
  978.           }
  979.           ++w;
  980.         }
  981.         ++r;
  982.       }
  983.       chsize(f,(long)(sizeof(shortmsgrec)) * (long)(w));
  984.       sh_close(f);
  985.     }
  986.   }
  987.   if (usernum==1)
  988.     fwaiting=thisuser.waiting;
  989.   write_user(usernum,&thisuser);
  990.   write_qscn(usernum,qsc,0);
  991.   remove_from_temp("*.*", syscfgovr.tempdir, 0);
  992.   remove_from_temp("*.*", syscfgovr.batchdir, 0);
  993.   if (numbatch && (numbatch != numbatchdl)) {
  994.     for (i=0; i<numbatch; i++) {
  995.       if (!batch[i].sending) {
  996.         didnt_upload(i);
  997.       }
  998.     }
  999.   }
  1000.   numbatch=numbatchdl=0;
  1001. }
  1002.