🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #230705

I don't bitch.

#230705
From: Jeff▲Relf
Date: Fri, 27 Feb 2009 07:33
183 lines
7908 bytes
When you have a problem you bitch at us,
hoping we'll follow your favorite standards.

Rarely do I have problems but, when I do,
I change my habits and/or my code. I don't bitch.

There's no separating me from X.EXE, we're a package,
a package that can't be copied.

P.S. I ran accross an HTML attachment in the Sci.Physics newsGroup:
  news:_Iupl.23601$cu.7218@news-server.bigpond.net.au

I had to make changes to the following code so that
attribution lines would get stripped ( as they normally are )
and to ensure that >quoted lines would get muffled.

As a further test, I made a post with my 8Bit.HTM file attached:
  news:Jeff_Relf@Seattle.2009_Feb.26|3.11pm|R

>From JeffRelf.F-M.FM/X.CPP:

  #define  >  ( Ch == '>' )
  #define  isQL  (  \
       >  \
    ||    ( Ch == '<' || Ch == '[' )  \
       && ( EqiN( P+1, L"Snip", 4 ) || EqiN( P+1, L"...", 3 ) ) )

  #define  unQ  {  \
    if ( Q ) {  /*  Attachment's Quoted Printable is in effect */  \
      int  SzB = strSz( B );  \
      wchar_t  & Ch  \
        = SzB <= 1 || B[ SzB - 2 ] == '=' ? B[ SzB ] : B[ SzB - 1 ];  \
      if ( Ch == '=' ) {  SzB --, Ch = 0 ;  \
        if ( PP + 1 >= EE )  continue ; \
        /*  unFold the once =terminated line */  \
        LnP  B2 = PP[ 1 ];  \
        int SzB2 = strSz( B2 ), SzBigB = SzB + SzB2 + 1 ;  \
        /*  Allocations come from a very  Temporary  heap  */  \
        LnP  BigB = PP[ 1 ] = MallocTmp( SzBigB * SzChar );  \
        wmemmove( BigB, B, SzB );  \
        wmemmove( BigB + SzB, B2, SzB2 + 1 ); continue ;  }  \
        \
      QQ = PP, unQ_B( B );  } }
       
  const int _HTML = 2, Filtered_ = 1 ;
