function next_confirm() { $confirm = new Confirm_address(); $confirm->whereAdd('claimed IS null'); $confirm->whereAdd('sent IS null'); # XXX: eventually we could do other confirmations in the queue, too $confirm->address_type = 'jabber'; $confirm->orderBy('modified DESC'); $confirm->limit(1); if ($confirm->find(true)) { $this->log(LOG_INFO, 'Claiming confirmation for ' . $confirm->address); # working around some weird DB_DataObject behaviour $confirm->whereAdd(''); # clears where stuff $original = clone $confirm; $confirm->claimed = common_sql_now(); $result = $confirm->update($original); if ($result) { $this->log(LOG_INFO, 'Succeeded in claim! ' . $result); return $confirm; } else { $this->log(LOG_INFO, 'Failed in claim!'); return false; } } return null; }