home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / winsock / wvnsc926 / rcs / wvheader.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-19  |  60.0 KB  |  2,795 lines

  1. head     1.26;
  2. branch   ;
  3. access   ;
  4. symbols  V80:1.9 V76d:1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.26
  10. date     94.09.16.00.42.53;  author jcooper;  state Exp;
  11. branches ;
  12. next     1.25;
  13.  
  14. 1.25
  15. date     94.08.24.18.40.15;  author mrr;  state Exp;
  16. branches ;
  17. next     1.24;
  18.  
  19. 1.24
  20. date     94.05.27.01.29.29;  author rushing;  state Exp;
  21. branches ;
  22. next     1.23;
  23.  
  24. 1.23
  25. date     94.02.24.21.31.49;  author jcoop;  state Exp;
  26. branches ;
  27. next     1.22;
  28.  
  29. 1.22
  30. date     94.02.09.18.01.08;  author cnolan;  state Exp;
  31. branches ;
  32. next     1.21;
  33.  
  34. 1.21
  35. date     94.01.18.09.51.34;  author jcoop;  state Exp;
  36. branches ;
  37. next     1.20;
  38.  
  39. 1.20
  40. date     94.01.15.20.31.16;  author jcoop;  state Exp;
  41. branches ;
  42. next     1.19;
  43.  
  44. 1.19
  45. date     93.12.08.01.27.21;  author rushing;  state Exp;
  46. branches ;
  47. next     1.18;
  48.  
  49. 1.18
  50. date     93.08.25.18.53.17;  author mbretherton;  state Exp;
  51. branches ;
  52. next     1.17;
  53.  
  54. 1.17
  55. date     93.08.17.21.53.06;  author UNKNOWN;  state Exp;
  56. branches ;
  57. next     1.16;
  58.  
  59. 1.16
  60. date     93.07.13.22.11.31;  author rushing;  state Exp;
  61. branches ;
  62. next     1.15;
  63.  
  64. 1.15
  65. date     93.07.06.21.09.50;  author cnolan;  state Exp;
  66. branches ;
  67. next     1.14;
  68.  
  69. 1.14
  70. date     93.06.29.20.06.07;  author rushing;  state Exp;
  71. branches ;
  72. next     1.13;
  73.  
  74. 1.13
  75. date     93.06.29.00.22.13;  author rushing;  state Exp;
  76. branches ;
  77. next     1.12;
  78.  
  79. 1.12
  80. date     93.06.28.17.51.21;  author rushing;  state Exp;
  81. branches ;
  82. next     1.11;
  83.  
  84. 1.11
  85. date     93.06.22.19.08.40;  author rushing;  state Exp;
  86. branches ;
  87. next     1.10;
  88.  
  89. 1.10
  90. date     93.06.22.16.46.33;  author bretherton;  state Exp;
  91. branches ;
  92. next     1.9;
  93.  
  94. 1.9
  95. date     93.06.11.01.05.17;  author rushing;  state Exp;
  96. branches ;
  97. next     1.8;
  98.  
  99. 1.8
  100. date     93.06.11.00.11.26;  author rushing;  state Exp;
  101. branches ;
  102. next     1.7;
  103.  
  104. 1.7
  105. date     93.05.24.23.34.12;  author rushing;  state Exp;
  106. branches ;
  107. next     1.6;
  108.  
  109. 1.6
  110. date     93.05.24.23.28.34;  author rushing;  state Exp;
  111. branches ;
  112. next     1.5;
  113.  
  114. 1.5
  115. date     93.05.18.22.10.45;  author rushing;  state Exp;
  116. branches ;
  117. next     1.4;
  118.  
  119. 1.4
  120. date     93.05.06.19.44.10;  author rushing;  state Exp;
  121. branches ;
  122. next     1.3;
  123.  
  124. 1.3
  125. date     93.04.30.21.17.01;  author rushing;  state Exp;
  126. branches ;
  127. next     1.2;
  128.  
  129. 1.2
  130. date     93.03.30.20.07.37;  author rushing;  state Exp;
  131. branches ;
  132. next     1.1;
  133.  
  134. 1.1
  135. date     93.02.16.20.54.22;  author rushing;  state Exp;
  136. branches ;
  137. next     ;
  138.  
  139.  
  140. desc
  141. @winvn version 0.76 placed into RCS
  142. @
  143.  
  144.  
  145. 1.26
  146. log
  147. @cc-by-mail feature and cleanup for 92.6
  148. @
  149. text
  150. @/* --- WVHEADER.C ---------------------------------------------
  151.  *
  152.  *  This file contains the code necessary to create the initial skeleton
  153.  *  version of an article, which will be edited by the user.
  154.  *
  155.  *  Mark Riordan   24-JAN-1990
  156.  */
  157.  
  158.  
  159. /*
  160.  *
  161.  * $Id: wvheader.c 1.25 1994/08/24 18:40:15 mrr Exp $
  162.  * $Log: wvheader.c $
  163.  * Revision 1.25  1994/08/24  18:40:15  mrr
  164.  * authorization enables post/mail
  165.  *
  166.  * Revision 1.24  1994/05/27  01:29:29  rushing
  167.  * unnecessary winundoc.h
  168.  *
  169.  * Revision 1.23  1994/02/24  21:31:49  jcoop
  170.  * jcoop changes
  171.  *
  172.  * Revision 1.22  1994/02/09  18:01:08  cnolan
  173.  * cnolan 90.2 changes
  174.  *
  175.  * Revision 1.21  1994/01/18  09:51:34  jcoop
  176.  * Use new version number scheme on X-Mailer header line
  177.  *
  178.  * Revision 1.20  1994/01/15  20:31:16  jcoop
  179.  * Font/color stuff and signature file handling
  180.  * 
  181.  * Revision 1.19  1993/12/08  01:27:21  rushing
  182.  * new version box and cr lf consistency
  183.  * 
  184.  * Revision 1.18  1993/08/25  18:53:17  mbretherton
  185.  * MRB merge, mail & post logging
  186.  *
  187.  *
  188.  * remove underscore for BC++ compile   Bretherton
  189.  *
  190.  * Revision 1.17  1993/08/17  21:53:06  UNKNOWN
  191.  * Updated version to Version 0.82 (JD)
  192.  *
  193.  * Revision 1.16  1993/07/13  22:11:31  rushing
  194.  * strncpy crashing in parseaddress
  195.  *
  196.  * Revision 1.15  1993/07/06  21:09:50  cnolan
  197.  * win32 support
  198.  *
  199.  * Revision 1.14  1993/06/29  20:06:07  rushing
  200.  * use localtime for Date header
  201.  *
  202.  * Revision 1.13  1993/06/29  00:22:13  rushing
  203.  * correct rfc822/rfc1036 MakeArtHeaderDate function
  204.  *
  205.  * Revision 1.12  1993/06/28  17:51:21  rushing
  206.  * warnings
  207.  *
  208.  * Revision 1.11  1993/06/22  19:08:40  rushing
  209.  * remove warnings
  210.  *
  211.  * Revision 1.10  1993/06/22  16:46:33  bretherton
  212.  * robust parse_address
  213.  *
  214.  * Revision 1.9  1993/06/11  01:05:17  rushing
  215.  * new version number
  216.  *
  217.  * Revision 1.8  1993/06/11  00:11:26  rushing
  218.  * second merge from Matt Bretherton sources
  219.  *
  220.  *
  221.  * Revision 1.7  1993/05/24  23:34:12  rushing
  222.  * further refinements to header manipulation
  223.  * extend reuse of header formatting capabilities
  224.  *
  225.  *
  226.  * Revision 1.5  1993/05/18  22:10:45  rushing
  227.  * smtp support
  228.  *
  229.  * Revision 1.4  1993/05/06  19:44:10  rushing
  230.  * CompareStringNoCase was using _tolower rather than tolower.
  231.  * according to c70 docs, _tolower is undefined for letters that
  232.  * are not uppercase.  Yikes!
  233.  *
  234.  * Revision 1.3  1993/04/30  21:17:01  rushing
  235.  * put the X-Newsreader: line back in.
  236.  *
  237.  * Revision 1.2  1993/03/30  20:07:37  rushing
  238.  * MAPI
  239.  *
  240.  * Revision 1.1  1993/02/16  20:54:22  rushing
  241.  * Initial revision
  242.  *
  243.  *
  244.  */
  245.  
  246. #include <windows.h>
  247. #include <windowsx.h>
  248. #include "wvglob.h"
  249. #include "winvn.h"
  250. #pragma hdrstop
  251. #include <ctype.h>
  252. #include <time.h>
  253. #include <stdlib.h>
  254.  
  255. #define MAXHEADERLINE 256
  256. int NewDocType;
  257.  
  258. BOOL (*PostHeaderFuncs[])(TypDoc * Doc, char *Buf, long int BufLen) =
  259. {
  260.     MakeArtHeaderFrom,
  261.     MakeArtHeaderNewsgroups,
  262.     MakeArtHeaderSubject,
  263. /* MakeArtHeaderMessageID, */
  264. /* MakeArtHeaderDate,      */
  265.     MakeArtHeaderReferences,
  266.     MakeArtHeaderOrganization,
  267.     MakeArtHeaderReplyTo,
  268.     MakeArtHeaderNewsreader,
  269.     NULL
  270. };
  271.  
  272.  
  273. /*--- function GetHeaderLine -------------------------------------------
  274.  *
  275.  *  Given a document, get a line from the header portion of that document
  276.  *  whose prefix matches a given prefix.  Prefix = first word in line.
  277.  *  For instance, you might call this routine to say "Get the 'Subject:'"
  278.  *  line from this document.
  279.  *
  280.  *    Entry    Doc      points to the document whose header we are scanning.
  281.  *                      The header is all the lines up to the first blank line.
  282.  *             Prefix   is the character string which will identify the
  283.  *                      line we are seeking.  It is the first word
  284.  *                      (blank-delimited) in a line in the header.
  285.  *             BufLen   is the number of bytes left in the buffer Buf.
  286.  *
  287.  *    Exit     Returns TRUE iff we returned a line.
  288.  *             Buf      if line was returned, contains that line, zero-
  289.  *                      terminated.
  290.  */
  291. BOOL
  292. GetHeaderLine (Doc, Prefix, Buf, BufLen)
  293.      TypDoc *Doc;
  294.      char *Prefix;
  295.      char *Buf;
  296.      int BufLen;
  297. {
  298.   char *bufptr = Buf;
  299.   TypBlock far *BlockPtr;
  300.   TypLine far *LinePtr;
  301.   unsigned int Offset;
  302.   HANDLE hBlock;
  303.   TypLineID MyLineID;
  304.   int found = FALSE;
  305.  
  306.   TopOfDoc (Doc, &BlockPtr, &LinePtr);
  307.   while (ExtractTextLine (Doc, LinePtr, Buf, BufLen))
  308.     {
  309.  
  310.       /* Is this a blank line signifying the end of the header?      */
  311.  
  312.       if (IsLineBlank (Buf))
  313.    break;
  314.  
  315.       if (CompareStringNoCase (Buf, Prefix, strlen (Prefix)) == 0)
  316.    {
  317.      found = TRUE;
  318.      break;
  319.    }
  320.       if (!NextLine (&BlockPtr, &LinePtr))
  321.    break;
  322.     }
  323.   UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  324.   return (found);
  325. }
  326.  
  327. /*--- function CreatePostingWnd -----------------------------------------
  328.  *
  329.  *    Create the window for composing the text of a posting,
  330.  *    if it's OK to post.
  331.  *
  332.  *    Entry    Hwnd     Handle to parnet window
  333.  *             Doc      points to the document to which we are posting
  334.  *                      a followup--NULL if it's a new posting.
  335.  *
  336.  *    Exit     Returns the handle of the newly-created window
  337.  *              (zero if failure).
  338.  */
  339.  
  340. HWND
  341. CreatePostingWnd (hWnd,Doc, DocType)
  342.      HWND hWnd ;
  343.      TypDoc *Doc;
  344.      int DocType;
  345. {
  346.   int ih;
  347.   BOOL found = FALSE;        
  348.   BOOL AuthReq;
  349.   unsigned int width;
  350.   char *TitlePtr, *WndName;      
  351.   
  352.   if (DocType == DOCTYPE_POSTING)
  353.     {          
  354.       AuthReq = AuthReqPost;
  355.       WndName = "WinVnPost";
  356.       PostDoc = Doc;
  357.       if (Doc)
  358.    {
  359.      TitlePtr = "Composing Followup Article";
  360.    }
  361.       else
  362.    {
  363.      TitlePtr = "Composing New Article";
  364.    }
  365.       for (ih = 0; !found && ih < MAXPOSTWNDS; ih++)
  366.    {
  367.      if (!WndPosts[ih].hWnd)
  368.        {
  369.          found = TRUE;
  370.          break;
  371.        }
  372.    }
  373.     }
  374.   else
  375.     {         
  376.       AuthReq = AuthReqMail;
  377.       WndName = "WinVnMail";
  378.       MailDoc = Doc;
  379.       if (Doc)
  380.    {
  381.      TitlePtr = "Composing Reply Message";
  382.    }
  383.       else
  384.    {
  385.      TitlePtr = "Composing New Mail Message";
  386.      strcpy(AddressString,"") ;
  387.    }
  388.       for (ih = 0; !found && ih < MAXMAILWNDS; ih++)
  389.    {
  390.      if (!WndMails[ih].hWnd)
  391.        {
  392.          found = TRUE;
  393.          break;
  394.        }
  395.    }
  396.     }
  397.   if (found && AuthenticatePosting (AuthReq))
  398.     {
  399.  
  400.       if (xScreen > 78 * ArtCharWidth)
  401.    {
  402.      width = 78 * ArtCharWidth;
  403.    }
  404.       else
  405.    {
  406.      width = xScreen - 2 * ArtCharWidth;
  407.    }
  408.  
  409.       hWnd = CreateWindow (WndName,
  410.             TitlePtr,
  411.             WS_OVERLAPPEDWINDOW /* | WS_VSCROLL */ ,
  412.             /* Initial X pos */
  413.             ih * CharWidth,
  414.             /* Initial Y pos */
  415.             (int) (yScreen * 3 / 8) + (1 + ih) * LineHeight,
  416.             /* Initial X Width */
  417.             (int) width,
  418.             /* Initial Y height */
  419.             (int) (yScreen * 5 / 8) - (2 * LineHeight),
  420.             NULL,
  421.             NULL,
  422.             hInst,
  423.             NULL);
  424.  
  425.       if (hWnd)
  426.    {
  427.      SetHandleBkBrush (hWnd, hArticleBackgroundBrush);        
  428.      ShowWindow (hWnd, SW_SHOWNORMAL);
  429.      UpdateWindow (hWnd);
  430.    }
  431.     }
  432.   return (hWnd);
  433. }
  434.  
  435.  
  436. /*--- function CreatePostingText ------------------------------------------
  437.  *
  438.  *    Create the text of the skeleton article to be edited by
  439.  *    the user before posting.   Display that text in an edit window.
  440.  */
  441. BOOL
  442. CreatePostingText (Doc, hWndPost, hWndEdit, DocType)
  443.      TypDoc *Doc;
  444.      HWND hWndPost;
  445.      HWND hWndEdit;
  446.      int DocType;
  447. {
  448.   char far *lpTextBuffer;
  449.   HANDLE hTextBuffer;
  450.   int nLines;
  451.   long lParam;
  452.  
  453.   if (NULL == (hTextBuffer = ExtractPostingText(Doc,DocType)))
  454.     {
  455.       MessageBox (hWndPost, "Cannot allocate memory for text", "", MB_OK);
  456.       return FALSE;
  457.     }
  458.   lpTextBuffer = GlobalLock(hTextBuffer) ;
  459.  
  460.   /*  Set the edit window text to this skeleton article.            */
  461.  
  462.  
  463.   SetWindowText (hWndEdit, lpTextBuffer);
  464.   FreePostingText (hTextBuffer);
  465.  
  466.   nLines = (int) SendMessage (hWndEdit, EM_GETLINECOUNT, 0, 0L);
  467.   lParam = (long) ((long) nLines);
  468.  
  469.   return TRUE;
  470. }
  471.  
  472. /*--------- Extract the Text for the Posting ---------------------------
  473.  *
  474.  *    Entry    Doc      points to the document to which we are posting
  475.  *                      a followup--NULL if it's a new posting. *  
  476.  *             DocType  either build skeletal mail or posting document
  477.  *
  478.  *    Exit      a pointer to the unlocked memory area for skeletal posting
  479.  *
  480.  *  Remember to call FreePosting Text to reclaim the memory allocated to
  481.  *  the posting text 
  482.  */
  483.  
  484. HANDLE
  485. ExtractPostingText (Doc, DocType)
  486.      TypDoc *Doc;
  487.     int DocType;
  488. {
  489.   long int BytesLeft;
  490.   char far *lpTextBuffer;
  491.   BOOL (**HeaderFuncs) (TypDoc * Doc, char *Buf, long int BufLen);
  492.   char far *lpCurPtr;
  493.   HANDLE hTextBuffer;
  494.   BOOL gotline;
  495.   char line[MAXHEADERLINE];
  496.   int ifunc;
  497.  
  498.   NewDocType = DocType;
  499.   if (DocType == DOCTYPE_POSTING)
  500.     {
  501.       HeaderFuncs = PostHeaderFuncs;
  502.     }
  503.   else
  504.     {
  505.      HeaderFuncs = MailCtrl.MailHeaderFuncs;
  506.     }
  507.  
  508.   /* Compute the number of bytes we need to hold a straight ASCII representation
  509.    * of the initial text of the reply, and allocate a buffer of that size.
  510.    */
  511.   if (Doc)
  512.     {
  513.       BytesLeft = (2 + NumBlocksInDoc (Doc)) * Doc->BlockSize;
  514.     }
  515.   else
  516.     {
  517.       BytesLeft = 3000;
  518.     }
  519.  
  520.   if (NULL == (hTextBuffer = GlobalAlloc (GHND, (DWORD) BytesLeft)))
  521.     {
  522.        return ((HANDLE) NULL) ;
  523.     }
  524.  
  525.   lpCurPtr = lpTextBuffer = GlobalLock (hTextBuffer);
  526.  
  527.   for (ifunc = 0; HeaderFuncs[ifunc]; ifunc++)
  528.     {
  529.      gotline = (HeaderFuncs[ifunc]) (Doc, line, (long int) MAXHEADERLINE);
  530.       if (gotline)
  531.    {
  532.          AppendTextToEditBuf (line, &lpCurPtr, &BytesLeft);
  533.    }
  534.     }
  535.   MakeArtBody (Doc, &lpCurPtr, &BytesLeft, DocType);
  536.  
  537.   GlobalUnlock (hTextBuffer);
  538.   return(hTextBuffer) ;
  539.   }
  540. /*---------- FreePostingText ---------------------------------------------
  541.  *
  542.  * Free the memory of the skeletal posting text
  543.  *
  544.  */
  545. BOOL
  546. FreePostingText (hTextBuffer)
  547.   HANDLE hTextBuffer;
  548. {
  549.   GlobalUnlock (hTextBuffer);
  550.   GlobalFree (hTextBuffer);
  551.   
  552.   strcpy(AddressString,"") ;
  553.   strcpy(NameString,"") ;
  554.   strcpy(DialogString,"") ;
  555.  
  556.   return(TRUE) ;
  557. }
  558.  
  559. /*--- functions MakeArtHeaderXXXXX ---------------------------------------
  560.  *
  561.  *   Functions with names of the form MakeArtHeaderXxxxxx are all called
  562.  *   the same way and have similar purposes.  They are called to
  563.  *   create and return a line of text that will become a line in
  564.  *   the header of an article to be posted.  The source of
  565.  *   this information varies; it may be taken from an article
  566.  *   being replied to, it may be taken from a configuration file,
  567.  *   read from the system clock, etc.
  568.  *
  569.  *    Entry    Doc      points to a document containing an article
  570.  *                      being replied to; NULL if we're not replying
  571.  *                      to an article.
  572.  *             BufLen   is the length of the output buffer.
  573.  *
  574.  *    Exit     Returns TRUE iff we returned a line.
  575.  *             Buf      contains the line, if any, terminated by a
  576.  *                      zero byte.
  577.  */
  578.  
  579. /*--- function MakeArtHeaderSubject -------------------------------------
  580.  *
  581.  *    Returned "Subject:" 
  582.  *
  583.  */
  584.  
  585. BOOL
  586. MakeArtHeaderSubject (Doc, Buf, BufLen)
  587.      TypDoc *Doc;
  588.      char *Buf;
  589.      long int BufLen;
  590. {
  591.   char *outptr = Buf;
  592.   char from[MAXHEADERLINE];
  593.   char *fromptr;
  594.   
  595.   CopyBuf ("Subject: ", &outptr, &BufLen);
  596.   if (Doc)
  597.     {
  598.       GetArtHeaderSubject (Doc, NULL, NULL);
  599. //    if (!DialogString[0])   // always allow reply-subject confirmation
  600.      
  601.       if (NewDocType == DOCTYPE_POSTING) {
  602.         fromptr = from;    
  603.         if (GetHeaderLine (Doc, "From:", from, MAXHEADERLINE-1))
  604.           {
  605.              NextToken (&fromptr);
  606.              ParseAddress (fromptr, CcAddress, MAXDIALOGSTRING , str, MAXINTERNALLINE ) ;
  607.           } else
  608.               CcAddress[0] = (char) NULL;
  609.       }
  610.       DialogBoxParam (hInst, "WinVnSubject", Doc->hDocWnd, lpfnWinVnSubjectDlg, (LPARAM)(NewDocType == DOCTYPE_POSTING));
  611.     }
  612.   else
  613.     {
  614.       DialogString[0] = (char) NULL;
  615.       CcAddress[0] = (char) NULL;
  616.  
  617.       DialogBoxParam (hInst, "WinVnSubject", hWndConf, lpfnWinVnSubjectDlg, (LPARAM)(NewDocType == DOCTYPE_POSTING));
  618.     }
  619.  
  620.   CopyBuf (DialogString, &outptr, &BufLen);
  621.   return (TRUE);
  622. }
  623.  
  624. /*--- function GetArtHeaderSubject -------------------------------------
  625.  *
  626.  *    Fill the DialogString global variable if a subject can be extracted
  627.  *    of the form  "Subject: Re: <previous subject>".
  628.  *    If the article being replied to had a subject already starting
  629.  *    with "Re:", the "Re:" is not repeated.
  630.  *    returns FALSE as no line assembled
  631.  *    if no previous subject is found SubjestString is ""
  632.  */
  633.  
  634. GetArtHeaderSubject (Doc, NA, NALen)
  635.      TypDoc *Doc;
  636.      char *NA;
  637.      long int NALen;
  638. {
  639.   char HeadLine[MAXHEADERLINE];
  640.   char *outptr = DialogString ; 
  641.   char *headptr = HeadLine;
  642.   long int BufLen = MAXDIALOGSTRING ;
  643.  
  644.   *outptr='\0' ;
  645.   if (Doc && ( GetHeaderLine (Doc, "Subject:", HeadLine, MAXHEADERLINE)))
  646.      {
  647.    NextToken (&headptr);
  648.    if (CompareStringNoCase (headptr, "Re:", 3) != 0)
  649.         {
  650.         CopyBuf ("Re: ", &outptr, &BufLen);
  651.          }
  652.    CopyBuf (headptr, &outptr, &BufLen);
  653.      }
  654.  
  655.    return(FALSE) ;
  656. }
  657. #if 0
  658. /*--- function MakeArtHeaderMessageID ----------------------------------
  659.  *
  660.  *    Returned "Message-ID:" line is computed from the time and
  661.  *    the ServerName (from Windows profile file).  This needs to
  662.  *    be improved.
  663.  */
  664. BOOL
  665. MakeArtHeaderMessageID (Doc, Buf, BufLen)
  666.      TypDoc *Doc;
  667.      char *Buf;
  668.      long int BufLen;
  669. {
  670. #define MAXSERVERNAME 32
  671.   char ServerName[MAXSERVERNAME];
  672.  
  673.   GetPrivateProfileString (szAppName, "ServerName", "titan.ksc.nasa.gov",
  674.           ServerName, MAXSERVERNAME, szAppProFile);
  675.  
  676.   sprintf (Buf, "Message-ID: <%ld@@%s>", time ((time_t *) NULL), ServerName);
  677.   return TRUE;
  678. }
  679.  
  680. #endif
  681.  
  682. /*--- function MakeArtHeaderFrom ----------------------------------
  683.  *
  684.  *  Returned "From:" is taken from Windows profile entries.
  685.  */
  686. BOOL
  687. MakeArtHeaderFrom (Doc, Buf, BufLen)
  688.      TypDoc *Doc;
  689.      char *Buf;
  690.      long int BufLen;
  691. {
  692.   char *outptr = Buf;
  693.  
  694.   CopyBuf ("From: ", &outptr, &BufLen);
  695.   if (MailAddress[0])
  696.     {
  697.       CopyBuf (MailAddress, &outptr, &BufLen);
  698.     }
  699.   else
  700.     {
  701.       CopyBuf ("<Unknown>", &outptr, &BufLen);
  702.     }
  703.   if (UserName[0])
  704.     {
  705.       CopyBuf (" (", &outptr, &BufLen);
  706.       CopyBuf (UserName, &outptr, &BufLen);
  707.       CopyBuf (")", &outptr, &BufLen);
  708.     }
  709.  
  710.   return TRUE;
  711. }
  712.  
  713. /*--- function MakeArtHeaderReplyTo -------------------------------
  714.  *
  715.  *  Returned "Reply-To:" is taken from Windows profile entries.
  716.  */
  717. BOOL
  718. MakeArtHeaderReplyTo (Doc, Buf, BufLen)
  719.      TypDoc *Doc;
  720.      char *Buf;
  721.      long int BufLen;
  722. {
  723.   char *outptr = Buf;
  724.  
  725.   if (ReplyTo[0] && strcmp(ReplyTo, MailAddress))
  726.     {
  727.       CopyBuf ("Reply-To: ", &outptr, &BufLen);
  728.       CopyBuf (ReplyTo, &outptr, &BufLen);
  729.       return TRUE;
  730.     }
  731.   return FALSE;
  732. }
  733.  
  734. /*--- function MakeArtHeaderTo ----------------------------------
  735.  *
  736.  *  Returns a well formed "To:" line or if user selected cancel
  737.  *  returns "To:" (blank) which if not edited will be rejected by
  738.  *  the server.
  739.  */
  740. BOOL
  741. MakeArtHeaderTo (Doc, Buf, BufLen)
  742.      TypDoc *Doc;
  743.      char *Buf;
  744.      long int BufLen;
  745. {
  746.   char HeadLine[MAXHEADERLINE];
  747.   char *outptr = Buf, *cptr = HeadLine;
  748.   GetArtHeaderTo(Doc,NULL,NULL);  
  749.  
  750.   if (!strcmp(AddressString, "")) {
  751.  
  752.     DialogString[0]=(char)NULL;
  753.     while (!strcmp(DialogString,""))
  754.       if (!DialogBox (hInst, "WinVnMail", hWndConf, lpfnWinVnMailDlg))
  755.         break;  
  756.         
  757.     sprintf(HeadLine,"To: %s", DialogString);
  758.   }
  759.   else
  760.     sprintf(HeadLine,"To: %s", AddressString);
  761.  
  762.   CopyBuf (HeadLine, &outptr, &BufLen);
  763.   return TRUE;
  764. }
  765.  
  766. /*--- function GetArtHeaderTo ----------------------------------
  767.  *
  768.  *    Simply returns contents for a "To:"  Line
  769.  *
  770.  *    Global Variables
  771.  *    NameString and AddressString are extracted from the Document
  772.  *    returns FALSE as no line has been assembled
  773.  */
  774. BOOL
  775. GetArtHeaderTo (Doc, NA, NALen)
  776.      TypDoc *Doc;
  777.      char *NA;
  778.      long int NALen;
  779. {
  780.   char HeadLine[MAXHEADERLINE];
  781.   char *cptr = HeadLine ;
  782.   BOOL gotwho;
  783.   char ReplyAddress[MAXDIALOGSTRING], ReplyName[MAXDIALOGSTRING];
  784.  
  785.   if (Doc)
  786.     {
  787.       if (GetHeaderLine (Doc, "From:", HeadLine, MAXHEADERLINE))
  788.          {
  789.         NextToken (&cptr);
  790.         ParseAddress (cptr, AddressString,MAXDIALOGSTRING , NameString,MAXDIALOGSTRING ) ;
  791.          }
  792.       if (gotwho = GetHeaderLine (Doc, "Reply-To:", HeadLine, MAXHEADERLINE))
  793.      {
  794.         NextToken (&cptr);
  795.         ParseAddress (cptr, ReplyAddress,MAXDIALOGSTRING , ReplyName,MAXDIALOGSTRING ) ;
  796.      }
  797.       if (gotwho && strcmp (AddressString, ReplyAddress))
  798.          {
  799.             if (AddressString[0] && ConfirmReplyTo)
  800.             { 
  801.                sprintf (str, "Use Reply-To: (%s) instead of\nFrom: (%s) in reply?", 
  802.                         ReplyAddress, AddressString);
  803.                       
  804.                if (MessageBox (Doc->hDocWnd, str, "Confirm Reply-To", 
  805.                                MB_YESNO|MB_ICONQUESTION) == IDNO)
  806.                   gotwho = FALSE;
  807.             }
  808.             if (gotwho)
  809.                strcpy (AddressString, ReplyAddress);
  810.          }
  811.       }
  812.  
  813.   return FALSE;
  814. }
  815. /*--- function ParseAddress --------------------------
  816.  *   Scan the
  817.  *       address field (null terminated ascii string)
  818.  *  representing any email address and optional
  819.  *       name
  820.  *
  821.  *   and extract
  822.  *   addressout which is the email address
  823.  *   nameout    which is the name (enclosed in parenthises)
  824.  *
  825.  *--------------------------------------------------------*/
  826. void ParseAddress(headerline,addressout,addressoutlen,nameout,nameoutlen)
  827.  char *headerline ;
  828.  char *addressout ;
  829.  long int addressoutlen ;
  830.  char *nameout ;
  831.  long int nameoutlen ;
  832. { char *ptra = headerline , *ptrb, *ptrc ;
  833.   char *iptr , *optr;
  834.   int  lastspace ;
  835.   long int adlen = addressoutlen - 1 ,nmlen = nameoutlen -1 ;
  836.   long int l;
  837.  
  838.    nameout[0]=addressout[0]=0 ;
  839.  
  840. // Note parsing not strictly correct as anything in quotes '"'
  841. // overrides the meaning of lexical constructs '<' and '('
  842.  
  843. // Seems this works and is robust but is now in the main
  844. // group list read and should be extremely efficient
  845. // suggest a single pass 'stream' parse more appropriate
  846. // but is more work
  847.  
  848.   if (ptrb=strchr(headerline,'<'))
  849.   {  // address enclosed in brackets  
  850.      l=min(ptrb-ptra-1,nmlen) ;
  851.      if (l < 0) l = 0;     /* this was killing print??? */
  852.      if (l>0)
  853.      {                      // otherwise strncpy crashes
  854.         nmlen-=l ;
  855.         strncpy(nameout,ptra,(int)l) ;
  856.         nameout[l]=0;
  857.      }
  858.      if(  ptrc=strchr(headerline,'>') )
  859.      {
  860.    if (nmlen >0)
  861.         {
  862.       strncpy(nameout+l,ptrc+1,(int)nmlen) ;
  863.       nameout[nameoutlen-1]=0 ;
  864.    }
  865.    l=min(ptrc-ptrb-1,adlen) ;
  866.      } else
  867.      {
  868.    l=adlen ;
  869.      }
  870.      if (l>0)
  871.      {
  872.      strncpy(addressout,ptrb+1,(int)l);
  873.      addressout[l]=0;
  874.      }
  875.  
  876.   } else
  877.     if (ptrb=strchr(headerline,'('))
  878.   {  // name enclosed in braces
  879.      l=min(ptrb-ptra-1,adlen) ;
  880.      if (l>0)
  881.      {
  882.         adlen-=l ;
  883.    strncpy(addressout,ptra,(int)l) ;
  884.         addressout[l+1]=0;
  885.      }
  886.      if( ptrc=strchr(headerline,')'))
  887.      {
  888.    if (adlen > 0)
  889.         {
  890.       strncpy(addressout+l,ptrc+1,(int)adlen) ;
  891.       addressout[addressoutlen-1]=0 ;
  892.         }
  893.    l=min(ptrc-ptrb-1,nmlen) ;
  894.      } else
  895.      {
  896.    l=nmlen ;
  897.      }
  898.      if (l>0)
  899.      {
  900.      strncpy(nameout,ptrb+1,(int)l);
  901.      nameout[l]=0;
  902.      }      
  903.  
  904.   } else
  905.   { // just an address
  906.      strncpy(addressout,ptra,(int)adlen) ;
  907.      addressout[addressoutlen-1]=0 ;
  908.   }
  909.  
  910. // Clean Name   - remove multiple space and quotes
  911.   lastspace=TRUE ;
  912.   for(iptr=optr=nameout ; *iptr ; iptr++)
  913.   {  switch( *iptr)
  914.      {
  915.        case ' ':
  916.     if (!lastspace) *optr++=*iptr ;
  917.     lastspace=TRUE ;
  918.          break;
  919.        case '"':    
  920.     break ;
  921.        default :
  922.     *optr++=*iptr ;
  923.     lastspace=FALSE ;
  924.       }
  925.    }
  926.    *optr=0 ;
  927.  
  928. // Clean Address
  929.   for(iptr=optr=addressout ; *iptr ; iptr++)
  930.   {  switch( *iptr)
  931.      {
  932.        case ' ':
  933.          break;
  934.        default :
  935.     *optr++=*iptr ;
  936.     lastspace=FALSE ;
  937.       }
  938.    }
  939.    *optr=0 ;
  940.  
  941.    if (*nameout==0)
  942.    {  // if no name default to address
  943.       strncpy(nameout,addressout,(int)nmlen) ;
  944.       addressout[nameoutlen-1]=0 ;
  945.    }
  946.  
  947.  }
  948.  
  949. /*  original code for parsing address
  950.   char *adptr = addressout, *nmptr=nameout, *cptr = headerline;
  951.   char *tptr ;
  952.  
  953.  
  954.   if ( *cptr == '(' )
  955.   {                         //  skip Name in brackets 
  956.       tptr =  strchr(headerline,')') ;
  957.       if (tptr != NULL) cptr=tptr ;
  958.       NextToken(&cptr);     // skip parenthesis and white space
  959.   }     
  960.   while (*cptr && *cptr != ' ' && adlen)
  961.   {
  962.       *(adptr++) = *(cptr++);
  963.       adlen-- ;
  964.   }
  965.   *adptr = '\0';
  966.  
  967.   cptr = strchr(headerline,'(');
  968.   if (cptr != NULL) 
  969.   {
  970.        cptr++;                                  // skip (    
  971.        while (*cptr && *cptr != ')' && nmlen)   // copy to ) 
  972.        {
  973.        if (*cptr != '"')                   // drop quote characters 
  974.             {
  975.           *(nmptr++) = *(cptr);
  976.           nmlen--;
  977.        }
  978.             cptr++ ;
  979.        }
  980.        *nmptr = '\0';
  981.    }
  982.    else
  983.    {
  984.    strncpy( nmptr,addressout,(int)nmlen)  ;
  985.    nmptr[nmlen+1]= '\0' ;
  986.   }
  987.  
  988. }
  989.  
  990. */
  991.  
  992. /*--- function MakeArtHeaderOrganization ----------------------------------
  993.  *
  994.  *    Returned "Organization:" line is gotten from the Windows
  995.  *    profile file.
  996.  */
  997. BOOL
  998. MakeArtHeaderOrganization (Doc, Buf, BufLen)
  999.      TypDoc *Doc;
  1000.      char *Buf;
  1001.      long int BufLen;
  1002. {
  1003.   char *outptr = Buf;
  1004.  
  1005.   if (Organization[0])
  1006.     {
  1007.       CopyBuf ("Organization: ", &outptr, &BufLen);
  1008.       CopyBuf (Organization, &outptr, &BufLen);
  1009.       return (TRUE);
  1010.     }
  1011.  
  1012.   return FALSE;
  1013. }
  1014.  
  1015. /*--- function MakeArtHeaderNewsreader ----------------------------------
  1016.  *
  1017.  *    Returned "Newsreader: " line is simply a constant.
  1018.  */
  1019. BOOL
  1020. MakeArtHeaderNewsreader (Doc, Buf, BufLen)
  1021.      TypDoc *Doc;
  1022.      char *Buf;
  1023.      long int BufLen;
  1024. {
  1025.   char *outptr = Buf;
  1026.  
  1027.   CopyBuf ("X-Newsreader: ", &outptr, &BufLen);
  1028.   CopyBuf (WINVN_VERSION, &outptr, &BufLen);
  1029. /* easier than examining this closely */
  1030. /*  CopyBuf ("\r", &outptr , &BufLen); */
  1031.   return (TRUE);
  1032.  
  1033. }
  1034.  
  1035. /*--- function MakeArtHeaderXmailer ----------------------------------
  1036.  *
  1037.  *    Returned "Mailer: " line is simply a constant.
  1038.  */
  1039. BOOL
  1040. MakeArtHeaderXmailer (TypDoc * Doc, char *Buf, long int BufLen)
  1041. {
  1042.   char *outptr = Buf;
  1043.  
  1044.   CopyBuf ("X-Mailer: ", &outptr, &BufLen);
  1045. //  CopyBuf ("WinVN version 0.82 SMTP", &outptr, &BufLen);
  1046.   CopyBuf (WINVN_VERSION, &outptr, &BufLen);
  1047.   return (TRUE);
  1048. }
  1049.  
  1050.  
  1051. /*--- function MakeArtHeaderDate ----------------------------------
  1052.  *
  1053.  *    Returned "Date:" line is computed from operating system time.
  1054.  *    Be sure to set the TZ environment variable correctly for
  1055.  *    "gmtime" to work properly.  Typical setting:  SET TZ=EST5
  1056.  */
  1057. BOOL
  1058. MakeArtHeaderDate (Doc, Buf, BufLen)
  1059.      TypDoc *Doc;
  1060.      char *Buf;
  1061.      long int BufLen;
  1062. {
  1063.   struct tm *timeptr;
  1064.   time_t curtime;
  1065.   static char * days[] = {"Sun","Mon","Tue","Wed","Thu","Fri","Sat"};
  1066.   static char * months[] = { "Jan","Feb","Mar","Apr","May","Jun",
  1067.                 "Jul","Aug","Sep","Oct","Nov","Dec"};
  1068.  
  1069.  
  1070.   if (!getenv("TZ")) {
  1071.     MessageBox (hWndConf,
  1072.       "Timezone environment variable 'TZ' not set.\n"
  1073.       "You must set this variable for your messages\n"
  1074.       "to be timestamped correctly.\n"
  1075.       "For example, you could add the following to your\n"
  1076.       "'autoexec.bat' file:\n"
  1077.       "set TZ=EST5EDT\n",
  1078.       "Warning:",
  1079.       MB_OK|MB_ICONHAND);
  1080.   }
  1081.  
  1082.   curtime = time ((time_t *) NULL);
  1083.   timeptr = localtime (&curtime);
  1084.   
  1085.   /* rfc1036&rfc822 acceptable format */
  1086.   /* Mon, 29 Jun 93 02:15:23 GMT */
  1087.   sprintf (Buf, "Date: %s, %.2d %s %.2d %.2d:%.2d:%.2d %s",
  1088.       days[timeptr->tm_wday],
  1089.       timeptr->tm_mday,
  1090.       months[timeptr->tm_mon],
  1091.       timeptr->tm_year,
  1092.       timeptr->tm_hour,
  1093.       timeptr->tm_min,
  1094.       timeptr->tm_sec,
  1095.       tzname[0]);
  1096.   return TRUE;
  1097. }
  1098.  
  1099.  
  1100. /*--- function MakeArtHeaderReferences -----------------------------------
  1101.  *
  1102.  *  Returned "References:" line contains all the previous article's
  1103.  *  References (if any), plus its Message-ID (if any).
  1104.  */
  1105. BOOL
  1106. MakeArtHeaderReferences (Doc, Buf, BufLen)
  1107.      TypDoc *Doc;
  1108.      char *Buf;
  1109.      long int BufLen;
  1110. {
  1111.   char HeadLine[MAXHEADERLINE];
  1112.   BOOL gotrefs;
  1113.   BOOL gotmesID;
  1114.   char *outptr = Buf;
  1115.   char *headptr = HeadLine;
  1116.  
  1117.  
  1118.   if (Doc)
  1119.     {
  1120.       gotrefs = GetHeaderLine (Doc, "References:", HeadLine, MAXHEADERLINE);
  1121.       if (gotrefs)
  1122.    {
  1123.      CopyBuf (HeadLine, &outptr, &BufLen);
  1124.      CopyBuf (" ", &outptr, &BufLen);
  1125.    }
  1126.       gotmesID = GetHeaderLine (Doc, "Message-ID:", HeadLine, MAXHEADERLINE);
  1127.       if (gotmesID)
  1128.    {
  1129.      if (!gotrefs)
  1130.        {
  1131.          CopyBuf ("References: ", &outptr, &BufLen);
  1132.        }
  1133.      NextToken (&headptr);
  1134.      CopyBuf (headptr, &outptr, &BufLen);
  1135.    }
  1136.       if (gotrefs || gotmesID)
  1137.    return (TRUE);
  1138.     }
  1139.   return FALSE;
  1140. }
  1141.  
  1142. /*--- function MakeArtHeaderNewsgroups -----------------------------------
  1143.  *
  1144.  *  Returned "Newsgroups:" line is simply a copy of previous article's.
  1145.  */
  1146. BOOL
  1147. MakeArtHeaderNewsgroups (Doc, Buf, BufLen)
  1148.      TypDoc *Doc;
  1149.      char *Buf;
  1150.      long int BufLen;
  1151. {
  1152.   char HeadLine[MAXHEADERLINE];
  1153.   BOOL gotnews = FALSE;
  1154.   char *outptr = Buf;
  1155.  
  1156.   if (Doc)
  1157.     {
  1158.       gotnews = GetHeaderLine (Doc, "Newsgroups:", HeadLine, MAXHEADERLINE);
  1159.       if (gotnews)
  1160.    {
  1161.      CopyBuf (HeadLine, &outptr, &BufLen);
  1162.    }
  1163.     }
  1164.   if (!gotnews)
  1165.     {
  1166.       CopyBuf ("Newsgroups: ", &outptr, &BufLen);
  1167.       CopyBuf (NewsgroupsPtr, &outptr, &BufLen);
  1168.     }
  1169.   return TRUE;
  1170. }
  1171.  
  1172. /*--- function MakeArtBody ----------------------------------------------
  1173.  *
  1174.  *    Make the body of the article.  This is null if there's no article
  1175.  *    to reply to, else it's text of the form:
  1176.  *    In article <Message-ID>, <user> says:
  1177.  *    >line 1
  1178.  *    >line 2
  1179.  *    > .....
  1180.  *
  1181.  *    Entry    Doc      points to the article being replied to, else
  1182.  *                      NULL if none.
  1183.  *             left     is the number of bytes left in MesBuf.
  1184.  *
  1185.  *    Exit     MesBuf   contains the added lines, and has been updated
  1186.  *                      to point to just after the last added byte.
  1187.  *             left     has been decremented appropriately.
  1188.  *             Return value is not used, for now.
  1189.  */
  1190. BOOL 
  1191. MakeArtBody (Doc, MesBuf, left, DocType)
  1192.      TypDoc *Doc;
  1193.      char far **MesBuf;
  1194.      long int *left;
  1195.      int DocType;
  1196. {
  1197.   HANDLE hBlock;
  1198.   unsigned int Offset;
  1199.   TypLineID MyLineID;
  1200.   TypBlock far *BlockPtr;
  1201.   TypLine far *LinePtr;
  1202.   char mesID[MAXHEADERLINE];
  1203.   char from[MAXHEADERLINE];
  1204.   char line[MAXHEADERLINE];
  1205.   BOOL gotmesID, gotfrom;
  1206.   char *outptr = line;
  1207.   char *fromptr = from;
  1208.   char *mesptr = mesID;
  1209.   register unsigned long i;
  1210.   
  1211.   AppendTextToEditBuf ("", MesBuf, left); /* blank line after header */
  1212.  
  1213.   /* Create the "In message xxx, yyy says:" line.                   */
  1214.  
  1215.   if (Doc)
  1216.     {
  1217.       gotmesID = GetHeaderLine (Doc, "Message-ID:", mesID, MAXHEADERLINE);
  1218.       if (gotmesID)
  1219.    {
  1220.      NextToken (&mesptr);
  1221.    }
  1222.       else
  1223.    {
  1224.      mesptr = "<Unknown>";
  1225.    }
  1226.       switch (DocType) {
  1227.       case DOCTYPE_POSTING:
  1228.    gotfrom = GetHeaderLine (Doc, "From:", from, MAXHEADERLINE);
  1229.    if (gotfrom)
  1230.        NextToken (&fromptr);
  1231.    else
  1232.          fromptr = "<Unknown>";
  1233.    sprintf (line, "In article %s, %s says:", mesptr, fromptr);
  1234.    break;
  1235.  
  1236.       case DOCTYPE_MAIL:
  1237.    sprintf (line, "In article %s, you say:", mesptr);
  1238.    break;
  1239.       }
  1240.  
  1241.       AppendTextToEditBuf (line, MesBuf, left);
  1242.  
  1243.       /* Skip past header of reply document.                            */
  1244.  
  1245.       TopOfDoc (Doc, &BlockPtr, &LinePtr);
  1246.       while (ExtractTextLine (Doc, LinePtr, line, MAXHEADERLINE) &&
  1247.         !IsLineBlank (line))
  1248.    {
  1249.      if (!NextLine (&BlockPtr, &LinePtr))
  1250.        break;
  1251.    }
  1252.  
  1253.       /* Copy body of reply document into the body of this article,  */
  1254.       /* prepending a ">" to each line */
  1255.  
  1256.       /* following line commented after a merge of MRB code (SMR)*/
  1257.       /* line[0] = '>'; */
  1258.  
  1259.       line[0] = QuoteLineInd ;
  1260.  
  1261.       while (ExtractTextLine (Doc, LinePtr, line + 1, MAXHEADERLINE - 1))
  1262.    {
  1263.      AppendTextToEditBuf (line, MesBuf, left);
  1264.      if (!NextLine (&BlockPtr, &LinePtr))
  1265.        break;
  1266.    }
  1267.       UnlockLine (BlockPtr, LinePtr, &hBlock, &Offset, &MyLineID);
  1268.       if (EnableSig && Signature->numLines > 0)
  1269.         AppendTextToEditBuf ("", MesBuf, left); /* blank line before sig */
  1270.     }
  1271.  
  1272.   if (EnableSig)
  1273.     {
  1274.    for (i = 0; i < Signature->numLines; i++)
  1275.      AppendTextToEditBuf (TextBlockLine(Signature, i), MesBuf, left);
  1276.     }
  1277.   return TRUE;
  1278. }
  1279.  
  1280.  
  1281. /*--- function CompareStringNoCase -------------------------------------
  1282.  *
  1283.  *   Compare two strings, case insensitive.
  1284.  *
  1285.  *    Entry    str1, str2  are two strings to compare.
  1286.  *             slen        is the number of characters to compare
  1287.  *                         (but stop at a zero byte).
  1288.  *
  1289.  *    Exit     returns -1 if str1 is earlier in collating sequence,
  1290.  *              0 if strings are equal, 1 otherwise
  1291.  */
  1292. int
  1293. CompareStringNoCase (str1, str2, slen)
  1294.      char *str1;
  1295.      char *str2;
  1296.      int slen;
  1297. {
  1298. /* bug when either string is zero length mrb */
  1299.   if (strlen(str1) < (unsigned) slen)
  1300.      {
  1301.    return(-1)  ;
  1302.       }
  1303.   if (strlen(str2) < (unsigned) slen)
  1304.      {
  1305.        return(+1) ;
  1306.      }
  1307.  
  1308.   while (slen-- && *str1 && *str2)
  1309.     {
  1310.       if (tolower (*str1) < tolower (*str2))
  1311.    {
  1312.      return (-1);
  1313.    }
  1314.       else if (tolower (*str1) > tolower (*str2))
  1315.    {
  1316.      return (1);
  1317.    }
  1318.       str1++;
  1319.       str2++;
  1320.     }
  1321.   return (0);
  1322. }
  1323.  
  1324. /*--- function CopyBuf -----------------------------------------------
  1325.  *
  1326.  *    Copy a string into a buffer, being sure not to overrun the
  1327.  *    buffer.
  1328.  *
  1329.  *    Entry    instr    points to the string to copy into the buffer,
  1330.  *                      zero-terminated.
  1331.  *             buf      is the buffer
  1332.  *             left     is the number of bytes left in the buffer
  1333.  *    Exit     buf      contains the LWA+1 of the bytes copied into
  1334.  *                      the output buffer.  A Zero byte is stored
  1335.  *                      into this location.
  1336.  *             left     is the number of bytes left in the buffer.
  1337.  */
  1338.  
  1339. void
  1340. CopyBuf (instr, buf, left)
  1341.      char *instr;
  1342.      char **buf;
  1343.      long int *left;
  1344. {
  1345.   while (--(*left) > 1 && *instr)
  1346.     {
  1347.       *((*buf)++) = *(instr++);
  1348.     }
  1349.   if (*left > 0)
  1350.     **buf = '\0';
  1351. }
  1352.  
  1353. /*--- function NextToken -----------------------------------------------
  1354.  *
  1355.  *  Position a pointer to the next token in a string.
  1356.  *  Delimiters are space and tab.
  1357.  *
  1358.  *    Entry    cptr     points to a position in a zero-terminated string.
  1359.  *
  1360.  *    Exit     Returns TRUE iff a next token was found.
  1361.  *             cptr     points to the next token, if found--else
  1362.  *                      it is unchanged.
  1363.  */
  1364. BOOL
  1365. NextToken (cptr)
  1366.      char **cptr;
  1367. {
  1368.   /* Skip to end of current token, if any.              */
  1369.  
  1370.   while (**cptr != ' ' && **cptr != '\t' && **cptr)
  1371.     (*cptr)++;
  1372.  
  1373.   /* Skip past white space.                             */
  1374.  
  1375.   while (**cptr && (**cptr == ' ' || **cptr == '\t'))
  1376.     (*cptr)++;
  1377.   if (**cptr)
  1378.     {
  1379.       return (TRUE);
  1380.     }
  1381.   else
  1382.     {
  1383.       return (FALSE);
  1384.     }
  1385. }
  1386.  
  1387. /*--- function AppendTextToEditBuf ----------------------------------------
  1388.  *
  1389.  *    Appends a zero-terminated text line to a buffer to be given
  1390.  *    to an Edit window.  Used in building messages to be displayed
  1391.  *    and edited by an Edit window.
  1392.  *
  1393.  *    Entry    instr    points to a text line to add.  It is terminated
  1394.  *                      by a zero byte and does not end in CR or LF.
  1395.  *             left     is the number of characters left in buf.
  1396.  *
  1397.  *    Exit     buf      contains the line, terminated by CR and LF.
  1398.  *                      buf now points to the next available byte.
  1399.  *             left     has been decremented as appropriate.
  1400.  */
  1401. void
  1402. AppendTextToEditBuf (instr, buf, left)
  1403.      char *instr;
  1404.      char far **buf;
  1405.      long int *left;
  1406. {
  1407.   while (--(*left) > 0 && *instr)
  1408.     {
  1409.       *((*buf)++) = *(instr++);
  1410.     }
  1411.   if (--(*left) > 0)
  1412.     *((*buf)++) = '\r';
  1413.  
  1414.   if (--(*left) > 0)
  1415.     *((*buf)++) = '\n';
  1416.  
  1417.   if ((*left) > 0)
  1418.     **buf = '\0';
  1419. }
  1420.  
  1421. /*--- function IsLineBlank ------------------------------------------------
  1422.  *
  1423.  *    Determine whether a zero-terminated line is blank.
  1424.  *    "Blank" means it contains nothing but spaces and tabs.
  1425.  *
  1426.  *    Entry    line     points to the line.
  1427.  *
  1428.  *    Exit     returns TRUE iff the line is blank.
  1429.  */
  1430. BOOL
  1431. IsLineBlank (line)
  1432.      char far *line;
  1433. {
  1434.   while (*line == ' ' || *line == '\t' || *line == '\n')
  1435.     line++;
  1436.   return (!(*line));
  1437. }
  1438.  
  1439. /*------------ editIntercept ---------------------------------- 
  1440.  *
  1441.  *   the subclassed WindowProc for the edit component
  1442.  *
  1443.  *   Capture key messages and pass them to parent
  1444.  * as may contain accelerator information
  1445.  *
  1446.  *--------------------------------------------------------------*/
  1447.  
  1448. BOOL FAR PASCAL  editIntercept(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
  1449.   HWND  parWnd ;
  1450.   BOOL res ;
  1451.  
  1452.   if (msg == WM_KEYDOWN || msg == WM_KEYUP)
  1453.     /* if it receives a keyboard event, pass it to your parent */
  1454.     {
  1455.      parWnd = GetParent(hwnd);
  1456.       res =  PostMessage(parWnd,msg, wParam,lParam );
  1457.     }
  1458.   /* and always let the edit control do its thing  */
  1459.   return (BOOL) CallWindowProc((WNDPROC)GetClassLong(hwnd, GCL_WNDPROC),
  1460.                 hwnd, msg, wParam , lParam);
  1461. }
  1462.  
  1463. /* --------------- prepareEditMenu -----------------
  1464.  *
  1465.  *  Common (wvpost and wvmail) preparartion
  1466.  *  of edit menus 
  1467.  *
  1468.  * ------------------------------------------------- 
  1469.  */
  1470.  
  1471. void  prepareEditMenu(HWND parWnd,HWND hWndEdit) 
  1472.  
  1473. {  DWORD dwResult ;
  1474.    UINT action;
  1475.    HMENU hMenu = GetMenu(parWnd);
  1476.  
  1477.    dwResult = SendMessage (hWndEdit, EM_GETSEL, 0, 0L);
  1478.  
  1479.    if ( HIWORD (dwResult) == LOWORD (dwResult) )
  1480.    {   /* No selection to ROT,Copy or Cut */
  1481.        action=MF_GRAYED ;
  1482.    } else
  1483.    {
  1484.        action=MF_ENABLED ;
  1485.    }
  1486.    EnableMenuItem(hMenu,IDM_ROT13,action) ;
  1487.    EnableMenuItem(hMenu,IDM_COPY,action) ;
  1488.    EnableMenuItem(hMenu,IDM_CUT,action) ;
  1489.    EnableMenuItem(hMenu,IDM_CLEAR,action) ;
  1490.  
  1491.    if (IsClipboardFormatAvailable(CF_TEXT))
  1492.    { 
  1493.       action=MF_ENABLED ;
  1494.    } else
  1495.    {   /* No Clip board contents to paste */
  1496.       action=MF_GRAYED ;
  1497.    }
  1498.    EnableMenuItem(hMenu,IDM_PASTE,action) ;
  1499.  
  1500.  
  1501.   if (SendMessage (hWndEdit, EM_CANUNDO, 0, 0L))
  1502.   { 
  1503.      action=MF_ENABLED ;
  1504.   } else
  1505.   {  /* Undo Buffer is empty so cannot Undo changes */
  1506.      action=MF_GRAYED ;
  1507.   }
  1508.   EnableMenuItem(hMenu,IDM_UNDO,action) ;
  1509.  
  1510. }
  1511.  
  1512. /* ---------------- function DoEditCommands -------------
  1513.  *
  1514.  *  Command edit commands between wvpost and wvmail
  1515.  *
  1516.  * ------------------------------------------------------*/
  1517. DoEditCommands(HWND hWndEdit,WPARAM wParam,LPARAM lParam)
  1518. {
  1519.       switch (LOWORD(wParam))
  1520.    {
  1521.    case IDM_UNDO:
  1522.      SendMessage (hWndEdit, WM_UNDO, 0, 0L);
  1523.      break;
  1524.  
  1525.    case IDM_CUT:
  1526.      SendMessage (hWndEdit, WM_CUT, 0, 0L);
  1527.      break;
  1528.  
  1529.    case IDM_COPY:
  1530.      SendMessage (hWndEdit, WM_COPY, 0, 0L);
  1531.      break;
  1532.  
  1533.    case IDM_PASTE:
  1534.      SendMessage (hWndEdit, WM_PASTE, 0, 0L);
  1535.      break;
  1536.  
  1537.    case IDM_CLEAR:
  1538.      SendMessage (hWndEdit, WM_CLEAR, 0, 0L);
  1539.      break;
  1540.  
  1541.    case IDM_SELALL:
  1542.      SendMessage (hWndEdit, EM_SETSEL, 0,
  1543.              MAKELONG (0, 32767));
  1544.      break;
  1545.  
  1546.    case IDM_ROT13:
  1547.      { DWORD dwResult ;
  1548.        WORD  wStart, wEnd ;
  1549.             char *editptr;
  1550.  
  1551.        dwResult = SendMessage (hWndEdit, EM_GETSEL, 0, 0L);
  1552.        wStart = LOWORD (dwResult) ;
  1553.        wEnd   = HIWORD (dwResult) ;
  1554.  
  1555.        editptr = GetEditText (hWndEdit);
  1556.        strnROT13(editptr + wStart, wEnd - wStart) ;
  1557.             SetEditText (hWndEdit, editptr);
  1558.             GlobalFreePtr (editptr);
  1559.        InvalidateRect (hWndEdit, NULL, TRUE);
  1560.      }
  1561.      break;
  1562.  
  1563.         default :
  1564.           return(0) ;   // signnify no action 
  1565.    }
  1566.    return(1) ;          // signify actions completed 
  1567.  }
  1568.  
  1569. /*
  1570.  *  function DoEditClose
  1571.  *  close down the edit window only if clean to close 
  1572.  *  or user agrees to lose information 
  1573.  *
  1574.  */
  1575.  
  1576.  void DoEditClose(HWND hWnd,int dirty)
  1577.  {
  1578.    if ( dirty == DT_DIRTY)
  1579.    {
  1580.      if (MessageBox(hWnd, "Are you sure you want to exit?", "Unsaved Work",
  1581.     MB_ICONQUESTION | MB_OKCANCEL) == IDOK)
  1582.     DestroyWindow(hWnd);
  1583.    }
  1584.    else
  1585.       DestroyWindow(hWnd);
  1586.  }
  1587. @
  1588.  
  1589.  
  1590. 1.25
  1591. log
  1592. @authorization enables post/mail
  1593. @
  1594. text
  1595. @d12 1
  1596. a12 1
  1597.  * $Id: wvheader.c 1.24 1994/05/27 01:29:29 rushing Exp $
  1598. d14 3
  1599. d97 2
  1600. a98 2
  1601. #include "windows.h"
  1602. #include <windowsx.h>   // for GlobalFreePtr
  1603. d101 1
  1604. a105 1
  1605.  
  1606. d107 1
  1607. a108 1
  1608.  
  1609. d349 1
  1610. d443 3
  1611. a445 1
  1612.  
  1613. d451 11
  1614. a461 1
  1615.           DialogBox (hInst, "WinVnSubject", Doc->hDocWnd, lpfnWinVnSubjectDlg);
  1616. d466 3
  1617. a468 1
  1618.       DialogBox (hInst, "WinVnSubject", hWndConf, lpfnWinVnSubjectDlg);
  1619. d605 1
  1620. a605 1
  1621.       if (!DialogBoxParam (hInst, "WinVnMail", hWndConf, lpfnWinVnMailDlg, (LPARAM) NULL))
  1622. d1311 1
  1623. a1311 1
  1624.   return (BOOL) CallWindowProc((FARPROC)GetClassLong(hwnd, GCL_WNDPROC),
  1625. @
  1626.  
  1627.  
  1628. 1.24
  1629. log
  1630. @unnecessary winundoc.h
  1631. @
  1632. text
  1633. @d12 1
  1634. a12 1
  1635.  * $Id: wvheader.c 1.23 1994/02/24 21:31:49 jcoop Exp rushing $
  1636. d14 3
  1637. d95 1
  1638. a95 1
  1639. #include <windowsx.h>    // for GlobalFreePtr
  1640. d161 1
  1641. a161 1
  1642.     break;
  1643. d164 4
  1644. a167 4
  1645.     {
  1646.       found = TRUE;
  1647.       break;
  1648.     }
  1649. d169 1
  1650. a169 1
  1651.     break;
  1652. d195 2
  1653. a196 1
  1654.   BOOL found = FALSE;
  1655. d201 2
  1656. a202 1
  1657.     {
  1658. d206 3
  1659. a208 3
  1660.     {
  1661.       TitlePtr = "Composing Followup Article";
  1662.     }
  1663. d210 3
  1664. a212 3
  1665.     {
  1666.       TitlePtr = "Composing New Article";
  1667.     }
  1668. d214 7
  1669. a220 7
  1670.     {
  1671.       if (!WndPosts[ih].hWnd)
  1672.         {
  1673.           found = TRUE;
  1674.           break;
  1675.         }
  1676.     }
  1677. d223 2
  1678. a224 1
  1679.     {
  1680. d228 3
  1681. a230 3
  1682.     {
  1683.       TitlePtr = "Composing Reply Message";
  1684.     }
  1685. d232 4
  1686. a235 4
  1687.     {
  1688.       TitlePtr = "Composing New Mail Message";
  1689.       strcpy(AddressString,"") ;
  1690.     }
  1691. d237 7
  1692. a243 7
  1693.     {
  1694.       if (!WndMails[ih].hWnd)
  1695.         {
  1696.           found = TRUE;
  1697.           break;
  1698.         }
  1699.     }
  1700. d245 1
  1701. a245 1
  1702.   if (found && AuthenticatePosting ())
  1703. d249 3
  1704. a251 3
  1705.     {
  1706.       width = 78 * ArtCharWidth;
  1707.     }
  1708. d253 3
  1709. a255 3
  1710.     {
  1711.       width = xScreen - 2 * ArtCharWidth;
  1712.     }
  1713. d258 14
  1714. a271 14
  1715.                TitlePtr,
  1716.                WS_OVERLAPPEDWINDOW /* | WS_VSCROLL */ ,
  1717.                /* Initial X pos */
  1718.                ih * CharWidth,
  1719.                /* Initial Y pos */
  1720.                (int) (yScreen * 3 / 8) + (1 + ih) * LineHeight,
  1721.                /* Initial X Width */
  1722.                (int) width,
  1723.                /* Initial Y height */
  1724.                (int) (yScreen * 5 / 8) - (2 * LineHeight),
  1725.                NULL,
  1726.                NULL,
  1727.                hInst,
  1728.                NULL);
  1729. d274 5
  1730. a278 5
  1731.     {
  1732.       SetHandleBkBrush (hWnd, hArticleBackgroundBrush);          
  1733.       ShowWindow (hWnd, SW_SHOWNORMAL);
  1734.       UpdateWindow (hWnd);
  1735.     }
  1736. d335 1
  1737. a335 1
  1738.      int DocType;
  1739. d352 1
  1740. a352 1
  1741.       HeaderFuncs = MailCtrl.MailHeaderFuncs;
  1742. d368 3
  1743. a370 3
  1744.      {
  1745.         return ((HANDLE) NULL) ;
  1746.      }
  1747. d376 1
  1748. a376 1
  1749.       gotline = (HeaderFuncs[ifunc]) (Doc, line, (long int) MAXHEADERLINE);
  1750. d378 3
  1751. a380 3
  1752.     {
  1753.             AppendTextToEditBuf (line, &lpCurPtr, &BytesLeft);
  1754.     }
  1755. d444 1
  1756. a444 1
  1757. //    if (!DialogString[0])    // always allow reply-subject confirmation
  1758. d480 6
  1759. a485 6
  1760.     NextToken (&headptr);
  1761.     if (CompareStringNoCase (headptr, "Re:", 3) != 0)
  1762.          {
  1763.           CopyBuf ("Re: ", &outptr, &BufLen);
  1764.           }
  1765.     CopyBuf (headptr, &outptr, &BufLen);
  1766. d507 1
  1767. a507 1
  1768.             ServerName, MAXSERVERNAME, szAppProFile);
  1769. d622 2
  1770. a623 2
  1771.          NextToken (&cptr);
  1772.          ParseAddress (cptr, AddressString,MAXDIALOGSTRING , NameString,MAXDIALOGSTRING ) ;
  1773. d626 4
  1774. a629 4
  1775.       {
  1776.          NextToken (&cptr);
  1777.          ParseAddress (cptr, ReplyAddress,MAXDIALOGSTRING , ReplyName,MAXDIALOGSTRING ) ;
  1778.       }
  1779. d651 1
  1780. a651 1
  1781.  *     representing any email address and optional
  1782. d684 1
  1783. a684 1
  1784.      if (l < 0) l = 0;        /* this was killing print??? */
  1785. d693 1
  1786. a693 1
  1787.     if (nmlen >0)
  1788. d695 4
  1789. a698 4
  1790.        strncpy(nameout+l,ptrc+1,(int)nmlen) ;
  1791.        nameout[nameoutlen-1]=0 ;
  1792.     }
  1793.     l=min(ptrc-ptrb-1,adlen) ;
  1794. d701 1
  1795. a701 1
  1796.     l=adlen ;
  1797. d716 1
  1798. a716 1
  1799.     strncpy(addressout,ptra,(int)l) ;
  1800. d721 1
  1801. a721 1
  1802.     if (adlen > 0)
  1803. d723 2
  1804. a724 2
  1805.        strncpy(addressout+l,ptrc+1,(int)adlen) ;
  1806.        addressout[addressoutlen-1]=0 ;
  1807. d726 1
  1808. a726 1
  1809.     l=min(ptrc-ptrb-1,nmlen) ;
  1810. d729 1
  1811. a729 1
  1812.     l=nmlen ;
  1813. d749 2
  1814. a750 2
  1815.      if (!lastspace) *optr++=*iptr ;
  1816.      lastspace=TRUE ;
  1817. d752 2
  1818. a753 2
  1819.        case '"':      
  1820.      break ;
  1821. d755 2
  1822. a756 2
  1823.      *optr++=*iptr ;
  1824.      lastspace=FALSE ;
  1825. d768 2
  1826. a769 2
  1827.      *optr++=*iptr ;
  1828.      lastspace=FALSE ;
  1829. d806 1
  1830. a806 1
  1831.         if (*cptr != '"')                   // drop quote characters 
  1832. d808 3
  1833. a810 3
  1834.            *(nmptr++) = *(cptr);
  1835.            nmlen--;
  1836.         }
  1837. d817 2
  1838. a818 2
  1839.     strncpy( nmptr,addressout,(int)nmlen)  ;
  1840.     nmptr[nmlen+1]= '\0' ;
  1841. d900 1
  1842. a900 1
  1843.                    "Jul","Aug","Sep","Oct","Nov","Dec"};
  1844. d905 8
  1845. a912 8
  1846.         "Timezone environment variable 'TZ' not set.\n"
  1847.         "You must set this variable for your messages\n"
  1848.         "to be timestamped correctly.\n"
  1849.         "For example, you could add the following to your\n"
  1850.         "'autoexec.bat' file:\n"
  1851.         "set TZ=EST5EDT\n",
  1852.         "Warning:",
  1853.         MB_OK|MB_ICONHAND);
  1854. d921 8
  1855. a928 8
  1856.        days[timeptr->tm_wday],
  1857.        timeptr->tm_mday,
  1858.        months[timeptr->tm_mon],
  1859.        timeptr->tm_year,
  1860.        timeptr->tm_hour,
  1861.        timeptr->tm_min,
  1862.        timeptr->tm_sec,
  1863.        tzname[0]);
  1864. d955 4
  1865. a958 4
  1866.     {
  1867.       CopyBuf (HeadLine, &outptr, &BufLen);
  1868.       CopyBuf (" ", &outptr, &BufLen);
  1869.     }
  1870. d961 8
  1871. a968 8
  1872.     {
  1873.       if (!gotrefs)
  1874.         {
  1875.           CopyBuf ("References: ", &outptr, &BufLen);
  1876.         }
  1877.       NextToken (&headptr);
  1878.       CopyBuf (headptr, &outptr, &BufLen);
  1879.     }
  1880. d970 1
  1881. a970 1
  1882.     return (TRUE);
  1883. d993 3
  1884. a995 3
  1885.     {
  1886.       CopyBuf (HeadLine, &outptr, &BufLen);
  1887.     }
  1888. d1044 1
  1889. a1044 1
  1890.   AppendTextToEditBuf ("", MesBuf, left);    /* blank line after header */
  1891. d1052 3
  1892. a1054 3
  1893.     {
  1894.       NextToken (&mesptr);
  1895.     }
  1896. d1056 3
  1897. a1058 3
  1898.     {
  1899.       mesptr = "<Unknown>";
  1900.     }
  1901. d1061 7
  1902. a1067 7
  1903.     gotfrom = GetHeaderLine (Doc, "From:", from, MAXHEADERLINE);
  1904.     if (gotfrom)
  1905.         NextToken (&fromptr);
  1906.     else
  1907.           fromptr = "<Unknown>";
  1908.     sprintf (line, "In article %s, %s says:", mesptr, fromptr);
  1909.     break;
  1910. d1070 2
  1911. a1071 2
  1912.     sprintf (line, "In article %s, you say:", mesptr);
  1913.     break;
  1914. d1080 5
  1915. a1084 5
  1916.          !IsLineBlank (line))
  1917.     {
  1918.       if (!NextLine (&BlockPtr, &LinePtr))
  1919.         break;
  1920.     }
  1921. d1095 5
  1922. a1099 5
  1923.     {
  1924.       AppendTextToEditBuf (line, MesBuf, left);
  1925.       if (!NextLine (&BlockPtr, &LinePtr))
  1926.         break;
  1927.     }
  1928. d1102 1
  1929. a1102 1
  1930.         AppendTextToEditBuf ("", MesBuf, left);    /* blank line before sig */
  1931. d1107 2
  1932. a1108 2
  1933.       for (i = 0; i < Signature->numLines; i++)
  1934.       AppendTextToEditBuf (TextBlockLine(Signature, i), MesBuf, left);
  1935. d1134 1
  1936. a1134 1
  1937.     return(-1)  ;
  1938. d1137 3
  1939. a1139 3
  1940.       {
  1941.          return(+1) ;
  1942.       }
  1943. d1144 3
  1944. a1146 3
  1945.     {
  1946.       return (-1);
  1947.     }
  1948. d1148 3
  1949. a1150 3
  1950.     {
  1951.       return (1);
  1952.     }
  1953. d1289 1
  1954. a1289 1
  1955.       parWnd = GetParent(hwnd);
  1956. d1294 1
  1957. a1294 1
  1958.                    hwnd, msg, wParam , lParam);
  1959. d1354 29
  1960. a1382 29
  1961.     {
  1962.     case IDM_UNDO:
  1963.       SendMessage (hWndEdit, WM_UNDO, 0, 0L);
  1964.       break;
  1965.  
  1966.     case IDM_CUT:
  1967.       SendMessage (hWndEdit, WM_CUT, 0, 0L);
  1968.       break;
  1969.  
  1970.     case IDM_COPY:
  1971.       SendMessage (hWndEdit, WM_COPY, 0, 0L);
  1972.       break;
  1973.  
  1974.     case IDM_PASTE:
  1975.       SendMessage (hWndEdit, WM_PASTE, 0, 0L);
  1976.       break;
  1977.  
  1978.     case IDM_CLEAR:
  1979.       SendMessage (hWndEdit, WM_CLEAR, 0, 0L);
  1980.       break;
  1981.  
  1982.     case IDM_SELALL:
  1983.       SendMessage (hWndEdit, EM_SETSEL, 0,
  1984.                MAKELONG (0, 32767));
  1985.       break;
  1986.  
  1987.     case IDM_ROT13:
  1988.       { DWORD dwResult ;
  1989.         WORD  wStart, wEnd ;
  1990. d1385 3
  1991. a1387 3
  1992.         dwResult = SendMessage (hWndEdit, EM_GETSEL, 0, 0L);
  1993.         wStart = LOWORD (dwResult) ;
  1994.         wEnd   = HIWORD (dwResult) ;
  1995. d1389 2
  1996. a1390 2
  1997.         editptr = GetEditText (hWndEdit);
  1998.         strnROT13(editptr + wStart, wEnd - wStart) ;
  1999. d1393 3
  2000. a1395 3
  2001.         InvalidateRect (hWndEdit, NULL, TRUE);
  2002.       }
  2003.       break;
  2004. d1399 1
  2005. a1399 1
  2006.     }
  2007. d1415 2
  2008. a1416 2
  2009.      MB_ICONQUESTION | MB_OKCANCEL) == IDOK)
  2010.      DestroyWindow(hWnd);
  2011. @
  2012.  
  2013.  
  2014. 1.23
  2015. log
  2016. @jcoop changes
  2017. @
  2018. text
  2019. @d12 1
  2020. a12 1
  2021.  * $Id: wvheader.c 1.22 1994/02/09 18:01:08 cnolan Exp $
  2022. d14 3
  2023. a94 1
  2024. #include "winundoc.h"
  2025. @
  2026.  
  2027.  
  2028. 1.22
  2029. log
  2030. @cnolan 90.2 changes
  2031. @
  2032. text
  2033. @d12 1
  2034. a12 1
  2035.  * $Id: wvheader.c 1.21 1994/01/18 09:51:34 jcoop Exp $
  2036. d14 3
  2037. d103 1
  2038. a103 1
  2039.   MakeArtHeaderFrom,
  2040. d110 1
  2041. a429 2
  2042.  
  2043.  
  2044. d436 2
  2045. a437 5
  2046.       if (!strcmp(DialogString,""))
  2047.     {
  2048.       DialogBoxParam (hInst, "WinVnGeneric", Doc->hDocWnd, lpfnWinVnGenericDlg,
  2049.               (LPARAM) (char far *) "Enter a Subject line for your post");
  2050.     }
  2051. d442 1
  2052. a442 2
  2053.       DialogBoxParam (hInst, "WinVnGeneric", hWndConf, lpfnWinVnGenericDlg,
  2054.               (LPARAM) (char far *) "Enter a Subject line for your post");
  2055. d538 21
  2056. d561 3
  2057. a563 1
  2058.  *  Simply returns a blank "To:" line.
  2059. d579 3
  2060. a581 3
  2061.       DialogBoxParam (hInst, "WinVnGeneric", hWndConf, lpfnWinVnGenericDlg,
  2062.               (LPARAM) (char far *) "Enter mail recipient:");
  2063.   
  2064. d608 1
  2065. d612 6
  2066. a617 2
  2067.       gotwho = GetHeaderLine (Doc, "Reply-To:", HeadLine, MAXHEADERLINE);
  2068.       if (!gotwho)
  2069. a618 4
  2070.          gotwho = GetHeaderLine (Doc, "From:", HeadLine, MAXHEADERLINE);
  2071.       }
  2072.       if (gotwho)
  2073.      {
  2074. d620 1
  2075. a620 1
  2076.          ParseAddress (cptr, AddressString,MAXDIALOGSTRING , NameString,MAXDIALOGSTRING ) ;
  2077. d622 14
  2078. @
  2079.  
  2080.  
  2081. 1.21
  2082. log
  2083. @Use new version number scheme on X-Mailer header line
  2084. @
  2085. text
  2086. @d12 1
  2087. a12 1
  2088.  * $Id: wvheader.c 1.20 1994/01/15 20:31:16 jcoop Exp $
  2089. d14 3
  2090. d263 1
  2091. a263 1
  2092.       SetClassWord (hWnd, GCW_HBRBACKGROUND, hArticleBackgroundBrush);
  2093. @
  2094.  
  2095.  
  2096. 1.20
  2097. log
  2098. @Font/color stuff and signature file handling
  2099. @
  2100. text
  2101. @d12 1
  2102. a12 1
  2103.  * $Id: wvheader.c 1.19 1993/12/08 01:27:21 rushing Exp $
  2104. d14 3
  2105. d823 1
  2106. a823 1
  2107.  *    Returned "Newsreader: " line is simply a constant.
  2108. d831 2
  2109. a832 1
  2110.   CopyBuf ("WinVN version 0.82 SMTP", &outptr, &BufLen);
  2111. @
  2112.  
  2113.  
  2114. 1.19
  2115. log
  2116. @new version box and cr lf consistency
  2117. @
  2118. text
  2119. @d12 1
  2120. a12 1
  2121.  * $Id: wvheader.c 1.18 1993/08/25 18:53:17 mbretherton Exp rushing $
  2122. d14 3
  2123. d80 1
  2124. d181 1
  2125. a181 3
  2126.   unsigned int width, AveCharWidth;
  2127.   HDC hDC;
  2128.   TEXTMETRIC tmFontInfo;
  2129. d183 1
  2130. a183 1
  2131.  
  2132. d230 1
  2133. a230 6
  2134.       hDC = GetDC (hWndConf);
  2135.       GetTextMetrics (hDC, (LPTEXTMETRIC) & tmFontInfo);
  2136.       AveCharWidth = tmFontInfo.tmAveCharWidth;
  2137.       ReleaseDC (hWndConf, hDC);
  2138.  
  2139.       if (xScreen > 78 * AveCharWidth)
  2140. d232 1
  2141. a232 1
  2142.       width = 78 * AveCharWidth;
  2143. d236 1
  2144. a236 1
  2145.       width = xScreen - 2 * AveCharWidth;
  2146. d257 1
  2147. a257 1
  2148.  
  2149. d991 2
  2150. a992 1
  2151.  
  2152. d1050 2
  2153. d1053 6
  2154. a1332 1
  2155.         HANDLE hEditBuffer;
  2156. d1338 1
  2157. a1338 3
  2158.         hEditBuffer = (HANDLE) SendMessage (hWndEdit, EM_GETHANDLE, 0, 0L);
  2159.             editptr = LocalLock (hEditBuffer);
  2160.  
  2161. d1340 2
  2162. a1341 2
  2163.  
  2164.         LocalUnlock (hEditBuffer);
  2165. @
  2166.  
  2167.  
  2168. 1.18
  2169. log
  2170. @MRB merge, mail & post logging
  2171. @
  2172. text
  2173. @d9 1
  2174. d12 1
  2175. a12 1
  2176.  * $Id: wvheader.c 1.17 1993/08/17 21:53:06 UNKNOWN Exp $
  2177. d14 3
  2178. d814 1
  2179. a814 1
  2180.   CopyBuf ("WinVN version 0.82", &outptr, &BufLen);
  2181. @
  2182.  
  2183.  
  2184. 1.17
  2185. log
  2186. @Updated version to Version 0.82 (JD)
  2187. @
  2188. text
  2189. @d11 1
  2190. a11 1
  2191.  * $Id: wvheader.c 1.16 1993/07/13 22:11:31 rushing Exp dumoulin $
  2192. d13 6
  2193. d192 1
  2194. a192 1
  2195.       if (!hWndPosts[ih])
  2196. d210 1
  2197. d214 1
  2198. a214 1
  2199.       if (!hWndMails[ih])
  2200. d876 1
  2201. a876 1
  2202.        _tzname[0]);
  2203. d1343 19
  2204. @
  2205.  
  2206.  
  2207. 1.16
  2208. log
  2209. @strncpy crashing in parseaddress
  2210. @
  2211. text
  2212. @d1 8
  2213. d11 1
  2214. a11 1
  2215.  * $Id: wvheader.c 1.15 1993/07/06 21:09:50 cnolan Exp rushing $
  2216. d13 3
  2217. a65 9
  2218. /* --- WVHEADER.C ---------------------------------------------
  2219.  *
  2220.  *  This file contains the code necessary to create the initial skeleton
  2221.  *  version of an article, which will be edited by the user.
  2222.  *
  2223.  *  Mark Riordan   24-JAN-1990
  2224.  */
  2225.  
  2226.  
  2227. d803 1
  2228. a803 1
  2229.   CopyBuf ("WinVN version 0.81", &outptr, &BufLen);
  2230. d820 1
  2231. a820 1
  2232.   CopyBuf ("WinVN version 0.81 SMTP", &outptr, &BufLen);
  2233. @
  2234.  
  2235.  
  2236. 1.15
  2237. log
  2238. @win32 support
  2239. @
  2240. text
  2241. @d3 1
  2242. a3 1
  2243.  * $Id: wvheader.c 1.14 1993/06/29 20:06:07 rushing Exp $
  2244. d5 3
  2245. d624 1
  2246. @
  2247.  
  2248.  
  2249. 1.14
  2250. log
  2251. @use localtime for Date header
  2252. @
  2253. text
  2254. @d3 1
  2255. a3 1
  2256.  * $Id: wvheader.c 1.13 1993/06/29 00:22:13 rushing Exp rushing $
  2257. d5 3
  2258. d1215 1
  2259. a1215 1
  2260.       parWnd =  GetWindowWord(hwnd,GWW_HWNDPARENT);
  2261. d1279 1
  2262. a1279 1
  2263.       switch (wParam)
  2264. @
  2265.  
  2266.  
  2267. 1.13
  2268. log
  2269. @correct rfc822/rfc1036 MakeArtHeaderDate function
  2270. @
  2271. text
  2272. @d3 1
  2273. a3 1
  2274.  * $Id: wvheader.c 1.12 1993/06/28 17:51:21 rushing Exp rushing $
  2275. d5 3
  2276. d64 1
  2277. a64 1
  2278.  
  2279. d820 1
  2280. a820 1
  2281.  *    "grtime" to work properly.  Typical setting:  SET TZ=EST5
  2282. a829 1
  2283.  
  2284. d834 13
  2285. d848 1
  2286. a848 1
  2287.   timeptr = gmtime (&curtime);
  2288. d852 1
  2289. a852 1
  2290.   sprintf (Buf, "Date: %s, %.2d %s %.2d %.2d:%.2d:%.2d GMT",
  2291. d859 2
  2292. a860 1
  2293.        timeptr->tm_sec);
  2294. @
  2295.  
  2296.  
  2297. 1.12
  2298. log
  2299. @warnings
  2300. @
  2301. text
  2302. @d3 1
  2303. a3 1
  2304.  * $Id: wvheader.c 1.11 1993/06/22 19:08:40 rushing Exp rushing $
  2305. d5 3
  2306. d791 1
  2307. a791 1
  2308.   CopyBuf ("WinVN version 0.80", &outptr, &BufLen);
  2309. d808 1
  2310. a808 1
  2311.   CopyBuf ("WinVN version 0.80 SMTP", &outptr, &BufLen);
  2312. a812 1
  2313. #if 0
  2314. d828 4
  2315. d834 11
  2316. a844 2
  2317.   sprintf (Buf, "Date: %.4d-%.2d-%.2d %.2d:%.2d GMT", timeptr->tm_year + 1900,
  2318.   timeptr->tm_mon + 1, timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min);
  2319. a847 1
  2320. #endif
  2321. @
  2322.  
  2323.  
  2324. 1.11
  2325. log
  2326. @remove warnings
  2327. @
  2328. text
  2329. @d3 1
  2330. a3 1
  2331.  * $Id: wvheader.c 1.10 1993/06/22 16:46:33 bretherton Exp rushing $
  2332. d5 3
  2333. d153 1
  2334. a153 1
  2335.   int width, AveCharWidth;
  2336. d409 1
  2337. a409 1
  2338.               (LPARAM)"Enter a Subject line for your post");
  2339. d416 1
  2340. a416 1
  2341.               (LPARAM) "Enter a Subject line for your post");
  2342. d531 1
  2343. a531 1
  2344.               (LPARAM) "Enter mail recipient:");
  2345. d1025 1
  2346. a1025 1
  2347.   if (strlen(str1) < slen)
  2348. d1029 1
  2349. a1029 1
  2350.   if (strlen(str2) < slen)
  2351. d1174 1
  2352. a1174 1
  2353. BOOL FAR PASCAL  editIntercept(HWND hwnd, unsigned msg, WORD wParam, LONG lParam)
  2354. d1176 2
  2355. a1177 2
  2356. HWND  parWnd ;
  2357. BOOL res ;
  2358. d1179 9
  2359. a1187 10
  2360. if (msg == WM_KEYDOWN || msg == WM_KEYUP)
  2361.   { //if it receives a keyboard event, pass it to your parent
  2362.  
  2363.     parWnd =  GetWindowWord(hwnd,GWW_HWNDPARENT);
  2364.     res =  PostMessage(parWnd,msg, wParam,lParam );
  2365.  
  2366.   }
  2367. // and always let the edit control do its thing 
  2368. return CallWindowProc((FARPROC)GetClassLong(hwnd, GCL_WNDPROC), hwnd, msg,
  2369.                                   wParam, lParam);
  2370. @
  2371.  
  2372.  
  2373. 1.10
  2374. log
  2375. @robust parse_address
  2376. @
  2377. text
  2378. @d3 1
  2379. a3 1
  2380.  * $Id: wvheader.c 1.9 1993/06/11 01:05:17 rushing Exp $
  2381. d5 3
  2382. a256 1
  2383.   BOOL found;
  2384. d406 1
  2385. a406 1
  2386.               (char far *) "Enter a Subject line for your post");
  2387. d413 1
  2388. a413 1
  2389.               (char far *) "Enter a Subject line for your post");
  2390. a520 1
  2391.   BOOL gotwho;
  2392. d528 1
  2393. a528 1
  2394.               (char far *) "Enter mail recipient:");
  2395. d612 1
  2396. a612 1
  2397.         strncpy(nameout,ptra,l) ;
  2398. d619 1
  2399. a619 1
  2400.        strncpy(nameout+l,ptrc+1,nmlen) ;
  2401. d629 1
  2402. a629 1
  2403.      strncpy(addressout,ptrb+1,l);
  2404. d640 1
  2405. a640 1
  2406.     strncpy(addressout,ptra,l) ;
  2407. d647 1
  2408. a647 1
  2409.        strncpy(addressout+l,ptrc+1,adlen) ;
  2410. d657 1
  2411. a657 1
  2412.      strncpy(nameout,ptrb+1,l);
  2413. d663 1
  2414. a663 1
  2415.      strncpy(addressout,ptra,adlen) ;
  2416. d700 1
  2417. a700 1
  2418.       strncpy(nameout,addressout,nmlen) ;
  2419. d741 1
  2420. a741 1
  2421.     strncpy( nmptr,addressout,nmlen)  ;
  2422. @
  2423.  
  2424.  
  2425. 1.9
  2426. log
  2427. @new version number
  2428. @
  2429. text
  2430. @d3 1
  2431. a3 1
  2432.  * $Id: wvheader.c 1.8 1993/06/11 00:11:26 rushing Exp rushing $
  2433. d5 3
  2434. d589 117
  2435. a705 1
  2436. {
  2437. a707 1
  2438.   long int adlen = addressoutlen - 1 ,nmlen = nameoutlen -1 ;
  2439. d711 1
  2440. a711 1
  2441.   {                         /* skip Name in brackets */
  2442. d714 1
  2443. a714 1
  2444.       NextToken(&cptr);     /* skip parenthesis and white space */
  2445. d726 2
  2446. a727 2
  2447.        cptr++;                                  /* skip (    */
  2448.        while (*cptr && *cptr != ')' && nmlen)   /* copy to ) */
  2449. d729 6
  2450. a734 2
  2451.         *(nmptr++) = *(cptr++);
  2452.         nmlen--;
  2453. d746 1
  2454. @
  2455.  
  2456.  
  2457. 1.8
  2458. log
  2459. @second merge from Matt Bretherton sources
  2460. @
  2461. text
  2462. @d3 1
  2463. a3 1
  2464.  * $Id: wvheader.c 1.7 1993/05/24 23:34:12 rushing Exp $
  2465. d5 2
  2466. d8 1
  2467. d661 1
  2468. a661 1
  2469.   CopyBuf ("WinVN version 0.77", &outptr, &BufLen);
  2470. d678 1
  2471. a678 1
  2472.   CopyBuf ("WinVN version 0.77 SMTP", &outptr, &BufLen);
  2473. d1171 1
  2474. a1171 1
  2475.  }@
  2476.  
  2477.  
  2478. 1.7
  2479. log
  2480. @further refinements to header manipulation
  2481. extend reuse of header formatting capabilities
  2482. @
  2483. text
  2484. @d3 1
  2485. a3 1
  2486.  * $Id: wvheader.c 1.5 1993/05/18 22:10:45 rushing Exp $
  2487. d6 5
  2488. d1035 118
  2489. d1154 15
  2490. @
  2491.  
  2492.  
  2493. 1.6
  2494. log
  2495. @Further refinements to header manipulation
  2496. extend reuse of header formatting capabilities
  2497. @
  2498. text
  2499. @@
  2500.  
  2501.  
  2502. 1.5
  2503. log
  2504. @smtp support
  2505. @
  2506. text
  2507. @d3 1
  2508. a3 1
  2509.  * $Id: wvheader.c 1.4 1993/05/06 19:44:10 rushing Exp rushing $
  2510. d5 4
  2511. d542 1
  2512. a542 1
  2513.   char *adptr = AddressString, *nmptr=NameString, *cptr = HeadLine;
  2514. a544 3
  2515.    *adptr = '\0';
  2516.    *nmptr = '\0';
  2517.   
  2518. d554 3
  2519. a556 22
  2520.           NextToken (&cptr);
  2521.           while (*cptr && *cptr != ' ')
  2522.          {
  2523.             *(adptr++) = *(cptr++);
  2524.          }
  2525.          *adptr = '\0';
  2526.  
  2527.          cptr = strchr(cptr,'(');
  2528.         if (cptr != NULL) 
  2529.            {
  2530.            cptr++;                             /* skip (    */
  2531.            while (*cptr && *cptr != ')')       /* copy to ) */
  2532.               {
  2533.              *(nmptr++) = *(cptr++);
  2534.               }
  2535.            *nmptr = '\0';
  2536.            }
  2537.         else
  2538.            {
  2539.            strcpy(nmptr,AddressString) ;
  2540.            }
  2541.        }
  2542. d561 54
  2543. d855 4
  2544. a858 1
  2545.       line[0] = '>';
  2546. @
  2547.  
  2548.  
  2549. 1.4
  2550. log
  2551. @CompareStringNoCase was using _tolower rather than tolower.
  2552. according to c70 docs, _tolower is undefined for letters that
  2553. are not uppercase.  Yikes!
  2554. @
  2555. text
  2556. @d3 1
  2557. a3 1
  2558.  * $Id: wvheader.c 1.3 1993/04/30 21:17:01 rushing Exp rushing $
  2559. d5 5
  2560. d199 8
  2561. a206 4
  2562.                ih * CharWidth,    /* Initial X pos */
  2563.                (int) (yScreen * 3 / 8) + (1 + ih) * LineHeight,    /* Initial Y pos */
  2564.                (int) width,    /* Initial X Width */
  2565.                (int) (yScreen * 5 / 8) - (2 * LineHeight),    /* Initial Y height */
  2566. d341 1
  2567. a341 1
  2568.   strcpy(SubjectString,"") ;
  2569. d386 1
  2570. a386 1
  2571.       if (!strcmp(SubjectString,""))
  2572. d388 2
  2573. a389 1
  2574.       DialogBox (hInst, "WinVnSubject", Doc->hDocWnd, lpfnWinVnSubjectDlg);
  2575. d392 1
  2576. a392 1
  2577.     else
  2578. d394 3
  2579. a396 1
  2580.       DialogBox (hInst, "WinVnSubject", hWndConf, lpfnWinVnSubjectDlg);
  2581. d399 1
  2582. a399 1
  2583.   CopyBuf (SubjectString, &outptr, &BufLen);
  2584. d405 1
  2585. a405 1
  2586.  *    Fill the SubjectString global variable if a subject can be extracted
  2587. d419 1
  2588. a419 1
  2589.   char *outptr = SubjectString ; 
  2590. d421 1
  2591. a421 1
  2592.   long int BufLen = MAXSUBJECTSTRING ;
  2593. d505 1
  2594. d507 11
  2595. a517 3
  2596.   CopyBuf ("To: ", &outptr, &BufLen);
  2597.   GetArtHeaderTo(Doc,NULL,NULL);  
  2598.   CopyBuf(AddressString,&outptr, &BufLen);
  2599. d519 1
  2600. d624 15
  2601. d789 6
  2602. a794 9
  2603.       if (DocType == DOCTYPE_POSTING)
  2604.     {
  2605.       gotfrom = GetHeaderLine (Doc, "From:", from, MAXHEADERLINE);
  2606.       if (gotfrom)
  2607.         {
  2608.           NextToken (&fromptr);
  2609.         }
  2610.       else
  2611.         {
  2612. d796 8
  2613. a803 7
  2614.         }
  2615.       sprintf (line, "In article %s, %s says:", mesptr, fromptr);
  2616.     }
  2617.       else
  2618.     {
  2619.       sprintf (line, "In article %s, you say:", mesptr);
  2620.     }
  2621. d817 1
  2622. a817 1
  2623.       /* prepending a ">" to each line.                              */
  2624. d820 1
  2625. @
  2626.  
  2627.  
  2628. 1.3
  2629. log
  2630. @put the X-Newsreader: line back in.
  2631. @
  2632. text
  2633. @d3 1
  2634. a3 1
  2635.  * $Id: wvheader.c 1.2 1993/03/30 20:07:37 rushing Exp rushing $
  2636. d5 3
  2637. d826 1
  2638. a826 1
  2639.       if (_tolower (*str1) < _tolower (*str2))
  2640. d830 1
  2641. a830 1
  2642.       else if (_tolower (*str1) > _tolower (*str2))
  2643. @
  2644.  
  2645.  
  2646. 1.2
  2647. log
  2648. @MAPI
  2649. @
  2650. text
  2651. @d3 5
  2652. a7 2
  2653.  * $Id: wvheader.c%v 1.1 1993/02/16 20:54:22 rushing Exp $
  2654.  * $Log: wvheader.c%v $
  2655. d44 1
  2656. a44 1
  2657. /*    MakeArtHeaderNewsreader, */
  2658. d591 2
  2659. a592 3
  2660.   CopyBuf ("Newsreader: ", &outptr, &BufLen);
  2661.   CopyBuf ("MS Windows ", &outptr, &BufLen);
  2662.   CopyBuf (szAppName, &outptr, &BufLen);
  2663. d594 1
  2664. a594 1
  2665.   CopyBuf ("\r", &outptr , &BufLen);
  2666. @
  2667.  
  2668.  
  2669. 1.1
  2670. log
  2671. @Initial revision
  2672. @
  2673. text
  2674. @d3 4
  2675. a6 2
  2676.  * $Id$
  2677.  * $Log$
  2678. d8 1
  2679. a44 8
  2680. BOOL (*MailHeaderFuncs[])(TypDoc * Doc, char *Buf, long int BufLen) =
  2681. {
  2682.   MakeArtHeaderTo,
  2683.     MakeArtHeaderFrom,
  2684.     MakeArtHeaderSubject,
  2685.     MakeArtHeaderOrganization,
  2686.     NULL
  2687. };
  2688. d105 2
  2689. a106 1
  2690.  *    Entry    Doc      points to the document to which we are posting
  2691. d114 2
  2692. a115 1
  2693. CreatePostingWnd (Doc, DocType)
  2694. a120 1
  2695.   HWND hWnd = 0;
  2696. d124 1
  2697. a124 1
  2698.   char *TitlePtr, *WndName;
  2699. d220 42
  2700. d264 1
  2701. a269 4
  2702.   int nLines;
  2703.   long lParam;
  2704.   BOOL found;
  2705.   BOOL (**HeaderFuncs) (TypDoc * Doc, char *Buf, long int BufLen);
  2706. d277 1
  2707. a277 1
  2708.       HeaderFuncs = MailHeaderFuncs;
  2709. a282 1
  2710.   found = 0;
  2711. d291 1
  2712. d293 3
  2713. a295 4
  2714.     {
  2715.       MessageBox (hWndPost, "Cannot allocate memory for text", "", MB_OK);
  2716.       return FALSE;
  2717.     }
  2718. d298 1
  2719. a298 1
  2720.  
  2721. d301 1
  2722. a301 1
  2723.       gotline = (HeaderFuncs[ifunc]) (Doc, line, (long int) MAXHEADERLINE);
  2724. d304 1
  2725. a304 1
  2726.       AppendTextToEditBuf (line, &lpCurPtr, &BytesLeft);
  2727. d309 12
  2728. a320 4
  2729.   /*  Set the edit window text to this skeleton article.            */
  2730.  
  2731.  
  2732.   SetWindowText (hWndEdit, lpTextBuffer);
  2733. d323 6
  2734. a328 5
  2735.  
  2736.   nLines = (int) SendMessage (hWndEdit, EM_GETLINECOUNT, 0, 0L);
  2737.   lParam = (long) ((long) nLines);
  2738.  
  2739.   return TRUE;
  2740. d353 2
  2741. a354 4
  2742.  *    Returned "Subject:" line is blank if no previous Subject: line
  2743.  *    could be found.  Otherwise, it is "Subject: Re: <previous subject>".
  2744.  *    If the article being replied to had a subject already starting
  2745.  *    with "Re:", the "Re:" is not repeated.
  2746. d363 2
  2747. a364 2
  2748.   char HeadLine[MAXHEADERLINE];
  2749.   BOOL gotline;
  2750. a365 1
  2751.   char *headptr = HeadLine;
  2752. d370 2
  2753. a371 11
  2754.       gotline = GetHeaderLine (Doc, "Subject:", HeadLine, MAXHEADERLINE);
  2755.       if (gotline)
  2756.     {
  2757.       NextToken (&headptr);
  2758.       if (CompareStringNoCase (headptr, "Re:", 3) != 0)
  2759.         {
  2760.           CopyBuf ("Re: ", &outptr, &BufLen);
  2761.         }
  2762.       CopyBuf (headptr, &outptr, &BufLen);
  2763.     }
  2764.     else
  2765. a373 1
  2766.       CopyBuf (SubjectString, &outptr, &BufLen);
  2767. a378 1
  2768.       CopyBuf (SubjectString, &outptr, &BufLen);
  2769. d380 2
  2770. d385 33
  2771. d489 27
  2772. d520 3
  2773. a522 3
  2774.     {
  2775.       gotwho = GetHeaderLine (Doc, "From:", HeadLine, MAXHEADERLINE);
  2776.     }
  2777. d524 24
  2778. a547 9
  2779.     {
  2780.       NextToken (&cptr);
  2781.       while (*cptr && *cptr != ' ')
  2782.         {
  2783.           *(outptr++) = *(cptr++);
  2784.         }
  2785.       *outptr = '\0';
  2786.     }
  2787.     }
  2788. d549 1
  2789. a549 1
  2790.   return TRUE;
  2791. d552 1
  2792. d809 10
  2793. @
  2794.