Filter( int _Filtered, LnA BB, LnA EE ) {
  //  “ Q == 1 ” when an attachment has Quoted Printable.
  //  “ MimeSep ” points to the line that Separates attachments.
  int Ch, Ch2, Q = 0, Starting = 1 ;  MimeSep = 0 ;  LnP  B, P ;
  //  goto “ subBody: ” when an attachement is Plain Text.
  subBody:
  LnA  PP = BB - 1 ;  int NeedBB = 1 ;  
  if ( ! _Filtered ) {
    while ( ++ PP < EE && ( B = * PP ) )
      //  Print all lines, raw and unFiltered, then quit.
      Sh( L"%s", B );
    return ;  }
  int NeedBB = 1 ;
  Loop( 10 ) {  
    //  Scanning through the first 10 lines of a post or eMail,
    //  looking for a good place to start printing lines.
    if ( ++ PP >= EE || ! ( B = * PP  ) )  break;
    if ( NeedBB ) {
      P = B ;
      WhileWhite
      //  Skip past leading whiteSpace.
      ;
      if ( ! Ch )
        //  The line was blank, get the next one.
        continue ;
      //  Make BB point to the array of nonBlank lines
      //  to start the body of the post ( or eMail ).
      BB = PP, NeedBB = 0 ;  }
    if ( EqN( B, L"-----BEGIN PGP", 14 ) ) {
      //  Xns9BB19489DD7E82362352@127.0.0.1
      //  Kill nonBlank lines.
      while ( ++ PP < EE && ( B = * PP ) && ( Ch = * B ) );
      //  Kill Blank lines.
      while ( ++ PP < EE && ( B = * PP ) && !( Ch = * B ) );
      //  Make BB point to the array of nonBlank lines
      //  to start the body of the post ( or eMail ).
      BB = PP ;  }
    if ( EqN( B, L"--", 2 ) )
       //  See if this is a MIME attacment.
       break;
  }
  if ( NeedBB )
    //  No more lines to print, quit.
    return ;  
  if ( _Filtered == _HTML || EqiN( B = * BB, L"<HTML", 5 )
  || EqiN( B, L"<!DOCTYPE", 9 ) || EqiN( B, L"<META", 5 ) )
    //  An HTML-only post or eMail, very rare these days.
    goto HTML_Only ;
    
  //  Jeff_Relf@Seattle.2009_Feb.26|3.11pm|R
  //  _Iupl.23601$cu.7218@news-server.bigpond.net.au
  if ( Starting && ( Starting = 0, MimeHeader ) )
    //  Start handiling MINE attachments, see X.CPP.
    goto Attach ;
    
  //  1c54b35eae63492f355dfdd8d0274b21np@mypost.invalid
  //  slrngpbe5a.6v5.wookie@aces.localdomain    
  LnA QQ = PP = BB - 1 ;  const int MaxAttribLns = 5 ;
  while ( ++ PP < EE && PP - BB <= MaxAttribLns
  && ( P = B = * PP ) && ( Ch = * P, Ch && !isQL )
  && ! ( MimeSep && EqN( B, * MimeSep, Sz_MimeSep ) ) )  
    //  Checking for a block of nonBlank lines
    //  terminated by either a >quoted line ( or a <Snip> line )
    //  or a blank line followed by a >quoted line ( or <Snip> ).
    unQ
  //  Remeber how many lines have been unQ'd
  LnA priQQ = QQ ;  
  if ( isQL || ++ PP < EE && ( P = * PP ) && ( Ch = * P, isQL ) )
    //  Make the post start here, on the ( soon-to-be-muffled )
    //  >quoted line or the <Snip> line, after the attribution lines.
    BB = PP ;
    
  PP = BB - 1 ; int Pgp = 0, wrpQL, QL = 0 ;
  LnP  prnQ1 = 0, prnQ2 = 0 ; const  LnP  ˄  = L"˄" ;
  
  while ( ++ PP < EE && ( P = B = * PP ) ) {
    //  Scan though each line of the body, selectively printing.

    if ( PP > priQQ )
      //  unQ more lines.
      unQ
    wrpQL = QL ;
    if ( Ch = * B, QL = isQL ) {
      //  This is a >quoted line or a <Snip...> line.
      
      if ( !prnQ2 )
        //  Remember a dummy ˄line,
        //  in case only blank lines were quoted.
        prnQ2 = ˄ ;
      P = B ;
      While( Ch <= 32 || > )
        //  Skip past leading >chars and whitepace
        ;
      //  Ch is null when a blank line was >quoted.
      if ( 
         Ch
      && !(    isQL || EqiN( P, L"- Show q", 8 )
            || EqiN( P, L"- Hide q", 8 ) ) )
        //  Something “ good ” was >quoted,
        //  remember the last two of these.
        prnQ1 = prnQ2, prnQ2 = B ;
      //  Don't print it, not yet.  
      continue ;  }

    if ( Eq( B, L"- -- " ) || Eq( B, L"--" ) || Eq( B, L"-- " ) ) {
      //  Report what sig was used; break out to handle attachments.
      Sh( L"\"%s\"", B );  break ;  }
    if ( EqN( B, L"-----BEGIN PGP SIGNA", 20 ) ) {
        Pgp = 1 ; continue ;  }
    if ( Pgp ) {
      if ( EqN( B, L"-----END PGP", 12 ) ) {
        Pgp = 0 ;  Sh( L"_PGP_Killed_" );  }  continue ;  }

    if (    wrpQL && 1 + PP < EE 
         && ( P = PP[1] ) && ( Ch = * P, > ) )
      //  False alarm, this line is a spilt-over >quoted line
      //  ( from wrapping ) ― ignore it.
      continue ;

    //  A line of original content ! print it ..
    //  and ( up-to ) two >quoted lines as well.
    if ( prnQ2 ) {
      //  >quoted line(s) preceeded original content.
      if ( prnQ1 && prnQ1 != ˄ )
        //  Print the second-to-last >quoted line of the block.
        Sh( L"%s", prnQ1 );

      //  Print the last >quoted line of the block
      Sh( L"%s", prnQ2 ), prnQ1 = prnQ2 = 0 ;  }

    //  Print the line of original content.
    Sh( L"%s", B );  }

  PP -- ;  
  //  Skip to next MIME attachment, if any.
  skipToHdr
  Attach:
...
Technical Details
Message-ID: <Jeff_Relf@Seattle.2009_Feb.26|11.32pm|y>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!transit4.hitnews.eu!feeder.news-service.com!news2.euro.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <slrngqbn7d.5ed.houghi@pasta.houghi> <7jri76-2e3.ln1@news.ducksburg.com> <1ivra6k.s0l2dp1m2bahfN%snipe@spambin.fsnet.co.uk> <ac87b$49a6f99f$5ed00124$25389@cache6.tilbu1.nb.home.nl> <slrngqe9hu.67t.pjr@pjr.gotdns.org> <1ivrr1f.1dzjg4tlyoocaN%snipe@spambin.fsnet.co.uk>

Show Full Headers
Complete Article Headers
Message-ID: <Jeff_Relf@Seattle.2009_Feb.26|11.32pm|y>
Subject: I don't bitch.
Date: Fri, 27 Feb 2009 07:33:01 +0000
From: Jeff▲Relf <Jeff_Relf@Seattle.TEST>
References: <slrngqbn7d.5ed.houghi@pasta.houghi> <7jri76-2e3.ln1@news.ducksburg.com> <1ivra6k.s0l2dp1m2bahfN%snipe@spambin.fsnet.co.uk> <ac87b$49a6f99f$5ed00124$25389@cache6.tilbu1.nb.home.nl> <slrngqe9hu.67t.pjr@pjr.gotdns.org> <1ivrr1f.1dzjg4tlyoocaN%snipe@spambin.fsnet.co.uk>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!transit4.hitnews.eu!feeder.news-service.com!news2.euro.net!newsfeed.freenet.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
Newsgroups: news.software.readers
Lines: 183
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net pZvqFBQploCwwJ44rFL6iAaJE4uiNR0ytMpdlKttt0/PuMLOE3
Cancel-Lock: sha1:+WM4ltlXCQpPbq8I6Ugqepd3Rf4=
User-Agent: JeffRelf.F-M.FM/X.ZIP