You are here

function casetracker_mail_comment in Case Tracker 5

Implementation of hook_comment().

File

./casetracker_mail.module, line 146
Enables mail sending and Mailhandler integration for Case Tracker.

Code

function casetracker_mail_comment(&$comment, $op) {
  switch ($op) {
    case 'insert':
    case 'update':
      $node = node_load($comment['nid']);

      // checks type and compares existing case meta to submitted.
      if (!in_array($node->type, variable_get('casetracker_case_node_types', array(
        'casetracker_basic_case',
      )), TRUE)) {
        return;

        // if this isn't a casetracker case node type, return without sullying our miserable code. MISERY!
      }

      // NP: 'Caught' from Stu Phillips's album 'Knight Rider: The Stu Phillips Scores: Original Television Soundtrack'.
      casetracker_mail_send($node, $comment);
      break;
    case 'delete':
      db_query('DELETE FROM {casetracker_mail} WHERE cid = %d', $comment->cid);
      break;
  }
}