Diff for /mail2lj/mail2lj.pl between versions 1.1 and 1.2

version 1.1, 2007/08/12 19:54:44 version 1.2, 2007/08/12 21:15:36
Line 42 Line 42
 # Original script seems to be distributed as freeware, so I stick to that  # Original script seems to be distributed as freeware, so I stick to that
 # decision.  No warranty whatsoever, of course - use at your own risk ;-).  # decision.  No warranty whatsoever, of course - use at your own risk ;-).
 #  #
   # Changes by Boris Veytsman - added --cut option
   #
 # ------------------------------------------------------------------------  # ------------------------------------------------------------------------
   
 use     strict ;  use     strict ;
Line 115  my %tr = ( Line 117  my %tr = (
   
 # ------------------------------------------------------------------------ #  # ------------------------------------------------------------------------ #
 # Changed by LG - added parsing of command line.  # Changed by LG - added parsing of command line.
   # Changed by BV - added options cur
 # ------------------------------------------------------------------------ #  # ------------------------------------------------------------------------ #
 my      %Opt = ();                      # Main options go here  my      %Opt = ();                      # Main options go here
 my      $opt_h ;                        # Help flag  my      $opt_h ;                        # Help flag
 my      $opt_bounces ;                  # Alternative error recipient flag  my      $opt_bounces ;                  # Alternative error recipient flag
 my      $opt_addfrom ;                  # Add the From field to the post  my      $opt_addfrom ;                  # Add the From field to the post
 my      $opt_addfromh ;                 # Add the htmlized From to the post  my      $opt_addfromh ;                 # Add the htmlized From to the post
   my      $opt_ljcut ;                    # Add lj-cut after line number N
 my      $opt_keepspaces ;               # HTML-encode multiple spaces in e-mail  my      $opt_keepspaces ;               # HTML-encode multiple spaces in e-mail
 my      @opt_taglist ;                  # command-line taglist first goes here  my      @opt_taglist ;                  # command-line taglist first goes here
 my      $Parse = GetOptions( \%Opt,  my      $Parse = GetOptions( \%Opt,
Line 142  my  $Parse = GetOptions( \%Opt, Line 146  my  $Parse = GetOptions( \%Opt,
                         'bounces|bounce|b=s' => \$opt_bounces,                          'bounces|bounce|b=s' => \$opt_bounces,
                         'addfrom|add-from|from!' => \$opt_addfrom,                          'addfrom|add-from|from!' => \$opt_addfrom,
                         'addfromh|add-fromh|fromh!' => \$opt_addfromh,                          'addfromh|add-fromh|fromh!' => \$opt_addfromh,
                           'ljcut|cut|l=s'=>\$opt_ljcut,
                         'keep-spaces|keep-space|keepspaces|keepspace|spaces|space!' => \$opt_keepspaces,                          'keep-spaces|keep-space|keepspaces|keepspace|spaces|space!' => \$opt_keepspaces,
                         'help|h' => \$opt_h,                          'help|h' => \$opt_h,
                            );                             );
Line 215  my $mp = new MIME::Parser() or die "new Line 220  my $mp = new MIME::Parser() or die "new
   
 # Changed by LG - changed directory.  # Changed by LG - changed directory.
 # $mp->output_dir("$home/mimetmp") ;  # $mp->output_dir("$home/mimetmp") ;
 $mp->output_dir("/tmp/mimetmp-$ENV{user}") ;  $mp->output_dir("/tmp/mimetmp-".$ENV{user}) ;
 mkdir $mp->output_dir if not -d $mp->output_dir ;       # Create it if missing  mkdir $mp->output_dir if not -d $mp->output_dir ;       # Create it if missing
   
 # Get the whole mail.  # Get the whole mail.
Line 607  sub post_me2req { Line 612  sub post_me2req {
            $hr->{event} =~ s/\t/\ \ \ \ \ \ \ \ /g ;             $hr->{event} =~ s/\t/\ \ \ \ \ \ \ \ /g ;
            $hr->{event} =~ s/  / \ /g ;             $hr->{event} =~ s/  / \ /g ;
         }          }
           
           #
           # Change by BV - added the option to put lj-cut after N
           #
           if ($opt_ljcut>0) {
               my $start=0;
               for (my $i=0; $i<$opt_ljcut; $i++) {
                   $start=index($hr->{event},"\n",$start)+1;
                   if ($start == 0) {
                       last;
                   }
               }
               if ($start>0) {
                   substr($hr->{event}, $start,0) = '<lj-cut>';
               }
           }
   
         $req->content_type('application/x-www-form-urlencoded');          $req->content_type('application/x-www-form-urlencoded');
         $req->content(href2string $hr) ;          $req->content(href2string $hr) ;
Line 923  Options: Line 944  Options:
                better preserved in the journal.  The option can be negated                 better preserved in the journal.  The option can be negated
                ('--nospaces').  Default is '--nospaces'.                 ('--nospaces').  Default is '--nospaces'.
   
   --ljcut, --cut, -l CUT
                add <lj-cut> after CUT lines.
   
 --charset CHARSET  --charset CHARSET
                This option tells the script that all COMMAND LINE options are                 This option tells the script that all COMMAND LINE options are
                given in this charset.  Default is "$SystemCharset".                 given in this charset.  Default is "$SystemCharset".

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>