function engagements_cron

7.x engagements.module engagements_cron()
6.x engagements.module engagements_cron()

Implements hook_cron

One of the things we want to do is check on all of our SMS messages.

We will also want to check our imap messages

File

modules/engagements/engagements.module, line 1132
This is the primary module file for the engagements module.

Code

function engagements_cron() 
 {



  $last_sms_check = intval(variable_get('engagements_sms_get_all_last_check', 0));
  $last_imap_check = variable_get('engagements_imap_get_all_last_check', 0);



  // only check every X minutes at most.  
  // TODO: Maybe this is a setting?
  $sms_check_against = strtotime("NOW - 30 MINUTES");
  if ($sms_check_against >= $last_sms_check) {
    engagements_sms_get_all_messages(); // refreshes sms information for messages we've sent and received
  }

  // Check for imap messages in a similar way as the SMS messages.
  engagements_imap_get_all_received_messages();
}