3 * StatusNet - the distributed open-source microblogging tool
4 * Copyright (C) 2009-2010, StatusNet, Inc.
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * @package OStatusPlugin
22 * @maintainer Brion Vibber <brion@status.net>
25 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
27 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/');
29 class FeedSubException extends Exception
31 function __construct($msg=null)
33 $type = get_class($this);
35 parent::__construct("$type: $msg");
37 parent::__construct($type);
42 class OStatusPlugin extends Plugin
45 * Hook for RouterInitialized event.
47 * @param Net_URL_Mapper $m path-to-action mapper
48 * @return boolean hook return
50 function onRouterInitialized($m)
53 $m->connect('.well-known/host-meta',
54 array('action' => 'hostmeta'));
55 $m->connect('main/xrd',
56 array('action' => 'userxrd'));
57 $m->connect('main/ownerxrd',
58 array('action' => 'ownerxrd'));
59 $m->connect('main/ostatus',
60 array('action' => 'ostatusinit'));
61 $m->connect('main/ostatus?nickname=:nickname',
62 array('action' => 'ostatusinit'), array('nickname' => '[A-Za-z0-9_-]+'));
63 $m->connect('main/ostatus?group=:group',
64 array('action' => 'ostatusinit'), array('group' => '[A-Za-z0-9_-]+'));
65 $m->connect('main/ostatussub',
66 array('action' => 'ostatussub'));
67 $m->connect('main/ostatusgroup',
68 array('action' => 'ostatusgroup'));
71 $m->connect('main/push/hub', array('action' => 'pushhub'));
73 $m->connect('main/push/callback/:feed',
74 array('action' => 'pushcallback'),
75 array('feed' => '[0-9]+'));
78 $m->connect('main/salmon/user/:id',
79 array('action' => 'usersalmon'),
80 array('id' => '[0-9]+'));
81 $m->connect('main/salmon/group/:id',
82 array('action' => 'groupsalmon'),
83 array('id' => '[0-9]+'));
88 * Set up queue handlers for outgoing hub pushes
89 * @param QueueManager $qm
90 * @return boolean hook return
92 function onEndInitializeQueueManager(QueueManager $qm)
94 // Prepare outgoing distributions after notice save.
95 $qm->connect('ostatus', 'OStatusQueueHandler');
97 // Outgoing from our internal PuSH hub
98 $qm->connect('hubconf', 'HubConfQueueHandler');
99 $qm->connect('hubprep', 'HubPrepQueueHandler');
101 $qm->connect('hubout', 'HubOutQueueHandler');
103 // Outgoing Salmon replies (when we don't need a return value)
104 $qm->connect('salmon', 'SalmonQueueHandler');
106 // Incoming from a foreign PuSH hub
107 $qm->connect('pushin', 'PushInQueueHandler');
112 * Put saved notices into the queue for pubsub distribution.
114 function onStartEnqueueNotice($notice, &$transports)
116 if ($notice->isLocal()) {
117 // put our transport first, in case there's any conflict (like OMB)
118 array_unshift($transports, 'ostatus');
124 * Add a link header for LRDD Discovery
126 function onStartShowHTML($action)
128 if ($action instanceof ShowstreamAction) {
129 $acct = 'acct:'. $action->profile->nickname .'@'. common_config('site', 'server');
130 $url = common_local_url('userxrd');
131 $url.= '?uri='. $acct;
133 header('Link: <'.$url.'>; rel="'. Discovery::LRDD_REL.'"; type="application/xrd+xml"');
138 * Set up a PuSH hub link to our internal link for canonical timeline
139 * Atom feeds for users and groups.
141 function onStartApiAtom($feed)
145 if ($feed instanceof AtomUserNoticeFeed) {
146 $salmonAction = 'usersalmon';
147 $user = $feed->getUser();
149 $profile = $user->getProfile();
150 $feed->setActivitySubject($profile->asActivityNoun('subject'));
151 } else if ($feed instanceof AtomGroupNoticeFeed) {
152 $salmonAction = 'groupsalmon';
153 $group = $feed->getGroup();
155 $feed->setActivitySubject($group->asActivitySubject());
161 $hub = common_config('ostatus', 'hub');
163 // Updates will be handled through our internal PuSH hub.
164 $hub = common_local_url('pushhub');
166 $feed->addLink($hub, array('rel' => 'hub'));
168 // Also, we'll add in the salmon link
169 $salmon = common_local_url($salmonAction, array('id' => $id));
170 $feed->addLink($salmon, array('rel' => Salmon::REL_SALMON));
172 // XXX: these are deprecated
173 $feed->addLink($salmon, array('rel' => Salmon::NS_REPLIES));
174 $feed->addLink($salmon, array('rel' => Salmon::NS_MENTIONS));
181 * Automatically load the actions and libraries used by the plugin
183 * @param Class $cls the class
185 * @return boolean hook return
188 function onAutoload($cls)
190 $base = dirname(__FILE__);
191 $lower = strtolower($cls);
192 $map = array('activityverb' => 'activity',
193 'activityobject' => 'activity',
194 'activityutils' => 'activity');
195 if (isset($map[$lower])) {
196 $lower = $map[$lower];
198 $files = array("$base/classes/$cls.php",
199 "$base/lib/$lower.php");
200 if (substr($lower, -6) == 'action') {
201 $files[] = "$base/actions/" . substr($lower, 0, -6) . ".php";
203 foreach ($files as $file) {
204 if (file_exists($file)) {
213 * Add in an OStatus subscribe button
215 function onStartProfileRemoteSubscribe($output, $profile)
217 $cur = common_current_user();
220 // Add an OStatus subscribe
221 $output->elementStart('li', 'entity_subscribe');
222 $url = common_local_url('ostatusinit',
223 array('nickname' => $profile->nickname));
224 $output->element('a', array('href' => $url,
225 'class' => 'entity_remote_subscribe'),
228 $output->elementEnd('li');
234 function onStartGroupSubscribe($output, $group)
236 $cur = common_current_user();
239 // Add an OStatus subscribe
240 $url = common_local_url('ostatusinit',
241 array('group' => $group->nickname));
242 $output->element('a', array('href' => $url,
243 'class' => 'entity_remote_subscribe'),
251 * Find any explicit remote mentions. Accepted forms:
252 * Webfinger: @user@example.com
253 * Profile link: @example.com/mublog/user
254 * @param Profile $sender (os user?)
255 * @param string $text input markup text
256 * @param array &$mention in/out param: set of found mentions
257 * @return boolean hook return value
260 function onEndFindMentions($sender, $text, &$mentions)
264 // Webfinger matches: @user@example.com
265 if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\-?\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!',
268 PREG_OFFSET_CAPTURE)) {
269 foreach ($wmatches[1] as $wmatch) {
270 list($target, $pos) = $wmatch;
271 $this->log(LOG_INFO, "Checking webfinger '$target'");
273 $oprofile = Ostatus_profile::ensureWebfinger($target);
274 if ($oprofile && !$oprofile->isGroup()) {
275 $profile = $oprofile->localProfile();
276 $matches[$pos] = array('mentioned' => array($profile),
279 'url' => $profile->profileurl);
281 } catch (Exception $e) {
282 $this->log(LOG_ERR, "Webfinger check failed: " . $e->getMessage());
287 // Profile matches: @example.com/mublog/user
288 if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+(?:/\w+)+)!',
291 PREG_OFFSET_CAPTURE)) {
292 foreach ($wmatches[1] as $wmatch) {
293 list($target, $pos) = $wmatch;
294 $schemes = array('http', 'https');
295 foreach ($schemes as $scheme) {
296 $url = "$scheme://$target";
297 $this->log(LOG_INFO, "Checking profile address '$url'");
299 $oprofile = Ostatus_profile::ensureProfileURL($url);
300 if ($oprofile && !$oprofile->isGroup()) {
301 $profile = $oprofile->localProfile();
302 $matches[$pos] = array('mentioned' => array($profile),
305 'url' => $profile->profileurl);
308 } catch (Exception $e) {
309 $this->log(LOG_ERR, "Profile check failed: " . $e->getMessage());
315 foreach ($mentions as $i => $other) {
316 // If we share a common prefix with a local user, override it!
317 $pos = $other['position'];
318 if (isset($matches[$pos])) {
319 $mentions[$i] = $matches[$pos];
320 unset($matches[$pos]);
323 foreach ($matches as $mention) {
324 $mentions[] = $mention;
331 * Allow remote profile references to be used in commands:
332 * sub update@status.net
333 * whois evan@identi.ca
334 * reply http://identi.ca/evan hey what's up
336 * @param Command $command
338 * @param Profile &$profile
339 * @return hook return code
341 function onStartCommandGetProfile($command, $arg, &$profile)
343 $oprofile = $this->pullRemoteProfile($arg);
344 if ($oprofile && !$oprofile->isGroup()) {
345 $profile = $oprofile->localProfile();
353 * Allow remote group references to be used in commands:
354 * join group+statusnet@identi.ca
355 * join http://identi.ca/group/statusnet
356 * drop identi.ca/group/statusnet
358 * @param Command $command
360 * @param User_group &$group
361 * @return hook return code
363 function onStartCommandGetGroup($command, $arg, &$group)
365 $oprofile = $this->pullRemoteProfile($arg);
366 if ($oprofile && $oprofile->isGroup()) {
367 $group = $oprofile->localGroup();
374 protected function pullRemoteProfile($arg)
377 if (preg_match('!^((?:\w+\.)*\w+@(?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+)$!', $arg)) {
380 return Ostatus_profile::ensureWebfinger($arg);
381 } catch (Exception $e) {
382 common_log(LOG_ERR, 'Webfinger lookup failed for ' .
383 $arg . ': ' . $e->getMessage());
387 // Look for profile URLs, with or without scheme:
389 if (preg_match('!^https?://((?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+(?:/\w+)+)$!', $arg)) {
392 if (preg_match('!^((?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+(?:/\w+)+)$!', $arg)) {
393 $schemes = array('http', 'https');
394 foreach ($schemes as $scheme) {
395 $urls[] = "$scheme://$arg";
399 foreach ($urls as $url) {
401 return Ostatus_profile::ensureProfileURL($url);
402 } catch (Exception $e) {
403 common_log(LOG_ERR, 'Profile lookup failed for ' .
404 $arg . ': ' . $e->getMessage());
411 * Make sure necessary tables are filled out.
413 function onCheckSchema() {
414 $schema = Schema::get();
415 $schema->ensureTable('ostatus_profile', Ostatus_profile::schemaDef());
416 $schema->ensureTable('ostatus_source', Ostatus_source::schemaDef());
417 $schema->ensureTable('feedsub', FeedSub::schemaDef());
418 $schema->ensureTable('hubsub', HubSub::schemaDef());
419 $schema->ensureTable('magicsig', Magicsig::schemaDef());
423 function onEndShowStatusNetStyles($action) {
424 $action->cssLink('plugins/OStatus/theme/base/css/ostatus.css');
428 function onEndShowStatusNetScripts($action) {
429 $action->script('plugins/OStatus/js/ostatus.js');
434 * Override the "from ostatus" bit in notice lists to link to the
435 * original post and show the domain it came from.
437 * @param Notice in $notice
438 * @param string out &$name
439 * @param string out &$url
440 * @param string out &$title
441 * @return mixed hook return code
443 function onStartNoticeSourceLink($notice, &$name, &$url, &$title)
445 if ($notice->source == 'ostatus') {
447 $bits = parse_url($notice->url);
448 $domain = $bits['host'];
449 if (substr($domain, 0, 4) == 'www.') {
450 $name = substr($domain, 4);
456 $title = sprintf(_m("Sent from %s via OStatus"), $domain);
464 * Send incoming PuSH feeds for OStatus endpoints in for processing.
466 * @param FeedSub $feedsub
467 * @param DOMDocument $feed
468 * @return mixed hook return code
470 function onStartFeedSubReceive($feedsub, $feed)
472 $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
474 $oprofile->processFeed($feed, 'push');
476 common_log(LOG_DEBUG, "No ostatus profile for incoming feed $feedsub->uri");
481 * Tell the FeedSub infrastructure whether we have any active OStatus
482 * usage for the feed; if not it'll be able to garbage-collect the
485 * @param FeedSub $feedsub
486 * @param integer $count in/out
487 * @return mixed hook return code
489 function onFeedSubSubscriberCount($feedsub, &$count)
491 $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
493 $count += $oprofile->subscriberCount();
499 * When about to subscribe to a remote user, start a server-to-server
500 * PuSH subscription if needed. If we can't establish that, abort.
502 * @fixme If something else aborts later, we could end up with a stray
503 * PuSH subscription. This is relatively harmless, though.
505 * @param Profile $subscriber
506 * @param Profile $other
508 * @return hook return code
512 function onStartSubscribe($subscriber, $other)
514 $user = User::staticGet('id', $subscriber->id);
520 $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
522 if (empty($oprofile)) {
526 if (!$oprofile->subscribe()) {
527 throw new Exception(_m('Could not set up remote subscription.'));
532 * Having established a remote subscription, send a notification to the
533 * remote OStatus profile's endpoint.
535 * @param Profile $subscriber
536 * @param Profile $other
538 * @return hook return code
542 function onEndSubscribe($subscriber, $other)
544 $user = User::staticGet('id', $subscriber->id);
550 $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
552 if (empty($oprofile)) {
556 $act = new Activity();
558 $act->verb = ActivityVerb::FOLLOW;
560 $act->id = TagURI::mint('follow:%d:%d:%s',
563 common_date_iso8601(time()));
566 $act->title = _("Follow");
567 $act->content = sprintf(_("%s is now following %s."),
568 $subscriber->getBestName(),
569 $other->getBestName());
571 $act->actor = ActivityObject::fromProfile($subscriber);
572 $act->object = ActivityObject::fromProfile($other);
574 $oprofile->notifyActivity($act, $subscriber);
580 * Notify remote server and garbage collect unused feeds on unsubscribe.
581 * @fixme send these operations to background queues
584 * @param Profile $other
585 * @return hook return value
587 function onEndUnsubscribe($profile, $other)
589 $user = User::staticGet('id', $profile->id);
595 $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
597 if (empty($oprofile)) {
601 // Drop the PuSH subscription if there are no other subscribers.
602 $oprofile->garbageCollect();
604 $act = new Activity();
606 $act->verb = ActivityVerb::UNFOLLOW;
608 $act->id = TagURI::mint('unfollow:%d:%d:%s',
611 common_date_iso8601(time()));
614 $act->title = _("Unfollow");
615 $act->content = sprintf(_("%s stopped following %s."),
616 $profile->getBestName(),
617 $other->getBestName());
619 $act->actor = ActivityObject::fromProfile($profile);
620 $act->object = ActivityObject::fromProfile($other);
622 $oprofile->notifyActivity($act, $profile);
628 * When one of our local users tries to join a remote group,
629 * notify the remote server. If the notification is rejected,
632 * @param User_group $group
635 * @return mixed hook return value
638 function onStartJoinGroup($group, $user)
640 $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
642 if (!$oprofile->subscribe()) {
643 throw new Exception(_m('Could not set up remote group membership.'));
646 $member = Profile::staticGet($user->id);
648 $act = new Activity();
649 $act->id = TagURI::mint('join:%d:%d:%s',
652 common_date_iso8601(time()));
654 $act->actor = ActivityObject::fromProfile($member);
655 $act->verb = ActivityVerb::JOIN;
656 $act->object = $oprofile->asActivityObject();
659 $act->title = _m("Join");
660 $act->content = sprintf(_m("%s has joined group %s."),
661 $member->getBestName(),
662 $oprofile->getBestName());
664 if ($oprofile->notifyActivity($act, $member)) {
667 $oprofile->garbageCollect();
668 throw new Exception(_m("Failed joining remote group."));
674 * When one of our local users leaves a remote group, notify the remote
677 * @fixme Might be good to schedule a resend of the leave notification
678 * if it failed due to a transitory error. We've canceled the local
679 * membership already anyway, but if the remote server comes back up
680 * it'll be left with a stray membership record.
682 * @param User_group $group
685 * @return mixed hook return value
688 function onEndLeaveGroup($group, $user)
690 $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
692 // Drop the PuSH subscription if there are no other subscribers.
693 $oprofile->garbageCollect();
695 $member = Profile::staticGet($user->id);
697 $act = new Activity();
698 $act->id = TagURI::mint('leave:%d:%d:%s',
701 common_date_iso8601(time()));
703 $act->actor = ActivityObject::fromProfile($member);
704 $act->verb = ActivityVerb::LEAVE;
705 $act->object = $oprofile->asActivityObject();
708 $act->title = _m("Leave");
709 $act->content = sprintf(_m("%s has left group %s."),
710 $member->getBestName(),
711 $oprofile->getBestName());
713 $oprofile->notifyActivity($act, $member);
718 * Notify remote users when their notices get favorited.
720 * @param Profile or User $profile of local user doing the faving
721 * @param Notice $notice being favored
722 * @return hook return value
725 function onEndFavorNotice(Profile $profile, Notice $notice)
727 $user = User::staticGet('id', $profile->id);
733 $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
735 if (empty($oprofile)) {
739 $act = new Activity();
741 $act->verb = ActivityVerb::FAVORITE;
742 $act->id = TagURI::mint('favor:%d:%d:%s',
745 common_date_iso8601(time()));
748 $act->title = _("Favor");
749 $act->content = sprintf(_("%s marked notice %s as a favorite."),
750 $profile->getBestName(),
753 $act->actor = ActivityObject::fromProfile($profile);
754 $act->object = ActivityObject::fromNotice($notice);
756 $oprofile->notifyActivity($act, $profile);
762 * Notify remote users when their notices get de-favorited.
764 * @param Profile $profile Profile person doing the de-faving
765 * @param Notice $notice Notice being favored
767 * @return hook return value
770 function onEndDisfavorNotice(Profile $profile, Notice $notice)
772 $user = User::staticGet('id', $profile->id);
778 $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
780 if (empty($oprofile)) {
784 $act = new Activity();
786 $act->verb = ActivityVerb::UNFAVORITE;
787 $act->id = TagURI::mint('disfavor:%d:%d:%s',
790 common_date_iso8601(time()));
792 $act->title = _("Disfavor");
793 $act->content = sprintf(_("%s marked notice %s as no longer a favorite."),
794 $profile->getBestName(),
797 $act->actor = ActivityObject::fromProfile($profile);
798 $act->object = ActivityObject::fromNotice($notice);
800 $oprofile->notifyActivity($act, $profile);
805 function onStartGetProfileUri($profile, &$uri)
807 $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
808 if (!empty($oprofile)) {
809 $uri = $oprofile->uri;
815 function onStartUserGroupHomeUrl($group, &$url)
817 return $this->onStartUserGroupPermalink($group, $url);
820 function onStartUserGroupPermalink($group, &$url)
822 $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
824 // @fixme this should probably be in the user_group table
825 // @fixme this uri not guaranteed to be a profile page
826 $url = $oprofile->uri;
831 function onStartShowSubscriptionsContent($action)
833 $this->showEntityRemoteSubscribe($action);
838 function onStartShowUserGroupsContent($action)
840 $this->showEntityRemoteSubscribe($action, 'ostatusgroup');
845 function onEndShowSubscriptionsMiniList($action)
847 $this->showEntityRemoteSubscribe($action);
852 function onEndShowGroupsMiniList($action)
854 $this->showEntityRemoteSubscribe($action, 'ostatusgroup');
859 function showEntityRemoteSubscribe($action, $target='ostatussub')
861 $user = common_current_user();
862 if ($user && ($user->id == $action->profile->id)) {
863 $action->elementStart('div', 'entity_actions');
864 $action->elementStart('p', array('id' => 'entity_remote_subscribe',
865 'class' => 'entity_subscribe'));
866 $action->element('a', array('href' => common_local_url($target),
867 'class' => 'entity_remote_subscribe')
869 $action->elementEnd('p');
870 $action->elementEnd('div');
875 * Ping remote profiles with updates to this profile.
876 * Salmon pings are queued for background processing.
878 function onEndBroadcastProfile(Profile $profile)
880 $user = User::staticGet('id', $profile->id);
882 // Find foreign accounts I'm subscribed to that support Salmon pings.
884 // @fixme we could run updates through the PuSH feed too,
885 // in which case we can skip Salmon pings to folks who
886 // are also subscribed to me.
887 $sql = "SELECT * FROM ostatus_profile " .
888 "WHERE profile_id IN " .
889 "(SELECT subscribed FROM subscription WHERE subscriber=%d) " .
891 "(SELECT group_id FROM group_member WHERE profile_id=%d)";
892 $oprofile = new Ostatus_profile();
893 $oprofile->query(sprintf($sql, $profile->id, $profile->id));
895 if ($oprofile->N == 0) {
896 common_log(LOG_DEBUG, "No OStatus remote subscribees for $profile->nickname");
900 $act = new Activity();
902 $act->verb = ActivityVerb::UPDATE_PROFILE;
903 $act->id = TagURI::mint('update-profile:%d:%s',
905 common_date_iso8601(time()));
907 $act->title = _m("Profile update");
908 $act->content = sprintf(_m("%s has updated their profile page."),
909 $profile->getBestName());
911 $act->actor = ActivityObject::fromProfile($profile);
912 $act->object = $act->actor;
914 while ($oprofile->fetch()) {
915 $oprofile->notifyDeferred($act, $profile);
921 function onStartProfileListItemActionElements($item)
923 if (!common_logged_in()) {
925 $profileUser = User::staticGet('id', $item->profile->id);
927 if (!empty($profileUser)) {
929 $output = $item->out;
931 // Add an OStatus subscribe
932 $output->elementStart('li', 'entity_subscribe');
933 $url = common_local_url('ostatusinit',
934 array('nickname' => $profileUser->nickname));
935 $output->element('a', array('href' => $url,
936 'class' => 'entity_remote_subscribe'),
938 $output->elementEnd('li');
945 function onPluginVersion(&$versions)
947 $versions[] = array('name' => 'OStatus',
948 'version' => STATUSNET_VERSION,
949 'author' => 'Evan Prodromou, James Walker, Brion Vibber, Zach Copley',
950 'homepage' => 'http://status.net/wiki/Plugin:OStatus',
952 _m('Follow people across social networks that implement '.
953 '<a href="http://ostatus.org/">OStatus</a>.'));
959 * Utility function to check if the given URL is a canonical group profile
960 * page, and if so return the ID number.
963 * @return mixed int or false
965 public static function localGroupFromUrl($url)
967 $template = common_local_url('groupbyid', array('id' => '31337'));
968 $template = preg_quote($template, '/');
969 $template = str_replace('31337', '(\d+)', $template);
970 if (preg_match("/$template/", $url, $matches)) {
971 return intval($matches[1]);
976 public function onStartProfileGetAtomFeed($profile, &$feed)
978 $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
980 if (empty($oprofile)) {
984 $feed = $oprofile->feeduri;
988 function onStartGetProfileFromURI($uri, &$profile) {
990 // XXX: do discovery here instead (OStatus_profile::ensureProfileURI($uri))
992 $oprofile = Ostatus_profile::staticGet('uri', $uri);
994 if (!empty($oprofile) && !$oprofile->isGroup()) {
995 $profile = $oprofile->localProfile();