From cdc5d0ec1486e437e56330e982613f7e086eac33 Mon Sep 17 00:00:00 2001
From: Nigel Kukard <nkukard@lbsd.net>
Date: Sat, 29 Sep 2012 12:14:22 +0000
Subject: [PATCH] Added basic function to ack a poll message

---
 modules/registrars/cozaepp/cozaepp.php | 29 +++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/modules/registrars/cozaepp/cozaepp.php b/modules/registrars/cozaepp/cozaepp.php
index 0c9fd5b..ce587f8 100644
--- a/modules/registrars/cozaepp/cozaepp.php
+++ b/modules/registrars/cozaepp/cozaepp.php
@@ -790,6 +790,34 @@ function _cozaepp_message($code) {
 }
 
 
+# Ack a POLL message
+function _cozaepp_ackpoll($client,$msgid) {
+	# Ack poll message
+	$output = $client->request('
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+		<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
+	<command>
+		<poll op="ack" msgID="'.$id.'"/>
+	</command>
+</epp>
+');
+	# Check for error
+	if (PEAR::isError($output)) {
+		return $output;
+	}
+
+	# Decipher XML
+	$doc = new DOMDocument();
+	$doc->loadXML($output);
+	$coderes = $doc->getElementsByTagName('result')->item(0)->getAttribute('code');
+
+	# Check result
+	if($coderes != '1301') {
+		return new PEAR_Error("Failed to ACK message $msgid");
+	}
+}
+
+
 # Function to create internal COZA EPP request
 function _cozaepp_Client() {
 	# Setup include dir
@@ -840,7 +868,6 @@ function _cozaepp_Client() {
 				<objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
 			</svcs>
 		</login>
-		<clTRID>RAR-LOGIN-0000001</clTRID>
 	</command>
 </epp>
 ');
-- 
GitLab