diff --git a/opensrs/Ops.php b/opensrs/Ops.php index 09625c19..6fd10ef8 100644 --- a/opensrs/Ops.php +++ b/opensrs/Ops.php @@ -193,6 +193,7 @@ public function XML2PHP($msg) public function encode($array) { ++$this->_MSGCNT; + //$msg_id = $this->_SESSID + $this->_MSGCNT; /* addition removes the leading zero */ $msg_id = ltrim($this->_SESSID.$this->_MSGCNT, '0'); $msg_type = $this->_MSGTYPE_STD; diff --git a/opensrs/RequestFactory.php b/opensrs/RequestFactory.php index f4984eb8..13dd49b7 100644 --- a/opensrs/RequestFactory.php +++ b/opensrs/RequestFactory.php @@ -131,7 +131,10 @@ class RequestFactory 'mailsetdomainblocklist' => 'mail\SetDomainBlockList', 'mailsetdomaindisabledstatus' => 'mail\SetDomainDisabledStatus', 'mailsetdomainmailboxlimits' => 'mail\SetDomainMailboxLimits', - 'accountgetbalance' => 'account\GetBalance' + 'accountgetbalance' => 'account\GetBalance', + // EVENT polling commands + 'eventpoll' => 'event\PollEvent', + 'eventack' => 'event\PollAck', ); public static function build($func, $type, $dataObject) diff --git a/opensrs/backwardcompatibility/dataconversion/event/PollAck.php b/opensrs/backwardcompatibility/dataconversion/event/PollAck.php new file mode 100644 index 00000000..412a5f64 --- /dev/null +++ b/opensrs/backwardcompatibility/dataconversion/event/PollAck.php @@ -0,0 +1,44 @@ + 'data->cookie' + // this will map ->data->cookie in the + // original object to ->cookie in the + // new format + // + // example 2: + // ['attributes']['domain'] = 'data->domain' + // this will map ->data->domain in the original + // to ->attributes->domain in the new format + protected $newStructure = array( + 'attributes' => array( + 'event_id' => 'data->event_id', + ), + ); + + public function convertDataObject($dataObject, $newStructure = null) + { + $p = new parent(); + + if (is_null($newStructure)) { + $newStructure = $this->newStructure; + } + + $newDataObject = $p->convertDataObject($dataObject, $newStructure); + + return $newDataObject; + } +} diff --git a/opensrs/backwardcompatibility/dataconversion/event/PollEvent.php b/opensrs/backwardcompatibility/dataconversion/event/PollEvent.php new file mode 100644 index 00000000..7a0055f4 --- /dev/null +++ b/opensrs/backwardcompatibility/dataconversion/event/PollEvent.php @@ -0,0 +1,44 @@ + 'data->cookie' + // this will map ->data->cookie in the + // original object to ->cookie in the + // new format + // + // example 2: + // ['attributes']['domain'] = 'data->domain' + // this will map ->data->domain in the original + // to ->attributes->domain in the new format + protected $newStructure = array( + 'attributes' => array( + 'limit' => 'data->poll_limit', + ), + ); + + public function convertDataObject($dataObject, $newStructure = null) + { + $p = new parent(); + + if (is_null($newStructure)) { + $newStructure = $this->newStructure; + } + + $newDataObject = $p->convertDataObject($dataObject, $newStructure); + + return $newDataObject; + } +} diff --git a/opensrs/event/PollAck.php b/opensrs/event/PollAck.php new file mode 100644 index 00000000..1e55baf9 --- /dev/null +++ b/opensrs/event/PollAck.php @@ -0,0 +1,38 @@ + array( + 'event_id' + ) + ); + + public function __construct($formatString, $dataObject, $returnFullResponse = true) + { + parent::__construct(); + + $this->_formatHolder = $formatString; + $this->_validateObject($dataObject); + + $this->send($dataObject, $returnFullResponse); + } + + public function __destruct() + { + parent::__destruct(); + } +} diff --git a/opensrs/event/PollEvent.php b/opensrs/event/PollEvent.php new file mode 100644 index 00000000..3600d114 --- /dev/null +++ b/opensrs/event/PollEvent.php @@ -0,0 +1,32 @@ +_formatHolder = $formatString; + $this->_validateObject($dataObject); + + $this->send($dataObject, $returnFullResponse); + } + + public function __destruct() + { + parent::__destruct(); + } +}