Skip to content

Commit

Permalink
fixup! fix(autoconfig): Refactor DNS query for testing
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Aug 7, 2024
1 parent 8b65f86 commit 4d94485
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 16,566 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/update-public-suffix-list.yml

This file was deleted.

373 changes: 0 additions & 373 deletions LICENSES/MPL-2.0.txt

This file was deleted.

1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"christophwurst/kitinerary-sys": "^0.1.0",
"ezyang/htmlpurifier": "4.14.0",
"gravatarphp/gravatar": "^2.0",
"jeremykendall/php-domain-parser": "^5.7",
"pear-pear.horde.org/horde_date": "^2.4.1@stable",
"pear-pear.horde.org/horde_exception": "^2.0.8@stable",
"pear-pear.horde.org/horde_imap_client": "^2.29.16@stable",
Expand Down
168 changes: 9 additions & 159 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 1 addition & 15 deletions lib/Service/AutoConfig/IspDb.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
namespace OCA\Mail\Service\AutoConfig;

use Exception;
use OCA\Mail\Dns\Resolver;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use Psr\Log\LoggerInterface;
Expand All @@ -42,9 +41,6 @@ class IspDb {
/** @var LoggerInterface */
private $logger;

/** @var Resolver */
private $dnsResolver;

/** @returns string[] */
public function getUrls(): array {
return [
Expand All @@ -55,10 +51,8 @@ public function getUrls(): array {
}

public function __construct(IClientService $clientService,
Resolver $dnsResolver,
LoggerInterface $logger) {
$this->client = $clientService->newClient();
$this->dnsResolver = $dnsResolver;
$this->logger = $logger;
}

Expand Down Expand Up @@ -129,7 +123,7 @@ private function convertServerElement(\SimpleXMLElement $server): array {
* @param bool $tryMx
* @return array
*/
public function query(string $domain, string $email, bool $tryMx = true): array {
public function query(string $domain, string $email): array {
$this->logger->debug("IsbDb: querying <$domain>");
if (strpos($domain, '@') !== false) {
// TODO: use horde mail address parsing instead
Expand All @@ -156,14 +150,6 @@ public function query(string $domain, string $email, bool $tryMx = true): array
}
}
}

if ($tryMx && ($dns = $this->dnsResolver->resolve($domain, DNS_MX))) {
$domain = $dns[0]['target'];
if (!($provider = $this->query($domain, $email, false))) {
[, $domain] = explode('.', $domain, 2);
$provider = $this->query($domain, $email, false);
}
}
return $provider;
}
}
Loading

0 comments on commit 4d94485

Please sign in to comment.