diff options
author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2013-04-24 10:38:57 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-04-24 15:19:37 -0500 |
commit | ebb5169a463db9a2e7c552abf87eaf1ac8d086a2 (patch) | |
tree | 1e9846528ac8411432e807c6596fb2439099384a | |
parent | 212971a3a6c7d2b336408f6432218ced55ac36a0 (diff) | |
download | forums-ebb5169a463db9a2e7c552abf87eaf1ac8d086a2.tar forums-ebb5169a463db9a2e7c552abf87eaf1ac8d086a2.tar.gz forums-ebb5169a463db9a2e7c552abf87eaf1ac8d086a2.tar.bz2 forums-ebb5169a463db9a2e7c552abf87eaf1ac8d086a2.tar.xz forums-ebb5169a463db9a2e7c552abf87eaf1ac8d086a2.zip |
[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
-rw-r--r-- | phpBB/includes/functions_messenger.php | 18 | ||||
-rw-r--r-- | phpBB/includes/notification/method/messenger_base.php | 2 |
2 files changed, 19 insertions, 1 deletions
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'], |