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
9 hours 53 min ago
14 hours 51 min ago
16 hours 18 min ago
17 hours 11 min ago
18 hours 54 min ago
23 hours 17 min ago
1 day 9 min ago
1 day 2 hours ago
1 day 15 hours ago
1 day 17 hours ago