aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Zot/Receiver.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-12-07 16:01:54 -0800
committerredmatrix <redmatrix@redmatrix.me>2015-12-07 16:01:54 -0800
commit8b974f8f74f6eefc5955a0f9e385f6460504fc42 (patch)
treef73a10571b7b0487aaa15a574fe8ea29a6dce225 /Zotlabs/Zot/Receiver.php
parent53627c89a716fcd9bac535169710e65b229e96a5 (diff)
downloadvolse-hubzilla-8b974f8f74f6eefc5955a0f9e385f6460504fc42.tar.gz
volse-hubzilla-8b974f8f74f6eefc5955a0f9e385f6460504fc42.tar.bz2
volse-hubzilla-8b974f8f74f6eefc5955a0f9e385f6460504fc42.zip
abstract the message handlers
Diffstat (limited to 'Zotlabs/Zot/Receiver.php')
-rw-r--r--Zotlabs/Zot/Receiver.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/Zotlabs/Zot/Receiver.php b/Zotlabs/Zot/Receiver.php
index b4d5d5ef6..6a11bcde0 100644
--- a/Zotlabs/Zot/Receiver.php
+++ b/Zotlabs/Zot/Receiver.php
@@ -12,14 +12,17 @@ class Receiver {
protected $validated;
protected $recipients;
protected $response;
+ protected $handler;
- function __construct($data,$prvkey) {
+ function __construct($data,$prvkey,$handler) {
$this->error = false;
$this->validated = false;
$this->messagetype = '';
$this->response = array('success' => false);
+ $this->handler = $handler;
+
if(! is_array($data))
$data = json_decode($data,true);
@@ -76,11 +79,11 @@ class Receiver {
switch($this->messagetype) {
case 'ping':
/* no validation needed */
- zot_reply_ping();
+ $this->handler->Ping();
break;
case 'pickup':
/* perform site validation, as opposed to sender validation */
- zot_reply_pickup($this->data);
+ $this->handler->Pickup($this->data);
break;
default:
@@ -96,24 +99,24 @@ class Receiver {
switch($this->messagetype) {
case 'auth_check':
- zot_reply_auth_check($this->data,$this->encrypted);
+ $this->handler->AuthCheck($this->data,$this->encrypted);
break;
case 'request':
- json_return_and_die(zot_process_message_request($this->data));
+ $this->handler->Request($this->data);
break;
case 'purge':
- zot_reply_purge($this->sender,$this->recipients);
+ $this->handler->Purge($this->sender,$this->recipients);
break;
case 'refresh':
case 'force_refresh':
- zot_reply_refresh($this->sender,$this->recipients);
+ $this->handler->Refresh($this->sender,$this->recipients);
break;
case 'notify':
- zot_reply_notify($this->data);
+ $this->handler->Notify($this->data);
break;
default: