[ticket/11454] Add messenger function set_addresses

Automatically fills to/im from a user row

Send messenger the Jabber address if using Jabber notifications

PHPBB3-11454
This commit is contained in:
Nathaniel Guse 2013-04-24 10:38:57 -05:00 committed by Nathan Guse
parent 212971a3a6
commit ebb5169a46
2 changed files with 19 additions and 1 deletions

View file

@ -56,6 +56,24 @@ class messenger
$this->mail_priority = MAIL_NORMAL_PRIORITY; $this->mail_priority = MAIL_NORMAL_PRIORITY;
} }
/**
* Set addresses for to/im as available
*
* @param array $user User row
*/
function set_addresses($user)
{
if ($user['user_email'])
{
$this->to($user['user_email'], ($user['username']) ?: '');
}
if ($user['user_jabber'])
{
$this->im($user['user_jabber'], ($user['username']) ?: '');
}
}
/** /**
* Sets an email address to send to * Sets an email address to send to
*/ */

View file

@ -80,7 +80,7 @@ abstract class phpbb_notification_method_messenger_base extends phpbb_notificati
$messenger->template($template_dir_prefix . $notification->get_email_template(), $user['user_lang']); $messenger->template($template_dir_prefix . $notification->get_email_template(), $user['user_lang']);
$messenger->to($user['user_email'], $user['username']); $messenger->set_addresses($user);
$messenger->assign_vars(array_merge(array( $messenger->assign_vars(array_merge(array(
'USERNAME' => $user['username'], 'USERNAME' => $user['username'],