ftpserver.pl: Added support for IMAP CREATE, DELETE and RENAME commands

This commit is contained in:
Steve Holme 2013-08-30 07:35:00 +01:00
parent c4a7ca038e
commit 9d35ad9552

View File

@ -578,10 +578,13 @@ sub protocolsetup {
%commandfunc = (
'APPEND' => \&APPEND_imap,
'CAPABILITY' => \&CAPABILITY_imap,
'CREATE' => \&CREATE_imap,
'DELETE' => \&DELETE_imap,
'EXAMINE' => \&EXAMINE_imap,
'FETCH' => \&FETCH_imap,
'LIST' => \&LIST_imap,
'LOGOUT' => \&LOGOUT_imap,
'RENAME' => \&RENAME_imap,
'SEARCH' => \&SEARCH_imap,
'SELECT' => \&SELECT_imap,
'STATUS' => \&STATUS_imap,
@ -1080,6 +1083,55 @@ sub SEARCH_imap {
return 0;
}
sub CREATE_imap {
my ($args) = @_;
fix_imap_params($args);
logmsg "CREATE_imap got $args\n";
if ($args eq "") {
sendcontrol "$cmdid BAD Command Argument\r\n";
}
else {
sendcontrol "$cmdid OK CREATE completed\r\n";
}
return 0;
}
sub DELETE_imap {
my ($args) = @_;
fix_imap_params($args);
logmsg "DELETE_imap got $args\n";
if ($args eq "") {
sendcontrol "$cmdid BAD Command Argument\r\n";
}
else {
sendcontrol "$cmdid OK DELETE completed\r\n";
}
return 0;
}
sub RENAME_imap {
my ($args) = @_;
my ($from_mailbox, $to_mailbox) = split(/ /, $args, 2);
fix_imap_params($from_mailbox, $to_mailbox);
logmsg "RENAME_imap got $args\n";
if (($from_mailbox eq "") || (to_mailbox eq "")) {
sendcontrol "$cmdid BAD Command Argument\r\n";
}
else {
sendcontrol "$cmdid OK RENAME completed\r\n";
}
return 0;
}
sub LOGOUT_imap {
sendcontrol "* BYE cURL IMAP server signing off\r\n";
sendcontrol "$cmdid OK LOGOUT completed\r\n";