function getObjects()
{
global $_DB_DATAOBJECT;
-
$flink = new Foreign_link();
$conn = &$flink->getDatabaseConnection();
$timeline = null;
+ $lastId = Twitter_synch_status::getLastId($flink->user_id, 'home_timeline');
+
try {
- $timeline = $client->statusesHomeTimeline();
+ $timeline = $client->statusesHomeTimeline($lastId);
} catch (Exception $e) {
common_log(LOG_WARNING, $this->name() .
' - Twitter client unable to get friends timeline for user ' .
common_debug(LOG_INFO, $this->name() . ' - Retrieved ' . sizeof($timeline) . ' statuses from Twitter.');
+ $lastSeenId = null;
+
// Reverse to preserve order
foreach (array_reverse($timeline) as $status) {
+ $lastSeenId = $status->id;
+
// Hacktastic: filter out stuff coming from this StatusNet
$source = mb_strtolower(common_config('integration', 'source'));
}
}
+ if (!empty($lastSeenId)) {
+ Twitter_synch_status::setLastId($flink->user_id, 'home_timeline', $lastSeenId);
+ }
+
// Okay, record the time we synced with Twitter for posterity
$flink->last_noticesync = common_sql_now();