Added self-contact check
This commit is contained in:
parent
8d5a95da9b
commit
481ea884f2
1 changed files with 6 additions and 1 deletions
|
@ -51,11 +51,16 @@
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
$peer = $request->getPeer();
|
||||||
|
if($peer->getAddress() == $address)
|
||||||
|
{
|
||||||
|
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Cannot add self as contact');
|
||||||
|
}
|
||||||
|
|
||||||
// Resolve the peer, this would throw a StandardException if something goes wrong
|
// Resolve the peer, this would throw a StandardException if something goes wrong
|
||||||
Socialbox::resolvePeer($address);
|
Socialbox::resolvePeer($address);
|
||||||
|
|
||||||
// Check if the contact already exists
|
// Check if the contact already exists
|
||||||
$peer = $request->getPeer();
|
|
||||||
if(ContactManager::isContact($peer, $address))
|
if(ContactManager::isContact($peer, $address))
|
||||||
{
|
{
|
||||||
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Contact already exists');
|
return $rpcRequest->produceError(StandardError::FORBIDDEN, 'Contact already exists');
|
||||||
|
|
Loading…
Add table
Reference in a new issue