private function connect()
{
bp_rbe_log('--- Attempting to start new connection... ---');
// if our DB marker says we're already connected, stop now!
// this is an extra precaution
if (bp_rbe_is_connected()) {
bp_rbe_log('--- RBE is already connected! ---');
return false;
}
// Let's open the IMAP stream!
$this->connection = BP_Reply_By_Email_Connect::init();
// couldn't connect :(
if ($this->connection === false) {
bp_rbe_log('Cannot connect: ' . imap_last_error());
bp_rbe_remove_imap_lock();
bp_rbe_remove_imap_connection_marker();
return false;
}
// add an entry in the DB to say that we're connected
//bp_update_option( 'bp_rbe_is_connected', time() + bp_rbe_get_execution_time() );
bp_rbe_add_imap_connection_marker();
bp_rbe_log('--- Connection successful! ---');
return true;
}