/**
* Receive a public Diaspora posting
*
+ * @return void
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
$this->logger->info('Diaspora: Dispatching.');
- Diaspora::dispatchPublic($msg);
+ Diaspora::dispatchPublic($msg, Diaspora::PUSHED);
}
/**
* Receive a Diaspora posting for a user
*
+ * @return void
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
$this->logger->info('Diaspora: Receiving post.');
$importer = User::getByGuid($this->parameters['guid']);
+ if (empty($importer)) {
+ // We haven't found the user.
+ // To avoid the remote system trying again we send the message that we accepted the content.
+ throw new HTTPException\AcceptedException();
+ }
+
+ if ($importer['account-type'] == User::ACCOUNT_TYPE_COMMUNITY) {
+ // Communities aren't working with the Diaspora protoccol
+ // We throw an "accepted" here, so that the sender doesn't repeat the delivery
+ throw new HTTPException\AcceptedException();
+ }
- $msg = $this->decodePost(false, $importer['prvkey'] ?? '');
+ $msg = $this->decodePost(false, $importer['prvkey']);
$this->logger->info('Diaspora: Dispatching.');
* @throws HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- private function decodePost(bool $public = true, string $privKey = '')
+ private function decodePost(bool $public = true, string $privKey = ''): array
{
if (empty($_POST['xml'])) {