8 require_once('include/salmon.php');
9 require_once('include/crypto.php');
10 require_once('include/diaspora.php');
14 function receive_post(&$a) {
16 if($a->argc != 3 || $a->argv[1] !== 'users')
21 $r = q("SELECT * FROM `user` WHERE `guid` = '%s' LIMIT 1",
31 logger('mod-diaspora: new salmon ' . $xml, LOGGER_DATA);
36 $msg = diaspora_decode($importer,$xml);
40 // If we reached this point, the message is good.
41 // Now let's figure out if the author is allowed to send us stuff.
43 $r = q("SELECT * FROM `contact` WHERE `network` = 'dspr' AND ( `url` = '%s' OR `alias` = '%s')
44 AND `uid` = %d LIMIT 1",
47 intval($importer['uid'])
50 logger('mod-diaspora: Author unknown to us.');
53 // is this a follower? Or have we ignored the person?
54 // If so we can not accept this post.
56 if((count($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == CONTACT_IS_FOLLOWER) || ($r[0]['blocked']))) {
57 logger('mod-diaspora: Ignoring this author.');
62 require_once('include/items.php');
64 // Placeholder for hub discovery. We shouldn't find any hubs
65 // since we supplied the fake feed header - and it doesn't have any.
71 * anti-spam measure: consume_feed will accept a follow activity from
72 * this person (and nothing else) if there is no existing contact record.
76 $contact_rec = ((count($r)) ? $r[0] : null);