home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / MODS / FMD-38A.ZIP / FMD-38A.MOD < prev    next >
Encoding:
Text File  |  1995-06-22  |  9.1 KB  |  298 lines

  1. Nicolas Leblanc #2 @20302
  2. Sun Jun 18 23:41:37 1995
  3.    ┌┬─── ──  ─   ─  ── ───────────────────────────────────────────────────┬─ ∙∙
  4.    ││                    Alternative Worlds Presents                      │
  5.    └┼─────────────────────────────────────────────────────────────────────┐
  6.    ││ Mod Name       » FMD-38a.MOD                                        │∙
  7.    ││ Difficulty     » █▒▒▒▒▒▒▒▒▒▒ (1/10)                                 │:
  8.    ││ WWIV Version   » 4.24                                               ││
  9.    ││ Date Affected  » 06/01/95                                           ││
  10.    :│ Files Affected » MISCCMD.C / VARDEC.H / LILO.C / MMENU.C            ││
  11.    ∙│ Description    » Send Memo To Other Users.                          ││
  12.     └─────────────────────────────────────────────────────────────────────┼┐
  13.     │       A French Mod Division Release - (C) 1995 FMD Software         ││
  14. ∙∙ ─┴─────────────────────────────────────────────────── ──  ─   ─  ── ───└┘
  15.  
  16.  
  17.  ┌┬══════════════════┐
  18.  ││ Long Description ││
  19.   └══════════════════┴┘
  20.  
  21.     This modification will give to your system another type of messages that
  22. users can send, a memo, a 2 lines message. This can also be used instead of
  23. SSM and it is very useful for system messages.
  24.  
  25.     The memo can be replied and saved.
  26.  
  27. Revision A:
  28.  
  29.   - Updated for WWIV v4.24
  30.  
  31.  ┌┬═══════┐
  32.  ││ Tests ││
  33.   └═══════┴┘
  34.  
  35.   This modification has been tested on a virgin WWIV v4.24 source using
  36.   Borland C++ v4.5
  37.  
  38. ──────────────────────────────────────────────────────────────────────────────
  39.                                    Legend
  40.                           ╔═══╤══════════════════┐
  41.                           │ + │ Add This Line    │
  42.                           │ - │ Delete This Line │
  43.                           │ * │ Modify This Line │
  44.                           │ = │ Existing Line    │
  45.                           └═══╧══════════════════╝
  46. ───[Step 1]────────────────────────────────────────────────────────────────────
  47.  
  48. Load up VARDEC.H, add the following structure just after batchrec:
  49.  
  50.  
  51. + typedef struct
  52. + {
  53. +         char            message[81],             /* Line 1 */
  54. +                         message1[81],            /* Line 2 */
  55. +                         from[41];                /* From */
  56. +         unsigned short  touser;                  /* To */
  57. + } memo;
  58.  
  59. ───[Step 2]────────────────────────────────────────────────────────────────────
  60.  
  61. Load up MISCCMD.C, add the following functions at the end of the file.
  62.  
  63. void systememo(int un, char *s,char *s2)
  64. /*
  65.  * Example : systememo(1, "Line 1", "Line 2");  un = User #
  66.  */
  67. {
  68.   int  f, i, i1;
  69.   userrec u;
  70.   char s1[81];
  71.   memo memorec;
  72.  
  73.   sprintf(s1,"%sMEMO.DAT",syscfg.datadir);
  74.   f=sh_open(s1,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
  75.   i=(int) (filelength(f) / sizeof(memo));
  76.   i1=i-1;
  77.   if (i1>=0)
  78.   {
  79.     sh_lseek(f,((long) (i1)) * sizeof(memo), SEEK_SET);
  80.     sh_read(f,(void *)&memorec,sizeof(memo));
  81.     while ((memorec.touser==0) && (i1>0))
  82.     {
  83.       --i1;
  84.       sh_lseek(f,((long) (i1)) * sizeof(memo), SEEK_SET);
  85.       sh_read(f,(void *)&memorec,sizeof(memo));
  86.     }
  87.     if (memorec.touser)
  88.       ++i1;
  89.   }
  90.   else
  91.     i1=0;
  92.   memorec.touser=un;
  93.   strcpy(memorec.message,s);
  94.   strcpy(memorec.message1,s2);
  95.   strcpy(memorec.from,syscfg.systemname);
  96.   sh_lseek(f,((long) (i1)) * sizeof(memo), SEEK_SET);
  97.   sh_write(f,(void *)&memorec,sizeof(memo));
  98.   sh_close(f);
  99. }
  100.  
  101. void send_memo(char *s)
  102. /* Example : send_memo("dark shadow") or send_memo("") = Ask User */
  103. {  int f, i, i1, ui;
  104.   char s1[81],*s2;
  105.   userrec u;
  106.   memo memorec;
  107.  
  108.   nl();
  109.   npr("2Send Memo To : ");
  110.   mpl(40);
  111.   if (!s[0])
  112.     input(s1,40);
  113.   else
  114.   {
  115.     s2=strupr(s);
  116.     strcpy(s1,s2);
  117.     npr("%s\r\n",s1);
  118.   }
  119.   ui=finduser1(s1);
  120.   if (ui>0)
  121.   {
  122.     read_user(ui,&u);
  123.     sprintf(s1,"%sMEMO.DAT",syscfg.datadir);
  124.     f=sh_open(s1,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
  125.     i=(int) (filelength(f) / sizeof(memo));
  126.     i1=i-1;
  127.     if (i1>=0)
  128.     {
  129.       sh_lseek(f,((long) (i1)) * sizeof(memo), SEEK_SET);
  130.       sh_read(f,(void *)&memorec,sizeof(memo));
  131.       while ((memorec.touser==0) && (i1>0))
  132.       {
  133.         --i1;
  134.         sh_lseek(f,((long) (i1)) * sizeof(memo), SEEK_SET);
  135.         sh_read(f,(void *)&memorec,sizeof(memo));
  136.       }
  137.       if (memorec.touser)
  138.         ++i1;
  139.     }
  140.     else
  141.       i1=0;
  142.     memorec.touser=ui;
  143.     strcpy(memorec.from,thisuser.name);
  144.     npr("\r\n  2Ok, Enter Your Memo, You Have Two Lines.\r\n");
  145.     npr(" [---------------------------------------------------------------------------]\r\n");
  146.     npr(": ");
  147.     inputl(memorec.message,75);
  148.     npr(": ");
  149.     inputl(memorec.message1,75);
  150.     npr("\r\n5Sending.... ");
  151.     sh_lseek(f,((long) (i1)) * sizeof(memo),SEEK_SET);
  152.     sh_write(f,(void *)&memorec,sizeof(memo));
  153.     sh_close(f);
  154.     npr("5Done\r\n");
  155.   }
  156.   else
  157.   {
  158.     npr("Unknown User");
  159.     s[0]=0;
  160.   }
  161. }
  162.  
  163. void read_memo(void)
  164. /* Example : read_memo(); */
  165. {
  166.   int i, i2=1, f, i1;
  167.   char s1[81], ch;
  168.   memo memorec;
  169.  
  170.   npr("5Scanning for Memo....\r\n");
  171.   sprintf(s1,"%sMEMO.DAT",syscfg.datadir);
  172.   f=sh_open(s1,O_RDWR | O_BINARY | O_CREAT, S_IREAD | S_IWRITE);
  173.   i=(int) (filelength(f) / sizeof(memo));
  174.   for (i1=0; i1<i; i1++)
  175.   {
  176.     sh_lseek(f,((long) (i1)) * sizeof(memo),SEEK_SET);
  177.     sh_read(f,(void *)&memorec,sizeof(memo));
  178.     if (memorec.touser==usernum)
  179.     {
  180.       i2=0;
  181.       nl();
  182.       npr("1You Have a Memo From : %s\r\n",memorec.from);
  183.       npr("%s\r\n",memorec.message);
  184.       npr("%s\r\n",memorec.message1);
  185.       nl();
  186.       npr("2[D]elete [R]eply [I]gnore : ");
  187.       ch=onek("DRI");
  188.       switch(ch)
  189.       {
  190.         case 'D':
  191.           memorec.touser=0;
  192.           memorec.from[0]=0;
  193.           memorec.message[0]=0;
  194.           memorec.message1[0]=0;
  195.           sh_lseek(f,((long) (i1)) * sizeof(memo),SEEK_SET);
  196.           sh_write(f,(void *)&memorec,sizeof(memo));
  197.         break;
  198.         case 'R':
  199.           strcpy(s1,memorec.from);
  200.           memorec.touser=0;
  201.           memorec.from[0]=0;
  202.           memorec.message[0]=0;
  203.           memorec.message1[0]=0;
  204.           sh_lseek(f,((long) (i1)) * sizeof(memo),SEEK_SET);
  205.           sh_write(f,(void *)&memorec,sizeof(memo));
  206.           send_memo(s1);
  207.         break;
  208.       }
  209.     }
  210.   }
  211.   sh_close(f);
  212.   if (i2)
  213.     npr("5Nothing For You Today....\r\n");
  214. }
  215.  
  216.  
  217. ───[Step 3]────────────────────────────────────────────────────────────────────
  218.  
  219. Load BBS.C, add the following code:
  220.  
  221. =  if ((strcmp(s,"UPLOAD")==0) && (actsl>10))
  222. =    upload_post();
  223. +  if ((strcmp(s,"MEMO")==0) && (actsl>syscfg.newusersl))
  224. +    send_memo("");
  225. =  if (strcmp(s,"QWK")==0)
  226. =    qwk_menu();
  227. =  if (strcmp(s,"CLS")==0) {
  228.  
  229. ───[Step 4]────────────────────────────────────────────────────────────────────
  230.  
  231. Load LILO.C and change the following code in function logon:
  232.  
  233. =    }
  234. =    topscreen();
  235. =    create_chain_file();
  236. =    rsm(usernum,&thisuser,1);
  237. +    read_memo();
  238. =    if (thisuser.waiting) {
  239. =      if (menu_on()) {
  240. =        printmenu(324);
  241. =        rip_popup = 0;      /* Disable the Yes/No prompt */
  242.  
  243. ───[Step 5]────────────────────────────────────────────────────────────────────
  244.  
  245. This is the 2nd function of that mod, you can send memo to users
  246. from "WWIV" as you like, you can add them everywhere you want.
  247. Example is:  systememo(54,"Happy Birthday","Dear User."); or
  248. anything like it, the function use is:
  249.  
  250.                   systememo(usernumber,"Line 1","Line 2");
  251.  
  252. As long as you will use this function, you will find many place in your
  253. system and a better way to use this, many functions can be done with
  254. this powerful tool, it's a better way that SSM, except that it's only
  255. available locally.
  256.  
  257. Example of use in case a newuser is validated on your system:
  258.  
  259. In NEWUSER.C
  260.  
  261. =      if (strcmp(s,thisuser.pw)==0)
  262. =        ok=1;
  263. =    } while ((!ok) && (!hangup));
  264. +    sprintf(s, "%s just validated today", thisuser.name);
  265. +    systememo(1, "New User Notice", s);
  266. =    checkit=0;
  267. =    if (incom) {
  268. =      if (printfile("FEEDBACK"))
  269. =        sl1(0,get_stringx(1,29));
  270. =      feedback(1);
  271. =    }
  272.  
  273. ───[Step 6]────────────────────────────────────────────────────────────────────
  274.  
  275. That's it, simply do a MAKE FCNS and recompile the entire system. You need to
  276. update your menus to let your user know that the //MEMO command exists. Also,
  277. this mod can be easily modified to send memo to all users or send memo from
  278. specific source, it's up to you!
  279.  
  280.  
  281. French Proverb: Il n'y a que la vérité qui blesse.
  282.  
  283. For comments, bug report and suggestion, e-mail at the following address:
  284.  
  285. Nicolas LeBlanc  2@20302.WWIVnet (aka Spotnick)
  286.                  -> spotnick@gamemaster.qc.ca
  287. Martin Bourdages 242@20306 / 3@20302.WWIVnet (aka Dark Shadow)
  288.                  -> martin.bourdages@radio.magicnet.com
  289.  
  290.                  =>   French Mod Division Support Sub   <=
  291.                                 SubType: FMD
  292.                            Host: @20302 (WWIVnet)
  293.                       Scan sublist for other networks
  294.  
  295.         Read PRODUCTS.FMD for the full list of our support systems.
  296.  
  297. ───[EOF]──────────────────────────────────────────────────────────────────────
  298.