function messaging_xmpp_user_check in Messaging 6.2
Same name and namespace in other branches
- 6.4 messaging_xmpp/messaging_xmpp.module \messaging_xmpp_user_check()
- 6.3 messaging_xmpp/messaging_xmpp.module \messaging_xmpp_user_check()
Message user callback. Check user destination and availability
Parameters
$params: Array of parameters that can be overridden
- method
- queue
- destination
- log
and some others that cannot
- account
- message
Return value
array() $params with overridden values
See also
1 string reference to 'messaging_xmpp_user_check'
- messaging_xmpp_messaging in messaging_xmpp/
messaging_xmpp.module - Implementation of hook_messaging
File
- messaging_xmpp/
messaging_xmpp.module, line 136 - XMPP Messsaging. Messaging method plug-in
Code
function messaging_xmpp_user_check($params) {
$account = $params['account'];
// If the option is 0 = Send anyway, we do nothing else
if (!empty($account->uid) && ($what = messaging_user_setting('xmpp_offline', $account, 0))) {
// Now we need to know whether the user is online, otherwise just return normal values
if (!xmppframework_get_user_resources($account)) {
// Now we need to decide
if ($what == MESSAGING_XMPP_OFFLINE_QUEUE) {
// Queue for when the user is online
messaging_log('Queueing XMPP message for offline user', array(
'uid' => $account->uid,
));
$params['queue'] = 1;
}
elseif ($what == MESSAGING_XMPP_OFFLINE_DISCARD) {
messaging_log('Discarding XMPP message for offline user', array(
'uid' => $account->uid,
));
// These two should cause the message to be discarded without logging
$params['destination'] = FALSE;
$params['log'] = FALSE;
}
elseif (messaging_method_info($what)) {
messaging_log('Redirecting XMPP message for offline user', array(
'uid' => $account->uid,
'method' => $what,
));
$params['method'] = $what;
}
}
}
return $params;
}