You are here

function drupalchat_send in DrupalChat 7

Same name and namespace in other branches
  1. 6.2 drupalchat.module \drupalchat_send()
  2. 6 drupalchat.module \drupalchat_send()
  3. 7.2 drupalchat.module \drupalchat_send()

Send messages via ajax

1 string reference to 'drupalchat_send'
drupalchat_menu in ./drupalchat.module
Implements hook_menu().

File

./drupalchat.module, line 725
Module code for DrupalChat.

Code

function drupalchat_send() {
  global $user;
  $message = (object) array(
    'message_id' => check_plain($_POST['drupalchat_message_id']),
    'uid1' => $user->uid ? $user->uid : '0-' . _drupalchat_get_sid(),
    'uid2' => check_plain($_POST['drupalchat_uid2']),
    'message' => $_POST['drupalchat_message'],
    'timestamp' => time(),
  );
  drupal_write_record('drupalchat_msg', $message);
  foreach (module_implements('drupalchat_send') as $module) {
    $function = $module . '_drupalchat_send';
    $function($message);
  }
  drupal_json_output(array());
}