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 * Check if we've got remote replies to send via Salmon.
253 * @fixme push webfinger lookup & sending to a background queue
254 * @fixme also detect short-form name for remote subscribees where not ambiguous
257 function onEndNoticeSave($notice)
262 * Find any explicit remote mentions. Accepted forms:
263 * Webfinger: @user@example.com
264 * Profile link: @example.com/mublog/user
265 * @param Profile $sender (os user?)
266 * @param string $text input markup text
267 * @param array &$mention in/out param: set of found mentions
268 * @return boolean hook return value
271 function onEndFindMentions($sender, $text, &$mentions)
275 // Webfinger matches: @user@example.com
276 if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+@(?:\w+\-?\w+\.)*\w+(?:\w+\-\w+)*\.\w+)!',
279 PREG_OFFSET_CAPTURE)) {
280 foreach ($wmatches[1] as $wmatch) {
281 list($target, $pos) = $wmatch;
282 $this->log(LOG_INFO, "Checking webfinger '$target'");
284 $oprofile = Ostatus_profile::ensureWebfinger($target);
285 if ($oprofile && !$oprofile->isGroup()) {
286 $profile = $oprofile->localProfile();
287 $matches[$pos] = array('mentioned' => array($profile),
290 'url' => $profile->profileurl);
292 } catch (Exception $e) {
293 $this->log(LOG_ERR, "Webfinger check failed: " . $e->getMessage());
298 // Profile matches: @example.com/mublog/user
299 if (preg_match_all('!(?:^|\s+)@((?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+(?:/\w+)+)!',
302 PREG_OFFSET_CAPTURE)) {
303 foreach ($wmatches[1] as $wmatch) {
304 list($target, $pos) = $wmatch;
305 $schemes = array('http', 'https');
306 foreach ($schemes as $scheme) {
307 $url = "$scheme://$target";
308 $this->log(LOG_INFO, "Checking profile address '$url'");
310 $oprofile = Ostatus_profile::ensureProfileURL($url);
311 if ($oprofile && !$oprofile->isGroup()) {
312 $profile = $oprofile->localProfile();
313 $matches[$pos] = array('mentioned' => array($profile),
316 'url' => $profile->profileurl);
319 } catch (Exception $e) {
320 $this->log(LOG_ERR, "Profile check failed: " . $e->getMessage());
326 foreach ($mentions as $i => $other) {
327 // If we share a common prefix with a local user, override it!
328 $pos = $other['position'];
329 if (isset($matches[$pos])) {
330 $mentions[$i] = $matches[$pos];
331 unset($matches[$pos]);
334 foreach ($matches as $mention) {
335 $mentions[] = $mention;
342 * Allow remote profile references to be used in commands:
343 * sub update@status.net
344 * whois evan@identi.ca
345 * reply http://identi.ca/evan hey what's up
347 * @param Command $command
349 * @param Profile &$profile
350 * @return hook return code
352 function onStartCommandGetProfile($command, $arg, &$profile)
354 $oprofile = $this->pullRemoteProfile($arg);
355 if ($oprofile && !$oprofile->isGroup()) {
356 $profile = $oprofile->localProfile();
364 * Allow remote group references to be used in commands:
365 * join group+statusnet@identi.ca
366 * join http://identi.ca/group/statusnet
367 * drop identi.ca/group/statusnet
369 * @param Command $command
371 * @param User_group &$group
372 * @return hook return code
374 function onStartCommandGetGroup($command, $arg, &$group)
376 $oprofile = $this->pullRemoteProfile($arg);
377 if ($oprofile && $oprofile->isGroup()) {
378 $group = $oprofile->localGroup();
385 protected function pullRemoteProfile($arg)
388 if (preg_match('!^((?:\w+\.)*\w+@(?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+)$!', $arg)) {
391 return Ostatus_profile::ensureWebfinger($arg);
392 } catch (Exception $e) {
393 common_log(LOG_ERR, 'Webfinger lookup failed for ' .
394 $arg . ': ' . $e->getMessage());
398 // Look for profile URLs, with or without scheme:
400 if (preg_match('!^https?://((?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+(?:/\w+)+)$!', $arg)) {
403 if (preg_match('!^((?:\w+\.)*\w+(?:\w+\-\w+)*\.\w+(?:/\w+)+)$!', $arg)) {
404 $schemes = array('http', 'https');
405 foreach ($schemes as $scheme) {
406 $urls[] = "$scheme://$arg";
410 foreach ($urls as $url) {
412 return Ostatus_profile::ensureProfileURL($url);
413 } catch (Exception $e) {
414 common_log(LOG_ERR, 'Profile lookup failed for ' .
415 $arg . ': ' . $e->getMessage());
422 * Make sure necessary tables are filled out.
424 function onCheckSchema() {
425 $schema = Schema::get();
426 $schema->ensureTable('ostatus_profile', Ostatus_profile::schemaDef());
427 $schema->ensureTable('ostatus_source', Ostatus_source::schemaDef());
428 $schema->ensureTable('feedsub', FeedSub::schemaDef());
429 $schema->ensureTable('hubsub', HubSub::schemaDef());
430 $schema->ensureTable('magicsig', Magicsig::schemaDef());
434 function onEndShowStatusNetStyles($action) {
435 $action->cssLink('plugins/OStatus/theme/base/css/ostatus.css');
439 function onEndShowStatusNetScripts($action) {
440 $action->script('plugins/OStatus/js/ostatus.js');
445 * Override the "from ostatus" bit in notice lists to link to the
446 * original post and show the domain it came from.
448 * @param Notice in $notice
449 * @param string out &$name
450 * @param string out &$url
451 * @param string out &$title
452 * @return mixed hook return code
454 function onStartNoticeSourceLink($notice, &$name, &$url, &$title)
456 if ($notice->source == 'ostatus') {
458 $bits = parse_url($notice->url);
459 $domain = $bits['host'];
460 if (substr($domain, 0, 4) == 'www.') {
461 $name = substr($domain, 4);
467 $title = sprintf(_m("Sent from %s via OStatus"), $domain);
475 * Send incoming PuSH feeds for OStatus endpoints in for processing.
477 * @param FeedSub $feedsub
478 * @param DOMDocument $feed
479 * @return mixed hook return code
481 function onStartFeedSubReceive($feedsub, $feed)
483 $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
485 $oprofile->processFeed($feed, 'push');
487 common_log(LOG_DEBUG, "No ostatus profile for incoming feed $feedsub->uri");
492 * Tell the FeedSub infrastructure whether we have any active OStatus
493 * usage for the feed; if not it'll be able to garbage-collect the
496 * @param FeedSub $feedsub
497 * @param integer $count in/out
498 * @return mixed hook return code
500 function onFeedSubSubscriberCount($feedsub, &$count)
502 $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
504 $count += $oprofile->subscriberCount();
510 * When about to subscribe to a remote user, start a server-to-server
511 * PuSH subscription if needed. If we can't establish that, abort.
513 * @fixme If something else aborts later, we could end up with a stray
514 * PuSH subscription. This is relatively harmless, though.
516 * @param Profile $subscriber
517 * @param Profile $other
519 * @return hook return code
523 function onStartSubscribe($subscriber, $other)
525 $user = User::staticGet('id', $subscriber->id);
531 $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
533 if (empty($oprofile)) {
537 if (!$oprofile->subscribe()) {
538 throw new Exception(_m('Could not set up remote subscription.'));
543 * Having established a remote subscription, send a notification to the
544 * remote OStatus profile's endpoint.
546 * @param Profile $subscriber
547 * @param Profile $other
549 * @return hook return code
553 function onEndSubscribe($subscriber, $other)
555 $user = User::staticGet('id', $subscriber->id);
561 $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
563 if (empty($oprofile)) {
567 $act = new Activity();
569 $act->verb = ActivityVerb::FOLLOW;
571 $act->id = TagURI::mint('follow:%d:%d:%s',
574 common_date_iso8601(time()));
577 $act->title = _("Follow");
578 $act->content = sprintf(_("%s is now following %s."),
579 $subscriber->getBestName(),
580 $other->getBestName());
582 $act->actor = ActivityObject::fromProfile($subscriber);
583 $act->object = ActivityObject::fromProfile($other);
585 $oprofile->notifyActivity($act, $subscriber);
591 * Notify remote server and garbage collect unused feeds on unsubscribe.
592 * @fixme send these operations to background queues
595 * @param Profile $other
596 * @return hook return value
598 function onEndUnsubscribe($profile, $other)
600 $user = User::staticGet('id', $profile->id);
606 $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
608 if (empty($oprofile)) {
612 // Drop the PuSH subscription if there are no other subscribers.
613 $oprofile->garbageCollect();
615 $act = new Activity();
617 $act->verb = ActivityVerb::UNFOLLOW;
619 $act->id = TagURI::mint('unfollow:%d:%d:%s',
622 common_date_iso8601(time()));
625 $act->title = _("Unfollow");
626 $act->content = sprintf(_("%s stopped following %s."),
627 $profile->getBestName(),
628 $other->getBestName());
630 $act->actor = ActivityObject::fromProfile($profile);
631 $act->object = ActivityObject::fromProfile($other);
633 $oprofile->notifyActivity($act, $profile);
639 * When one of our local users tries to join a remote group,
640 * notify the remote server. If the notification is rejected,
643 * @param User_group $group
646 * @return mixed hook return value
649 function onStartJoinGroup($group, $user)
651 $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
653 if (!$oprofile->subscribe()) {
654 throw new Exception(_m('Could not set up remote group membership.'));
657 $member = Profile::staticGet($user->id);
659 $act = new Activity();
660 $act->id = TagURI::mint('join:%d:%d:%s',
663 common_date_iso8601(time()));
665 $act->actor = ActivityObject::fromProfile($member);
666 $act->verb = ActivityVerb::JOIN;
667 $act->object = $oprofile->asActivityObject();
670 $act->title = _m("Join");
671 $act->content = sprintf(_m("%s has joined group %s."),
672 $member->getBestName(),
673 $oprofile->getBestName());
675 if ($oprofile->notifyActivity($act, $member)) {
678 $oprofile->garbageCollect();
679 throw new Exception(_m("Failed joining remote group."));
685 * When one of our local users leaves a remote group, notify the remote
688 * @fixme Might be good to schedule a resend of the leave notification
689 * if it failed due to a transitory error. We've canceled the local
690 * membership already anyway, but if the remote server comes back up
691 * it'll be left with a stray membership record.
693 * @param User_group $group
696 * @return mixed hook return value
699 function onEndLeaveGroup($group, $user)
701 $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
703 // Drop the PuSH subscription if there are no other subscribers.
704 $oprofile->garbageCollect();
706 $member = Profile::staticGet($user->id);
708 $act = new Activity();
709 $act->id = TagURI::mint('leave:%d:%d:%s',
712 common_date_iso8601(time()));
714 $act->actor = ActivityObject::fromProfile($member);
715 $act->verb = ActivityVerb::LEAVE;
716 $act->object = $oprofile->asActivityObject();
719 $act->title = _m("Leave");
720 $act->content = sprintf(_m("%s has left group %s."),
721 $member->getBestName(),
722 $oprofile->getBestName());
724 $oprofile->notifyActivity($act, $member);
729 * Notify remote users when their notices get favorited.
731 * @param Profile or User $profile of local user doing the faving
732 * @param Notice $notice being favored
733 * @return hook return value
736 function onEndFavorNotice(Profile $profile, Notice $notice)
738 $user = User::staticGet('id', $profile->id);
744 $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
746 if (empty($oprofile)) {
750 $act = new Activity();
752 $act->verb = ActivityVerb::FAVORITE;
753 $act->id = TagURI::mint('favor:%d:%d:%s',
756 common_date_iso8601(time()));
759 $act->title = _("Favor");
760 $act->content = sprintf(_("%s marked notice %s as a favorite."),
761 $profile->getBestName(),
764 $act->actor = ActivityObject::fromProfile($profile);
765 $act->object = ActivityObject::fromNotice($notice);
767 $oprofile->notifyActivity($act, $profile);
773 * Notify remote users when their notices get de-favorited.
775 * @param Profile $profile Profile person doing the de-faving
776 * @param Notice $notice Notice being favored
778 * @return hook return value
781 function onEndDisfavorNotice(Profile $profile, Notice $notice)
783 $user = User::staticGet('id', $profile->id);
789 $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
791 if (empty($oprofile)) {
795 $act = new Activity();
797 $act->verb = ActivityVerb::UNFAVORITE;
798 $act->id = TagURI::mint('disfavor:%d:%d:%s',
801 common_date_iso8601(time()));
803 $act->title = _("Disfavor");
804 $act->content = sprintf(_("%s marked notice %s as no longer a favorite."),
805 $profile->getBestName(),
808 $act->actor = ActivityObject::fromProfile($profile);
809 $act->object = ActivityObject::fromNotice($notice);
811 $oprofile->notifyActivity($act, $profile);
816 function onStartGetProfileUri($profile, &$uri)
818 $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
819 if (!empty($oprofile)) {
820 $uri = $oprofile->uri;
826 function onStartUserGroupHomeUrl($group, &$url)
828 return $this->onStartUserGroupPermalink($group, $url);
831 function onStartUserGroupPermalink($group, &$url)
833 $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
835 // @fixme this should probably be in the user_group table
836 // @fixme this uri not guaranteed to be a profile page
837 $url = $oprofile->uri;
842 function onStartShowSubscriptionsContent($action)
844 $this->showEntityRemoteSubscribe($action);
849 function onStartShowUserGroupsContent($action)
851 $this->showEntityRemoteSubscribe($action, 'ostatusgroup');
856 function onEndShowSubscriptionsMiniList($action)
858 $this->showEntityRemoteSubscribe($action);
863 function onEndShowGroupsMiniList($action)
865 $this->showEntityRemoteSubscribe($action, 'ostatusgroup');
870 function showEntityRemoteSubscribe($action, $target='ostatussub')
872 $user = common_current_user();
873 if ($user && ($user->id == $action->profile->id)) {
874 $action->elementStart('div', 'entity_actions');
875 $action->elementStart('p', array('id' => 'entity_remote_subscribe',
876 'class' => 'entity_subscribe'));
877 $action->element('a', array('href' => common_local_url($target),
878 'class' => 'entity_remote_subscribe')
880 $action->elementEnd('p');
881 $action->elementEnd('div');
886 * Ping remote profiles with updates to this profile.
887 * Salmon pings are queued for background processing.
889 function onEndBroadcastProfile(Profile $profile)
891 $user = User::staticGet('id', $profile->id);
893 // Find foreign accounts I'm subscribed to that support Salmon pings.
895 // @fixme we could run updates through the PuSH feed too,
896 // in which case we can skip Salmon pings to folks who
897 // are also subscribed to me.
898 $sql = "SELECT * FROM ostatus_profile " .
899 "WHERE profile_id IN " .
900 "(SELECT subscribed FROM subscription WHERE subscriber=%d) " .
902 "(SELECT group_id FROM group_member WHERE profile_id=%d)";
903 $oprofile = new Ostatus_profile();
904 $oprofile->query(sprintf($sql, $profile->id, $profile->id));
906 if ($oprofile->N == 0) {
907 common_log(LOG_DEBUG, "No OStatus remote subscribees for $profile->nickname");
911 $act = new Activity();
913 $act->verb = ActivityVerb::UPDATE_PROFILE;
914 $act->id = TagURI::mint('update-profile:%d:%s',
916 common_date_iso8601(time()));
918 $act->title = _m("Profile update");
919 $act->content = sprintf(_m("%s has updated their profile page."),
920 $profile->getBestName());
922 $act->actor = ActivityObject::fromProfile($profile);
923 $act->object = $act->actor;
925 while ($oprofile->fetch()) {
926 $oprofile->notifyDeferred($act, $profile);
932 function onStartProfileListItemActionElements($item)
934 if (!common_logged_in()) {
936 $profileUser = User::staticGet('id', $item->profile->id);
938 if (!empty($profileUser)) {
940 $output = $item->out;
942 // Add an OStatus subscribe
943 $output->elementStart('li', 'entity_subscribe');
944 $url = common_local_url('ostatusinit',
945 array('nickname' => $profileUser->nickname));
946 $output->element('a', array('href' => $url,
947 'class' => 'entity_remote_subscribe'),
949 $output->elementEnd('li');
956 function onPluginVersion(&$versions)
958 $versions[] = array('name' => 'OStatus',
959 'version' => STATUSNET_VERSION,
960 'author' => 'Evan Prodromou, James Walker, Brion Vibber, Zach Copley',
961 'homepage' => 'http://status.net/wiki/Plugin:OStatus',
963 _m('Follow people across social networks that implement '.
964 '<a href="http://ostatus.org/">OStatus</a>.'));
970 * Utility function to check if the given URL is a canonical group profile
971 * page, and if so return the ID number.
974 * @return mixed int or false
976 public static function localGroupFromUrl($url)
978 $template = common_local_url('groupbyid', array('id' => '31337'));
979 $template = preg_quote($template, '/');
980 $template = str_replace('31337', '(\d+)', $template);
981 if (preg_match("/$template/", $url, $matches)) {
982 return intval($matches[1]);
987 public function onStartProfileGetAtomFeed($profile, &$feed)
989 $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
991 if (empty($oprofile)) {
995 $feed = $oprofile->feeduri;