Просмотр исходного кода

pua_usrloc: removed local variables aliasing functions from pua api

- use directly the pua bind structure, which was global already
Daniel-Constantin Mierla 10 лет назад
Родитель
Сommit
e9acce2d1b

+ 4 - 9
modules/pua_usrloc/pua_usrloc.c

@@ -64,7 +64,7 @@ int pua_ul_publish = 0;
 int pua_ul_bflag = -1;
 int pua_ul_bmask = 0;
 
-pua_api_t pua;
+pua_api_t _pu_pua;
 str pres_prefix= STR_NULL;
 
 /*! \brief Structure containing pointers to usrloc functions */
@@ -76,9 +76,6 @@ static int mod_init(void);
 
 int pua_set_publish(struct sip_msg* , char*, char*);
 
-send_publish_t pua_send_publish;
-send_subscribe_t pua_send_subscribe;
-
 static cmd_export_t cmds[]=
 {
 	{"pua_set_publish", (cmd_function)pua_set_publish, 0, 0, 0, REQUEST_ROUTE},
@@ -174,24 +171,22 @@ static int mod_init(void)
 		return -1;
 	}
 	
-	if (bind_pua(&pua) < 0)
+	if (bind_pua(&_pu_pua) < 0)
 	{
 		LM_ERR("Can't bind pua\n");
 		return -1;
 	}
-	if(pua.send_publish == NULL)
+	if(_pu_pua.send_publish == NULL)
 	{
 		LM_ERR("Could not import send_publish\n");
 		return -1;
 	}
-	pua_send_publish= pua.send_publish;
 
-	if(pua.send_subscribe == NULL)
+	if(_pu_pua.send_subscribe == NULL)
 	{
 		LM_ERR("Could not import send_subscribe\n");
 		return -1;
 	}
-	pua_send_subscribe= pua.send_subscribe;
 	
 	/* register post-script pua_unset_publish unset function */
 	if(register_script_cb(pua_unset_publish, POST_SCRIPT_CB|REQUEST_CB, 0)<0)

+ 1 - 2
modules/pua_usrloc/pua_usrloc.h

@@ -34,8 +34,6 @@
 #define _PUA_UL_
 #include "../pua/pua_bind.h"
 
-extern send_publish_t pua_send_publish;
-extern send_subscribe_t pua_send_subscribe;
 void ul_publish(ucontact_t* c, int type, void* param);
 int pua_unset_publish(struct sip_msg* msg, unsigned int flags, void* param);
 
@@ -43,4 +41,5 @@ extern str pres_prefix;
 extern int pua_ul_bflag;
 extern int pua_ul_bmask;
 
+extern pua_api_t _pu_pua;
 #endif

+ 1 - 1
modules/pua_usrloc/ul_publish.c

@@ -321,7 +321,7 @@ void ul_publish(ucontact_t* c, int type, void* param)
 	publ->event|= PRESENCE_EVENT;
 	publ->extra_headers= NULL;
 	print_publ(publ);
-	if((error=pua_send_publish(publ))< 0)
+	if((error=_pu_pua.send_publish(publ))< 0)
 	{
 		LM_ERR("while sending publish for ul event %d\n", type);
 		if((type & UL_CONTACT_UPDATE) && error == ERR_PUBLISH_NO_BODY) {