- parent::prepare($args);
- $nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
-
- if (!$this->user) {
- $this->clientError(_('No such user.'));
- return false;
- } else {
- $this->notices = $this->getNotices($this->limit);
- return true;
- }
- }
-
- /**
- * Get notices
- *
- * @param integer $limit max number of notices to return
- *
- * @return array notices
- */
- function getNotices($limit=0)
- {
- $cur = common_current_user();
-
- if (!empty($cur) && $cur->id == $user->id) {
- $notice = $this->user->noticeInbox(0, $limit);
- } else {
- $notice = $this->user->noticesWithFriends(0, $limit);
- }
-
- $user = $this->user;
- $notice = $user->noticesWithFriends(0, $limit);
- $notices = array();
-
- while ($notice->fetch()) {
- $notices[] = clone($notice);
- }
-
- return $notices;
+ $stream = new InboxNoticeStream($this->target);
+ return $stream->getNotices(0, $this->limit)->fetchAll();