#include "presentity.h"
#include "../../core/sr_module.h"
-typedef int (*update_watchers_t)(str pres_uri, pres_ev_t *ev, str *rules_doc);
+typedef int (*update_watchers_t)(str *pres_uri, pres_ev_t *ev, str *rules_doc);
typedef str *(*pres_get_presentity_t)(
str pres_uri, pres_ev_t *ev, str *etag, str *contact);
typedef void (*pres_free_presentity_t)(str *presentity, pres_ev_t *ev);
return 0;
}
-int update_phtable(presentity_t *presentity, str pres_uri, str body)
+int update_phtable(presentity_t *presentity, str *pres_uri, str *body)
{
char *sphere = NULL;
unsigned int hash_code;
}
/* search for record in hash table */
- hash_code = core_case_hash(&pres_uri, NULL, phtable_size);
+ hash_code = core_case_hash(pres_uri, NULL, phtable_size);
lock_get(&pres_htable[hash_code].lock);
- p = search_phtable(&pres_uri, presentity->event->evp->type, hash_code);
+ p = search_phtable(pres_uri, presentity->event->evp->type, hash_code);
if(p == NULL) {
lock_release(&pres_htable[hash_code].lock);
goto done;
size += source.len; \
} while(0)
-#define PKG_MEM_TYPE 1 << 1
-#define SHM_MEM_TYPE 1 << 2
+#define PKG_MEM_TYPE (1 << 1)
+#define SHM_MEM_TYPE (1 << 2)
extern int pres_delete_same_subs;
int insert_phtable(str *pres_uri, int event, char *sphere);
-int update_phtable(struct presentity *presentity, str pres_uri, str body);
+int update_phtable(struct presentity *presentity, str *pres_uri, str *body);
int delete_phtable(str *pres_uri, int event);
static int fixup_subscribe(void **param, int param_no);
static int update_pw_dialogs(
subs_t *subs, unsigned int hash_code, subs_t **subs_array);
-int update_watchers_status(str pres_uri, pres_ev_t *ev, str *rules_doc);
static int w_pres_auth_status(struct sip_msg *_msg, char *_sp1, char *_sp2);
static int w_pres_refresh_watchers(
struct sip_msg *msg, char *puri, char *pevent, char *ptype);
goto error;
}
- if(update_watchers_status(*pres, ev, rules_doc) < 0) {
+ if(update_watchers_status(pres, ev, rules_doc) < 0) {
LM_ERR("failed to update watchers\n");
goto error;
}
return 0;
}
-int update_watchers_status(str pres_uri, pres_ev_t *ev, str *rules_doc)
+int update_watchers_status(str *pres_uri, pres_ev_t *ev, str *rules_doc)
{
subs_t subs;
db_key_t query_cols[6], result_cols[5];
}
memset(&subs, 0, sizeof(subs_t));
- subs.pres_uri = pres_uri;
+ subs.pres_uri = *pres_uri;
subs.event = ev;
subs.auth_rules_doc = rules_doc;
query_cols[n_query_cols] = &str_presentity_uri_col;
query_vals[n_query_cols].nul = 0;
query_vals[n_query_cols].type = DB1_STR;
- query_vals[n_query_cols].val.str_val = pres_uri;
+ query_vals[n_query_cols].val.str_val = *pres_uri;
n_query_cols++;
query_cols[n_query_cols] = &str_event_col;
}
LM_DBG("found %d record-uri in watchers_table\n", result->n);
- hash_code = core_case_hash(&pres_uri, &ev->name, shtable_size);
+ hash_code = core_case_hash(pres_uri, &ev->name, shtable_size);
subs.db_flag = hash_code;
/* must do a copy as sphere_check requires database queries */
return -1;
}
ret = 1;
- if(update_watchers_status(*pres_uri, ev, rules_doc) < 0) {
+ if(update_watchers_status(pres_uri, ev, rules_doc) < 0) {
LM_ERR("updating watchers in presence\n");
ret = -1;
}
extern db_locking_t pres_db_table_lock;
-int update_watchers_status(str pres_uri, pres_ev_t *ev, str *rules_doc);
+int update_watchers_status(str *pres_uri, pres_ev_t *ev, str *rules_doc);
int pres_auth_status(struct sip_msg *msg, str watcher_uri, str presentity_uri);
int _api_pres_refresh_watchers(str *pres, str *event, int type);
if(pres_sphere_enable
&& presentity->event->evp->type == EVENT_PRESENCE) {
if(publ_cache_enabled
- && update_phtable(presentity, pres_uri, *body) < 0) {
+ && update_phtable(presentity, &pres_uri, body) < 0) {
LM_ERR("failed to update sphere for presentity\n");
goto error;
}
if(pres_sphere_enable && event == EVENT_PRESENCE) {
body.s = (char *)row_vals[body_col].val.string_val;
body.len = strlen(body.s);
- sphere = extract_sphere(body);
+ sphere = extract_sphere(&body);
}
if(insert_phtable(&uri, event, sphere) < 0) {
return -1;
}
-char *extract_sphere(str body)
+char *extract_sphere(str *body)
{
/* check for a rpid sphere element */
char *cont, *sphere = NULL;
- doc = xmlParseMemory(body.s, body.len);
+ doc = xmlParseMemory(body->s, body->len);
if(doc == NULL) {
LM_ERR("failed to parse xml body\n");
return NULL;
goto error;
}
- sphere = extract_sphere(body);
+ sphere = extract_sphere(&body);
pa_dbf.free_result(pa_db, result);
pres = new_presentity(realm, user, expires, ev, etag, sender);
if(pres_sphere_enable) {
- sphere = extract_sphere(*body);
+ sphere = extract_sphere(body);
}
if(pres) {
ret = update_presentity(
int pres_htable_restore(void);
-char *extract_sphere(str body);
+char *extract_sphere(str *body);
char *get_sphere(str *pres_uri);
typedef char *(*pres_get_sphere_t)(str *pres_uri);
if(pres_sphere_enable && event->evp->type == EVENT_PRESENCE
&& get_content_type(msg) == SUBTYPE_PIDFXML) {
- sphere = extract_sphere(body);
+ sphere = extract_sphere(&body);
}
}
memset(&puri, 0, sizeof(struct sip_uri));
xmlDocPtr doc;
if(pres_sphere_enable) {
- sphere = extract_sphere(*pidf_doc);
+ sphere = extract_sphere(pidf_doc);
}
doc = xmlParseMemory(pidf_doc->s, pidf_doc->len);