IRCBot Plugin API
v5
|
#include <plugins.h>
Public Attributes | |
DS_CONFIG_SECTION *(* | GetConfigSection )(DS_CONFIG_SECTION *parent, const char *name) |
bool(* | GetConfigSectionValueBuf )(DS_CONFIG_SECTION *section, const char *name, char *buf, size_t bufSize) |
char *(* | GetConfigSectionValue )(DS_CONFIG_SECTION *section, const char *name) |
long(* | GetConfigSectionLong )(DS_CONFIG_SECTION *section, const char *name) |
double(* | GetConfigSectionFloat )(DS_CONFIG_SECTION *section, const char *name) |
bool(* | IsConfigSectionValue )(DS_CONFIG_SECTION *section, const char *name) |
These functions give you access to the configuration in ircbot.conf.
As you probably know from your own dealings with ircbot.conf, the bot's configuration is based on hierarchical sections with values inside them.
DS_CONFIG_SECTION*(* API_config::GetConfigSection)(DS_CONFIG_SECTION *parent, const char *name) |
This function finds and returns a config section.
Example getting the AutoDJ section: DS_CONFIG_SECTION * sec = GetConfigSection(NULL, "AutoDJ");
Example getting the AutoDJ/Options section after getting AutoDJ above: DS_CONFIG_SECTION * options = GetConfigSection(sec, "Options");
parent | The parent section to search in, NULL to search the root section. |
name | The name of the section to find |
bool(* API_config::GetConfigSectionValueBuf)(DS_CONFIG_SECTION *section, const char *name, char *buf, size_t bufSize) |
This function finds a section value and if it exists fills buf with it.
If the setion value is a number it will be converted to a string with snprintf
section | The section to search in. This must not be NULL! |
name | The name of the value to find |
buf | The buffer to store the value in |
bufSize | The size of buf |
char*(* API_config::GetConfigSectionValue)(DS_CONFIG_SECTION *section, const char *name) |
This function finds a string section value and if it exists returns a const pointer to the value.
The returned pointer should not be modified or free'd, it belongs to the configuration parser.
In the value is a number the function will return NULL
section | The section to search in. This must not be NULL! |
name | The name of the value to find |
long(* API_config::GetConfigSectionLong)(DS_CONFIG_SECTION *section, const char *name) |
This function finds a numerical section value and if it exists returns the number.
In the value is a string it will be converted to a number with atol()
section | The section to search in. This must not be NULL! |
name | The name of the value to find |
double(* API_config::GetConfigSectionFloat)(DS_CONFIG_SECTION *section, const char *name) |
This function finds a floating point section value and if it exists returns the number.
In the value is a string it will be converted to a number with atof()
section | The section to search in. This must not be NULL! |
name | The name of the value to find |
bool(* API_config::IsConfigSectionValue)(DS_CONFIG_SECTION *section, const char *name) |
This function checks to see if a section value exists
In the value is a string it will be converted to a number with atof()
section | The section to search in. This must not be NULL! |
name | The name of the value to find |