+ $parts = parse_url($uri);
+
+ if (isset($parts["scheme"]) AND isset($parts["host"]) AND isset($parts["path"])) {
+
+ /// @todo: Ports?
+ $host = $parts["host"];
+
+ if ($host == 'twitter.com') {
+ return array("network" => NETWORK_TWITTER);
+ }
+ $lrdd = self::xrd($host);
+
+ $path_parts = explode("/", trim($parts["path"], "/"));
+
+ while (!$lrdd AND (sizeof($path_parts) > 1)) {
+ $host .= "/".array_shift($path_parts);
+ $lrdd = self::xrd($host);
+ }
+ if (!$lrdd) {
+ return self::feed($uri);
+ }
+ $nick = array_pop($path_parts);
+
+ // Mastodon uses a "@" as prefix for usernames in their url format
+ $nick = ltrim($nick, '@');
+
+ $addr = $nick."@".$host;
+ } elseif (strstr($uri, '@')) {