Jelajahi Sumber

presence_dialoginfo: removed svn id, history, coherent indentation

Daniel-Constantin Mierla 8 tahun lalu
induk
melakukan
1bb3aeaaeb

+ 20 - 24
src/modules/presence_dialoginfo/add_events.c

@@ -17,13 +17,10 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2008-08-25  initial version (kd)
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -36,34 +33,33 @@
 
 
 int dlginfo_add_events(void)
 int dlginfo_add_events(void)
 {
 {
-    pres_ev_t event;
-	
-    /* constructing message-summary event */
-    memset(&event, 0, sizeof(pres_ev_t));
-    event.name.s = "dialog";
-    event.name.len = 6;
+	pres_ev_t event;
 
 
-    event.content_type.s = "application/dialog-info+xml";
-    event.content_type.len = 27;
+	/* constructing message-summary event */
+	memset(&event, 0, sizeof(pres_ev_t));
+	event.name.s = "dialog";
+	event.name.len = 6;
+
+	event.content_type.s = "application/dialog-info+xml";
+	event.content_type.len = 27;
 
 
 	event.default_expires= 3600;
 	event.default_expires= 3600;
-    event.type = PUBL_TYPE;
+	event.type = PUBL_TYPE;
 	event.req_auth = 0;
 	event.req_auth = 0;
-    event.evs_publ_handl = 0;
+	event.evs_publ_handl = 0;
 
 
 	/* aggregate XML body and free() fuction */
 	/* aggregate XML body and free() fuction */
-    event.agg_nbody = dlginfo_agg_nbody;
-    event.free_body = free_xml_body;
+	event.agg_nbody = dlginfo_agg_nbody;
+	event.free_body = free_xml_body;
 
 
 	/* modify XML body for each watcher to set the correct "version" */
 	/* modify XML body for each watcher to set the correct "version" */
-    event.aux_body_processing = dlginfo_body_setversion;
-    event.aux_free_body = free_xml_body;
+	event.aux_body_processing = dlginfo_body_setversion;
+	event.aux_free_body = free_xml_body;
 
 
-	
-    if (pres_add_event(&event) < 0) {
+	if (pres_add_event(&event) < 0) {
 		LM_ERR("failed to add event \"dialog\"\n");
 		LM_ERR("failed to add event \"dialog\"\n");
 		return -1;
 		return -1;
-    }		
-	
-    return 0;
+	}
+
+	return 0;
 }
 }

+ 2 - 5
src/modules/presence_dialoginfo/add_events.h

@@ -16,13 +16,10 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2008-08-25  initial version (kd)
  */
  */
 
 
 #ifndef _DLGINFO_ADD_EV_H_
 #ifndef _DLGINFO_ADD_EV_H_

+ 71 - 90
src/modules/presence_dialoginfo/notify_body.c

@@ -1,7 +1,5 @@
 /*
 /*
- * $Id: notify_body.c 1337 2006-12-07 18:05:05Z bogdan_iancu $
- *
- * presence_dialoginfo module -  
+ * presence_dialoginfo module
  *
  *
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2008 Klaus Darilion, IPCom
  * Copyright (C) 2008 Klaus Darilion, IPCom
@@ -22,10 +20,8 @@
  * along with this program; if not, write to the Free Software
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2008-08-25  initial version (kd)
  */
  */
