Server plugin interface

From TotalcmdWiki
Jump to: navigation, search
  • FTP, HTTP, SCP, SFTP and other remote connection protocols should use the same interface.
  • new plugin type: Server.
  • use the current connection details dialog with some improvements.
  • add a button "Extended connection details" to the dialog. I imagine something like the "Configure" button in the pack files dialog. The button opens a dialog where extended connection details can be set.
  • add a combobox "connection type" to the dialog. FTP is the default. If you have installed the "sftp server plugin" SFTP will be shown in the combobox and so on.
  • If you have selected SFTP the "extended connection dialog" for SFTP will be shown after you pressed the "extended connection settings" button. This dialog is provided by the plugin (if necessary).
  • Even FTP should have such a "extended connection details" dialog to offer an uniform interface to the user an to make the "connection dialog" more clearly (all FTP specific settings in the current dialog should be moved to the extended dialog). Of course FTP could be implemented as a plugin too, but that's not really important, because it's a Total Commander core feature.
  • Some filesystem plugins have one more entries somewhere in the filelist to add and edit connections. (Smartbrowser) is a good example to see that filesystem is not the right kind of plugin for this.
  • Quick connect should be supported by the new plugin interface.


The whole idea can be split into two main parts:

1. The consistent connections interface for all connections

a) All connections should be together somewhere. Best solution seems to change current "ftp connections" dialog to just "connections" and show not only internal ftp connections, but also those provided by plugins.

Required api change:

Could be made as simple extension to current filesystem plugin api. Just few more added functions should be enough. One function, when called, would feed basic information about available connections to TC. Only general parameters used by every plugin should be passed:

  • connection name to display in the list
  • optional connection description
  • connection identifier; for simple fs plugin api extension, this should be the path TC must request from plugin to open this connection, for server plugins (see below) the numerical id would be enough

If this function was missing from plugin, it would mean that plugin does not want to use central bookmarks (good for backward compatibility too).

Other required functions would be those for bookmark handling (adding new connection, editing existing connection, deleting connection, ..). It should be noted that all bookmark handling should be done by plugin. TC should know only connection name and identifier, to be able to display it and call plugin functions for selected connection.

Required TC changes:

Change current "ftp connections" dialog to show plugin-provided connections. Should be easy.

b) Open connections should be indicated in drive combo in the same way as current internal FTP connections do (by "<number> drive")

Required changes:

Quite a lot. Since TC does not care about connections made by plugins, it's probably impossible to achieve this by simple extension of fs plugin api. Solution would be "server plugins" (see below).

c) Quick connect should be available for plugins

Required changes:

Not many. Adding combobox with available connection types should do it. Then just pass entered string to selected plugin to handle it. Plugin would have to export another function for this.

d) Bonus ;) - folders in connections dialog. Cool feature and very easy to implement.

2. Better support for "connection oriented" filesystems

This one should help the developers. Current filesystem plugin api does not care about connections at all. TC just asks the plugin for content of directory and plugin has to take care of finding if the location can be retrieved using some of the open connctions, if so then if the open connection is not busy, etc. It brings a lot of complications for plugin developer. Server plugins should be very similar to current filesystem plugins, but key to everything should be the connection. It means that TC would ask plugin to open connection and then all requests should be made for specific connection. Basically it means to change the fs plugin api from:

function FsFindFirst(path: PChar; var FindData: TWIN32FINDDATA): THandle; stdcall;

to:

function FsFindFirst(ConnectionId: Integer; path: PChar; var FindData: TWIN32FINDDATA): THandle; stdcall;

It should make writing of plugins much easier. Also it would be very easy to implement the "<number> drive" feature for plugin connections. As a test if server plugin api is perfect, internal FTP should be moved to external plugin. When it is possible to do it without any problems and with preserving all existing functionality, then the server plugin api is probably perfect.


Back to Internal functions