From ebb5169a463db9a2e7c552abf87eaf1ac8d086a2 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Apr 2013 10:38:57 -0500 Subject: [PATCH] [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 --- phpBB/includes/functions_messenger.php | 18 ++++++++++++++++++ .../notification/method/messenger_base.php | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 821f0d970d..5c0c182f4f 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -55,6 +55,24 @@ class messenger $this->vars = $this->msg = $this->replyto = $this->from = ''; $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 diff --git a/phpBB/includes/notification/method/messenger_base.php b/phpBB/includes/notification/method/messenger_base.php index 2f9073e80b..4966aa94bc 100644 --- a/phpBB/includes/notification/method/messenger_base.php +++ b/phpBB/includes/notification/method/messenger_base.php @@ -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->to($user['user_email'], $user['username']); + $messenger->set_addresses($user); $messenger->assign_vars(array_merge(array( 'USERNAME' => $user['username'],