summaryrefslogtreecommitdiff
path: root/classes/Inbox.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-01-15 10:01:50 -0800
committerBrion Vibber <brion@pobox.com>2010-01-15 10:03:02 -0800
commit963260d2628cdaccd330c47761ebbf972193f15e (patch)
tree0db2a80aa5ea251adc35577214b97117f2768baa /classes/Inbox.php
parent038287c1ffb71207f8028014f20005483364956d (diff)
Fix since_id and max_id API parameters for inbox-based loads; was failing if the exact id mentioned wasn't present in the inbox (or had been trimmed out)
Diffstat (limited to 'classes/Inbox.php')
-rw-r--r--classes/Inbox.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/classes/Inbox.php b/classes/Inbox.php
index 312b4586b..086dba1c9 100644
--- a/classes/Inbox.php
+++ b/classes/Inbox.php
@@ -154,17 +154,23 @@ class Inbox extends Memcached_DataObject
$ids = unpack('N*', $inbox->notice_ids);
if (!empty($since_id)) {
- $i = array_search($since_id, $ids);
- if ($i !== false) {
- $ids = array_slice($ids, 0, $i - 1);
+ $newids = array();
+ foreach ($ids as $id) {
+ if ($id > $since_id) {
+ $newids[] = $id;
+ }
}
+ $ids = $newids;
}
if (!empty($max_id)) {
- $i = array_search($max_id, $ids);
- if ($i !== false) {
- $ids = array_slice($ids, $i - 1);
+ $newids = array();
+ foreach ($ids as $id) {
+ if ($id <= $max_id) {
+ $newids[] = $id;
+ }
}
+ $ids = $newids;
}
$ids = array_slice($ids, $offset, $limit);