function msg_jabber()
{
global $config, $user, $phpbb_root_path, $phpEx;
if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password'])) {
return false;
}
if (empty($this->addresses['im'])) {
// Send was successful. ;)
return true;
}
$use_queue = false;
if ($config['jab_package_size'] && $this->use_queue) {
if (empty($this->queue)) {
$this->queue = new queue();
$this->queue->init('jabber', $config['jab_package_size']);
}
$use_queue = true;
}
$addresses = array();
foreach ($this->addresses['im'] as $type => $uid_ary) {
$addresses[] = $uid_ary['uid'];
}
$addresses = array_unique($addresses);
if (!$use_queue) {
include_once $phpbb_root_path . 'includes/functions_jabber.' . $phpEx;
$this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']);
if (!$this->jabber->connect()) {
$this->error('JABBER', $user->lang['ERR_JAB_CONNECT'] . '<br />' . $this->jabber->get_log());
return false;
}
if (!$this->jabber->login()) {
$this->error('JABBER', $user->lang['ERR_JAB_AUTH'] . '<br />' . $this->jabber->get_log());
return false;
}
foreach ($addresses as $address) {
$this->jabber->send_message($address, $this->msg, $this->subject);
}
$this->jabber->disconnect();
} else {
$this->queue->put('jabber', array('addresses' => $addresses, 'subject' => $this->subject, 'msg' => $this->msg));
}
unset($addresses);
return true;
}