You are here

function messaging_xmpp_send_msg in Messaging 6.3

Same name and namespace in other branches
  1. 6.4 messaging_xmpp/messaging_xmpp.module \messaging_xmpp_send_msg()
  2. 6.2 messaging_xmpp/messaging_xmpp.module \messaging_xmpp_send_msg()

Send message via the xmppframework

Parameters

$destination: Destination JID

$message: Message Object

$params: Extra parameters

1 string reference to 'messaging_xmpp_send_msg'
messaging_xmpp_messaging in messaging_xmpp/messaging_xmpp.module
Implementation of hook_messaging

File

messaging_xmpp/messaging_xmpp.module, line 194
XMPP Messsaging. Messaging method plug-in

Code

function messaging_xmpp_send_msg($destination, $message, $params = array()) {
  if ($conn = messaging_xmpp_connect()) {

    // We can send 'headline' or 'chat'. I get each headline in a different Pidgin chat window,
    // not very practical, so we use 'chat' and a single text with new lines
    $content = $message
      ->render('xmpp');
    $text = messaging_text_build($content, "\n");
    return xmppframework_send_message($destination, 'chat', $text, NULL, $conn);
  }
  else {
    return FALSE;
  }
}