summaryrefslogtreecommitdiff
path: root/classes/User.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-12 15:35:05 -0500
committerEvan Prodromou <evan@status.net>2009-12-12 15:35:05 -0500
commit138ce0cd05e2e59c79b29f5eeea5c11d1e56e931 (patch)
tree2a6e5a0c2230c8929dc9a8e2d2405184921bfc4d /classes/User.php
parenta3660fbea46be4d9408cd0f824166a75b8c865ab (diff)
add statuses/retweeted_by_me api action
Diffstat (limited to 'classes/User.php')
-rw-r--r--classes/User.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php
index 2a4fab7d4..4b7365fc7 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -741,4 +741,56 @@ class User extends Memcached_DataObject
$profile = $this->getProfile();
return $profile->isSilenced();
}
+
+ function repeatedByMe($offset=0, $limit=20, $since_id=null, $max_id=null)
+ {
+ $ids = Notice::stream(array($this, '_repeatedByMeDirect'),
+ array(),
+ 'user:repeated_by_me:'.$this->id,
+ $offset, $limit, $since_id, $max_id, null);
+
+ return Notice::getStreamByIds($ids);
+ }
+
+ function _repeatedByMeDirect($offset, $limit, $since_id, $max_id, $since)
+ {
+ $notice = new Notice();
+
+ $notice->selectAdd(); // clears it
+ $notice->selectAdd('id');
+
+ $notice->profile_id = $this->id;
+ $notice->whereAdd('repeat_of IS NOT NULL');
+
+ $notice->orderBy('id DESC');
+
+ if (!is_null($offset)) {
+ $notice->limit($offset, $limit);
+ }
+
+ if ($since_id != 0) {
+ $notice->whereAdd('id > ' . $since_id);
+ }
+
+ if ($max_id != 0) {
+ $notice->whereAdd('id <= ' . $max_id);
+ }
+
+ if (!is_null($since)) {
+ $notice->whereAdd('created > \'' . date('Y-m-d H:i:s', $since) . '\'');
+ }
+
+ $ids = array();
+
+ if ($notice->find()) {
+ while ($notice->fetch()) {
+ $ids[] = $notice->id;
+ }
+ }
+
+ $notice->free();
+ $notice = NULL;
+
+ return $ids;
+ }
}