提交 597b99b7 authored 作者: João Mesquita's avatar João Mesquita

Thank anthm for helping load the module.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@16121 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 7e3fa67e
...@@ -27,5 +27,6 @@ SOURCES += main.cpp \ ...@@ -27,5 +27,6 @@ SOURCES += main.cpp \
mod_qsettings/mod_qsettings.cpp mod_qsettings/mod_qsettings.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
fshost.h \ fshost.h \
call.h call.h \
mod_qsettings/mod_qsettings.h
FORMS += mainwindow.ui FORMS += mainwindow.ui
#include <QtGui> #include <QtGui>
#include "fshost.h" #include "fshost.h"
#include "call.h" #include "call.h"
#include "mod_qsettings/mod_qsettings.h"
/* Declare it globally */ /* Declare it globally */
FSHost g_FSHost; FSHost g_FSHost;
...@@ -40,7 +41,7 @@ void FSHost::run(void) ...@@ -40,7 +41,7 @@ void FSHost::run(void)
} }
/* Load our QSettings module */ /* Load our QSettings module */
if (switch_loadable_module_load_module("", "mod_qsettings", SWITCH_FALSE, &err) != SWITCH_STATUS_SUCCESS) if (switch_loadable_module_build_dynamic("mod_qsettings",mod_qsettings_load,NULL,mod_qsettings_shutdown,SWITCH_FALSE) != SWITCH_STATUS_SUCCESS)
{ {
printf("Something went wrong when loading our QSettings module\n"); printf("Something went wrong when loading our QSettings module\n");
} }
......
...@@ -30,11 +30,12 @@ ...@@ -30,11 +30,12 @@
* Module to load configurations from Qt preference system QSettings * Module to load configurations from Qt preference system QSettings
* *
*/ */
#include <switch.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_qsettings_load); #include "mod_qsettings/mod_qsettings.h"
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_qsettings_shutdown);
/*
SWITCH_MODULE_DEFINITION(mod_qsettings, mod_qsettings_load, mod_qsettings_shutdown, NULL); SWITCH_MODULE_DEFINITION(mod_qsettings, mod_qsettings_load, mod_qsettings_shutdown, NULL);
*/
struct xml_binding { struct xml_binding {
...@@ -63,8 +64,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con ...@@ -63,8 +64,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con
return NULL; return NULL;
} }
#define ENABLE_PARAM_VALUE "enabled" /*static switch_status_t do_config(void)
static switch_status_t do_config(void)
{ {
char *cf = "qsettings.conf"; char *cf = "qsettings.conf";
switch_xml_t cfg, xml, bindings_tag, binding_tag, param; switch_xml_t cfg, xml, bindings_tag, binding_tag, param;
...@@ -107,25 +107,26 @@ static switch_status_t do_config(void) ...@@ -107,25 +107,26 @@ static switch_status_t do_config(void)
switch_xml_free(xml); switch_xml_free(xml);
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
} }*/
SWITCH_MODULE_LOAD_FUNCTION(mod_qsettings_load) SWITCH_MODULE_LOAD_FUNCTION(mod_qsettings_load)
{ {
/*switch_api_interface_t *qsettings_api_interface;*/ /*switch_api_interface_t *qsettings_api_interface;*/
/* connect my internal structure to the blank pointer passed to me */ /* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname); *module_interface = switch_loadable_module_create_module_interface(pool, "mod_qsettings");
memset(&globals,0,sizeof(globals)); memset(&globals,0,sizeof(globals));
globals.pool = pool; globals.pool = pool;
if (do_config() == SWITCH_STATUS_SUCCESS) { /* if (do_config() == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding worked!"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding worked!");
} else { } else {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
*/
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "We loaded mod_qsettings.\n");
/* indicate that the module should continue to be loaded */ /* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
#ifndef MOD_QSETTINGS_H
#define MOD_QSETTINGS_H
#include <switch.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_qsettings_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_qsettings_shutdown);
#endif // MOD_QSETTINGS_H
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论