home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / W / WWIVSOR.ZIP / UEDIT.C < prev    next >
C/C++ Source or Header  |  1995-04-25  |  23KB  |  899 lines

  1. /*****************************************************************************
  2.  
  3.                 WWIV Version 4
  4.                     Copyright (C) 1988-1995 by Wayne Bell
  5.  
  6. Distribution of the source code for WWIV, in any form, modified or unmodified,
  7. without PRIOR, WRITTEN APPROVAL by the author, is expressly prohibited.
  8. Distribution of compiled versions of WWIV is limited to copies compiled BY
  9. THE AUTHOR.  Distribution of any copies of WWIV not compiled by the author
  10. is expressly prohibited.
  11.  
  12.  
  13. *****************************************************************************/
  14.  
  15.  
  16.  
  17. #include "vars.h"
  18.  
  19. #pragma hdrstop
  20.  
  21. static unsigned long *u_qsc;
  22.  
  23.  
  24. void deluser(int un)
  25. {
  26.   userrec u;
  27.   int i,i1,f,n;
  28.   mailrec m;
  29.   char fn[81];
  30.   votingrec v;
  31.   voting_response vr;
  32.  
  33.   read_user(un,&u);
  34.   if ((u.inact & inact_deleted)==0) {
  35.     rsm(un,&u,0);
  36.     dsr(u.name);
  37.     u.inact |= inact_deleted;
  38.     u.waiting=0;
  39.     write_user(un,&u);
  40.     f=open_email(1);
  41.     if (f>0) {
  42.       i1=filelength(f)/sizeof(mailrec);
  43.       for (i=0; i<i1; i++) {
  44.         sh_lseek(f,((long) i) * sizeof(mailrec), SEEK_SET);
  45.         sh_read(f,(void *)(&m),sizeof(mailrec));
  46.         if (((m.tosys==0) && (m.touser==un)) ||
  47.             ((m.fromsys==0) && (m.fromuser==un))) {
  48.           delmail(f,i);
  49.         }
  50.       }
  51.       f=sh_close(f);
  52.     }
  53.     sprintf(fn,"%sVOTING.DAT",syscfg.datadir);
  54.     f=sh_open(fn,O_RDWR | O_BINARY, S_IREAD | S_IWRITE);
  55.     n=(int) (filelength(f) / sizeof(votingrec)) -1;
  56.     for (i=0; i<20; i++)
  57.       if (u.votes[i]) {
  58.         if (i<=n) {
  59.           sh_lseek(f,((long) i) * sizeof(votingrec), SEEK_SET);
  60.           sh_read(f,(void *)&v,sizeof(votingrec));
  61.           vr=v.responses[u.votes[i]-1];
  62.           vr.numresponses--;
  63.           v.responses[u.votes[i]-1]=vr;
  64.           sh_lseek(f,((long) i) * sizeof(votingrec), SEEK_SET);
  65.           sh_write(f,(void *)&v,sizeof(votingrec));
  66.         }
  67.         u.votes[i]=0;
  68.       }
  69.     f=sh_close(f);
  70.     write_user(un,&u);
  71.   }
  72. }
  73.  
  74.  
  75. void outstr_x2(char *s)
  76. {
  77.   ansic_x(2);
  78.   outstr(s);
  79.   ansic_x(1);
  80. }
  81.  
  82.  
  83. void print_data(int un, userrec *u, int lng, int cls)
  84. {
  85.   char s[81],s1[81],s2[81],s3[81];
  86.   int i;
  87.  
  88.   if (cls)
  89.     outchr(12);
  90.   if ((u->inact) & inact_deleted) {
  91.    ansic_x(6);
  92.     pl(get_string(236));
  93.     nl();
  94.   }
  95.   outstr_x2(get_string(1005)); pl(nam(u,un));
  96.   outstr_x2(get_string(238)); pl(u->realname);
  97.   if (lng) {
  98.     if (u->street[0]) {
  99.       outstr_x2(get_string(239)); pl(u->street);
  100.     }
  101.     if (u->city[0] || u->state[0] || u->country[0] || u->zipcode[0]) {
  102.       outstr_x2(get_string(240)); npr("%s, %s  %s (%s)\r\n",
  103.                             u->city, u->state, u->zipcode, u->country);
  104.     }
  105.   }
  106.   if (u->registered) {
  107.     outstr_x2(get_string(1421));
  108.     npr("%s    ",daten_to_date(u->registered));
  109.     npr("%s%s", get_string(1422),daten_to_date(u->expires));
  110.     nl();
  111.   }
  112.   if ((u->callsign[0])!=0) {
  113.     outstr_x2(get_string(241)); pl(u->callsign);
  114.   }
  115.   outstr_x2(get_string(242)); pl(u->phone);
  116.   if (u->dataphone[0]) {
  117.     outstr_x2(get_string(243)); pl(u->dataphone);
  118.   }
  119.   outstr_x2(get_string(244));
  120.     npr("%d %c  (%02d/%02d/%02d)\r\n",
  121.     u->age, u->sex, u->month, u->day, u->year);
  122.   outstr_x2(get_string(245)); pl(ctypes[u->comp_type]);
  123.   if (u->forwardusr) {
  124.     outstr_x2(get_string(246));
  125.     if (u->forwardsys) {
  126.       if (net_num_max>1) {
  127.         npr("%s #%d @%d\r\n", net_networks[u->net_num].name,
  128.           u->forwardusr, u->forwardsys);
  129.       } else {
  130.         npr("#%d @%d\r\n",u->forwardusr, u->forwardsys);
  131.       }
  132.     } else {
  133.       npr("#%d\r\n",u->forwardusr);
  134.     }
  135.   }
  136.   if (lng) {
  137.     outstr_x2(get_string(247));
  138.     if (lecho)
  139.       outs(u->pw);
  140.     if ((incom) && (thisuser.sl==255))
  141.       pr1(u->pw);
  142.     else
  143.       pr1(get_string(1527));
  144.     nl();
  145.     outstr_x2(get_string(248));
  146.     npr("%s   %s\r\n",(u->laston),(u->firston));
  147.     outstr_x2(get_string(249));
  148.     if (u->emailnet)
  149.       npr("P=%u E=%u F=%u W=%u O=%u D=%u\r\n",u->msgpost, u->emailsent,
  150.           u->feedbacksent, u->waiting, u->emailnet, u->deletedposts);
  151.     else
  152.       npr("P=%u E=%u F=%u W=%u D=%u\r\n",u->msgpost, u->emailsent,
  153.           u->feedbacksent, u->waiting, u->deletedposts);
  154.     outstr_x2(get_string(250));
  155.       npr("%d  %d  I=%d\r\n",
  156.         u->logons,(strcmp(u->laston,date()))?0:u->ontoday,u->illegal);
  157.     outstr_x2(get_string(251));
  158.       npr("U=%d-%ldk   D=%d-%ldk\r\n",
  159.         u->uploaded, u->uk, u->downloaded, u->dk);
  160.     outstr_x2(get_string(252)); pln(u->lastrate);
  161.   }
  162.   if (u->note[0]) {
  163.     outstr_x2(get_string(253)); pl(u->note);
  164.   }
  165.   if (u->ass_pts) {
  166.     outstr_x2(get_string(254)); pln(u->ass_pts);
  167.   }
  168.   outstr_x2(get_string(255)); pln(u->sl);
  169.   outstr_x2(get_string(318)); pln(u->dsl);
  170.   if (u_qsc) {
  171.     if ((*u_qsc)!=999) {
  172.       outstr_x2(get_string(256)); pln(*u_qsc);
  173.     }
  174.   }
  175.   if (u->exempt) {
  176.     outstr_x2(get_string(257)); pln(u->exempt);
  177.   }
  178.   strcpy(s3,restrict_string);
  179.   for (i=0; i<=15; i++) {
  180.     if (u->ar & (1 << i))
  181.       s[i]='A'+i;
  182.     else
  183.       s[i]=32;
  184.     if (u->dar & (1 << i))
  185.       s1[i]='A'+i;
  186.     else
  187.       s1[i]=32;
  188.     if (u->restrict & (1 << i))
  189.       s2[i]=s3[i];
  190.     else
  191.       s2[i]=32;
  192.   }
  193.   s[16]=0;
  194.   s1[16]=0;
  195.   s2[16]=0;
  196.   if ((u->ar)!=0) {
  197.     outstr_x2(get_string(258)); pl(s);
  198.   }
  199.   if ((u->dar)!=0) {
  200.     outstr_x2(get_string(259)); pl(s1);
  201.   }
  202.   if ((u->restrict)!=0) {
  203.     outstr_x2(get_string(260)); pl(s2);
  204.   }
  205.   if (u->wwiv_regnum) {
  206.     outstr_x2(get_string(261));
  207.       npr("%ld\r\n", u->wwiv_regnum);
  208.   }
  209.   if (lng)
  210.     print_affil(u);
  211. }
  212.  
  213.  
  214. /****************************************************************************/
  215.  
  216.  
  217.  
  218. int matchuser(int un)
  219. {
  220.   userrec u;
  221.  
  222.   read_user(un,&u);
  223.   sp=search_pattern;
  224.   return(match_user(&u));
  225. }
  226.  
  227.  
  228. int match_user(userrec *u)
  229. {
  230.   int ok=1,not=0,done=0,less=0,cpf=0,cpp=0,and=1,gotfcn=0,evalit=0,tmp,tmp1,tmp2;
  231.   char fcn[12],parm[80],ts[40];
  232.   long l;
  233.  
  234.   do {
  235.     if (*sp==0)
  236.       done=1;
  237.     else {
  238.       if (strchr("()|&!<>",*sp)) {
  239.         switch(*sp++) {
  240.           case '(':
  241.             evalit=2;
  242.             break;
  243.           case ')':
  244.             done=1;
  245.             break;
  246.           case '|':
  247.             and=0;
  248.             break;
  249.           case '&':
  250.             and=1;
  251.             break;
  252.           case '!':
  253.             not=1;
  254.             break;
  255.           case '<':
  256.             less=1;
  257.             break;
  258.           case '>':
  259.             less=0;
  260.             break;
  261.         }
  262.       } else if (*sp=='[') {
  263.         gotfcn=1;
  264.         sp++;
  265.       } else if (*sp==']') {
  266.         evalit=1;
  267.         ++sp;
  268.       } else if ((*sp!=' ') || (gotfcn)) {
  269.         if (gotfcn) {
  270.           if (cpp<22)
  271.             parm[cpp++]=*sp++;
  272.           else
  273.             sp++;
  274.         } else {
  275.           if (cpf<10)
  276.             fcn[cpf++]=*sp++;
  277.           else
  278.             sp++;
  279.         }
  280.       } else
  281.         ++sp;
  282.       if (evalit) {
  283.         if (evalit==1) {
  284.           fcn[cpf]=0;
  285.           parm[cpp]=0;
  286.           tmp=1;
  287.           tmp1=atoi(parm);
  288.  
  289.           if (!strcmp(fcn,"SL")) {
  290.             if (less)
  291.               tmp=(tmp1>u->sl);
  292.             else
  293.               tmp=(tmp1<u->sl);
  294.           } else if (!strcmp(fcn,"DSL")) {
  295.             if (less)
  296.               tmp=(tmp1>u->dsl);
  297.             else
  298.               tmp=(tmp1<u->dsl);
  299.           } else if (!strcmp(fcn,"AR")) {
  300.             if ((parm[0]>='A') && (parm[0]<='P')) {
  301.               tmp1=1 << (parm[0]-'A');
  302.               if (u->ar & tmp1)
  303.                 tmp=1;
  304.               else
  305.                 tmp=0;
  306.             } else
  307.               tmp=0;
  308.           } else if (!strcmp(fcn,"DAR")) {
  309.             if ((parm[0]>='A') && (parm[0]<='P')) {
  310.               tmp1=1 << (parm[0]-'A');
  311.               if (u->dar & tmp1)
  312.                 tmp=1;
  313.               else
  314.                 tmp=0;
  315.             } else
  316.               tmp=0;
  317.           } else if (!strcmp(fcn,"SEX")) {
  318.             tmp=parm[0]==u->sex;
  319.           } else if (!strcmp(fcn,"AGE")) {
  320.             if (less)
  321.               tmp=(tmp1>u->age);
  322.             else
  323.               tmp=(tmp1<u->age);
  324.           } else if (!strcmp(fcn,"LASTON")) {
  325.             time(&l);
  326.             tmp2=(unsigned int)( (l-u->daten)/24.0/3600.0 );
  327.             if (less)
  328.               tmp=tmp2<tmp1;
  329.             else
  330.               tmp=tmp2>tmp1;
  331.           } else if (!strcmp(fcn,"AREACODE")) {
  332.             tmp=(!strncmp(parm,u->phone,3));
  333.           } else if (!strcmp(fcn,"RESTRICT")) {
  334.             ;
  335.           } else if (!strcmp(fcn,"LOGONS")) {
  336.             if (less)
  337.               tmp=u->logons<tmp1;
  338.             else
  339.               tmp=u->logons>tmp1;
  340.           } else if (!strcmp(fcn,"REALNAME")) {
  341.             strcpy(ts,u->realname);
  342.             strupr(ts);
  343.             tmp=(strstr(ts,parm)!=NULL);
  344.           } else if (!strcmp(fcn,"BAUD")) {
  345.             if (less)
  346.               tmp=u->lastrate<(unsigned short)tmp1;
  347.             else
  348.               tmp=u->lastrate>(unsigned short)tmp1;
  349.           }
  350.  
  351.         } else
  352.           tmp=match_user(u);
  353.  
  354.         if (not)
  355.           tmp=!tmp;
  356.         if (and)
  357.           ok = ok && tmp;
  358.         else
  359.           ok = ok || tmp;
  360.  
  361.         not=less=cpf=cpp=gotfcn=evalit=0;
  362.         and=1;
  363.       }
  364.     }
  365.   } while (!done);
  366.   return(ok);
  367. }
  368.  
  369. /****************************************************************************/
  370.  
  371. void changeopt(void)
  372. {
  373.   helpl=42;
  374.   outchr(12);
  375.   pl(get_string(262));
  376.   if (search_pattern[0])
  377.     pl(search_pattern);
  378.   else
  379.     pl(get_string(263));
  380.   nl();
  381.   nl();
  382.   prt(5,get_string(264));
  383.   if (yn()) {
  384.     pl(get_string(265));
  385.     prt(2,":");
  386.     input(search_pattern,75);
  387.   }
  388.   helpl=0;
  389. }
  390.  
  391.  
  392. /****************************************************************************/
  393.  
  394. void auto_val(int n, userrec *u)
  395. {
  396.   if (u->sl==255)
  397.     return;
  398.   u->sl=syscfg.autoval[n].sl;
  399.   u->dsl=syscfg.autoval[n].dsl;
  400.   u->ar=syscfg.autoval[n].ar;
  401.   u->dar=syscfg.autoval[n].dar;
  402.   u->restrict=syscfg.autoval[n].restrict;
  403. }
  404.  
  405.  
  406. void uedit(int usern, int other)
  407. {
  408.   char s[81],s1[81],s2[81],ch,ch1;
  409.   int i,i1,un,done,nu,done1,full,temp_full,tempu,cls=1,done2;
  410.   userrec u;
  411.   int m,dd;
  412.  
  413.   u_qsc=(unsigned long *)malloca(syscfg.qscn_len);
  414.  
  415.   if (incom)
  416.     full=0;
  417.   else
  418.     full=1;
  419.   if (other&1)
  420.     full=0;
  421.   if (other&2)
  422.     cls=0;
  423.   un=usern;
  424.   done=0;
  425.   read_user(un,&u);
  426.   nu=number_userrecs();
  427.   do {
  428.     read_user(un,&u);
  429.     read_qscn(un,u_qsc,0);
  430.     done1=0;
  431.     temp_full=0;
  432.     do {
  433.       print_data(un,&u, ((full) || (temp_full)), cls);
  434.       nl();
  435.       prt(2,get_string(266));
  436.       if ((thisuser.sl==255) || (wfc))
  437.         ch=onek("ACDEGILMNOPQRSTUXYZ0123456789[]{}/,.?~%:");
  438.       else
  439.         ch=onek("ACDEGILMNOPQRSTUYZ0123456789[]{}/,.?%");
  440.       switch(ch) {
  441.         case 'A':
  442.           nl();
  443.           prt(2,get_string(280));
  444.           ch1=onek("\rABCDEFGHIJKLMNOP");
  445.           if (ch1!=13) {
  446.             ch1-='A';
  447.             if ((wfc) || (thisuser.ar & (1 << ch1))) {
  448.               u.ar ^= (1 << ch1);
  449.               write_user(un,&u);
  450.             }
  451.           }
  452.           break;
  453.         case 'C':
  454.           nl();
  455.           prt(2,get_string(270));
  456.           input(s,sizeof(u.callsign)-1);
  457.           if (s[0]) {
  458.             strcpy(u.callsign,s);
  459.             write_user(un,&u);
  460.           } else {
  461.             prt(5,get_string(271));
  462.             if (yn()) {
  463.               u.callsign[0]=0;
  464.               write_user(un,&u);
  465.             }
  466.           }
  467.           break;
  468.         case 'D':
  469.           if (((u.inact & inact_deleted)==0) && (actsl>u.sl)) {
  470.             prt(5,get_string(267));
  471.             if (yn()) {
  472.               deluser(un);
  473.               read_user(un,&u);
  474.             }
  475.           }
  476.           break;
  477.         case 'E':
  478.           nl();
  479.           prt(2,get_string(277));
  480.           input(s,3);
  481.           i=atoi(s);
  482.           if ((i>=0) && (i<=255) && (s[0])) {
  483.             u.exempt=i;
  484.             write_user(un,&u);
  485.           }
  486.           break;
  487.         case 'G':
  488.           nl();
  489.           outstr(get_string(274));
  490.           npr("%02d/%02d/%02d\r\n",(int) u.month, (int) u.day, (int) u.year);
  491.           input_age(&u);
  492.           write_user(un,&u);
  493.           break;
  494.         case 'I':
  495.           nl();
  496.           prt(2,get_string(281));
  497.           ch1=onek("\rABCDEFGHIJKLMNOP");
  498.           if (ch1!=13) {
  499.             ch1-='A';
  500.             if ((wfc) || (thisuser.dar & (1 << ch1))) {
  501.               u.dar ^= (1 << ch1);
  502.               write_user(un,&u);
  503.             }
  504.           }
  505.           break;
  506.         case 'L':
  507.           nl();
  508.           prt(2,get_string(269));
  509.           inputl(s,sizeof(u.realname)-1);
  510.           if (s[0]) {
  511.             strcpy(u.realname,s);
  512.             write_user(un,&u);
  513.           }
  514.           break;
  515.         case 'M':
  516.           nl();
  517.           pl(get_string(275));
  518.           nl();
  519.           for (i=0; ctypes[i]; i++)
  520.             npr("%d. %s\r\n",i+1,ctypes[i]);
  521.           nl();
  522.           prt(2,get_string(276));
  523.           input(s,2);
  524.           i1=atoi(s);
  525.           if ((i1>0) && (i1<=i)) {
  526.             u.comp_type=i1-1;
  527.             if (checkcomp("Ami"))
  528.               u.colors[0]=4;
  529.             else
  530.               u.colors[0]=7;
  531.             write_user(un,&u);
  532.           }
  533.           break;
  534.         case 'N':
  535.           nl();
  536.           prt(2,get_string(69));
  537.           input(s,sizeof(u.name)-1);
  538.           if (s[0]) {
  539.             if (finduser(s)<1) {
  540.               dsr(u.name);
  541.               strcpy(u.name,s);
  542.               isr(un,u.name);
  543.               write_user(un,&u);
  544.             }
  545.           }
  546.           break;
  547.         case 'O':
  548.           nl();
  549.           prt(2,get_string(273));
  550.           inputl(s,sizeof(u.note)-1);
  551.           strcpy(u.note,s);
  552.           write_user(un,&u);
  553.           break;
  554.         case 'P':
  555.           nl();
  556.           prt(2,get_string(272));
  557.           input(s,sizeof(u.phone)-1);
  558.           if (s[0]) {
  559.             strcpy(u.phone,s);
  560.             write_user(un,&u);
  561.           }
  562.           prt(2,get_string(287));
  563.           input(s,sizeof(u.dataphone)-1);
  564.           if (s[0]) {
  565.             if (s[0]=='0')
  566.               u.dataphone[0]=0;
  567.             else
  568.               strcpy(u.dataphone,s);
  569.             write_user(un,&u);
  570.           }
  571.           break;
  572.         case 'Q':
  573.           done=1;
  574.           done1=1;
  575.           break;
  576.         case 'R':
  577.           if (u.inact & inact_deleted) {
  578.             u.inact ^= inact_deleted;
  579.             isr(un,u.name);
  580.             write_user(un,&u);
  581.           }
  582.           break;
  583.         case 'S':
  584.           if (u.sl==255)
  585.             break;
  586.           if (u.sl>=actsl)
  587.             break;
  588.           nl();
  589.           prt(2,get_string(76));
  590.           input(s,3);
  591.           i=atoi(s);
  592.           if ((!wfc) && (i>=actsl))
  593.             i=-1;
  594.           if ((i>=0) && (i<255) && (s[0])) {
  595.             u.sl=i;
  596.             write_user(un,&u);
  597.             if (un==usernum)
  598.               actsl=i;
  599.           }
  600.           break;
  601.         case 'T':
  602.           if (u.dsl==255)
  603.             break;
  604.           if (u.dsl>=thisuser.dsl)
  605.             break;
  606.           nl();
  607.           prt(2,get_string(153));
  608.           input(s,3);
  609.           i=atoi(s);
  610.           if ((!wfc) && (i>=thisuser.dsl))
  611.             i=-1;
  612.           if ((i>=0) && (i<255) && (s[0])) {
  613.             u.dsl=i;
  614.             write_user(un,&u);
  615.           }
  616.           break;
  617.         case 'U':
  618.           nl();
  619.           prt(2,get_string(268));
  620.           input(s,sizeof(u.name)-1);
  621.           i=finduser1(s);
  622.           if (i>0) {
  623.             un=i;
  624.             done1=1;
  625.           }
  626.           break;
  627.         case 'X':
  628.           if (!(sysinfo.flags & OP_FLAGS_USER_REGIST))
  629.             break;
  630.           nl();
  631.           if (u.registered!=0) {
  632.             strncpy(s1,daten_to_date(u.registered),sizeof(s1));
  633.             strncpy(s2,daten_to_date(u.expires),sizeof(s2));
  634.             npr("%s%s%s%s\r\n", get_string(1387), s1, get_string(1388), s2);
  635.           } else
  636.             pl(get_string(1389));
  637.           do {
  638.             nl();
  639.             pl(get_string(1390));
  640.             pl(get_string(792));
  641.             outstr(":");
  642.             input(s,8);
  643.           } while ((strlen(s)!=8) && (s[0]!=0));
  644.           if (s[0]==0)
  645.             strcpy(s,date());
  646.  
  647.           m=atoi(s);
  648.           dd=atoi(&(s[3]));
  649.           if ((strlen(s)==8) && (m>0) && (m<=12)
  650.             && (dd>0) && (dd<32))
  651.             u.registered=date_to_daten(s);
  652.           else
  653.             nl();
  654.           do {
  655.             nl();
  656.             pl(get_string(1392));
  657.             pl(get_string(792));
  658.             outstr(":");
  659.             input(s,8);
  660.           } while ((strlen(s)!=8) && (s[0]!=0));
  661.           if (strlen(s)==8) {
  662.             m=atoi(s);
  663.             dd=atoi(&(s[3]));
  664.           } else {
  665.             u.registered=0L;
  666.             u.expires=0L;
  667.           }
  668.           if ((strlen(s)==8) && (m>0) && (m<=12)
  669.             && (dd>0) && (dd<32))
  670.             u.expires=date_to_daten(s);
  671.           write_user(un,&u);
  672.           break;
  673.         case 'Y':
  674.           if (u_qsc) {
  675.             nl();
  676.             prt(2,get_string(278));
  677.             input(s,3);
  678.             i=atoi(s);
  679.             if ((i>=0) && (i<=999) && (s[0])) {
  680.               *u_qsc=i;
  681.               write_qscn(un,u_qsc,0);
  682.             }
  683.           }
  684.           break;
  685.         case 'Z':
  686.           nl();
  687.           npr("%s%s\r\n",get_string(1309),restrict_string);
  688.           do {
  689.             prt(2,get_string(279));
  690.             s[0]=13;
  691.             s[1]='?';
  692.             strcpy(&(s[2]),restrict_string);
  693.             ch1=onek(s);
  694.             if (ch1==32)
  695.               ch1=13;
  696.             if (ch1=='?')
  697.               printmenu(10);
  698.             if ((ch1!=13) && (ch1!='?')) {
  699.               i=-1;
  700.               for (i1=0; i1<16; i1++)
  701.                 if (ch1==s[i1+2])
  702.                   i=i1;
  703.               if (i>-1) {
  704.                 u.restrict ^= (1 << i);
  705.                 write_user(un,&u);
  706.               }
  707.             }
  708.           } while ((!hangup) && (ch1=='?'));
  709.           break;
  710.         case '1':
  711.         case '2':
  712.         case '3':
  713.         case '4':
  714.         case '5':
  715.         case '6':
  716.         case '7':
  717.         case '8':
  718.         case '9':
  719.         case '0':
  720.           if (ch!='0')
  721.             i=ch-'1';
  722.           else
  723.             i=9;
  724.           if ((actsl>=syscfg.autoval[i].sl) &&
  725.               (thisuser.dsl>=syscfg.autoval[i].dsl) &&
  726.               (((~thisuser.ar) & syscfg.autoval[i].ar)==0) &&
  727.               (((~thisuser.dar) & syscfg.autoval[i].dar)==0)) {
  728.             auto_val(i,&u);
  729.             write_user(un,&u);
  730.           }
  731.           break;
  732.         case ']':
  733.           ++un;
  734.           if (un>nu)
  735.             un=1;
  736.           done1=1;
  737.           break;
  738.         case '[':
  739.           --un;
  740.           if (un==0)
  741.             un=nu;
  742.           done1=1;
  743.           break;
  744.         case '}':
  745.           tempu=un;
  746.           ++un;
  747.           if (un>nu)
  748.             un=1;
  749.           while ((un!=tempu) && (!matchuser(un))) {
  750.             ++un;
  751.             if (un>nu)
  752.               un=1;
  753.           }
  754.           done1=1;
  755.           break;
  756.         case '{':
  757.           tempu=un;
  758.           --un;
  759.           if (un<1)
  760.             un=nu;
  761.           while ((un!=tempu) && (!matchuser(un))) {
  762.             --un;
  763.             if (un<1)
  764.               un=nu;
  765.           }
  766.           done1=1;
  767.           break;
  768.         case '/':
  769.           changeopt();
  770.           break;
  771.         case ',':
  772.           temp_full=(!temp_full);
  773.           break;
  774.         case '.':
  775.           full=(!full);
  776.           temp_full=full;
  777.           break;
  778.         case '?':
  779.           printmenu(6);
  780.           getkey();
  781.           break;
  782.         case '~':
  783.           u.ass_pts=0;
  784.           write_user(un,&u);
  785.           break;
  786.         case '%':
  787.           nl();
  788.           prt(2,get_string(282));
  789.           inputl(s1,sizeof(u.street)-1);
  790.           if (s1[0]) {
  791.             strcpy(u.street,s1);
  792.             write_user(un,&u);
  793.           }
  794.           prt(2,get_string(283));
  795.           inputl(s1,sizeof(u.city)-1);
  796.           if (s1[0]) {
  797.             strcpy(u.city,s1);
  798.             write_user(un,&u);
  799.           }
  800.           prt(2,get_string(284));
  801.           input(s1,sizeof(u.state)-1);
  802.           if (s1[0]) {
  803.             strcpy(u.state,s1);
  804.             write_user(un,&u);
  805.           }
  806.           prt(2,get_string(285));
  807.           input(s1,sizeof(u.country)-1);
  808.           if (s1[0]) {
  809.             strcpy(u.country,s1);
  810.             write_user(un,&u);
  811.           }
  812.           prt(2,get_string(286));
  813.           input(s1,sizeof(u.zipcode)-1);
  814.           if (s1[0]) {
  815.             strcpy(u.zipcode,s1);
  816.             write_user(un,&u);
  817.           }
  818.           prt(2,get_string(287));
  819.           input(s1,sizeof(u.dataphone)-1);
  820.           if (s1[0]){
  821.             strcpy(u.dataphone,s1);
  822.             write_user(un,&u);
  823.           }
  824.           break;
  825.         case ':':
  826.           do {
  827.             done2=0;
  828.             nl();
  829.             pl(get_string(288));
  830.             pl(get_string(289));
  831.             pl(get_string(290));
  832.             pl(get_string(291));
  833.             pl(get_string(292));
  834.             pl(get_string(293));
  835.             pl(get_string(294));
  836.             pl(get_string(295));
  837.             pl(get_string(296));
  838.             pl(get_string(12));
  839.             outstr(get_string(297));
  840.             ch1=onek("Q12345678");
  841.             switch(ch1) {
  842.               case '1': u.realname[0]=0; break;
  843.               case '2': u.year=0; break;
  844.               case '3': u.street[0]=0; break;
  845.               case '4': u.city[0]=0; break;
  846.               case '5': u.state[0]=0; break;
  847.               case '6': u.country[0]=0; break;
  848.               case '7': u.zipcode[0]=0; break;
  849.               case '8': u.dataphone[0]=0; break;
  850.               case 'Q': done2=1; break;
  851.             }
  852.           } while (!done2);
  853.           write_user(un,&u);
  854.           break;
  855.       }
  856.     } while ((!done1) && (!hangup));
  857.   } while ((!done) && (!hangup));
  858.   if (u_qsc)
  859.     bbsfree(u_qsc);
  860.   u_qsc=NULL;
  861.   if (!wfc)
  862.     topscreen();
  863. }
  864.  
  865. /***************************************************************************/
  866.  
  867. unsigned char *daten_to_date(long dt)
  868. {
  869.   struct date d;
  870.   struct time t;
  871.   static unsigned char s[9];
  872.  
  873.   unixtodos(dt,&d,&t);
  874.  
  875.   sprintf(s, "%02d/%02d/%02d", d.da_mon, d.da_day,
  876.     d.da_year-2000 > 0 ? d.da_year-2000 : d.da_year-1900);
  877.  
  878.   return(s);
  879. }
  880.  
  881. /***************************************************************************/
  882.  
  883. void print_affil(userrec *u)
  884. {
  885.   net_system_list_rec *csne;
  886.  
  887.   if ((u->net_num==0) || (u->homesys==0))
  888.     return;
  889.   set_net_num(u->net_num);
  890.   csne=next_system(u->homesys);
  891.   ansic_x(2);
  892.   outstr(get_string(1431));
  893.   ansic_x(1);
  894.   npr("@%u, %s, on %s.",u->homesys,csne->name,net_name);
  895.   nln(2);
  896. }
  897.  
  898.  
  899.