public function presence($status = null, $show = 'available', $to = null, $type = 'available', $priority = 0)
{
if ($type === 'available') {
$type = '';
}
$to = htmlspecialchars($to);
$status = htmlspecialchars($status);
$show = htmlspecialchars($show);
$type = htmlspecialchars($type);
$priority = htmlspecialchars($priority);
if ($show === 'unavailable') {
$type = 'unavailable';
}
$out = "<presence";
$out .= ' from="' . $this->fulljid . '"';
if ($to) {
$out .= ' to="' . $to . '"';
}
if ($type) {
$out .= ' type="' . $type . '"';
}
$inner = '';
if ($show !== 'available') {
$inner .= "<show>{$show}</show>";
}
if ($status) {
$inner .= "<status>{$status}</status>";
}
if ($priority) {
$inner .= "<priority>{$priority}</priority>";
}
if ($inner === '') {
$out .= "/>";
} else {
$out .= '>' . $inner . '</presence>';
}
$this->sendXML($out);
}