Module: sip-router
Branch: master
Commit: 11efca600514ba791e456cc809743dd5ec6819c2
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=11efca6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Sun Apr 10 12:34:53 2011 +0200
purple(k): enable cfg framework for module's extra process
---
modules_k/purple/clientpipe.c | 4 ++++
modules_k/purple/purple.c | 6 ++++++
modules_k/purple/purple_sip.c | 9 ++++++++-
3 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/modules_k/purple/clientpipe.c b/modules_k/purple/clientpipe.c
index 2e374fb..489ba8a 100644
--- a/modules_k/purple/clientpipe.c
+++ b/modules_k/purple/clientpipe.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include "../../dprint.h"
+#include "../../cfg/cfg_struct.h"
#include "purple.h"
#include "purplepipe.h"
@@ -231,6 +232,9 @@ void pipe_reader(gpointer data, gint fd, PurpleInputCondition
condition) {
return;
}
+ /* update the local config framework structures */
+ cfg_update();
+
switch (cmd->type) {
case PURPLE_MESSAGE_CMD:
LM_DBG("received message cmd via pipe from <%s> to <%s>\n",
cmd->message.from, cmd->message.to);
diff --git a/modules_k/purple/purple.c b/modules_k/purple/purple.c
index f85b9d5..7729ffe 100644
--- a/modules_k/purple/purple.c
+++ b/modules_k/purple/purple.c
@@ -30,6 +30,7 @@
#include "../../parser/parse_content.h"
#include "../../parser/parse_from.h"
#include "../../modules/tm/tm_load.h"
+#include "../../cfg/cfg_struct.h"
#include "../pua/pua_bind.h"
#include "../pua/pidf.h"
@@ -219,6 +220,8 @@ static int init(void) {
/* add space for one extra process */
register_procs(1);
+ /* add child to update local config framework structures */
+ cfg_register_child(1);
return 0;
}
@@ -236,6 +239,9 @@ static int child_init(int rank)
return -1; /* error */
if(pid==0){
/* child */
+ /* initialize the config framework */
+ if (cfg_child_init())
+ return -1;
runprocs(1);
}
}
diff --git a/modules_k/purple/purple_sip.c b/modules_k/purple/purple_sip.c
index 536f4f8..5b23d89 100644
--- a/modules_k/purple/purple_sip.c
+++ b/modules_k/purple/purple_sip.c
@@ -23,6 +23,7 @@
#include "../../dprint.h"
#include "../../str.h"
+#include "../../cfg/cfg_struct.h"
#include "../../modules/tm/tm_load.h"
#include "../pua/pua_bind.h"
#include "../pua/pidf.h"
@@ -41,6 +42,9 @@ int purple_send_sip_msg(char *to, char *from, char *msg) {
char hdr_buf[512], ruri_buf[512];
uac_req_t uac_r;
+ /* update the local config framework structures */
+ cfg_update();
+
ruri.s = ruri_buf;
ruri.len = snprintf(ruri_buf, sizeof(ruri_buf), "%s;proto=purple", to);
@@ -210,10 +214,13 @@ int purple_send_sip_publish(char *from, char *tupleid, enum
purple_publish_basic
char pres_buff[512];
publ_info_t publ;
+ str pres_uri;
+
+ /* update the local config framework structures */
+ cfg_update();
memset(&publ, 0, sizeof(publ_info_t));
- str pres_uri;
pres_uri.s = pres_buff;
pres_uri.len = sprintf(pres_buff, "%s;proto=purple", from);