+function check_conversations() {
+ $last = get_config('system','ostatus_last_poll');
+
+ $poll_interval = intval(get_config('system','ostatus_poll_interval'));
+ if(! $poll_interval)
+ $poll_interval = OSTATUS_DEFAULT_POLL_INTERVAL;
+
+ if($last) {
+ $next = $last + ($poll_interval * 60);
+ if($next > time()) {
+ logger('complete_conversation: poll intervall not reached');
+ return;
+ }
+ }
+
+ logger('complete_conversation: cron_start');
+
+ $start = date("Y-m-d H:i:s", time() - 86400);
+ $conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'",
+ dbesc($start));
+ foreach ($conversations AS $conversation) {
+ $id = $conversation['oid'];
+ $url = $conversation['url'];
+ complete_conversation($id, $url);
+ }
+
+ logger('complete_conversation: cron_end');
+
+ set_config('system','ostatus_last_poll', time());
+}
+
+function complete_conversation($itemid, $conversation_url, $only_add_conversation = false) {
+ global $a;