Prev Previous Post   Next Post Next
  #11  
Old 12th July 2009, 07:55
Rescue9 Rescue9 is offline
Member
 
Join Date: Jun 2007
Posts: 52
Thanks: 4
Thanked 3 Times in 2 Posts
Default Another Edit

I've messed with the code a bit more to make it more friendly for the maildirmake area. I'm actually not sure it works yet as my ISPC3 server is currently on the inside network. I'll hook it up to the outside network tomorrow and test out the code during the day.

Here are the changes I've made to the code:
Code:
        function getRule() {

                $content = '';
                $content .= '### BEGIN FILTER_ID:'.$this->id."\n";

                $TargetNoQuotes = $this->dataRecord["target"];
                $TargetQuotes = "\"$TargetNoQuotes\"";

                $TestChDirNoQuotes = '$DEFAULT/.'.$TargetNoQuotes;
                $TestChDirQuotes = "\"$TestChDirNoQuotes\"";

                $MailDirMakeNoQuotes = $TargetQuotes.' $DEFAULT';

                $EchoTargetFinal = $TargetNoQuotes;


                if($this->dataRecord["action"] == 'move') {

                $content .= "
`test -e ".$TestChDirQuotes."`
if ( ".'$RETURNCODE'." != 0 )
{
  `maildirmake -f $MailDirMakeNoQuotes`
  `chmod -R 0700 ".$TestChDirQuotes."`
  `echo \"INBOX.$EchoTargetFinal\" >> ".'$DEFAULT'."/courierimapsubscribed`
}
";
                }

                $content .= "if (/^".$this->dataRecord["source"].":";

Here is the output of the code box:
Code:
### BEGIN FILTER_ID:8

`test -e "$DEFAULT/.Yahoo Groups.BGT"`
if ( $RETURNCODE != 0 )
{
  `maildirmake -f "Yahoo Groups.BGT" $DEFAULT`
  `chmod -R 0700 "$DEFAULT/.Yahoo Groups.BGT"`
  `echo "INBOX.Yahoo Groups.BGT" >> $DEFAULT/courierimapsubscribed`
}
if (/^Subject:.*\[backpackgeartest\]/:h)
{
exception {
ID8EndFolder = "$DEFAULT/.Yahoo Groups.BGT/"
to $ID8EndFolder
}
}
### END FILTER_ID:8
Wrapping the code in quotes effectively handles mail folders with spaces. I've also verified that all commands work as written and that the quotes don't break the command.

I'm not quite clear on how maildrop handles the .mailfilter file enough yet, but one of the things that I'm worried about is the 'test -e' line. My understanding of the test cmd is that it doesn't return anything. If this is the case, then the $RETURNCODE variable should always be null. how can you evaluate a null variable.

Maybe the line should read:
Code:
`test -e ".$TestChDirQuotes." && exit 1 || exit 0`
if ( ".'$RETURNCODE'." != 1 )
Till or Falko care to comment on this test statement? Am I thinking correctly, or does maildrop interpret this correctly as is?

Last edited by Rescue9; 12th July 2009 at 07:59.
Reply With Quote
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix problem and few questions Gimly Installation/Configuration 12 7th July 2009 16:27
Postfix + postfixadmin = SMTP errors... Rashef Server Operation 4 25th June 2009 16:12
just the last step...and it works. Postfix...need help config. ubuntusr Installation/Configuration 1 5th January 2009 09:50
Problem with dcc-client installation (Postfix) swap-as Installation/Configuration 9 18th September 2008 20:47
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 05:45.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.