aboutsummaryrefslogtreecommitdiffstats
path: root/archiveIMAP.pl
diff options
context:
space:
mode:
Diffstat (limited to 'archiveIMAP.pl')
-rw-r--r--archiveIMAP.pl16
1 files changed, 15 insertions, 1 deletions
diff --git a/archiveIMAP.pl b/archiveIMAP.pl
index 713fd31..5b5c04f 100644
--- a/archiveIMAP.pl
+++ b/archiveIMAP.pl
@@ -32,6 +32,19 @@ sub getTargetFolder {
return "/INBOX/Archiv/" . $year . '/' . $source;
}
+# makes sure that the folder including its parents
+# RFC2060 says in 6.3.3 that server SHOULD create
+# parents, so just to be sure if it doesn't.
+sub assureFolder {
+ my $imaphandle = shift;
+ my $fullfoldername = shift;
+
+ if ($imaphandle->exists($fullfoldername)) {
+ return 1;
+ }
+
+}
+
our $Strp = new DateTime::Format::Strptime(
pattern => '%a, %d %b %Y %H:%M:%S %z'
);
@@ -113,7 +126,8 @@ foreach my $folder (@sourceFolders) {
# FIXME: check the situation when the parent folder(s) don't exist
# what about different folder separators? (i.e., can we put
# "Archiv/2007/Pratele/PCF" as an argument of $imap->create?)
- # does RFC says something about it?
+ # RFC says (in 6.3.3) that server SHOULD create parent folders
+ #
if (!($imap->exists($tFolder))) {
$imap->create($tFolder)
or die "Could not create $tFolder: $@\n";