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?
Recent comments
3 hours 48 min ago
10 hours 30 min ago
14 hours 20 min ago
15 hours 59 min ago
1 day 24 min ago
1 day 9 hours ago
1 day 10 hours ago
1 day 14 hours ago
1 day 18 hours ago
1 day 19 hours ago