addon.register

Registers a script-based addon
Usage
addon.register [-f] [-n] [-q] (<id>,<version>,<visible_name>,<description>,<minkvircverion>[,<iconid>])
{
    <uninstall callback>
}
Description

Registers a script-based addon.

The registration process allows to "show" the addon in the script-addon manager dialog and provides a standard way for the user to manage and uninstall the addons. You simply register your addon BEFORE attempting to install it.

A script-based addon is a set of scripts, icons, translations and possibly other data files that add functionality to the KVIrc program. The script-based addons are often simply called "scripts" and we will adhere to that naming in certain parts of the documentation too.

Each script-based addon (a set of scripts) is identified by an UNIQUE <id>. Two addons with the same <id> can't co-exist in the same KVIrc installation (so be sure to choose a token characteristic enough to avoid collisions with others). The <id> itself is used only for identification purposes and the user will almost always see the <visible_name> instead, which can contain the $tr function that will handle the translation for it.

Each addon has also a <version> which is a string in the form x.y.z where x, y and z are numbers (yes.. that's the standard major-minor-patch level version numbering scheme). A <version> of 2.4.23 is greater than 2.4.3 even if 2.4.3 comes after when compared as a string. When an addon with a greater or equal version is installed over an addon with a lower version, the lower one gets uninstalled first. Installing a lower version over a greater one is not possible, unless the lower versioned one is uninstalled first.

<description> is another, possibly translated, string that will be presented to the user in the addon management dialog.

<minkvircversion> is the minimum KVIrc version required for the addon to run. If the version of the running KVIrc executable is lower than the requested one then the command will abort with an error. If you want to completly ignore the KVIrc versioning (don't do it), use "0.0.0" here. If you need fine tuning on cvs features you may add also the sources date tag at the end of the required version string (e.g 3.2.1.20060303).

<iconid> is the image identifier of the icon that will be displayed in the addon management dialog. If not specified, a default icon will be used.

The <uninstall_callback> is a snippet of code that should wipe out the addon from the system. It is ALWAYS a good practice to write a complete uninstallation procedure (think that YOU like to be able to completly uninstall a program that you don't use anymore). The <uninstall_callback> will be called by KVIrc when the addon uninstallation is requested, either explicitly by using the GUI or the command addon.uninstall, or implicitly by installing a newer version of the addon (upgrading).

If the user security rules don't allow your addon to be installed or a higher version of a addon with the same name already exists the command will fail with an error (aborting your whole intallation addon). If you don't want to fail with an error but handle it gracefully instead then you should use $addon.exists() to check if a addon with the same name and a greater version already exists. You can't gracefully handle security error conditions: your installation will be always aborted with an error in this case.

The addon can also have a configuration callback settable with addon.setconfigurecallback and a help callback settable with addon.sethelpcallback. The first will usually display a configuration dialog, the second will display some sort of addon's documentation, usually in the help browser.

The registration process uninstalls any previous addon version by executing its uninstall callback routine. This is another reason for that you should call addon.register BEFORE you attempt to install your addon. Failing to do that may cause your old uninstalled to wipe out your newly installed files or code.

Switches
-f | --force
    Registers the addon even if an addon with the same <id> and     a higher version already exists. The usage of this flag     is highly discouraged (i.e. use it only for debugging purposes     on your own machine).
-n | --no-uninstall
    Performs no uninstallation of existing versions of the addon:     it simply replaces the registration entry with the new data.     Again, do NOT use this switch if not for debugging purposes     and on your own machine.
-q | --quiet
    Makes the command run quietly
Syntax Specification
addon.register [-f] [-n] [-q] (<id:string>,<version:string>,<visible_name:string>,<description:string>,<minkvircverion:string>[,<iconid:string>])
{
    <uninstall callback>
}
Examples


See also
addon.uninstall, $addon.exists(), addon.setconfigurecallback, addon.configure, addon.sethelpcallback, addon.help

Index, Commands
KVIrc 3.9.99 Documentation
Generated by root at Wed Oct 17 19:34:06 2007