home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / HATCH / SINM10B1.ZIP / SINMAIL.MOD < prev   
Text File  |  1996-03-01  |  17KB  |  558 lines

  1. In order to get SinMail to work with your system, these mods must be made to
  2. the WWIV source code.  These have been tested with versions v4.24 and v4.24a
  3. and are planned to be updated as new versions of WWIV are released.
  4.  
  5. There are three main sections to this file.  The first includes all the
  6. necessary changes which will enable SinMail to work with your system.  The
  7. second part adds an automatic dialer to your WFC so your system will be able
  8. to call your internet connection.  The third section gives your users their
  9. own plan files which users on the internet can finger through SinMail.  For
  10. more information on the finger system, please refer to the main documenation
  11. for SinMail.
  12.  
  13. Why is this section broken up into three separate sections?  In the interest
  14. of proper modularity and future modifications writen by Singe Technologies
  15. and/or third parties, this makes it easier to distinguish the main sections
  16. that might be built upon.
  17.  
  18.  
  19.   KEY to symbols:
  20.  
  21.     ##  = Look for this existing code (in unmodified original source code)
  22.      +  = Add this line of code
  23.     -   = Remove this line of code
  24.  
  25.  
  26. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27. :::
  28. :::  SinMail Mod
  29. :::
  30.  
  31. This section is absolutely necessary if you wish to run SinMail.
  32.  
  33. Adds approximately 1.5kb to your BBS.EXE
  34.  
  35. [ ] VARDEC.H ================================================================
  36.  
  37.   (1) Look for this code near the top of the file and make the
  38.       appropriate additions.
  39.  
  40. ##  #ifndef __OS2__
  41. ##  #define RIPDRIVE
  42. ##  #endif
  43. ##
  44.  +  // sinmail block start
  45.  +  #define INTERNET_EMAIL   65532
  46.  +  #define INTERNET_NEWS    65533
  47.  +  #define INTERNET_STORAGE 3
  48.  +  // sinmail block end
  49. ##
  50. ##  #define OK_LEVEL 0
  51.  
  52.  
  53. [ ] FCNS.H ==================================================================
  54.  
  55.   (1) Change the line for "int open_email".   (Near line 233 if you haven't
  56.       changed your source very much.)
  57.  
  58. -  int open_email(int wrt);
  59.  + int open_email(unsigned int wrt);
  60.  
  61.  
  62. [ ] MSGBASE.C ===============================================================
  63.  
  64.   (1) SEARCH for "void remove_link".  Down a few lines more (about 20):
  65.  
  66. ##  case 2:
  67.  +  case INTERNET_STORAGE: // sinmail line
  68. ##    f=open_file(aux);
  69.  
  70.   (2) Again, about 25 lines down in "void savefile":
  71.  
  72. ##  case 2:
  73.  +  case INTERNET_STORAGE: // sinmail line
  74. ##    f=open_file(aux);
  75.  
  76.   (3) Again, about 30 lines down in "char *readfile":
  77.  
  78. ##  case 2:
  79.  +  case INTERNET_STORAGE: // sinmail line
  80. ##    f=open_file(aux);
  81.  
  82.   (4)  In the "void inmsg" function, SEARCH for "if (real_name)" and put
  83.        this section of code _above_ it.
  84.  
  85. ##    l1=0;
  86.  +    // sinmail block start
  87.  +    if (strcmpi(aux,"imail")==0)
  88.  +      addline(b,dest,&l1);
  89.  +    // sinmail block end
  90. ##    if (real_name)
  91. ##      addline(b,thisuser.realname,&l1);
  92. ##    else
  93. ##      addline(b,nam1(&thisuser,usernum,net_sysnum),&l1);
  94.  
  95.   (5) A little over 50 lines down in inmsg from where you just were, you'll
  96.       find this section:
  97.  
  98. ##  if (sysinfo.flags & OP_FLAGS_MSG_TAG) {
  99. ##    if ((xsubs[curlsub].num_nets) && (strcmp(aux,"EMAIL")!=0)
  100.  +        && (strcmp(aux,"IMAIL")!=0) // sinmail line
  101. ##        && (!(subboards[curlsub].anony & anony_no_tag))
  102. ##        && (strcmp(strupr(irt),strupr(get_string(333)))!=0)) {
  103.  
  104.   (6) SEARCH for "int open_email", make these changes and insert these lines:
  105.  
  106. -   int open_email(int wrt)
  107.  +  int open_email(unsigned int wrt)
  108. ##  {
  109. ##    char s[100];
  110. ##    int f,i;
  111. ##
  112.  +    // sinmail block start
  113.  +    if(wrt==INTERNET_EMAIL)
  114.  +      sprintf(s,"%sIMAIL.DAT", syscfg.datadir);
  115.  +    else
  116.  +    // sinmail block end
  117. ##    sprintf(s,"%sEMAIL.DAT", syscfg.datadir);
  118. ##
  119. ##    for (i=0; i<5; i++) {
  120.  
  121.   (7) SEARCH for "void sendout_email".  About 25 lines down ...
  122.  
  123. ##  if (sy==0) {
  124.  +    // sinmail block start
  125.  +    if ((un==INTERNET_EMAIL)||(un==INTERNET_NEWS))
  126.  +      f=open_email(INTERNET_EMAIL);
  127.  +    else
  128.  +    // sinmail block end
  129. ##    f=open_email(1);
  130. ##    if (f<0) {
  131. ##      return;
  132. ##    }
  133.  
  134.   (8) SEARCH for "get_string(647)", which should be about 80 lines down,
  135.  
  136. ##    bbsfree(b);
  137. ##    bbsfree(b1);
  138. ##  }
  139. ##  s2[0]=0;
  140. ##  strcpy(s,get_string(647));
  141.  +
  142.  +  // sinmail block start
  143.  +  if (un==INTERNET_EMAIL)
  144.  +    strcat(s,net_email_name);
  145.  +  else if (un==INTERNET_NEWS)
  146.  +    strcat(s,subboards[curlsub].name);
  147.  +  else
  148.  +  // sinmail block end
  149.  +
  150. ##  if (sy==0) {
  151. ##    read_user(un,&ur);
  152. ##    ++ur.waiting;
  153.  
  154.   (9) SEARCH for "void email".  Near the top, put in this chunk of code:
  155.       (it's large, but try to bear with it; you're almost done MSGBASE.C)
  156.  
  157. ##  char s2[81],t[81];
  158. ##  userrec ur;
  159. ##  slrec ss;
  160. ##  net_system_list_rec *csne;
  161. ##
  162. ##
  163.  +  // sinmail block start
  164.  +  if (un==INTERNET_EMAIL) {
  165. >+    if (0x0100 & thisuser.ar) {
  166.  +      // user is qualified
  167.  +      // net_email_name has recipient's email address
  168.  +      nl();
  169.  +      prt(7,"Internet email to: ");
  170.  +      prt(3,net_email_name);
  171.  +      nl();
  172.  +      strcpy(s2,net_email_name);
  173.  +      msg.storage_type=2;
  174.  +      write_inst(INST_LOC_EMAIL, INTERNET_EMAIL, INST_FLAGS_NONE);
  175.  +
  176.  +      // now get the message.
  177.  +      inmsg(&msg,t,0,1,"IMAIL",ALLOW_FULLSCREEN,s2,0);
  178.  +      if (msg.stored_as==0xffffffff)
  179.  +        return;
  180.  +      sendout_email(t, &msg, 0, INTERNET_EMAIL, 0, 0, usernum,
  181.  +        net_sysnum, 0, net_num);
  182.  +
  183.  +      sprintf(s2,"9Sent Internet email to 1%s9.0",net_email_name);
  184.  +      sysoplog(s2);
  185.  +      return;
  186. >+    }
  187. >+    else {
  188. >+      // user is not qualified
  189. >+      nl();
  190. >+      pl("9I'm sorry, your account cannot access Internet email.");
  191. >+      nl();
  192. >+      return;
  193. >+    }
  194.  +  }
  195.  +  // sinmail block end
  196.  +
  197. ##  if (freek1(syscfg.msgsdir)<10.0) {
  198. ##    nl();
  199. ##    pl(get_string(332));
  200.  
  201.   ==> Special Note:  The lines above that begin with the symbol >+ indicate
  202.       lines that the SysOp may wish to change to suit his or her own system.
  203.       On The Ethereal Plane, an AR of I indicates that a user has the access
  204.       to send or receive Internet mail, but this is changable above.  You
  205.       may also wish to remove the >+ lines entirely, which will still work,
  206.       but will not restrict certain users from using Internet email.  This is
  207.       left to the SysOp's discretion.
  208.  
  209.   (10) SEARCH for "void read_message1".  About 25 lines down :
  210.  
  211. ##    case 2:
  212.  +    case INTERNET_STORAGE: // sinmail line
  213. ##      ss=readfile(&m,fn,&len);
  214. -       if (m.storage_type!=2) {
  215.  +      // sinmail line changed
  216.  +      if ((m.storage_type!=2) && (m.storage_type!=INTERNET_STORAGE)) {
  217. ##        strcpy(s,syscfg.msgsdir);
  218. ##        ltoa(m.stored_as,s1,16);
  219. ##        if (m.storage_type==1) {
  220.  
  221.   (11) Down about 150 lines in read_message1 ...
  222.        (SEARCH for "case 2:")
  223.  
  224. ##      case 2:
  225.  +      case INTERNET_STORAGE: // sinmail line
  226. ##        ch=ss[l1];
  227. ##        if (l1>=len)
  228.  
  229.   (12) SEARCH for "void lineadd".  About 25 lines down from that:
  230.  
  231. ##    case 2:
  232.  +    case INTERNET_STORAGE: // sinmail line
  233. ##      f=open_file(aux);
  234.  
  235.  
  236. [ ] READMAIL.C ==============================================================
  237.  
  238.   (1) SEARCH for "fromsys==0".  This should be in the void readmail function,
  239.       about 108 lines down from readmail, and 373 from the top of the file.
  240.       (The search should nab it fine though, don't bother counting. <grin>)
  241.  
  242. ##      } else {
  243. ##        if (m.fromsys==0) {
  244.  +          // sinmail block start
  245.  +          if (m.fromuser==INTERNET_EMAIL) {
  246.  +            grab_user_name(&(m.msg),"EMAIL");
  247.  +            sprintf(s1,"%30.30s",net_email_name);
  248.  +            strcat(s,s1);
  249.  +          }
  250.  +          else
  251.  +          // sinmail block end
  252. ##          if (m.fromuser==65535) {
  253. ##            if (nn!=255)
  254. ##              strcat(s,net_networks[nn].name);
  255.  
  256.   (2) Down about 100 lines...  (SEARCH for "rd_coff")
  257.  
  258. ##  #ifdef RIPDRIVE
  259. ##        rd_coff();
  260. ##  #endif
  261. ##        pla(s,&abort);
  262. -         if ((m.fromsys) && (!m.fromuser))
  263.  +        // sinmail line changed
  264.  +        if (((m.fromsys) && (!m.fromuser)) ||
  265.  +         (m.fromuser == INTERNET_EMAIL))
  266. ##          grab_user_name(&(m.msg),"EMAIL");
  267. ##        else
  268. ##          net_email_name[0]=0;
  269.  
  270.  
  271. [ ] BBSUTL1.C ===============================================================
  272.  
  273.   (1) SEARCH for "void parse_email_info".  About 10 lines down:
  274.  
  275. ##        if (un>0)
  276. ##          *un1=un;
  277. ##        else
  278. ##          pl(get_string(8));
  279.  +  /*         // sinmail commenting this block out.
  280. ##  } else if (atoi(ss+1)==0) {
  281. ##        for (i=0; i<net_num_max; i++) {
  282. .
  283. .   should be a few more lines in here ...  we're getting rid of them anyway
  284. .   by commenting them out.
  285. .
  286. ##        if (i>=net_num_max)
  287. ##          pl(get_string(8));
  288.  +  */         // sinmail block out end
  289. ##  } else {
  290.  +    // sinmail block start
  291.  +    // at this point, we know they put something after the @at@ sign
  292.  +    if(isalpha(ss[1])) {
  293.  +      // to get here, there are letters after the @at@ sign
  294.  +      *un1=INTERNET_EMAIL;
  295.  +      strcpy(net_email_name,s);
  296.  +      return;
  297.  +    }
  298.  +    if(isdigit(ss[1])) {
  299.  +      // to get here, there are numbers.
  300.  +      // this might not be for the internet though so we have to check.
  301.  +      ss1=strchr(ss+1,'.');
  302.  +      if(ss1) if(isdigit(ss1[1])) {
  303.  +        // now we have at least '@255.1'... so we can safely guess its
  304.  +        // an internet IP address.
  305.  +        *un1=INTERNET_EMAIL;
  306.  +        strcpy(net_email_name,s);
  307.  +        return;
  308.  +        }                         
  309.  +      }
  310.  +    // sinmail block end
  311. ##
  312. ##        ss[0]=0;
  313. ##        ss=&(ss[1]);
  314. ##        i=strlen(s);
  315. ##        while ((i>0) && (s[i-1]==' '))
  316.  
  317.  
  318. [ ] BBSOVL1.C ===============================================================
  319.  
  320.   (1) This step isn't that important, but it does add the 'feel' of having
  321.       Internet mail by making the mail input prompt lowercase.  SEARCH for
  322.       "void send_email".  A few lines down:
  323.  
  324. ##  pl(get_string(15));
  325. ##  helpl=14;
  326. ##  outstr(":");
  327. -   input(s1,75);
  328.  +  inputl(s1,75); // sinmail line
  329. ##  helpl=0;
  330.  
  331.  
  332. [ ] FIX.C ===================================================================
  333.  
  334.   (1) SEARCH for "case 2".  It should be in the "void remove_link" function.
  335.  
  336. ##      unlink(s);
  337. ##      break;
  338. ##    case 2:
  339.  +    case INTERNET_STORAGE:  // sinmail line
  340. ##      f=open_file(aux);
  341. ##      if (f>=0) {
  342. ##        set_gat_section(f,(int) (m.stored_as/2048));
  343.  
  344.   (2) SEARCH for "void check_type_2".  About 40 lines down:
  345.  
  346. ##  anything_done=0;
  347. ##
  348. ##  for (i=0; i<num; i++)
  349. -     if (list[i].storage_type==2) {
  350.  +    // sinmail line changed
  351.  +    if ((list[i].storage_type==2) ||
  352.  +      (list[i].storage_type==INTERNET_STORAGE)) {
  353. ##      if (f<0) {
  354. ##        if (!any) {
  355.  
  356.   (3) Down about 50 lines from there:
  357.  
  358. ##    printf("%sErrors in '%s%s.DAT':\n",NOK,syscfg.msgsdir,extra);
  359. ##    for (i=0; i<num; i++)
  360. -       if (list[i].storage_type==2) {
  361.  +      // sinmail line changed
  362.  +      if ((list[i].storage_type==2) ||
  363.  +        (list[i].storage_type==INTERNET_STORAGE)) {
  364. ##        sec=(list[i].stored_as/2048)*2048;
  365. ##        csec=list[i].stored_as % 2048;
  366.  
  367.  
  368. [ ] QWK.C ===================================================================
  369.  
  370.   (1) SEARCH for "char *qwk_readfile".  About 35 lines down:
  371.  
  372. ##      b[*l]=0;  // Null terminate out text
  373. ##      break;
  374. ##    case 2:
  375.  +    case INTERNET_STORAGE: // sinmail line
  376. ##
  377. ##      // You will notice that this case opens, but does not close its file
  378. ##      // This is becuase of the optimized open file routine, the file gets
  379.  
  380.  
  381. [ ] MSGBASE1.C ==============================================================
  382.  
  383.   (1) SEARCH for "write_inst".  The first one should be about 70 lines down
  384.       in the "void post" function.
  385.  
  386. ##  time1=time(NULL);
  387. ##
  388. ##  write_inst(INST_LOC_POST,curlsub,INST_FLAGS_NONE);
  389. ##
  390.  +  // sinmail block start
  391.  +  if (subboards[curlsub].storage_type == INTERNET_STORAGE) {
  392.  +    nl();
  393.  +    prt(7,"posting on usenet newsgroup: ");
  394.  +    prt(3,subboards[curlsub].name);
  395.  +    nl();
  396.  +    inmsg(&m,p.title,0,1,"IMAIL",ALLOW_FULLSCREEN,subboards[curlsub].name,0);
  397.  +    if(m.stored_as==0xFFFFFFFF)
  398.  +      return;
  399.  +    sendout_email(p.title,&m,0,INTERNET_NEWS,0,0,usernum,0,0,0);
  400.  +    sprintf(s,"9posted on usenet newsgroup: 1%s9.0",
  401.  +      subboards[curlsub].name);
  402.  +    sysoplog(s);
  403.  +    nl();
  404.  +    prt(7,"Be patient, your post will not show up immediately ...");
  405.  +    nl();
  406.  +    return;
  407.  +  }
  408.  +  else
  409.  +  // sinmail block end
  410.  +
  411. ##  inmsg(&m,p.title,&a,1,(subboards[curlsub].filename),ALLOW_FULLSCREEN,
  412. ##    subboards[curlsub].name, (subboards[curlsub].anony&anony_no_tag)?1:0)
  413. ##  if (m.stored_as!=0xffffffff) {
  414.  
  415.   (2) SEARCH for "case 'A'".  It should be about 200 lines down inside the
  416.       "void scan" function.
  417.  
  418. ##  case 'A':
  419. ##    if (rip_on()) {
  420. ##      sprintf(s,"\n!|w000%c271610|e|#\r ", formery);
  421. ##      comstr(s);
  422. ##    }
  423. ##    strcpy(irt_sub, subboards[usub[cursub].subnum].name);
  424. -     if ((get_post(msgnum)->ownersys) && (!get_post(msgnum)->owneruser))
  425.  +    // sinmail line changed
  426.  +    if (((get_post(msgnum)->ownersys) && (!get_post(msgnum)->owneruser))
  427.  +      || (get_post(msgnum)->owneruser == INTERNET_EMAIL))
  428. ##      grab_user_name(&(get_post(msgnum)->msg),subboards[curlsub].filename);
  429. ##    grab_quotes(&(get_post(msgnum)->msg),subboards[curlsub].filename);
  430.  
  431.  
  432. [ ] SUBEDIT.C ===============================================================
  433.  
  434.   (1) SEARCH for "exist".  You should be able to find it in the
  435.       "void modify_sub" function.  A little over 100 lines down:
  436.  
  437. ##    sprintf(s,"%s%s.SUB",syscfg.datadir,r.filename);
  438. ##    sprintf(s1,"%s%s.DAT",syscfg.msgsdir,r.filename);
  439. -     if ((r.storage_type==2) && (!exist(s)) && (!exist(s1)) &&
  440.  +    // sinmail line changed
  441.  +    if (((r.storage_type==2) || (r.storage_type==INTERNET_STORAGE)) &&
  442.  +      (!exist(s)) && (!exist(s1)) &&
  443. ##      (strcmp(r.filename,"NONAME")!=0)) {
  444. ##      prt(2,get_string(973));
  445.  
  446.   (2) SEARCH for "case 'K'".  It should be about 150 lines down from
  447.       where you were, in the same function.  If you have changed the value
  448.       of INTERNET_STORAGE, you may need to make some changes here.
  449.  
  450. ##  case 'K':
  451. ##    nl();
  452. ##    prt(2,get_string(205));
  453. ##    input(s,4);
  454. ##    i=atoi(s);
  455. -     if ((s[0]) && (i>=0) && (i<=2))
  456.  +    // sinmail line changed
  457.  +    if ((s[0]) && (i>=0) && (i<=INTERNET_STORAGE))
  458. ##      r.storage_type=i;
  459. ##    break;
  460.  
  461.  
  462. [ ] BBS.STR =================================================================
  463.  
  464.   (1) You've probably noticed that we are adding an option to the above
  465.       part in which the SysOp can choose a message base's storage type.
  466.       You will need to change the BBS.STR line 205 to reflect this change
  467.       if you want it to show up in the prompt line.  BBS.STR is found in the
  468.       GFILES directory and can be editing with MINIESM, included with the
  469.       WWIV source, or with any other External String Manager.  Here is an
  470.       example of the usage for MINIESM
  471.  
  472.     C:\WWIV>MINIESM GFILES\BBS.STR -M205
  473.     GFILES\BBS.STR: 1639 strings
  474.  
  475.     String #205: "New Storage Type (0,1,2) ? "
  476.  
  477.     New? New Storage Type (0,1,2,3) ?
  478.  
  479.  
  480.     Change string #205 to:
  481.     "New Storage Type (0,1,2,3) ? "
  482.  
  483.     Sure? y
  484.  
  485.     Updated string #205
  486.  
  487.       Please note, that the addition of '3' relies on the fact that you have
  488.       chosen 3 as the INTERNET_STORAGE value.  If you have changed the value,
  489.       it would make sense to make the obvious change here as well.  Also note
  490.       the additional space at the end of the string.  It's not a big deal,
  491.       but since you've taken the time to read this, why not make it look
  492.       nice too?
  493.  
  494.  
  495. :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  496. :::
  497. :::  Dialout Mod
  498. :::
  499.  
  500. This mod is pretty much required if you would like your system to
  501. automatically dialout to your connection from the WFC.
  502.  
  503. Adds approximately 176 bytes to your BBS.EXE  
  504.  
  505.  
  506. [ ] BBS.C ===================================================================
  507.  
  508.   (1) SEARCH for "void getcaller".  Down a few lines more:
  509.  
  510. ##  double d;
  511. ##  userrec tu;
  512.  +  unsigned long l;            // sinmail line
  513.  +  l=(long)time(NULL) + 3600;  // sinmail line
  514. ##  c_sub=c_dir=0;
  515.  
  516.   (2) a little further down in "void getcaller":
  517.  
  518. ##    attempt_callout();
  519. ##    any=1;
  520. ##  }
  521. ##
  522.  +  // sinmail block start
  523.  +  // auto dialout after specified duration of time
  524.  +  if ((long)time(NULL)>=l) {
  525.  +    l=(long)time(NULL) + 3600;
  526.  +    if (instance==1) {
  527.  +      // callout time
  528.  +      pl("polling...");
  529.  +      extern_prog("poll.bat",EFLAG_SHRINK);
  530.  +    }
  531.  +  }
  532.  +  // sinmail block end
  533.  +
  534. ##  if (kbhitb()) {
  535.  
  536.  
  537.   (3) down a little bit more ...
  538.  
  539. ## if (ch) {
  540. ##   wfc=2;
  541. ##   any=1;
  542. ##   switch(ch) {
  543.  +
  544.  +     // sinmail block start
  545.  +     // poll internet connection by pressing '\' backslash key from WFC.
  546.  +     case '\\':
  547.  +       l=(long)time(NULL) + 3600;
  548.  +       // callout time
  549.  +       pl("polling...");
  550.  +       extern_prog("poll.bat",EFLAG_SHRINK);
  551.  +       break;
  552.  +     // sinmail block end
  553.  +
  554. ##     case '=':
  555. ##       if (ok_local()) {
  556.  
  557.  
  558.