diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-30 22:54:46 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-11-30 22:54:46 +0100 |
| commit | 529fbd9a94fc1c87fe5198066c2ecf34004af356 (patch) | |
| tree | d628a57d3f0c0127d1010931992151ae5beae16c | |
| parent | 19b81e549eb6e555003fdf26268f63bcb508b0c6 (diff) | |
| download | tuxcmd-529fbd9a94fc1c87fe5198066c2ecf34004af356.tar.xz | |
Foundation of VFS capabilities
| -rw-r--r-- | vfs/UVFSCore.pas | 13 | ||||
| -rw-r--r-- | vfs/uVFSprototypes.pas | 15 |
2 files changed, 25 insertions, 3 deletions
diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas index 3e14618..cf3e36a 100644 --- a/vfs/UVFSCore.pas +++ b/vfs/UVFSCore.pas @@ -68,6 +68,7 @@ type FVFSResetPassword: TVFSResetPassword; FVFSStartCopyOperation: TVFSStartCopyOperation; FVFSStopCopyOperation: TVFSStopCopyOperation; + FVFSGetCapabilities: TVFSGetCapabilities; function GetHandlesArchives: boolean; function GetHandlesNetwork: boolean; public @@ -98,6 +99,7 @@ type FArchivePath: string; function GetPluginID: string; function GetDataItemFromVFSItem(P: PVFSItem): PDataItem; + function GetArchiveStreamingType: boolean; public Password: string; PasswordUsed: boolean; @@ -160,11 +162,10 @@ type function CopyFileInEx(Sender: Pointer; const SourceFile, DestFile: string; ErrorFunc: TEngineErrorFunc; Append: boolean): boolean; function CopyFileOutEx(Sender: Pointer; const SourceFile, DestFile: string; ErrorFunc: TEngineErrorFunc; Append: boolean): boolean; published - property Path: string read GetPath write SetPath; - property BlockSize: Cardinal read GetBlockSize write SetBlockSize; property PluginID: string read GetPluginID; property ArchiveMode: boolean read FArchiveMode; property ArchivePath: string read FArchivePath; + property ArchiveStreamingType: boolean read GetArchiveStreamingType; end; @@ -246,6 +247,7 @@ begin @FVFSResetPassword := dlsym(ModuleHandle, 'VFSResetPassword'); @FVFSStartCopyOperation := dlsym(ModuleHandle, 'VFSStartCopyOperation'); @FVFSStopCopyOperation := dlsym(ModuleHandle, 'VFSStopCopyOperation'); + @FVFSGetCapabilities := dlsym(ModuleHandle, 'VFSGetCapabilities'); // Initialize the extensions list SetLength(Extensions, 0); @@ -917,6 +919,13 @@ begin else Result := ''; end; +function TVFSEngine.GetArchiveStreamingType: boolean; +begin + Result := False; + if (@FSourcePlugin.FVFSGetCapabilities <> nil) then + Result := (FSourcePlugin.FVFSGetCapabilities() and VFS_CAP_ARCHIVE_STREAMING) = VFS_CAP_ARCHIVE_STREAMING; +end; + (********************************************************************************************************************************) (********************************************************************************************************************************) function GetBinaryPath: string; diff --git a/vfs/uVFSprototypes.pas b/vfs/uVFSprototypes.pas index bd33726..8beacdd 100644 --- a/vfs/uVFSprototypes.pas +++ b/vfs/uVFSprototypes.pas @@ -58,14 +58,22 @@ const cVFS_OpenWrite = 1; cVFS_OpenAppend = 2; + // Ask password callback flags VFS_ASK_PASSWORD_NEED_PASSWORD = 1 shl 0; VFS_ASK_PASSWORD_NEED_USERNAME = 1 shl 1; VFS_ASK_PASSWORD_NEED_DOMAIN = 1 shl 2; - VFS_ASK_PASSWORD_SAVING_SUPPORTED = 1 shl 3; // Plugin reports if gnome-keyring is available + VFS_ASK_PASSWORD_SAVING_SUPPORTED = 1 shl 3; // Plugin reports whether gnome-keyring is available VFS_ASK_PASSWORD_ANONYMOUS_SUPPORTED = 1 shl 4; VFS_ASK_PASSWORD_SAVE_INTERNAL = 1 shl 14; // Save password into internal Connection Manager VFS_ASK_PASSWORD_ARCHIVE_MODE = 1 shl 15; // Callback from archive, change the UI a little bit + // Module capability flags + VFS_CAP_HANDLES_MULTIPLE_REQUESTS = 1 shl 0; // Multiple (background) operations; usually unsuitable for archives + VFS_CAP_CAN_BROWSE_NETWORK = 1 shl 1; // Can handle network:// URIs, scan network resources + VFS_CAP_CAN_CREATE_ARCHIVES = 1 shl 2; // Creating archives from scratch + VFS_CAP_ARCHIVE_STREAMING = 1 shl 3; // Streaming archive type, can't handle random requests + + type TVFSResult = longint; @@ -175,6 +183,8 @@ type // Returning NULL or not defining the symbol at all means plugin can't access network services // tuxcmd will take care of memory deallocation TVFSGetNetworkServices = function: PChar; cdecl; + // Returns bitmask of module capabilities - can be called during initialization, common for whole module + TVFSGetCapabilities = function: guint32; cdecl; // TODO: Sets the protocol log function (unlike module debug log func this is intended only for server messages (FTP mainly)) TVFSSetProtocolLogFunc = procedure (g:TVFSGlobs; ProtocolLogFunc: TVFSLogFunc); cdecl; // Sets block size for I/O operations (not supported by all modules) @@ -264,11 +274,14 @@ type // Sets the position in the file from the start and returns real current position +// Archive-specific routines: + // Returns flag indicating whether password is required for some files in the archive TVFSGetPasswordRequired = function (g:TVFSGlobs): gboolean; cdecl; // Reset stored password in the plugin session TVFSResetPassword = procedure (g: TVFSGlobs); cdecl; + // TODO: some function to check the CRC of the archive - it should need also some progress feedback - the processed file and percentage progress // TODO: port error logging subsystem to glib's GError |
