Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /naja/src/php/rpc/NajaServer/NajaMessage.class.php

naja
Discussion topic

Back to topic list

CVS update: /naja/src/php/rpc/NajaServer/NajaMessage.class.php

Reply

Author pablo_cabrera
Full name Pablo J. Cabrera Munoz
Date 2006-05-27 13:13:37 PDT
Message User: pablo_cabrera
Date: 2006-05-27 13:13:37-0700
Log:
 no message

File Changes:

Directory: /naja/src/php/rpc/NajaServer/
====================​====================​

File [changed]: NajaMessage.class.php
Url: http://naja.tigris.o​rg/source/browse/naj​a/src/php/rpc/NajaSe​rver/NajaMessage.cla​ss.php?r1=1.1&r2​=1.2
Delta lines: +47 -18
---------------------
--- NajaMessage.class.php 2006-05-23 19:39:18-0700 1.1
+++ NajaMessage.class.php 2006-05-27 13:13:35-0700 1.2
@@ -18,6 +18,7 @@
     protected $type;
     protected $message;
     protected $hashMessage;
+ protected $transport;
 
     /**
      * Setters & getters
@@ -118,46 +119,74 @@
         return $this->hashMessage;
     }
 
+ public function setTransport($pValue) {
+ $this->transport = $pValue;
+ }
+
+ public function getTransport() {
+ return $this->transport;
+ }
+
     public function createMessage() {
         $packet = "";
 
- if (!empty($this->module)) {
- $packet .= "<MODULE>".htm​lentities($this-​>module)."</MODUL​E>";
+ $module = $this->module;
+ $method = $this->method;
+ $params = $this->params;
+ $reply = $this->reply;
+ $error = $this->error;
+
+ if ($this->transport == "BASE64") {
+ if (!empty($params)) {
+ foreach (array_keys($params) as $key) {
+ $params[$key] = base64_encode($params[$key]);
+ }
+ }
+
+ $reply = base64_encode($reply);
+ } else if ($this->transport == "URLENCODED") {
+
+ if (!empty($params)) {
+ foreach (array_keys($params) as $key) {
+ $params[$key] = urlencode($params[$key]);
+ }
+ }
+
+ $reply = urlencode($reply);
         }
 
- if (!empty($this->method)) {
- $packet .= "<METHOD>".htm​lentities($this-​>method)."</METHO​D>";
+ if (!empty($module)) {
+ $packet .= "<MODULE>".htm​lentities($module).​"</MODULE>";
         }
 
- if (!empty($this->params)) {
- foreach ($this->params as $param) {
+ if (!empty($method)) {
+ $packet .= "<METHOD>".htm​lentities($method).​"</METHOD>";
+ }
+
+ if (!empty($params)) {
+ foreach ($params as $param) {
                 $packet .= "<PARAM>".html​entities($param)."​</PARAM>";
             }
         }
 
- if (!empty($this->reply)) {
- $packet .= "<REPLY>".html​entities($this->​reply)."</REPLY​>";
+ if (!empty($reply)) {
+ $packet .= "<REPLY>".html​entities($reply)."​</REPLY>";
         }
 
 
- if (!empty($this->error)) {
- $packet .= "<ERROR>".html​entities($this->​error)."</ERROR​>";
+ if (!empty($error)) {
+ $packet .= "<ERROR>".html​entities($error)."​</ERROR>";
         }
 
         $this->hashCode = md5($packet);
 
- $id = "";
- if (!empty($this->id)) {
- $id = 'ID="'.htmlentities(​$this->id).'" ';
- }
-
         $clientId = "";
         if (!empty($this->clientId)) {
             $id = 'CLIENTID="'.htmlent​ities($this->cli​entId).'" ';
         }
 
- $message = '<?xml version="1.0" encoding="UTF-8"?​><MESSAGE '.$id.$clientId;
- $this->hashMessage = '<?xml version="1.0" encoding="UTF-8"?​><MESSAGE '.$id.$clientId.' TYPE="HASHCODE" HASHCODE="'.htmlenti​ties($this->hash​Code).'" />';
+ $message = '<?xml version="1.0" encoding="UTF-8"?​><MESSAGE '.$clientId;
+ $this->hashMessage = '<?xml version="1.0" encoding="UTF-8"?​><MESSAGE '.$clientId.' TYPE="HASHCODE" HASHCODE="'.htmlenti​ties($this->hash​Code).'" />';
 
         $encoding = "PLAIN";
         if (!empty($this->encoding)) {
@@ -176,7 +205,7 @@
 
         $hashCode = $this->hashCode;
 
- $message .= 'ENCODING="'.htmlent​ities($encoding).'"​ RESPONSE="'.htmlenti​ties($response).'" TYPE="'.htmlentities($type).'" HASHCODE="'.htmlenti​ties($hashCode).'" >';
+ $message .= 'ENCODING="'.htmlent​ities($encoding).'"​ RESPONSE="'.htmlenti​ties($response).'" TYPE="'.htmlentities($type).'" HASHCODE="'.htmlenti​ties($hashCode).'" TRANSPORT="'.htmlent​ities($this->tra​nsport).'" >';
         $message .= $packet . '</MESSAGE>';
 
         $this->message = $message;

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /naja/src/php/rpc/NajaServer/NajaMessage.class.php pablo_cabrera Pablo J. Cabrera Munoz 2006-05-27 13:13:37 PDT
Messages per page: