php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64671
Patch stomp-patch-whitespace-at-eol revision 2013-04-18 18:49 UTC by mi+php at aldan dot algebra dot com
Patch stomp-patch-nack revision 2013-04-18 18:47 UTC by mi+php at aldan dot algebra dot com

Patch stomp-patch-nack for stomp Bug #64671

Patch version 2013-04-18 18:47 UTC

Return to Bug #64671 | Download this patch
Patch Revisions:

Developer: mi+php@aldan.algebra.com

--- php_stomp.c	2012-11-18 17:35:40.000000000 -0500
+++ php_stomp.c	2013-04-18 12:44:57.000000000 -0400
@@ -210,4 +210,5 @@
 	PHP_FE(stomp_abort,             stomp_transaction_args)
 	PHP_FE(stomp_ack,               stomp_ack_args)
+	PHP_FALIAS(stomp_nack, stomp_ack, stomp_ack_args)
 	PHP_FE(stomp_error,             stomp_link_only)
 	PHP_FE(stomp_set_read_timeout,  stomp_set_read_timeout_args)
@@ -231,4 +232,5 @@
 	PHP_FALIAS(abort,           stomp_abort,             stomp_oop_transaction_args)
 	PHP_FALIAS(ack,             stomp_ack,               stomp_oop_ack_args)
+	PHP_FALIAS(nack,            stomp_ack,               stomp_oop_ack_args)
 	PHP_FALIAS(error,           stomp_error,             stomp_no_args)
 	PHP_FALIAS(setReadTimeout,  stomp_set_read_timeout,  stomp_oop_set_read_timeout_args)
@@ -1083,4 +1085,5 @@
 	stomp_frame_t frame = {0}; 
 	int success = 0;
+	const char *argv0;
 
 	if (stomp_object) {
@@ -1088,5 +1091,6 @@
 		if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a!", &msg, &headers) == FAILURE) {
 			return;
-		} 
+		}
+		argv0 = EG(current_execute_data)->function_state.function->common.function_name;
 		FETCH_STOMP_OBJECT;
 	} else {
@@ -1095,8 +1099,13 @@
 			return;
 		}
+		argv0 = EG(current_execute_data)->function_state.function->common.function_name + 6;
 		ZEND_FETCH_RESOURCE(stomp, stomp_t *, &arg, -1, PHP_STOMP_RES_NAME, le_stomp); 
 	}
 
-	INIT_FRAME(frame, "ACK");
+	if (argv0[0] == 'a') {
+		INIT_FRAME(frame, "ACK");
+	} else {
+		INIT_FRAME(frame, "NACK");
+	}
 
 	if (NULL != headers) {
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Feb 25 07:01:26 2020 UTC