]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Protocol.php
Merge pull request #13704 from MrPetovan/bug/13693-infinite-indentation-level
[friendica.git] / src / Core / Protocol.php
index 98eb386c34aa3936c1b446d9b4261b802c35fbd6..4effa8d74b94eff2aa3f41649bb3d983fa9a70cc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -56,6 +56,8 @@ class Protocol
        const STATUSNET = 'stac';    // Statusnet connector
        const TWITTER   = 'twit';    // Twitter
        const DISCOURSE = 'dscs';    // Discourse
+       const TUMBLR    = 'tmbl';    // Tumblr
+       const BLUESKY   = 'bsky';    // Bluesky
 
        // Dead protocols
        const APPNET    = 'apdn';    // app.net - Dead protocol
@@ -304,4 +306,31 @@ class Protocol
 
                return $hook_data['result'];
        }
+
+       /**
+        * Returns whether the provided protocol supports probing for contacts
+        *
+        * @param $protocol
+        * @return bool
+        * @throws HTTPException\InternalServerErrorException
+        */
+       public static function supportsProbe($protocol): bool
+       {
+               // "Mail" can only be probed for a specific user in a specific condition, so we are ignoring it here.
+               if ($protocol == self::MAIL) {
+                       return false;
+               }
+
+               if (in_array($protocol, array_merge(self::NATIVE_SUPPORT, [self::ZOT, self::PHANTOM]))) {
+                       return true;
+               }
+
+               $hook_data = [
+                       'protocol' => $protocol,
+                       'result' => null
+               ];
+               Hook::callAll('support_probe', $hook_data);
+
+               return $hook_data['result'] === true;
+       }
 }