Author Topic: How to Create Upload Plugins  (Read 16485 times)

nk

  • Administrator
  • Sr. Member
  • *****
  • Posts: 263
    • View Profile
How to Create Upload Plugins
« on: August 06, 2008, 04:35:42 PM »
Rightload's upload plugin feature allows you to write your own upload handlers that will be integrated into Rightload. All you have to do is create a DLL that exports a few functions and put it into Rightload's plugin directory.

General
  • Uploads have to be non-blocking, i.e. the Upload procedure can not wait for the upload to complete. This can be accomplished by starting a Thread.
  • Methods that write to a buffer will be called with an empty buffer first to determine the required buffer length (their return value) and then a second time to actually write to the buffer. lenBuffer is the length of the Buffer.
  • All methods use stdcall.

The C++ header file with commented functions is here: http://rightload.svn.sourceforge.net/viewvc/rightload/plugins/rightload_plugin.h

When building the DLL, you have to make sure that the function names are actually the plain names with no @XX at the end. In GCC, this can be archived by adding "-Wl,--add-stdcall-alias" to the linker options. You can use Microsofts "Dependency Walker" (depends.exe) to check this.

To keep the DLL size down, you can link dynamically against libcurl, as this library will be included with the main Rightload download.

To provide additional details and settings for your plugin, you can provide an example plugin info XML to Rightload. This file has to have the same name as the DLL and must also be located in the plugins folder. An example can be found here: http://rightload.svn.sourceforge.net/viewvc/rightload/plugins/plugininfo.xml

The option fields you specify under "OptionFields" will be displayed in Rightload and passed on to your plugin using the SetOption function.

The cache variables will be requested from your plugin after the upload using the GetCacheVar function and then returned to your plugin before the next upload using the SetCacheVar function. To keep a variable in the cache indefinitely, you need to make sure that GetCacheVar always returns the value that your plugin has obtained from SetCacheVar.

If you have any questions, please post here or contact me!
« Last Edit: June 21, 2010, 12:58:51 PM by nk »