Il motore aveva I_Create ma nessuno lo chiamava: Make_Folder crea solo sotto Local (Can_Hold=1). Aggiunte tre patch (Note_Make in Mail_Pending, ramo mkdir nel Flush) e l'unita' Make_Remote che esporta gd_make_remote. L'interfaccia ha 'Nuova cartella nell'account': la cartella nasce al controllo successivo.
34 lines
966 B
Ada
34 lines
966 B
Ada
with Ada.Exceptions;
|
|
|
|
with Mail_Folders;
|
|
with Mail_Log;
|
|
with Mail_Pending;
|
|
|
|
package body Make_Remote is
|
|
|
|
function Make (Folder : int; Name : System.Address; Length : int) return int is
|
|
Path : constant String := Mail_Folders.Path_Of (Folder);
|
|
Text : String (1 .. Natural (Length)) with Import, Address => Name;
|
|
begin
|
|
-- Senza nome non c'è niente da creare; senza percorso la cartella non
|
|
-- esiste (indice vecchio, di un albero ricaricato).
|
|
if Length <= 0 or else Path = "" then
|
|
return -1;
|
|
end if;
|
|
|
|
-- Solo le cartelle di un account: sotto Local ci pensa Make_Folder.
|
|
if Mail_Folders.Can_Hold (Folder) /= 2 then
|
|
return -1;
|
|
end if;
|
|
|
|
Mail_Pending.Note_Make (Path, Text);
|
|
return 1;
|
|
exception
|
|
when Error : others =>
|
|
Mail_Log.Write
|
|
("ERR make remote: " & Ada.Exceptions.Exception_Message (Error));
|
|
return -1;
|
|
end Make;
|
|
|
|
end Make_Remote;
|