home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / BBS / MISC / HSRC_117.ZIP / HEAD2.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-09  |  18.7 KB  |  780 lines

  1. /* HeadEdit XBBS message area reader -- Nodelist functions, header
  2.    editor, miscellaneous functions */
  3.  
  4. /* Note this stuff needs to stay together as there is some really sloppy
  5.    sharing of windows and such (bleagh!) */
  6.  
  7. #include "msgg.h"
  8. #include "twindow.h"
  9. #include "keys.h"
  10. #include "headedit.h"
  11.  
  12. extern WINDOW *ewnd;
  13.  
  14.  
  15. static char attrprompts[16][12]={
  16.         "Private:",
  17.         "Crash:",
  18.         "Read:",
  19.         "Sent:",
  20.         "File:",
  21.         "Forward:",
  22.         "Orphan:",
  23.         "Kill:",
  24.         "Local:",
  25.         "XX1:",
  26.         "XX2:",
  27.         "FReq:",
  28.         "RReq:",
  29.         "Receipt:",
  30.         "Audit Rq:",
  31.         "Update Rq:"
  32.     };
  33. static char mattrprompts[][12]={
  34.         "Deleted:",
  35.         "Anonymous:",
  36.         "Echo:",
  37.         "Net:",
  38.         "Hold:",
  39.         "Host Rt:",
  40.         "Scanned:",
  41.         "Keep:",
  42.         "Treated:",
  43.         "Packed:"
  44. };
  45.  
  46.  
  47. void pascal node_lister (void) {
  48.  
  49.     static char zone[7]="";
  50.     static char net[7]="";
  51.     char lines;
  52.     struct nodeidx nid;
  53.     int returncode;
  54.     FIELD *fld;
  55.  
  56.     if(!nidxsize || !nidx) {
  57.         any_message(" No nodelist available. ");
  58.         pause();
  59.         return;
  60.     }
  61.     wnd6=establish_window(4,maxy-7,5,31);
  62.     set_border(wnd6,3);
  63.     set_title(wnd6," Nodelist Scanner ");
  64.     set_colors(wnd6,BORDER,7,0,0);
  65.     display_window(wnd6);
  66.     wcursor(wnd6,0,0);
  67.     wprintf(wnd6," F10 to list or ESC to abort");
  68.     if (!*zone || !(word)atol(zone)) {
  69.         sprintf(zone,"%u",curaddress.zone);
  70.         sprintf(net,"%u",curaddress.net);
  71.     }
  72.     init_template(wnd6);
  73.     wprompt(wnd6,1,1,"Zone:");
  74.     wprompt(wnd6,1,2,"Net:");
  75.     fld=establish_field(wnd6,7,1,msk5,zone,'N');
  76.     field_window(fld,"zone      ",40,6);
  77.     fld=establish_field(wnd6,7,2,msk5,net,'N');
  78.     field_window(fld,"net       ",40,5);
  79.     prep_template(wnd6);
  80. NodeOver:
  81.     returncode=data_entry(wnd6);
  82.     if (returncode==ESC){
  83.          delete_window(wnd6);
  84.          return;
  85.     }
  86.     if (returncode!=F10) goto NodeOver;
  87.     if (atol(zone)<1 || atol(zone)>65535L || atol(net)>65535L) {
  88.         error_message(" Invalid value(s)...zone=1-65535, net=0-65535 ");
  89.         pause();
  90.         goto NodeOver;
  91.     }
  92.     nid.zone=(word)atol(zone);
  93.     nid.net=(word)atol(net);
  94.     delete_window(wnd6);
  95.     nid.node=0;
  96.     nid.type=255;
  97.     wnd4=establish_window(0,0,maxy,maxx);
  98.     set_border(wnd4,1);
  99.     set_title(wnd4," NodeList ");
  100.     display_window(wnd4);
  101.     wcursor(wnd4,0,0);
  102.     any_message(" Searching ");
  103.     if (!nid.net) {
  104.         if (nodelist(&nid,3)==-1) goto BreakOut;
  105.         clear_message();
  106.         nid.type=3;
  107.         lines=2;
  108.         while(nodelist(&nid,4)>(-1)) {
  109.             lines+=2;
  110.             if (lines>=(maxy-3)) {
  111.                 any_message("More? (Y-n)");
  112.                 lines=toupper(generic_mouse_input(ewnd));
  113.                 clear_message();
  114.                 if (lines=='S' || lines=='N' || lines==ESC) goto BreakOut;
  115.                 lines=0;
  116.             }
  117.         }
  118.         any_message(" Complete ");
  119.         pause();
  120.         goto BreakOut;
  121.     }
  122.     clear_message();
  123.     if (nodelist(&nid,1)==-1) goto BreakOut;
  124.     nid.type=0;
  125.     lines=2;
  126.     while(nodelist(&nid,2)>(-1)) {
  127.         lines+=2;
  128.         if (lines>=(maxy-3)) {
  129.             any_message("More? (Y-n)");
  130.             lines=toupper(generic_mouse_input(ewnd));
  131.             clear_message();
  132.             if (lines=='S' || lines=='N' || lines==ESC) goto BreakOut;
  133.             lines=0;
  134.         }
  135.     }
  136.     any_message(" Complete ");
  137.     generic_mouse_input(ewnd);
  138. BreakOut:
  139.     clear_message();
  140.     delete_window(wnd4);
  141. }
  142.  
  143.  
  144.  
  145. int pascal nodelist (struct nodeidx *nii,char type) {
  146.  
  147.  struct nodeinfo nif;
  148.  char temp[91];
  149.  int handle;
  150.  long x;
  151.  static long cidx=0;
  152.  WINDOW *fake;
  153.  char len;
  154.  
  155.  if(!nidxsize || !nidx) {
  156.     any_message(" No nodelist available. ");
  157.     return (-1);
  158.  }
  159.  if (nii->zone==0) {
  160.     nii->zone=curaddress.zone;
  161.  }
  162.  
  163.  nif.zone=nii->zone;
  164.  nif.net=nii->net;
  165.  nif.node=nii->node;
  166.  nif.type=nii->type;
  167.  
  168.  if (type==2 || type==4) {
  169.     x=cidx;
  170.     if (type==2) goto GotwhatIwant;
  171.  }
  172.  else x=cidx=0;
  173.  if (type==3 || type==4) {
  174.      if (type==4) {
  175.         x++;
  176.         cidx=x;
  177.      }
  178.      for (;x<(nidxsize+1);x++) {
  179.         if (nidx[x].zone==nif.zone && nidx[x].node==0) break;
  180.      }
  181.      cidx=x;
  182.      goto GotwhatIwant;
  183.  }
  184.  for (;x<(nidxsize+1);x++) {
  185.     if (nidx[x].zone==nif.zone && nidx[x].net==nif.net && nidx[x].node==nif.node) break;
  186.  }
  187.  cidx=x;
  188.  
  189. GotwhatIwant:
  190.  
  191.  if (x>nidxsize) {
  192.      if (!type) {
  193.         wnd6=establish_window(3,maxy-5,4,maxx-6);
  194.         set_border(wnd6,3);
  195.         set_title(wnd6," Node Info ");
  196.         set_colors(wnd6,BORDER,7,0,0);
  197.         display_window(wnd6);
  198.         wcursor(wnd6,1,1);
  199.         wprintf(wnd6,"\t\t\t\tRequested Node not found. ");
  200.      }
  201.      return (-1);
  202.  }
  203.  if (type==2 || type==4) {
  204.     if (type==2) {
  205.         x++;
  206.         cidx=x;
  207.     }
  208.     if (x>nidxsize) return (-1);
  209.     if (type==2 && (nidx[x].zone!=nif.zone || nidx[x].net!=nif.net)) return (-1);
  210.     if (type==4 && (nidx[x].zone!=nif.zone || nidx[x].node!=0)) return (-1);
  211.  }
  212.  sprintf(temp,"%sQNL_DAT.BBS",nodepath);
  213.  if ((handle=_open(temp,O_RDONLY | O_BINARY | O_DENYNONE))==-1) {
  214.    error_message(" Can't open QNL_DAT.BBS ");
  215.    pause();
  216.    return(-1);
  217.  }
  218.  lseek(handle,x*(long)sizeof(struct nodeinfo),SEEK_SET);
  219.  if (_read(handle,&nif,sizeof(struct nodeinfo))<1) {
  220.     _close(handle);
  221.     goto ReadError;
  222.  }
  223.  _close(handle);
  224.  len=*nif.name;
  225.  memmove(nif.name,&nif.name[1],len);
  226.  nif.name[len]=0;
  227.  len=*nif.city;
  228.  memmove(nif.city,&nif.city[1],len);
  229.  nif.city[len]=0;
  230.  len=*nif.phone;
  231.  memmove(nif.phone,&nif.phone[1],len);
  232.  nif.phone[len]=0;
  233.  len=*nif.password;
  234.  memmove(nif.password,&nif.password[1],len);
  235.  nif.password[len]=0;
  236.  if (!type) {
  237.     wnd6=establish_window(3,maxy-5,5,maxx-6);
  238.     set_border(wnd6,3);
  239.     set_title(wnd6," Node Info ");
  240.     set_colors(wnd6,BORDER,7,0,0);
  241.     wcursor(wnd6,1,1);
  242.     fake=wnd6;
  243.     display_window(fake);
  244.  }
  245.  else fake=wnd4;
  246.  wprintf(fake,"\n");
  247.  wprintfraw(fake,"Type:%hd * %u:%u/%u (%s, %s)\n",nif.type,nif.zone,nif.net,nif.node,nif.name,nif.city);
  248.  wprintfraw(fake,"%s * %s * %u baud * %d cost * ",nif.phone,nif.password,nif.baud,nif.cost);
  249.  if (nif.flags & B_hub) wprintf(fake,"Hub  ");
  250.  if (nif.flags & B_host) wprintf(fake,"Host  ");
  251.  if (nif.flags & B_region) wprintf(fake,"RC  ");
  252.  if (nif.flags & B_zone) wprintf(fake,"ZC  ");
  253.  if (nif.flags & B_CM) wprintf(fake,"CM");
  254.  return(nif.cost);
  255.  
  256. ReadError:
  257.     error_message(" Error reading record ");
  258.     pause();
  259.     return (-1);
  260. }
  261.  
  262.  
  263.  
  264.  
  265. int dest_check (char *bf,int key) {
  266.  
  267.    struct nodeidx nid;
  268.  
  269.    if (!autocheck && *bf) return 0;
  270.    if ((currarea->attr & NET)==0 && (currarea->attr & ALTERNATE)==0) return 0;
  271.    nid.node=(word)atol(dest);
  272.    nid.net=(word)atol(dest_net);
  273.    nid.zone=(word)atol(d_zone);
  274.    clear_message();
  275.    nid.type=255;
  276.    sprintf(cost,"%-5d",nodelist(&nid,0));
  277.    if (*cost=='-') strcpy(cost,"0    ");
  278.    pause();
  279.    delete_window(wnd6);
  280.    if(wnd1)normal_video(wnd1);
  281.    if(wnd1)field_tally(wnd1);
  282.    if(wnd1)reverse_video(wnd1);
  283.    return 0;
  284. }
  285.  
  286.  
  287.  
  288. int orig_check (char *bf,int key) {
  289.  
  290.    struct nodeidx nid;
  291.  
  292.    if (!autocheck) return 0;
  293.    if ((currarea->attr & NET)==0 && (currarea->attr & ALTERNATE)==0) return 0;
  294.    nid.node=(word)atol(orig);
  295.    nid.net=(word)atol(orig_net);
  296.    nid.zone=(word)atol(o_zone);
  297.    clear_message();
  298.    nid.type=255;
  299.    nodelist(&nid,0);
  300.    pause();
  301.    delete_window(wnd6);
  302.    return 0;
  303. }
  304.  
  305.  
  306.  
  307. void find_sysop (char *bf) {
  308.  
  309.     int  fp;
  310.     char s[128];
  311.     char *p;
  312.     char first[36];
  313.     char last[36];
  314.     char searchname[39];
  315.     char changed=0;
  316.     int  x;
  317.     int  y;
  318.     long pos=0;
  319.  
  320.     strcpy(first,bf);
  321.     rstrip(first);
  322.     lstrip(first);
  323.     if (!strlen(first)) return;
  324.     strtok(first," ");
  325.     p=strtok(0," ");
  326.     if (p==NULL) *last=0;
  327.     else strcpy(last,p);
  328.     lstrip(last);
  329.     if (*last) sprintf(searchname,"%s, %s",last,first);
  330.     else strcpy(searchname,first);
  331.     pos=0;
  332.  
  333.     if (isalpha(*searchname)) {
  334.         sprintf(s,"%sFidoUser.IDX",nodepath);
  335.         if ((fp=_open(s,O_RDONLY | O_BINARY | O_DENYNONE))!=-1) {
  336.             lseek(fp,(long)((toupper(*searchname)-'A')*sizeof(long)),SEEK_SET);
  337.             _read(fp,&pos,sizeof(long));
  338.             _close(fp);
  339.         }
  340.     }
  341.     sprintf(s,"%sFidoUser.LST",nodepath);
  342.     if ((fp=_open(s,O_RDONLY | O_TEXT | O_DENYNONE))==-1) {
  343.         any_message(" No FidoUser.Lst available ");
  344.         pause();
  345.         return;
  346.     }
  347.     setmode(fp,O_TEXT);
  348.     lseek(fp,pos,SEEK_SET);
  349.     any_message(" Searching... ");
  350.     while (!eof(fp)) {
  351.         pos=tell(fp);
  352.         if (!fgetsx(s,128,fp)) break;
  353.         s[39]=0;
  354.         rstrip(s);
  355.         lstrip(s);
  356.         if (!stricmp(s,searchname)) {
  357.             lseek(fp,pos,SEEK_SET);
  358.             fgetsx(s,128,fp);
  359.             p=&s[41];
  360.             s[40]=0;
  361.             rstrip(s);
  362.             p=lstrip(p);
  363.             if (strchr(p,':')) {
  364.                 sprintf(d_zone,"%-5u",(word)atol(strtok(p,":")));
  365.                 p=strtok(0,"/");
  366.             }
  367.             else {
  368.                 sprintf(d_zone,"%-5u",curaddress.zone);
  369.                 p=strtok(p,"/");
  370.             }
  371.             if (p!=NULL) sprintf(dest_net,"%-5u",(word)atol(p));
  372.             p=strtok(0,"\n");
  373.             if (p!=NULL) sprintf(dest,"%-5u",(word)atol(p));
  374.             strcpy(d_point,"0    ");
  375.             changed=1;
  376.             break;
  377.         }
  378.         if (*s>*searchname) break;
  379.     }
  380.     _close(fp);
  381.     if (changed) {
  382.         if(wnd1) {
  383.             curr_cursor(&x,&y);
  384.             normal_video(wnd1);
  385.             field_tally(wnd1);
  386.             reverse_video(wnd1);
  387.             dest_check("",0);
  388.             cursor(x,y);
  389.         }
  390.         else dest_check("",0);
  391.     }
  392.     else any_message(" Unsuccessful search ");
  393.     nopause();
  394. }
  395.  
  396.  
  397.  
  398. int pascal edit_mess (char type) {  /* Message header editor */
  399.  
  400.     int exitcode;
  401.     char inattr=0;
  402.     char from[36];
  403.     char to[36];
  404.     char subj[64];
  405.     char date[20];
  406.     char times[11];
  407.     char attr[16][2];
  408.     char mattr[16][2];
  409.     word register x;
  410.     struct nodeidx nid;
  411.     FIELD *fld;
  412.     FIELD *fld2;
  413.     WINDOW *wnd2;
  414.  
  415. ReStart:
  416.  
  417.     if (type==0) if (messno==0) {
  418.         if (nomess==0) return ESC;
  419.         messno=1;
  420.     }
  421.  
  422.     wnd1=establish_window(maxx-79,maxy-24,24,79);
  423.     set_border(wnd1,2);
  424.     set_title(wnd1," Message Header Editor ");
  425.     set_colors(wnd1,BORDER,7,0,0);
  426.     display_window(wnd1);
  427.  
  428. NextMess:
  429.     if (type<2) get_mess(0);
  430. SkipGet:
  431.     sprintf(from,"%s",msg.from);
  432.     sprintf(to,"%s",msg.to);
  433.     sprintf(subj,"%s",msg.subj);
  434.     sprintf(date,"%s",msg.date);
  435.     sprintf(times,"%u",msg.times);
  436.     sprintf(dest,"%u",msg.dest);
  437.     sprintf(orig,"%u",msg.orig);
  438.     sprintf(cost,"%d",msg.cost);
  439.     sprintf(orig_net,"%u",msg.orig_net);
  440.     sprintf(dest_net,"%u",msg.dest_net);
  441.     sprintf(d_zone,"%u",msg.d_zone);
  442.     sprintf(o_zone,"%u",msg.o_zone);
  443.     sprintf(o_point,"%u",msg.o_point);
  444.     sprintf(d_point,"%u",msg.d_point);
  445.  
  446. OverMess:
  447.     clear_window(wnd1);
  448.     wcursor(wnd1,0,21);
  449.     if (!type) {
  450.         wprintf(wnd1," Message #%u of %u--PageUp/Dn to move  %s\n",messno,nomess,area_attr());
  451.         wprintf(wnd1," F1=help, F2=DOS, F6=nodes, F7=attrs, F8=areas, F9=msgs, F10=save, ESC=exit");
  452.         wcursor(wnd1,1,17);
  453.         wprintf(wnd1,"Message text: %u bytes",msg.length-1);
  454.     }
  455.     else {
  456.         wprintf(wnd1," Prepare new message header  %s\n",area_attr());
  457.         wprintf(wnd1," F1=help, F2=DOS, F6=nodes, F7=attrs, F10=save, ESC=exit");
  458.     }
  459.     if (msg.attr & MSGPRIVATE) {
  460.         wcursor(wnd1,1,0);
  461.         wprintf(wnd1,"Private.");
  462.     }
  463.     if (msg.m_attr & MSGANON) {
  464.         wcursor(wnd1,22,0);
  465.         wprintf(wnd1,"Anon.");
  466.     }
  467.     if (msg.m_attr & MSGNET) {
  468.         wcursor(wnd1,1,18);
  469.         wprintf(wnd1,"Netmail.");
  470.     }
  471.     if (msg.attr & MSGFRQ) {
  472.         wcursor(wnd1,52,17);
  473.         wprintf(wnd1,"FReq.");
  474.     }
  475.     if (msg.attr & MSGFILE) {
  476.         wcursor(wnd1,52,17);
  477.         wprintf(wnd1,"Attach.");
  478.     }
  479.     if (msg.attr & MSGURQ) {
  480.         wcursor(wnd1,52,17);
  481.         wprintf(wnd1,"UReq.");
  482.     }
  483.     if (msg.m_attr & MSGECHO) {
  484.         wcursor(wnd1,1,18);
  485.         wprintf(wnd1,"Echomail.");
  486.     }
  487.     if (msg.m_attr & MSGDELETED) {
  488.         wcursor(wnd1,1,18);
  489.         wprintf(wnd1,"Del.");
  490.     }
  491.     if (msg.attr & MSGLOCAL) {
  492.         wcursor(wnd1,20,18);
  493.         wprintf(wnd1,"Local.");
  494.     }
  495.     if (msg.m_attr & MSGKEEP) {
  496.         wcursor(wnd1,52,1);
  497.         wprintf(wnd1,"Keep.");
  498.     }
  499.     wcursor(wnd1,1,19);
  500.     wprintf(wnd1,quick_attr());
  501.     init_template(wnd1);
  502.     wprompt(wnd1,2,2,"From:");
  503.     wprompt(wnd1,2,3,"To:");
  504.     wprompt(wnd1,2,4,"Subj:");
  505.     wprompt(wnd1,2,6,"Date:");
  506.     wprompt(wnd1,2,7,"Times Read:");
  507.     wprompt(wnd1,2,8,"Destination zone #:");
  508.     wprompt(wnd1,2,9,"Destination net #:");
  509.     wprompt(wnd1,2,10,"Destination node #:");
  510.     wprompt(wnd1,2,11,"Destination point #:");
  511.     wprompt(wnd1,2,12,"Origin zone #:");
  512.     wprompt(wnd1,2,13,"Origin net #:");
  513.     wprompt(wnd1,2,14,"Origin node #:");
  514.     wprompt(wnd1,2,15,"Origin point #:");
  515.     wprompt(wnd1,2,16,"Message cost:");
  516.     if(type) {
  517.         wprompt(wnd1,26,16,"Dest. domain:");
  518.     }
  519.     fld=establish_field(wnd1,26,2,msk35,from,'a');
  520.     field_help(fld,myname);
  521.     field_validate(fld,noblank);
  522.     fld=establish_field(wnd1,26,3,msk35,to,'a');
  523.     if ((currarea->attr & NET) || (currarea->attr & ALTERNATE)) field_help(fld,find_sysop);
  524.     else field_window(fld,"to        ",40,12);
  525.     field_validate(fld,noblank);
  526.     fld=establish_field(wnd1,3,5,msk63,subj,'a');
  527.     field_window(fld,"subj      ",40,13);
  528.     field_validate(fld,noblank);
  529.     fld=establish_field(wnd1,26,6,msk19,date,'a');
  530.     field_help(fld,help_date);
  531.     field_validate(fld,noblank);
  532.     fld=establish_field(wnd1,26,7,msk10,times,'N');
  533.     field_window(fld,"timesread ",40,14);
  534.     fld=establish_field(wnd1,26,8,msk5,d_zone,'N');
  535.     field_window(fld,"d_zone    ",40,1);
  536.     fld=establish_field(wnd1,26,9,msk5,dest_net,'N');
  537.     field_window(fld,"dest_net  ",40,2);
  538.     fld=establish_field(wnd1,26,10,msk5,dest,'N');
  539.     field_window(fld,"dest_node ",40,3);
  540.     field_validate(fld,dest_check);
  541.     fld=establish_field(wnd1,26,11,msk5,d_point,'N');
  542.     field_window(fld,"d_point   ",40,3);
  543.     fld=establish_field(wnd1,26,12,msk5,o_zone,'N');
  544.     field_help(fld,myzone);
  545.     fld=establish_field(wnd1,26,13,msk5,orig_net,'N');
  546.     field_help(fld,mynet);
  547.     fld=establish_field(wnd1,26,14,msk5,orig,'N');
  548.     field_help(fld,mynode);
  549.     field_validate(fld,orig_check);
  550.     fld=establish_field(wnd1,26,15,msk5,o_point,'N');
  551.     field_help(fld,mypoint);
  552.     fld=establish_field(wnd1,18,16,msk5,cost,'N');
  553.     field_window(fld,"cost      ",40,7);
  554.     if(type) {
  555.         fld=establish_field(wnd1,40,16,msk36,to_domain,'a');
  556.         field_window(fld,"destdomain",40,7);
  557.         field_help(fld,mydomain);
  558.     }
  559.     prep_template(wnd1);
  560. SameMess:
  561.     if(inattr) goto Attributes;
  562.     exitcode=data_entry(wnd1);
  563.  
  564. AttrInterrupt:
  565.     switch (exitcode) {
  566.         case ALT_F1:
  567.         case ALT_F2:
  568.         case ALT_F3:
  569.         case ALT_F4:
  570.         case ALT_F5:
  571.         case ALT_F6:
  572.         case ALT_F7:
  573.         case ALT_F8:
  574.         case ALT_F9:
  575.         case ALT_F10:   do_spawn(convertstring(fkey[exitcode-ALT_F1]));
  576.                         goto OverMess;
  577.         case CTRL_HOME:
  578.         case HOME:  if (type) break;
  579.                     messno=1;
  580.                     get_mess(0);
  581.                     goto NextMess;
  582.         case CTRL_END:
  583.         case END:   if (type) break;
  584.                     messno=nomess;
  585.                     get_mess(0);
  586.                     goto NextMess;
  587.         case CTRL_PGDN:
  588.         case PGDN:  if (type) break;
  589.                     messno++;
  590.                     if (messno>nomess) messno=1;
  591.                     get_mess(0);
  592.                     goto NextMess;
  593.         case CTRL_PGUP:
  594.         case PGUP:  if (type) break;
  595.                     if (messno==1) messno=nomess;
  596.                     else messno--;
  597.                     get_mess(0);
  598.                     goto NextMess;
  599.         case F10:   strcpy(msg.from,rstrip(from));
  600.                     strcpy(msg.to,rstrip(to));
  601.                     strcpy(msg.subj,rstrip(subj));
  602.                     strcpy(msg.date,date);
  603.                     msg.times=(word)atol(times);
  604.                     msg.dest=(word)atol(dest);
  605.                     msg.orig=(word)atol(orig);
  606.                     msg.orig_net=(word)atol(orig_net);
  607.                     msg.dest_net=(word)atol(dest_net);
  608.                     msg.o_zone=(word)atol(o_zone);
  609.                     msg.d_zone=(word)atol(d_zone);
  610.                     msg.d_point=(word)atol(d_point);
  611.                     msg.o_point=(word)atol(o_point);
  612.                     msg.cost=atoi(cost);
  613.                     if (!type) put_mess();
  614.                     else {
  615.                         lstrip(to_domain);
  616.                         rstrip(to_domain);
  617.                         if(!*to_domain) strcpy(to_domain,curaddress.domain);
  618.                         delete_window(wnd1);
  619.                         wnd1=NULL;
  620.                         return (exitcode);
  621.                     }
  622.                     goto NextMess;
  623.         case F9:    if (type) break;
  624.                     messno=select_mess();
  625.                     get_mess(0);
  626.                     goto NextMess;
  627.         case F8:    if (type) break;
  628.                     areano=select_area();
  629.                     get_mess(0);
  630.                     goto NextMess;
  631.         case F7:    goto Attributes;
  632.         case F6:    if(!nidxsize) {
  633.                         any_message(" No nodelist available. ");
  634.                         pause();
  635.                         goto SameMess;
  636.                     }
  637.                     any_message(" [D]estination or [O]rigin node? [D] ");
  638.                     if (toupper(generic_mouse_input(ewnd))!='O') {
  639.                         nid.node=(word)atol(dest);
  640.                         nid.net=(word)atol(dest_net);
  641.                         nid.zone=(word)atol(d_zone);
  642.                     }
  643.                     else {
  644.                         nid.node=(word)atol(orig);
  645.                         nid.net=(word)atol(orig_net);
  646.                         nid.zone=(word)atol(o_zone);
  647.                     }
  648.                     nid.type=255;
  649.                     sprintf(cost,"%-5d",nodelist(&nid,0));
  650.                     if (*cost=='-') strcpy(cost,"0");
  651.                     generic_mouse_input(wnd6);
  652.                     delete_window(wnd6);
  653.                     clear_message();
  654.                     goto SameMess;
  655.         case F4:    select_address();
  656.                     goto SameMess;
  657.         case F3:    select_name();
  658.                     goto SameMess;
  659.         case F2:    do_spawn("");
  660.                     goto OverMess;
  661.         case ESC:   delete_window(wnd1);
  662.                     wnd1=NULL;
  663.                     return (exitcode);
  664.     }
  665.     bell();
  666.     goto SameMess;
  667.  
  668. Attributes: /* Attribute editor */
  669.  
  670.     inattr=1;
  671.     for (x=0;x<16;x++) {
  672.         if (msg.attr & (1<<x)) attr[x][0]='X';
  673.         else attr[x][0]='-';
  674.         attr[x][1]=0;
  675.     }
  676.     for (x=0;x<10;x++) {
  677.         if (msg.m_attr & (1<<x)) mattr[x][0]='X';
  678.         else mattr[x][0]='-';
  679.         mattr[x][1]=0;
  680.     }
  681.     wnd2=establish_window(maxx-40,maxy-21,21,40);
  682.     set_border(wnd2,3);
  683.     set_colors(wnd2,ALL,BLUE,WHITE,BRIGHT);
  684.     set_colors(wnd2,BORDER,WHITE,BLUE,DIM);
  685.     set_colors(wnd2,ACCENT,WHITE,BLACK,BRIGHT);
  686.     set_colors(wnd2,TITLE,BLACK,CYAN,BRIGHT);
  687.     set_title(wnd2," Message Attributes ");
  688.     display_window(wnd2);
  689.     init_template(wnd2);
  690.     wcursor(wnd2,0,18);
  691.     if (!type) wprintf(wnd2," Msg#%u/%u %s\n",messno,nomess,area_attr());
  692.     wprintf(wnd2," [X][-] ESC F7=keep ");
  693.     if(!type) wprintf(wnd2,"F5=qsv F10=save");
  694.     wcursor(wnd2,0,0);
  695.     reverse_video(wnd2);
  696.     wprintf(wnd2," Standard ");
  697.     wcursor(wnd2,21,0);
  698.     wprintf(wnd2," Extra ");
  699.     normal_video(wnd2);
  700.     for (x=0;x<16;x++) {
  701.         wprompt(wnd2,2,x+1,attrprompts[x]);
  702.     }
  703.     for (x=0;x<10;x++) {
  704.         wprompt(wnd2,23,x+1,mattrprompts[x]);
  705.     }
  706.     for (x=0;x<16;x++) {
  707.         fld2=establish_field(wnd2,13,x+1,msk1,attr[x],'O');
  708.         field_window(fld2,"fidoattr  ",1,1);
  709.     }
  710.     for (x=0;x<10;x++) {
  711.         fld2=establish_field(wnd2,34,x+1,msk1,mattr[x],'O');
  712.         field_window(fld2,"xbbsattr  ",1,1);
  713.         if(x==9) {
  714.             if(stricmp(name,"Wayne Michaels") && stricmp(name,"Hector Plasmic") && stricmp(name,"Mark Kimes")) {
  715.                 field_protect(fld2,1);
  716.             }
  717.         }
  718.     }
  719.  
  720.     prep_template(wnd2);
  721. AttrOver:
  722.     exitcode=data_entry(wnd2);
  723.     if (exitcode==ESC) {
  724.         goto QuitAttr;
  725.     }
  726.     if(type) {
  727.         if(exitcode!=F7) {
  728.             bell();
  729.             goto AttrOver;
  730.         }
  731.     }
  732.     else if (exitcode!=F7 && exitcode!=F10 && exitcode!=F5) {
  733.         delete_window(wnd2);
  734.         goto AttrInterrupt;
  735.     }
  736.     for (x=0;x<16;x++) {
  737.         if (attr[x][0]=='X') msg.attr = (msg.attr | (1<<x));
  738.         else msg.attr = (msg.attr & (~(1<<x)));
  739.     }
  740.     for (x=0;x<10;x++) {
  741.         if (mattr[x][0]=='X') msg.m_attr = (msg.m_attr | (1<<x));
  742.         else msg.m_attr = (msg.m_attr & (~(1<<x)));
  743.     }
  744. QuitAttr:
  745.     delete_window(wnd2);
  746.     if(exitcode!=F5) {
  747.         inattr=0;
  748.     }
  749.     else {
  750.         exitcode=F10;
  751.         goto AttrInterrupt;
  752.     }
  753.     goto SameMess;
  754. }
  755.  
  756.  
  757. void help_date (char *bf) {
  758.  
  759.     strcpy(bf,fidodate());
  760. }
  761. void myname (char *bf) {
  762.     sprintf(bf,"%-35s",name);
  763. }
  764. void myzone (char *bf) {
  765.     sprintf(bf,"%-5u",curaddress.zone);
  766. }
  767. void mynet (char *bf) {
  768.     sprintf(bf,"%-5u",curaddress.net);
  769. }
  770. void mynode (char *bf) {
  771.     sprintf(bf,"%-5u",curaddress.node);
  772. }
  773. void mypoint (char *bf) {
  774.     sprintf(bf,"%-5u",curaddress.point);
  775. }
  776. void mydomain (char *bf) {
  777.     strcpy(to_domain,curaddress.domain);
  778. }
  779.  
  780.