+
 /*! \file
 /*! \file
  * \brief Kamailio Presence_XML :: Notify BODY handling
  * \brief Kamailio Presence_XML :: Notify BODY handling
  * \ingroup presence_xml
  * \ingroup presence_xml
@@ -53,7 +49,8 @@
 #include "pidf.h"
 #include "pidf.h"
 
 
 str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n);
 str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n);
-int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_nodes);
+int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array,
+		int total_nodes);
 
 
 extern int force_single_dialog;
 extern int force_single_dialog;
 extern int force_dummy_dialog;
 extern int force_dummy_dialog;
@@ -68,10 +65,10 @@ void free_xml_body(char* body)
 }
 }
 
 
 #define DIALOGINFO_EMPTY_BODY "<dialog-info>\
 #define DIALOGINFO_EMPTY_BODY "<dialog-info>\
-<dialog id=\"615293b33c62dec073e05d9421e9f48b\" direction=\"recipient\">\
-<state>terminated</state>\
-</dialog>\
-</dialog-info>"
+	<dialog id=\"615293b33c62dec073e05d9421e9f48b\" direction=\"recipient\">\
+	<state>terminated</state>\
+	</dialog>\
+	</dialog-info>"
 
 
 #define DIALOGINFO_EMPTY_BODY_SIZE 512
 #define DIALOGINFO_EMPTY_BODY_SIZE 512
 
 
@@ -97,7 +94,7 @@ str* dlginfo_agg_nbody_empty(str* pres_user, str* pres_domain)
 		return NULL;
 		return NULL;
 	}
 	}
 
 
-	sprintf(body, DIALOGINFO_EMPTY_BODY);//, pres_user->len, pres_user->s, pres_domain->len, pres_domain->s);
+	sprintf(body, DIALOGINFO_EMPTY_BODY);
 	body_array->s = body;
 	body_array->s = body;
 	body_array->len = strlen(body);
 	body_array->len = strlen(body);
 
 
@@ -120,7 +117,8 @@ str* dlginfo_agg_nbody_empty(str* pres_user, str* pres_domain)
 	return n_body;
 	return n_body;
 }
 }
 
 
-str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n, int off_index)
+str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array,
+		int n, int off_index)
 {
 {
 	str* n_body= NULL;
 	str* n_body= NULL;
 
 
@@ -148,7 +146,7 @@ str* dlginfo_agg_nbody(str* pres_user, str* pres_domain, str** body_array, int n
 	xmlMemoryDump();
 	xmlMemoryDump();
 
 
 	return n_body;
 	return n_body;
-}	
+}
 
 
 str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 {
 {
@@ -199,7 +197,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 		xml_array[j] = NULL;
 		xml_array[j] = NULL;
 		xml_array[j] = xmlParseMemory( body_array[i]->s, body_array[i]->len );
 		xml_array[j] = xmlParseMemory( body_array[i]->s, body_array[i]->len );
 
 
-		/* LM_DBG("parsing XML body: [n]=%d, [i]=%d, [j]=%d xml_array[j]=%p\n", n, i, j, xml_array[j] ); */
+		/* LM_DBG("parsing XML body: [n]=%d, [i]=%d, [j]=%d xml_array[j]=%p\n",
+		 *			n, i, j, xml_array[j] ); */
 
 
 		if( xml_array[j]== NULL)
 		if( xml_array[j]== NULL)
 		{
 		{
@@ -208,7 +207,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 		}
 		}
 		j++;
 		j++;
 
 
-	} 
+	}
 
 
 	if(j== 0)  /* no body */
 	if(j== 0)  /* no body */
 	{
 	{
@@ -219,7 +218,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 	/* n: number of bodies in total */
 	/* n: number of bodies in total */
 	/* j: number of useful bodies; created XML structures */
 	/* j: number of useful bodies; created XML structures */
 	/* i: loop counter */
 	/* i: loop counter */
-	/* LM_DBG("number of bodies in total [n]=%d, number of useful bodies [j]=%d\n", n, j ); */
+	/* LM_DBG("number of bodies in total [n]=%d, number of"
+	 *			" useful bodies [j]=%d\n", n, j ); */
 
 
 	/* create the new NOTIFY body  */
 	/* create the new NOTIFY body  */
 	if ( (pres_user->len + pres_domain->len + 1 + 4 + 1) >= MAX_URI_SIZE) {
 	if ( (pres_user->len + pres_domain->len + 1 + 4 + 1) >= MAX_URI_SIZE) {
@@ -243,21 +243,22 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 		goto error;
 		goto error;
 
 
 	xmlDocSetRootElement(doc, root_node);
 	xmlDocSetRootElement(doc, root_node);
-	namespace = xmlNewNs(root_node, BAD_CAST "urn:ietf:params:xml:ns:dialog-info", NULL);
+	namespace = xmlNewNs(root_node,
+			BAD_CAST "urn:ietf:params:xml:ns:dialog-info", NULL);
 	if (!namespace) {
 	if (!namespace) {
 		LM_ERR("creating namespace failed\n");
 		LM_ERR("creating namespace failed\n");
 	}
 	}
 	xmlSetNs(root_node, namespace);
 	xmlSetNs(root_node, namespace);
 	/* The version must be increased for each new document and is a 32bit int.
 	/* The version must be increased for each new document and is a 32bit int.
-	   As the version is different for each watcher, we can not set here the
-	   correct value. Thus, we just put here a placeholder which will be
-	   replaced by the correct value in the aux_body_processing callback.
-	   Thus we have CPU intensive XML aggregation only once and can use
-	   quick search&replace in the per-watcher aux_body_processing callback.
-	   We use 11 chracters as an signed int (although RFC says unsigned int we
-	   use signed int as presence module stores "version" in DB as
-	   signed int) has max. 10 characters + 1 character for the sign
-	   */
+	 * As the version is different for each watcher, we can not set here the
+	 * correct value. Thus, we just put here a placeholder which will be
+	 * replaced by the correct value in the aux_body_processing callback.
+	 * Thus we have CPU intensive XML aggregation only once and can use
+	 * quick search&replace in the per-watcher aux_body_processing callback.
+	 * We use 11 chracters as an signed int (although RFC says unsigned int we
+	 * use signed int as presence module stores "version" in DB as
+	 * signed int) has max. 10 characters + 1 character for the sign
+	 */
 	xmlNewProp(root_node, BAD_CAST "version", BAD_CAST "00000000000");
 	xmlNewProp(root_node, BAD_CAST "version", BAD_CAST "00000000000");
 	xmlNewProp(root_node, BAD_CAST  "state",  BAD_CAST "full" );
 	xmlNewProp(root_node, BAD_CAST  "state",  BAD_CAST "full" );
 	xmlNewProp(root_node, BAD_CAST "entity",  BAD_CAST buf);
 	xmlNewProp(root_node, BAD_CAST "entity",  BAD_CAST buf);
@@ -265,7 +266,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 	/* loop over all bodies and create the aggregated body */
 	/* loop over all bodies and create the aggregated body */
 	for(i=0; i<j; i++)
 	for(i=0; i<j; i++)
 	{
 	{
-		/* LM_DBG("[n]=%d, [i]=%d, [j]=%d xml_array[i]=%p\n", n, i, j, xml_array[j] ); */
+		/* LM_DBG("[n]=%d, [i]=%d, [j]=%d xml_array[i]=%p\n",
+		 *			n, i, j, xml_array[j] ); */
 		p_root= xmlDocGetRootElement(xml_array[i]);
 		p_root= xmlDocGetRootElement(xml_array[i]);
 		if(p_root ==NULL) {
 		if(p_root ==NULL) {
 			LM_ERR("the xml_tree root element is null\n");
 			LM_ERR("the xml_tree root element is null\n");
@@ -280,8 +282,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 				LM_DBG("node type: Element, name: %s\n", node->name);
 				LM_DBG("node type: Element, name: %s\n", node->name);
 				/* we do not copy the node, but unlink it and then add it ot the new node
 				/* we do not copy the node, but unlink it and then add it ot the new node
 				 * this destroys the original document but we do not need it anyway.
 				 * this destroys the original document but we do not need it anyway.
-				 * using "copy" instead of "unlink" would also copy the namespace which 
-				 * would then be declared redundant (libxml unfortunately can not remove 
+				 * using "copy" instead of "unlink" would also copy the namespace which
+				 * would then be declared redundant (libxml unfortunately can not remove
 				 * namespaces)
 				 * namespaces)
 				 */
 				 */
 				if(!force_single_dialog || (j == 1)) {
 				if(!force_single_dialog || (j == 1)) {
@@ -316,57 +318,57 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 							LM_DBG("found terminated state\n");
 							LM_DBG("found terminated state\n");
 							terminated_node = node;
 							terminated_node = node;
 						} else if(strcasecmp(state, "confirmed") == 0
 						} else if(strcasecmp(state, "confirmed") == 0
-								  && node_id == i) {
+								&& node_id == i) {
 							/*  here we check if confirmed is terminated or not
 							/*  here we check if confirmed is terminated or not
-								 *  if it is not we are in the middle of the conversation
-								 */
+							 *  if it is not we are in the middle of the conversation
+							 */
 							if(check_relevant_state(dialog_id, xml_array, j)
 							if(check_relevant_state(dialog_id, xml_array, j)
 									>= DEF_TERMINATED_NODE) {
 									>= DEF_TERMINATED_NODE) {
 								LM_DBG("confirmed state for dialog %s, but it "
 								LM_DBG("confirmed state for dialog %s, but it "
-									   "is not latest state\n",
+										"is not latest state\n",
 										dialog_id);
 										dialog_id);
 							} else {
 							} else {
 								LM_DBG("confirmed state for dialog %s and "
 								LM_DBG("confirmed state for dialog %s and "
-									   "latest state for this dialog\n",
+										"latest state for this dialog\n",
 										dialog_id);
 										dialog_id);
 								confirmed_node = node;
 								confirmed_node = node;
 							}
 							}
 						} else if(strcasecmp(state, "early") == 0
 						} else if(strcasecmp(state, "early") == 0
-								  && node_id == i) {
+								&& node_id == i) {
 							if(check_relevant_state(dialog_id, xml_array, j)
 							if(check_relevant_state(dialog_id, xml_array, j)
 									>= DEF_CONFIRMED_NODE) {
 									>= DEF_CONFIRMED_NODE) {
 								LM_DBG("early state for dialog %s, but it is "
 								LM_DBG("early state for dialog %s, but it is "
-									   "not latest state\n",
+										"not latest state\n",
 										dialog_id);
 										dialog_id);
 							} else {
 							} else {
 								LM_DBG("early state for dialog %s and latest "
 								LM_DBG("early state for dialog %s and latest "
-									   "state for this dialog\n",
+										"state for this dialog\n",
 										dialog_id);
 										dialog_id);
 								early_node = node;
 								early_node = node;
 							}
 							}
 						} else if(strcasecmp(state, "proceeding") == 0
 						} else if(strcasecmp(state, "proceeding") == 0
-								  && node_id == i) {
+								&& node_id == i) {
 							if(check_relevant_state(dialog_id, xml_array, j)
 							if(check_relevant_state(dialog_id, xml_array, j)
 									>= DEF_EARLY_NODE) {
 									>= DEF_EARLY_NODE) {
 								LM_DBG("proceeding state for dialog %s, but it "
 								LM_DBG("proceeding state for dialog %s, but it "
-									   "is not latest state\n",
+										"is not latest state\n",
 										dialog_id);
 										dialog_id);
 							} else {
 							} else {
 								LM_DBG("proceeding state for dialog %s and "
 								LM_DBG("proceeding state for dialog %s and "
-									   "latest state for this dialog\n",
+										"latest state for this dialog\n",
 										dialog_id);
 										dialog_id);
 								proceed_node = node;
 								proceed_node = node;
 							}
 							}
 						} else if(strcasecmp(state, "trying") == 0
 						} else if(strcasecmp(state, "trying") == 0
-								  && node_id == i) {
+								&& node_id == i) {
 							if(check_relevant_state(dialog_id, xml_array, j)
 							if(check_relevant_state(dialog_id, xml_array, j)
 									>= DEF_PROCEEDING_NODE) {
 									>= DEF_PROCEEDING_NODE) {
 								LM_DBG("trying state for dialog %s, but it is "
 								LM_DBG("trying state for dialog %s, but it is "
-									   "not latest state\n",
+										"not latest state\n",
 										dialog_id);
 										dialog_id);
 							} else {
 							} else {
 								LM_DBG("trying state for dialog %s and latest "
 								LM_DBG("trying state for dialog %s and latest "
-									   "state for this dialog\n",
+										"state for this dialog\n",
 										dialog_id);
 										dialog_id);
 								trying_node = node;
 								trying_node = node;
 							}
 							}
@@ -385,16 +387,7 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 							/* assume a failure somewhere and all above nodes are NULL */
 							/* assume a failure somewhere and all above nodes are NULL */
 							winner_dialog_node = node;
 							winner_dialog_node = node;
 						}
 						}
-						/*
-						if(winner_dialog_node == NULL) {
-							priority = get_dialog_state_priority(state);
-							if (priority > winner_priority) {
-								winner_priority = priority;
-								LM_DBG("new winner priority = %s (%d)\n", state, winner_priority);
-								winner_dialog_node = node;
-							}
-						}
-						*/
+
 						xmlFree(state);
 						xmlFree(state);
 					}
 					}
 				}
 				}
@@ -420,8 +413,8 @@ str* agregate_xmls(str* pres_user, str* pres_domain, str** body_array, int n)
 		ERR_MEM(PKG_MEM_STR);
 		ERR_MEM(PKG_MEM_STR);
 	}
 	}
 
 
-	xmlDocDumpFormatMemory(doc,(xmlChar**)(void*)&body->s, 
-			&body->len, 1);	
+	xmlDocDumpFormatMemory(doc,(xmlChar**)(void*)&body->s,
+			&body->len, 1);
 
 
 	if(dialog_id!=NULL) xmlFree(dialog_id);
 	if(dialog_id!=NULL) xmlFree(dialog_id);
 	for(i=0; i<j; i++) {
 	for(i=0; i<j; i++) {
@@ -453,25 +446,10 @@ error:
 	return NULL;
 	return NULL;
 }
 }
 
 
-/*
-int get_dialog_state_priority(char *state) {
-	if (strcasecmp(state,"terminated") == 0)
-		return 0;
-	if (strcasecmp(state,"trying") == 0)
-		return 1;
-	if (strcasecmp(state,"proceeding") == 0)
-		return 2;
-	if (strcasecmp(state,"confirmed") == 0)
-		return 3;
-	if (strcasecmp(state,"early") == 0)
-		return 4;
-
-	return 0;
-}
-*/
 
 
 /* returns 16 -> terminated, 8 -> confirmed, 4 -> early */
 /* returns 16 -> terminated, 8 -> confirmed, 4 -> early */
-int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_nodes)
+int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array,
+		int total_nodes)
 {
 {
 	int result = 0;
 	int result = 0;
 	int i = 0;
 	int i = 0;
@@ -501,7 +479,7 @@ int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_
 					}
 					}
 					if(strcasecmp((char *)node->name, "dialog") == 0) {
 					if(strcasecmp((char *)node->name, "dialog") == 0) {
 						/* Getting the node id so we would be sure
 						/* Getting the node id so we would be sure
-							 * that terminate state from same one the same */
+						 * that terminate state from same one the same */
 						if(dialog_id_tmp)
 						if(dialog_id_tmp)
 							xmlFree(dialog_id_tmp);
 							xmlFree(dialog_id_tmp);
 						dialog_id_tmp = xmlGetProp(node, (const xmlChar *)"id");
 						dialog_id_tmp = xmlGetProp(node, (const xmlChar *)"id");
@@ -517,8 +495,8 @@ int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_
 						if((strcasecmp(state, "terminated") == 0)
 						if((strcasecmp(state, "terminated") == 0)
 								&& (node_id == i) && (node_id >= 0)
 								&& (node_id == i) && (node_id >= 0)
 								&& (strcasecmp((char *)dialog_id_tmp,
 								&& (strcasecmp((char *)dialog_id_tmp,
-											(char *)dialog_id)
-										   == 0)) {
+										(char *)dialog_id)
+									== 0)) {
 							LM_DBG("Found terminated in dialog %s\n",
 							LM_DBG("Found terminated in dialog %s\n",
 									dialog_id);
 									dialog_id);
 							result += DEF_TERMINATED_NODE;
 							result += DEF_TERMINATED_NODE;
@@ -527,24 +505,24 @@ int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_
 						if((strcasecmp(state, "confirmed") == 0)
 						if((strcasecmp(state, "confirmed") == 0)
 								&& (node_id == i) && (node_id >= 0)
 								&& (node_id == i) && (node_id >= 0)
 								&& (strcasecmp((char *)dialog_id_tmp,
 								&& (strcasecmp((char *)dialog_id_tmp,
-											(char *)dialog_id)
-										   == 0)) {
+										(char *)dialog_id)
+									== 0)) {
 							LM_DBG("Found confirmed in dialog %s\n", dialog_id);
 							LM_DBG("Found confirmed in dialog %s\n", dialog_id);
 							result += DEF_CONFIRMED_NODE;
 							result += DEF_CONFIRMED_NODE;
 						}
 						}
 						if((strcasecmp(state, "early") == 0) && (node_id == i)
 						if((strcasecmp(state, "early") == 0) && (node_id == i)
 								&& (node_id >= 0)
 								&& (node_id >= 0)
 								&& (strcasecmp((char *)dialog_id_tmp,
 								&& (strcasecmp((char *)dialog_id_tmp,
-											(char *)dialog_id)
-										   == 0)) {
+										(char *)dialog_id)
+									== 0)) {
 							LM_DBG("Found early in dialog %s\n", dialog_id);
 							LM_DBG("Found early in dialog %s\n", dialog_id);
 							result += DEF_EARLY_NODE;
 							result += DEF_EARLY_NODE;
 						}
 						}
 						if((strcasecmp(state, "proceeding") == 0)
 						if((strcasecmp(state, "proceeding") == 0)
 								&& (node_id == i) && (node_id >= 0)
 								&& (node_id == i) && (node_id >= 0)
 								&& (strcasecmp((char *)dialog_id_tmp,
 								&& (strcasecmp((char *)dialog_id_tmp,
-											(char *)dialog_id)
-										   == 0)) {
+										(char *)dialog_id)
+									== 0)) {
 							LM_DBG("Found proceeding in dialog %s\n",
 							LM_DBG("Found proceeding in dialog %s\n",
 									dialog_id);
 									dialog_id);
 							result += DEF_PROCEEDING_NODE;
 							result += DEF_PROCEEDING_NODE;
@@ -552,8 +530,8 @@ int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_
 						if((strcasecmp(state, "trying") == 0) && (node_id == i)
 						if((strcasecmp(state, "trying") == 0) && (node_id == i)
 								&& (node_id >= 0)
 								&& (node_id >= 0)
 								&& (strcasecmp((char *)dialog_id_tmp,
 								&& (strcasecmp((char *)dialog_id_tmp,
-											(char *)dialog_id)
-										   == 0)) {
+										(char *)dialog_id)
+									== 0)) {
 							LM_DBG("Found trying in dialog %s\n", dialog_id);
 							LM_DBG("Found trying in dialog %s\n", dialog_id);
 							result += DEF_TRYING_NODE;
 							result += DEF_TRYING_NODE;
 						}
 						}
@@ -569,7 +547,8 @@ int check_relevant_state (xmlChar * dialog_id, xmlDocPtr * xml_array, int total_
 }
 }
 
 
 
 
-str *dlginfo_body_setversion(subs_t *subs, str *body) {
+str *dlginfo_body_setversion(subs_t *subs, str *body)
+{
 	char *version_start=0;
 	char *version_start=0;
 	char version[MAX_INT_LEN + 2]; /* +2 becasue of trailing " and \0 */
 	char version[MAX_INT_LEN + 2]; /* +2 becasue of trailing " and \0 */
 	int version_len;
 	int version_len;
@@ -630,18 +609,20 @@ str *dlginfo_body_setversion(subs_t *subs, str *body) {
 	memcpy(version_start, version, version_len);
 	memcpy(version_start, version, version_len);
 	memset(version_start + version_len, ' ', 12 - version_len);
 	memset(version_start + version_len, ' ', 12 - version_len);
 
 
-	xmlDocPtr doc = xmlReadMemory(aux_body->s, aux_body->len, "noname.xml", NULL, 0);
-        if (doc == NULL) {
+	xmlDocPtr doc = xmlReadMemory(aux_body->s, aux_body->len, "noname.xml",
+			NULL, 0);
+	if (doc == NULL) {
 		LM_ERR("error allocation xmldoc\n");
 		LM_ERR("error allocation xmldoc\n");
 		pkg_free(aux_body->s);
 		pkg_free(aux_body->s);
 		pkg_free(aux_body);
 		pkg_free(aux_body);
 		return NULL;
 		return NULL;
 	}
 	}
 	pkg_free(aux_body->s);
 	pkg_free(aux_body->s);
-        xmlDocDumpFormatMemory(doc,(xmlChar**)(void*)&aux_body->s, &aux_body->len, 1);
+	xmlDocDumpFormatMemory(doc,(xmlChar**)(void*)&aux_body->s,
+			&aux_body->len, 1);
 	xmlFreeDoc(doc);
 	xmlFreeDoc(doc);
-        xmlCleanupParser();
-        xmlMemoryDump();
+	xmlCleanupParser();
+	xmlMemoryDump();
 
 
 	return aux_body;
 	return aux_body;
 }
 }

+ 4 - 9
src/modules/presence_dialoginfo/notify_body.h

@@ -1,7 +1,5 @@
 /*
 /*
- * $Id: notify_body.h 1337 2006-12-07 18:05:05Z bogdan_iancu $
- *
- * presence_dialoginfo module -  
+ * presence_dialoginfo module
  *
  *
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2008 Klaus Darilion, IPCom
  * Copyright (C) 2008 Klaus Darilion, IPCom
@@ -18,17 +16,14 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2008-08-25  initial version (kd)
  */
  */
 
 
 /*! \file
 /*! \file
- * \brief Kamailio presence dialog-info  :: 
+ * \brief Kamailio presence dialog-info  ::
  * \ref notify_body.c
  * \ref notify_body.c
  * \ingroup presence_dialoginfo
  * \ingroup presence_dialoginfo
  */
  */

+ 8 - 17
src/modules/presence_dialoginfo/pidf.c

@@ -1,6 +1,4 @@
 /*
 /*
- * $Id: pidf.c 1953 2007-04-04 08:50:33Z anca_vamanu $
- *
  * presence module - presence server implementation
  * presence module - presence server implementation
  *
  *
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2006 Voice Sistem S.R.L.
@@ -17,13 +15,10 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2007-04-14  initial version (anca)
  */
  */
 
 
 /*! \file
 /*! \file
@@ -39,8 +34,8 @@
 #ifdef __OS_linux
 #ifdef __OS_linux
 	#define _XOPEN_SOURCE 600          /* glibc2 on linux */
 	#define _XOPEN_SOURCE 600          /* glibc2 on linux */
 	#define _BSD_SOURCE 1				/* needed on linux to "fix" the effect
 	#define _BSD_SOURCE 1				/* needed on linux to "fix" the effect
-										  of the above define on
-										  features.h/unistd.h syscall() */
+										 * of the above define on
+										 * features.h/unistd.h syscall() */
 	#define _DEFAULT_SOURCE 1			/* _BSD_SOURCE is deprecated */
 	#define _DEFAULT_SOURCE 1			/* _BSD_SOURCE is deprecated */
 #elif defined __OS_solaris
 #elif defined __OS_solaris
 	#define _XOPEN_SOURCE_EXTENDED 1   /* solaris */
 	#define _XOPEN_SOURCE_EXTENDED 1   /* solaris */
@@ -124,7 +119,7 @@ xmlNodePtr xmlDocGetNodeByName(xmlDocPtr doc, const char *name, const char *ns)
 	return xmlNodeGetNodeByName(cur, name, ns);
 	return xmlNodeGetNodeByName(cur, name, ns);
 }
 }
 
 
-char *xmlDocGetNodeContentByName(xmlDocPtr doc, const char *name, 
+char *xmlDocGetNodeContentByName(xmlDocPtr doc, const char *name,
 		const char *ns)
 		const char *ns)
 {
 {
 	xmlNodePtr node = xmlDocGetNodeByName(doc, name, ns);
 	xmlNodePtr node = xmlDocGetNodeByName(doc, name, ns);
@@ -156,7 +151,7 @@ time_t xml_parse_dateTime(char* xml_time_str)
 		printf("error: failed to parse time\n");
 		printf("error: failed to parse time\n");
 		return 0;
 		return 0;
 	}
 	}
-	
+
 	if(*p== '\0')
 	if(*p== '\0')
 		goto done;
 		goto done;
 
 
@@ -173,9 +168,7 @@ time_t xml_parse_dateTime(char* xml_time_str)
 	if(*p== '\0')
 	if(*p== '\0')
 		goto done;
 		goto done;
 
 
-	
 	/* read time zone */
 	/* read time zone */
-
 	if(*p== 'Z')
 	if(*p== 'Z')
 	{
 	{
 		goto done;
 		goto done;
@@ -190,14 +183,12 @@ time_t xml_parse_dateTime(char* xml_time_str)
 		printf("error: failed to parse time\n");
 		printf("error: failed to parse time\n");
 		return 0;
 		return 0;
 	}
 	}
-	
+
 	h= (h1- '0')*10+ h2- '0';
 	h= (h1- '0')*10+ h2- '0';
 	m= (m1- '0')*10+ m2- '0';
 	m= (m1- '0')*10+ m2- '0';
 
 
 	timezone_diff= sign* ((m+ h* 60)* 60);
 	timezone_diff= sign* ((m+ h* 60)* 60);
 
 
 done:
 done:
-	return (mktime(&tm) + timezone_diff);	
+	return (mktime(&tm) + timezone_diff);
 }
 }
-
-

+ 1 - 6
src/modules/presence_dialoginfo/pidf.h

@@ -1,6 +1,4 @@
 /*
 /*
- * $Id: pidf.h 1401 2006-12-14 11:12:42Z anca_vamanu $
- *
  * presence module - presence server implementation
  * presence module - presence server implementation
  *
  *
  * Copyright (C) 2006 Voice Sistem S.R.L.
  * Copyright (C) 2006 Voice Sistem S.R.L.
@@ -21,9 +19,6 @@
  * along with this program; if not, write to the Free Software
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2006-08-15  initial version (anca)
  */
  */
 
 
 /*! \file
 /*! \file
@@ -50,4 +45,4 @@ char *xmlNodeGetAttrContentByName(xmlNodePtr node, const char *name);
 
 
 time_t xml_parse_dateTime(char* xml_time_str);
 time_t xml_parse_dateTime(char* xml_time_str);
 
 
-#endif 
+#endif

+ 20 - 23
src/modules/presence_dialoginfo/presence_dialoginfo.c

@@ -16,13 +16,10 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2008-08-25  initial version (kd)
  */
  */
 
 
 #include <stdio.h>
 #include <stdio.h>
@@ -56,7 +53,7 @@ int force_dummy_dialog = 0;
 /* module exported commands */
 /* module exported commands */
 static cmd_export_t cmds[] =
 static cmd_export_t cmds[] =
 {
 {
-    {0,	0, 0, 0, 0, 0}
+	{0,	0, 0, 0, 0, 0}
 };
 };
 
 
 /* module exported paramaters */
 /* module exported paramaters */
@@ -68,20 +65,20 @@ static param_export_t params[] = {
 
 
 /* module exports */
 /* module exports */
 struct module_exports exports= {
 struct module_exports exports= {
-    "presence_dialoginfo",		/* module name */
-    DEFAULT_DLFLAGS,			/* dlopen flags */
-    cmds,						/* exported functions */
-    params,						/* exported parameters */
-    0,							/* exported statistics */
-    0,							/* exported MI functions */
-    0,							/* exported pseudo-variables */
-    0,							/* extra processes */
-    mod_init,					/* module initialization function */
-    0,							/* response handling function */
-    0,							/* destroy function */
-    0							/* per-child init function */
+	"presence_dialoginfo",		/* module name */
+	DEFAULT_DLFLAGS,			/* dlopen flags */
+	cmds,						/* exported functions */
+	params,						/* exported parameters */
+	0,							/* exported statistics */
+	0,							/* exported MI functions */
+	0,							/* exported pseudo-variables */
+	0,							/* extra processes */
+	mod_init,					/* module initialization function */
+	0,							/* response handling function */
+	0,							/* destroy function */
+	0							/* per-child init function */
 };
 };
-	
+
 /*
 /*
  * init module function
  * init module function
  */
  */
@@ -107,8 +104,8 @@ static int mod_init(void)
 	}
 	}
 	if(dlginfo_add_events() < 0) {
 	if(dlginfo_add_events() < 0) {
 		LM_ERR("failed to add dialog-info events\n");
 		LM_ERR("failed to add dialog-info events\n");
-		return -1;		
-	}	
-    
-    return 0;
+		return -1;
+	}
+
+	return 0;
 }
 }

+ 2 - 5
src/modules/presence_dialoginfo/presence_dialoginfo.h

@@ -16,13 +16,10 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  * GNU General Public License for more details.
  *
  *
- * You should have received a copy of the GNU General Public License 
- * along with this program; if not, write to the Free Software 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  *
- * History:
- * --------
- *  2008-08-25  initial version (kd)
  */
  */
 
 
 #ifndef _PRES_DLGINFO_H_
 #ifndef _PRES_DLGINFO_H_