Module: kamailio
Branch: master
Commit: 47d506cd6d6045bd09d89cafab0384d2a74a9c65
URL:
https://github.com/kamailio/kamailio/commit/47d506cd6d6045bd09d89cafab0384d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-03-31T15:08:23+02:00
presence: variable for last subscription uri made static and renamed
- avoid eventual conflicts in the future because presence modules bind between
each other
---
Modified: modules/presence/subscribe.c
---
Diff:
https://github.com/kamailio/kamailio/commit/47d506cd6d6045bd09d89cafab0384d…
Patch:
https://github.com/kamailio/kamailio/commit/47d506cd6d6045bd09d89cafab0384d…
---
diff --git a/modules/presence/subscribe.c b/modules/presence/subscribe.c
index 7f826f9..84f16e5 100644
--- a/modules/presence/subscribe.c
+++ b/modules/presence/subscribe.c
@@ -755,7 +755,7 @@ void msg_watchers_clean(unsigned int ticks,void *param)
LM_ERR("cleaning pending subscriptions\n");
}
-char* last_presentity = NULL;
+static char* _pres_subs_last_presentity = NULL;
int pv_parse_subscription_name(pv_spec_p sp, str *in)
{
@@ -787,7 +787,8 @@ int pv_parse_subscription_name(pv_spec_p sp, str *in)
int pv_get_subscription(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
{
if(param->pvn.u.isname.name.n==1) /* presentity */
- return last_presentity == NULL ? pv_get_null(msg, param, res) : pv_get_strzval(msg,
param, res, last_presentity);
+ return (_pres_subs_last_presentity == NULL) ? pv_get_null(msg, param, res)
+ : pv_get_strzval(msg, param, res, _pres_subs_last_presentity);
LM_ERR("unknown specifier\n");
return pv_get_null(msg, param, res);
@@ -848,9 +849,9 @@ int handle_subscribe(struct sip_msg* msg, str watcher_user, str
watcher_domain)
str reply_str;
int sent_reply= 0;
- if(last_presentity) {
- pkg_free(last_presentity);
- last_presentity = NULL;
+ if(_pres_subs_last_presentity) {
+ pkg_free(_pres_subs_last_presentity);
+ _pres_subs_last_presentity = NULL;
}
/* ??? rename to avoid collisions with other symbols */
@@ -952,9 +953,10 @@ int handle_subscribe(struct sip_msg* msg, str watcher_user, str
watcher_domain)
}
if(subs.pres_uri.len > 0 && subs.pres_uri.s) {
- last_presentity= (char*)pkg_malloc((subs.pres_uri.len+1) * sizeof(char));
- strncpy(last_presentity, subs.pres_uri.s, subs.pres_uri.len);
- last_presentity[subs.pres_uri.len] = '\0';
+ _pres_subs_last_presentity =
+ (char*)pkg_malloc((subs.pres_uri.len+1) * sizeof(char));
+ strncpy(_pres_subs_last_presentity, subs.pres_uri.s, subs.pres_uri.len);
+ _pres_subs_last_presentity[subs.pres_uri.len] = '\0';
}
/* mark that the received event is a SUBSCRIBE message */