aboutsummaryrefslogtreecommitdiffstats
path: root/mod/post.php
blob: ef94c9b5d4cd842f59b932964e39917e4b02c44b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php

/**
 * Zot endpoint
 */


require_once('include/zot.php');
	
function post_post(&$a) {

	$ret = array('result' => false, 'message' => '');

	$msgtype = ((x($_REQUEST,'type')) ? $_REQUEST['type'] : '');

	$hub = zot_gethub($_REQUEST);
	if(! $hub) {
		$result = zot_register_hub($_REQUEST);
		if((! $result) || (! zot_gethub($_REQUEST))) {
			$ret['message'] = 'Hub not available.';
			json_return_and_die($ret);
		}
	}

	// check which hub is primary and take action if mismatched


	if($msgtype === 'refresh') {

		// Need to pass the recipient in the message

		// look up recipient

		// format args
		// $r = zot_refresh($them,$channel);

		return;

	}

	if($msgtype === 'notify') {


		// add to receive queue
		// qreceive_add($_REQUEST);

		$ret['result'] = true;
		json_return_and_die($ret);
	}

}