Commit a1050064 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add API to define from where to load the plugins before calling ms_plugins_init().

parent 60e63c3d
......@@ -201,6 +201,12 @@ MS2_PUBLIC void ms_voip_init(void);
*/
MS2_PUBLIC void ms_plugins_init(void);
/**
* Set the directory from where the plugins are to be loaded when calling ms_plugins_init().
* @param[in] path The path to the plugins directory.
*/
MS2_PUBLIC void ms_set_plugins_dir(const char *path);
/**
* Load plugins from a specific directory.
* This method basically loads all libraries in the specified directory and attempts to call a C function called
......
......@@ -65,6 +65,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static MSList *ms_plugins_loaded_list;
#endif
static char *plugins_dir = NULL;
static unsigned int cpu_count = 1;
unsigned int ms_get_cpu_count() {
......@@ -498,10 +500,24 @@ void ms_base_exit(){
}
void ms_plugins_init(void) {
if (plugins_dir == NULL) {
#ifdef PACKAGE_PLUGINS_DIR
ms_message("Loading ms plugins from [%s]",PACKAGE_PLUGINS_DIR);
ms_load_plugins(PACKAGE_PLUGINS_DIR);
plugins_dir = ms_strdup(PACKAGE_PLUGINS_DIR);
#else
plugins_dir = ms_strdup("");
#endif
}
if (strlen(plugins_dir) > 0) {
ms_message("Loading ms plugins from [%s]",plugins_dir);
ms_load_plugins(plugins_dir);
}
}
void ms_set_plugins_dir(const char *path) {
if (plugins_dir != NULL) {
ms_free(plugins_dir);
}
plugins_dir = ms_strdup(path);
}
void ms_sleep(int seconds){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment