diff --git a/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookAddContact.php b/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookAddContact.php index 328599e..df37c61 100644 --- a/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookAddContact.php +++ b/src/Socialbox/Classes/StandardMethods/AddressBook/AddressBookAddContact.php @@ -4,6 +4,7 @@ use InvalidArgumentException; use Socialbox\Abstracts\Method; + use Socialbox\Enums\ReservedUsernames; use Socialbox\Enums\StandardError; use Socialbox\Enums\Types\ContactRelationshipType; use Socialbox\Exceptions\DatabaseOperationException; @@ -54,6 +55,10 @@ { return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Cannot add self as contact'); } + elseif($peer->getUsername() === ReservedUsernames::HOST->value) + { + return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Cannot add host as contact'); + } // Resolve the peer, this would throw a StandardException if something goes wrong Socialbox::resolvePeer($peerAddress);