[prev in list] [next in list] [prev in thread] [next in thread] 

List:       procmail
Subject:    Re: Email to Bloxsom?
From:       PSE-L () mail ! professional ! org (Professional Software Engineering)
Date:       2002-12-23 18:02:26
[Download RAW message or body]

At 20:12 2002-12-23 +0700, Robert Nicholson wrote:
>Here's what I'll use from my filtmail script.

... which isn't procmail.  Are you asking us to translate your perl script 
to something that achieves the same thing within procmail, or are you just 
on the WRONG list?

>Blosxom is a no brains needed weblogging tool that's very simple but 
>effective.

How good fer it.  You're still not being clear what it is you are asking 
for, esp if you seem to already have something that will achieve your 
goal.  Also, when discussing some nonstandard software package, it helps if 
you provide a URL to information about it, so that everybody doesn't have 
to go searching for what it is you're talking about and weed through the 
search results looking for the relevant information.  Surely if you use 
this tool, you have a URL to an official site for it, and that can't be too 
difficult to include in a message when you're asking others to help you 
interface with it on a list which has _nothing_ to do with that package?


You do realize that you could invoke this same perl script from procmail 
like so:

:0:
* ^TO_blog@elastica\.com
| /path/to/your/perlscript.pl

and leave it at that?


>use lib "$ENV{HOME}/lib/perl5/site_perl";
>use File::Path;
>
>$blogpath = "$ENV{HOME}/www/htdocs/blosxom";

# Something I define for logging purposes
$NL="
"

LOG=${HOME}/yourprocmaillogfile.log

BLOGPATH=${HOME}/www/htdocs/blosxom

>if ( $Header{To} =~ /blog\@elastica.com/ ) {

:0
* ^TO_blog@elastica\.com

># strip path and filename
>#$Header{Subject} = "path/subdir/subdir2/filename.txt@this is the title";
>
>$Header{Subject} =~ /(.*)@(.*)/;
>$fullpathname = $1;
>$title = $2;
>$fullpathname =~ m!(.*)/(.*)!;
>$path = $1;
>$file = $2;

* Subject:[     ]*\/[^  ].*
{
         SUBJECT=$MATCH

         :0
         * MATCH ?? ^\/[^\@]+
         {
                 FULLPATHNAME=$MATCH
         }

         :0
         * SUBJECT ?? \@\/.*
         {
                 TITLE=$MATCH
         }

         :0
         * FULLPATHNAME ?? /\/[^/]+$
         {
                 FILE=$MATCH
         }

         :0
         * FULLPATHNAME ?? ^\/.*/
         {
                 # PATH is a system variable.
                 # also, unlike the perl code, this INCLUDES the terminating
                 # path separator token - it's much easier for us to extract
                 # it while maintaining it.
                 PATHNAME=$MATCH
         }

>#@dest = split /\//, $path;
>
>$finalpath = $blogpath . '/' . $path;

         FINALPATH=${BLOGPATH}/${PATHNAME}

>if (!-d $finalpath) {
>    mkpath($finalpath, 755) || die("Cannot make path $finalpath");
>}

         # if dir doesn't _already_ exist, create it.
         :0
         * ? test ! -d ${FINALPATH}.
         {
                 LOG="Creating ${FINALPATH}$NL"

                 :Wic
                 * ! FINALPATH ?? ^^^^
                 | mkdir -p $FINALPATH

                 :0E
                 {
                         LOG="Cannot make path $FINALPATH$NL"
                 }
         }

># output to file make sure title is the first line
>if (!-f "$finalpath/$file") {
>    open(BLOG,">$finalpath/$file");
>    print BLOG $title;
># output body to rest of file
>    print BLOG "\n";
>    print BLOG $Body;
>    close(BLOG);
>}

         # yea, I could use gnu extensions in the echo, but this is more
         # generic.

         # one must wonder why the protection against overrwriting a file
         # -- why not just _concatenate_ ?  Lose the condition line, and
         # change the redir (>) to an appending redir (>>).

         :0b:$FINALPATH$FILE$LOCKEXT
         * ? test ! -f ${FINALPATH}${FILE}
         | ( echo "$TITLE" ; echo ; cat - ) > $FINALPATH$FILE

         # Add a log entry if we don't actually emit the blog.  Note that
         # the message will continue on through to the user mailbox unless
         # we also deliberatley delete it.  Seems sensible to delete it here,
         # but create an mbox archive copy at the top of this recipe (below
         # the address condition).
         :0E
         {
                 LOG="Blog entry not added - file exists!$NL"
         }
}

---
  Sean B. Straw / Professional Software Engineering

  Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
  Please DO NOT carbon me on list replies.  I'll get my copy from the list.


_______________________________________________
procmail mailing list
procmail@lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic