[Freeswitch-svn] [commit] r12292 - in freeswitch/trunk: libs/esl/src src

FreeSWITCH SVN anthm at freeswitch.org
Wed Feb 25 16:38:15 PST 2009


Author: anthm
Date: Wed Feb 25 18:38:14 2009
New Revision: 12292

Log:
missed a spot

Modified:
   freeswitch/trunk/libs/esl/src/esl_event.c
   freeswitch/trunk/src/switch_event.c

Modified: freeswitch/trunk/libs/esl/src/esl_event.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl_event.c	(original)
+++ freeswitch/trunk/libs/esl/src/esl_event.c	Wed Feb 25 18:38:14 2009
@@ -147,7 +147,7 @@
 {
 	*event = NULL;
 
-	if (event_id != ESL_EVENT_CUSTOM && subclass_name) {
+	if ((event_id > 0 && event_id != ESL_EVENT_CUSTOM) && subclass_name) {
 		return ESL_FAIL;
 	}
 
@@ -157,9 +157,10 @@
 
 	memset(*event, 0, sizeof(esl_event_t));
 
-	(*event)->event_id = event_id;
-
-	esl_event_add_header_string(*event, ESL_STACK_BOTTOM, "Event-Name", esl_event_name((*event)->event_id));
+	if (event_id) {
+		(*event)->event_id = event_id;
+		esl_event_add_header_string(*event, ESL_STACK_BOTTOM, "Event-Name", esl_event_name((*event)->event_id));
+	}
 
 	if (subclass_name) {
 		(*event)->subclass_name = DUP(subclass_name);
@@ -389,20 +390,17 @@
 
 ESL_DECLARE(esl_status_t) esl_event_dup(esl_event_t **event, esl_event_t *todup)
 {
-	esl_event_header_t *hp, *hp2;
+	esl_event_header_t *hp;
 
-	if (esl_event_create_subclass(event, todup->event_id, todup->subclass_name) != ESL_SUCCESS) {
+	if (esl_event_create_subclass(event, 0, todup->subclass_name) != ESL_SUCCESS) {
 		return ESL_FAIL;
 	}
 
-	if (todup->subclass_name) {
-		(*event)->subclass_name = DUP(todup->subclass_name);
-	}
+	(*event)->event_id = todup->event_id;
+
 	(*event)->event_user_data = todup->event_user_data;
 	(*event)->bind_user_data = todup->bind_user_data;
 
-	hp2 = (*event)->headers;
-
 	for (hp = todup->headers; hp; hp = hp->next) {
 		esl_event_add_header_string(*event, ESL_STACK_BOTTOM, hp->name, hp->value);
 	}

Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c	(original)
+++ freeswitch/trunk/src/switch_event.c	Wed Feb 25 18:38:14 2009
@@ -598,7 +598,7 @@
 
 	*event = NULL;
 
-	if (event_id != SWITCH_EVENT_CUSTOM && subclass_name) {
+	if ((event_id > 0 && event_id != SWITCH_EVENT_CUSTOM) && subclass_name) {
 		return SWITCH_STATUS_GENERR;
 	}
 
@@ -611,9 +611,10 @@
 
 	memset(*event, 0, sizeof(switch_event_t));
 
-	(*event)->event_id = event_id;
-
-	switch_event_prep_for_delivery_detailed(file, func, line, *event);
+	if (event_id) {
+		(*event)->event_id = event_id;
+		switch_event_prep_for_delivery_detailed(file, func, line, *event);
+	}
 
 	if (subclass_name) {
 		(*event)->subclass_name = DUP(subclass_name);
@@ -810,20 +811,16 @@
 
 SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_event_t *todup)
 {
-	switch_event_header_t *hp, *hp2;
+	switch_event_header_t *hp;
 
-	if (switch_event_create_subclass(event, todup->event_id, todup->subclass_name) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_create_subclass(event, 0, todup->subclass_name) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (todup->subclass_name) {
-		(*event)->subclass_name = DUP(todup->subclass_name);
-	}
+	(*event)->event_id = todup->event_id;
 	(*event)->event_user_data = todup->event_user_data;
 	(*event)->bind_user_data = todup->bind_user_data;
 
-	hp2 = (*event)->headers;
-
 	for (hp = todup->headers; hp; hp = hp->next) {
 		switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, hp->name, hp->value);
 	}



More information about the Freeswitch-svn mailing list