Compare commits
2 commits
f36a7f8563
...
b6aa591f8c
Author | SHA1 | Date | |
---|---|---|---|
b6aa591f8c | |||
2179df3372 |
5 changed files with 12 additions and 12 deletions
|
@ -47,7 +47,7 @@
|
|||
*/
|
||||
public function getDomain(): ?string
|
||||
{
|
||||
return $this->domain;
|
||||
return strtolower($this->domain);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,13 +34,18 @@
|
|||
// Check if host is making the request & the identifier is not empty
|
||||
try
|
||||
{
|
||||
$identifyAs = null;
|
||||
if ($request->getPeer()->getUsername() === ReservedUsernames::HOST->value && $request->getIdentifyAs() !== null)
|
||||
{
|
||||
$identifyAs = $request->getIdentifyAs();
|
||||
}
|
||||
else
|
||||
{
|
||||
$identifyAs = $request->getPeer()->getAddress();
|
||||
$requestingPeer = $request->getPeer();
|
||||
if($requestingPeer->getUsername() !== ReservedUsernames::HOST->value)
|
||||
{
|
||||
$identifyAs = $requestingPeer->getAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (DatabaseOperationException $e)
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
*/
|
||||
public function __construct(string $username, string $domain)
|
||||
{
|
||||
$this->username = $username;
|
||||
$this->domain = $domain;
|
||||
$this->username = strtolower($username);
|
||||
$this->domain = strtolower($domain);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,11 +78,6 @@
|
|||
*/
|
||||
public function isExternal(): bool
|
||||
{
|
||||
if($this->isHost())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->domain !== Configuration::getInstanceConfiguration()->getDomain();
|
||||
}
|
||||
|
||||
|
|
|
@ -978,12 +978,12 @@
|
|||
*/
|
||||
public static function resolvePeer(PeerAddress|string $peerAddress, null|PeerAddress|string $identifiedAs=null): Peer
|
||||
{
|
||||
if($peerAddress->getDomain() !== Configuration::getInstanceConfiguration()->getDomain())
|
||||
if(strtolower($peerAddress->getDomain()) !== strtolower(Configuration::getInstanceConfiguration()->getDomain()))
|
||||
{
|
||||
return self::resolveExternalPeer($peerAddress, $identifiedAs);
|
||||
}
|
||||
|
||||
if($peerAddress->getUsername() === ReservedUsernames::HOST->value)
|
||||
if(strtolower($peerAddress->getUsername()) === strtolower(ReservedUsernames::HOST->value))
|
||||
{
|
||||
return new Peer([
|
||||
'address' => sprintf('%s@%s', ReservedUsernames::HOST->value, Configuration::getInstanceConfiguration()->getDomain()),
|
||||
|
|
|
@ -767,7 +767,7 @@
|
|||
|
||||
$contact = $johnClient->addressBookGetContact($aliceClient->getIdentifiedAs());
|
||||
$this->assertInstanceOf(Contact::class, $contact);
|
||||
$this->assertEquals($aliceClient->getIdentifiedAs(), $contact->getAddress()->getAddress());
|
||||
$this->assertEquals($aliceClient->getIdentifiedAs()->getAddress(), $contact->getAddress()->getAddress());
|
||||
|
||||
$this->expectException(RpcException::class);
|
||||
$johnClient->addressBookGetContact('non-existent@coffee.com');
|
||||
|
|
Loading…
Add table
Reference in a new issue