From 0f9c35e214a7d047286b0d2ae69fcd60b223b9d4 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 2 Dec 2011 00:43:12 +0100 Subject: add documentation for plugin config framework --- plugins/plugin20.html | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'plugins/plugin20.html') diff --git a/plugins/plugin20.html b/plugins/plugin20.html index 787c048b..b36490ba 100644 --- a/plugins/plugin20.html +++ b/plugins/plugin20.html @@ -81,6 +81,11 @@ margin-right: 32px;
xchat_strip
xchat_free
+
xchat_set_pluginpref_str +
xchat_get_pluginpref_str +
xchat_set_pluginpref_int +
xchat_get_pluginpref_int +

xchat_list_get
xchat_list_free
xchat_list_fields (not documented yet) @@ -998,5 +1003,85 @@ A newly allocated string or NULL for failure. You must free this string with xch

+

 xchat_set_pluginpref_str() (new for 2.8.10)

+Prototype: int xchat_set_pluginpref_str (xchat_plugin *ph, const char *var, const char *value); +
+
Description: Saves a plugin-specific setting with string value to a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to save. +
value: String value of the the setting. +
+
+Returns: 1 for success, 0 for failure. +

Example: +
+
int xchat_plugin_init (xchat_plugin *plugin_handle,
+			char **plugin_name,
+			char **plugin_desc,
+			char **plugin_version,
+			char *arg)
+{
+	ph = plugin_handle;
+	*plugin_name = "Tester Thingie";
+	*plugin_desc = "Testing stuff";
+	*plugin_version = "1.0";
+
+	xchat_set_pluginpref_str (ph, "myvar1", "I want to save this string!");
+	xchat_set_pluginpref_str (ph, "myvar2", "This is important, too.");
+
+	return 1;       /* return 1 for success */
+}
+
+In the example above, the settings will be saved to the plugin_tester_thingie.conf file, and its content will be: +
+
myvar1 = I want to save this string!
+myvar2 = This is important, too.
+
+You should never need to edit this file manually. +


+ +

 xchat_get_pluginpref_str() (new for 2.8.10)

+Prototype: int xchat_get_pluginpref_str (xchat_plugin *ph, const char *var, char *dest); +
+
Description: Loads a plugin-specific setting with string value from a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to load. +
dest: Array to save the loaded setting's string value to. +
+
+Returns: 1 for success, 0 for failure. +


+ +

 xchat_set_pluginpref_int() (new for 2.8.10)

+Prototype: int xchat_set_pluginpref_int (xchat_plugin *ph, const char *var, int value); +
+
Description: Saves a plugin-specific setting with decimal value to a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to save. +
value: Decimal value of the the setting. +
+
+Returns: 1 for success, 0 for failure. +


+ +

 xchat_get_pluginpref_int() (new for 2.8.10)

+Prototype: int xchat_get_pluginpref_int (xchat_plugin *ph, const char *var); +
+
Description: Loads a plugin-specific setting with decimal value from a plugin-specific config file. +
+
Arguments: +
ph: Plugin handle (as given to xchat_plugin_init). +
var: Name of the setting to load. +
+
+Returns: The decimal value of the requested setting upon success, -1 for failure. +


+ -- cgit 1.4.1