summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-09-23 17:28:14 -0400
committerEvan Prodromou <evan@status.net>2009-09-23 17:28:14 -0400
commit5152d31d2a4199306d656480ca5ff8d0978d8984 (patch)
tree5e2fedce90dacba856763a1cd55209b6ee533392 /plugins
parent1fe11eabb675fa876bdbcd5884231ffd6fa278ff (diff)
Add some more realtime feeds
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Realtime/RealtimePlugin.php67
1 files changed, 64 insertions, 3 deletions
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index 22851a6c1..0f3e31071 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -107,13 +107,23 @@ class RealtimePlugin extends Plugin
{
$paths = array();
- // XXX: Add other timelines; this is just for the public one
+ // Add to the author's timeline
+
+ $user = User::staticGet('id', $notice->profile_id);
+
+ if (!empty($user)) {
+ $paths[] = array('showstream', $user->nickname);
+ }
+
+ // Add to the public timeline
if ($notice->is_local ||
($notice->is_local == 0 && !common_config('public', 'localonly'))) {
$paths[] = array('public');
}
+ // Add to the tags timeline
+
$tags = $this->getNoticeTags($notice);
if (!empty($tags)) {
@@ -122,6 +132,46 @@ class RealtimePlugin extends Plugin
}
}
+ // Add to inbox timelines
+ // XXX: do a join
+
+ $inbox = new Notice_inbox();
+ $inbox->notice_id = $notice->id;
+
+ if ($inbox->find()) {
+ while ($inbox->fetch()) {
+ $user = User::staticGet('id', $inbox->user_id);
+ $paths[] = array('all', $user->nickname);
+ }
+ }
+
+ // Add to the replies timeline
+
+ $reply = new Reply();
+ $reply->notice_id = $notice->id;
+
+ if ($reply->find()) {
+ while ($reply->fetch()) {
+ $user = User::staticGet('id', $reply->profile_id);
+ if (!empty($user)) {
+ $paths[] = array('replies', $user->nickname);
+ }
+ }
+ }
+
+ // Add to the group timeline
+ // XXX: join
+
+ $gi = new Group_inbox();
+ $gi->notice_id = $notice->id;
+
+ if ($gi->find()) {
+ while ($gi->fetch()) {
+ $ug = User_group::staticGet('id', $gi->group_id);
+ $paths[] = array('showgroup', $ug->nickname);
+ }
+ }
+
if (count($paths) > 0) {
$json = $this->noticeAsJson($notice);
@@ -270,7 +320,9 @@ class RealtimePlugin extends Plugin
$path = null;
$timeline = null;
- switch ($action->trimmed('action')) {
+ $action_name = $action->trimmed('action');
+
+ switch ($action_name) {
case 'public':
$path = array('public');
break;
@@ -280,11 +332,20 @@ class RealtimePlugin extends Plugin
$path = array('tag', $tag);
}
break;
+ case 'showstream':
+ case 'all':
+ case 'replies':
+ case 'showgroup':
+ $nickname = common_canonical_nickname($action->trimmed('nickname'));
+ if (!empty($nickname)) {
+ $path = array($action_name, $nickname);
+ }
+ break;
default:
break;
}
- if (!is_null($path)) {
+ if (!empty($path)) {
$timeline = $this->_pathToChannel($path);
}