[ticket/17135] Move notify method constants to interface class

PHPBB-17135
This commit is contained in:
rxu 2025-01-06 20:01:52 +07:00
parent 28d5534d06
commit 0d8c0c4228
No known key found for this signature in database
GPG key ID: 955F0567380E586A
21 changed files with 77 additions and 50 deletions

View file

@ -11,6 +11,8 @@
* *
*/ */
use phpbb\messenger\method\messenger_interface;
/** /**
* @ignore * @ignore
*/ */
@ -156,9 +158,9 @@ class acp_email
foreach ($rows as $row) foreach ($rows as $row)
{ {
if (($row['user_notify_type'] == NOTIFY_EMAIL && $row['user_email']) || if (($row['user_notify_type'] == messenger_interface::NOTIFY_EMAIL && $row['user_email']) ||
($row['user_notify_type'] == NOTIFY_IM && $row['user_jabber']) || ($row['user_notify_type'] == messenger_interface::NOTIFY_IM && $row['user_jabber']) ||
($row['user_notify_type'] == NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber']))) ($row['user_notify_type'] == messenger_interface::NOTIFY_BOTH && ($row['user_email'] || $row['user_jabber'])))
{ {
if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type) if ($i == $max_chunk_size || $row['user_lang'] != $old_lang || $row['user_notify_type'] != $old_notify_type)
{ {
@ -228,14 +230,14 @@ class acp_email
foreach ($messenger_collection_iterator as $messenger_method) foreach ($messenger_collection_iterator as $messenger_method)
{ {
$notify_method = $messenger_method->get_id(); $notify_method = $messenger_method->get_id();
if ($notify_method == $used_method || $used_method == NOTIFY_BOTH) if ($notify_method == $used_method || $used_method == messenger_interface::NOTIFY_BOTH)
{ {
$messenger_method->set_use_queue($use_queue); $messenger_method->set_use_queue($use_queue);
$messenger_method->template($email_template, $used_lang); $messenger_method->template($email_template, $used_lang);
$messenger_method->subject(html_entity_decode($subject, ENT_COMPAT)); $messenger_method->subject(html_entity_decode($subject, ENT_COMPAT));
$messenger_method->assign_vars($template_data); $messenger_method->assign_vars($template_data);
if ($notify_method == NOTIFY_EMAIL) if ($notify_method == messenger_interface::NOTIFY_EMAIL)
{ {
for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++) for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++)
{ {
@ -243,7 +245,6 @@ class acp_email
if (count($email_list[$i]) == 1) if (count($email_list[$i]) == 1)
{ {
$messenger_method->to($email_row['email'], $email_row['name']); $messenger_method->to($email_row['email'], $email_row['name']);
} }
else else
{ {
@ -254,7 +255,7 @@ class acp_email
$messenger_method->anti_abuse_headers($config, $user); $messenger_method->anti_abuse_headers($config, $user);
$messenger_method->set_mail_priority($priority); $messenger_method->set_mail_priority($priority);
} }
else if ($notify_method == NOTIFY_IM) else if ($notify_method == messenger_interface::NOTIFY_IM)
{ {
for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++) for ($j = 0, $list_size = count($email_list[$i]); $j < $list_size; $j++)
{ {

View file

@ -207,7 +207,7 @@ class acp_inactive
{ {
foreach ($messenger_collection_iterator as $messenger_method) foreach ($messenger_collection_iterator as $messenger_method)
{ {
if ($messenger_method->get_id() == $user_row['user_notify_type'] || $user_row['user_notify_type'] == NOTIFY_BOTH) if ($messenger_method->get_id() == $user_row['user_notify_type'] || $user_row['user_notify_type'] == $messenger_method::NOTIFY_BOTH)
{ {
$messenger_method->template('user_remind_inactive', $row['user_lang']); $messenger_method->template('user_remind_inactive', $row['user_lang']);
$messenger_method->set_addresses($row); $messenger_method->set_addresses($row);

View file

@ -30,15 +30,10 @@ class acp_jabber
function main($id, $mode) function main($id, $mode)
{ {
global $db, $user, $template, $phpbb_log, $request; global $db, $user, $template, $phpbb_log, $request;
global $config, $phpbb_root_path, $phpEx; global $config, $phpbb_container, $phpbb_root_path, $phpEx;
$user->add_lang('acp/board'); $user->add_lang('acp/board');
if (!class_exists('jabber'))
{
include($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
}
$submit = (isset($_POST['submit'])) ? true : false; $submit = (isset($_POST['submit'])) ? true : false;
if ($mode != 'settings') if ($mode != 'settings')
@ -73,11 +68,11 @@ class acp_jabber
$message = $user->lang['JAB_SETTINGS_CHANGED']; $message = $user->lang['JAB_SETTINGS_CHANGED'];
$log = 'JAB_SETTINGS_CHANGED'; $log = 'JAB_SETTINGS_CHANGED';
// Is this feature enabled? Then try to establish a connection $jabber = $phpbb_container->get('messenger.method.jabber');
if ($jab_enable)
{
$jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl, $jab_verify_peer, $jab_verify_peer_name, $jab_allow_self_signed);
// Is this feature enabled? Then try to establish a connection
if ($jabber->is_enabled())
{
if (!$jabber->connect()) if (!$jabber->connect())
{ {
trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['ERR_JAB_CONNECT'] . '<br /><br />' . $jabber->get_log() . adm_back_link($this->u_action), E_USER_WARNING);
@ -97,12 +92,12 @@ class acp_jabber
// We update the user table to be sure all users that have IM as notify type are set to both as notify type // We update the user table to be sure all users that have IM as notify type are set to both as notify type
// We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled. // We set this to both because users still have their jabber address entered and may want to receive jabber notifications again once it is re-enabled.
$sql_ary = array( $sql_ary = array(
'user_notify_type' => NOTIFY_BOTH, 'user_notify_type' => $jabber::NOTIFY_BOTH,
); );
$sql = 'UPDATE ' . USERS_TABLE . ' $sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_notify_type = ' . NOTIFY_IM; WHERE user_notify_type = ' . $jabber::NOTIFY_IM;
$db->sql_query($sql); $db->sql_query($sql);
} }
@ -137,7 +132,7 @@ class acp_jabber
'JAB_VERIFY_PEER' => $jab_verify_peer, 'JAB_VERIFY_PEER' => $jab_verify_peer,
'JAB_VERIFY_PEER_NAME' => $jab_verify_peer_name, 'JAB_VERIFY_PEER_NAME' => $jab_verify_peer_name,
'JAB_ALLOW_SELF_SIGNED' => $jab_allow_self_signed, 'JAB_ALLOW_SELF_SIGNED' => $jab_allow_self_signed,
'S_CAN_USE_SSL' => jabber::can_use_ssl(), 'S_CAN_USE_SSL' => $jabber::can_use_ssl(),
'S_GTALK_NOTE' => (!@function_exists('dns_get_record')) ? true : false, 'S_GTALK_NOTE' => (!@function_exists('dns_get_record')) ? true : false,
)); ));
} }

View file

@ -16,6 +16,7 @@
*/ */
use phpbb\controller\helper; use phpbb\controller\helper;
use phpbb\messenger\method\messenger_interface;
if (!defined('IN_PHPBB')) if (!defined('IN_PHPBB'))
{ {
@ -1792,9 +1793,9 @@ class acp_users
'MASS_EMAIL' => $data['massemail'], 'MASS_EMAIL' => $data['massemail'],
'ALLOW_PM' => $data['allowpm'], 'ALLOW_PM' => $data['allowpm'],
'HIDE_ONLINE' => $data['hideonline'], 'HIDE_ONLINE' => $data['hideonline'],
'NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, 'NOTIFY_EMAIL' => ($data['notifymethod'] == messenger_interface::NOTIFY_EMAIL) ? true : false,
'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, 'NOTIFY_IM' => ($data['notifymethod'] == messenger_interface::NOTIFY_IM) ? true : false,
'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, 'NOTIFY_BOTH' => ($data['notifymethod'] == messenger_interface::NOTIFY_BOTH) ? true : false,
'NOTIFY_PM' => $data['notifypm'], 'NOTIFY_PM' => $data['notifypm'],
'BBCODE' => $data['bbcode'], 'BBCODE' => $data['bbcode'],
'SMILIES' => $data['smilies'], 'SMILIES' => $data['smilies'],

View file

@ -120,8 +120,11 @@ define('POST_ANNOUNCE', 2);
define('POST_GLOBAL', 3); define('POST_GLOBAL', 3);
// Notify methods // Notify methods
/** @deprecated 4.0.0-a1 Replaced by \phpbb\messenger\method\messenger_interface::NOTIFY_EMAIL, to be removed in 5.0.0-a1 */
define('NOTIFY_EMAIL', 0); define('NOTIFY_EMAIL', 0);
/** @deprecated 4.0.0-a1 Replaced by \phpbb\messenger\method\messenger_interface::NOTIFY_IM, to be removed in 5.0.0-a1 */
define('NOTIFY_IM', 1); define('NOTIFY_IM', 1);
/** @deprecated 4.0.0-a1 Replaced by \phpbb\messenger\method\messenger_interface::NOTIFY_BOTH, to be removed in 5.0.0-a1 */
define('NOTIFY_BOTH', 2); define('NOTIFY_BOTH', 2);
// Notify status // Notify status

View file

@ -11,6 +11,8 @@
* *
*/ */
use phpbb\messenger\method\messenger_interface;
/** /**
* @ignore * @ignore
*/ */
@ -244,7 +246,7 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)
'user_notify' => 0, 'user_notify' => 0,
'user_notify_pm' => 1, 'user_notify_pm' => 1,
'user_notify_type' => NOTIFY_EMAIL, 'user_notify_type' => messenger_interface::NOTIFY_EMAIL,
'user_allow_pm' => 1, 'user_allow_pm' => 1,
'user_allow_viewonline' => 1, 'user_allow_viewonline' => 1,
'user_allow_viewemail' => 1, 'user_allow_viewemail' => 1,

View file

@ -135,7 +135,7 @@ class ucp_activate
$messenger_collection_iterator = $messenger->getIterator(); $messenger_collection_iterator = $messenger->getIterator();
foreach ($messenger_collection_iterator as $messenger_method) foreach ($messenger_collection_iterator as $messenger_method)
{ {
if ($messenger_method->get_id() == $user_row['user_notify_type'] || $user_row['user_notify_type'] == NOTIFY_BOTH) if ($messenger_method->get_id() == $user_row['user_notify_type'] || $user_row['user_notify_type'] == $messenger_method::NOTIFY_BOTH)
{ {
$messenger_method->set_use_queue(false); $messenger_method->set_use_queue(false);
$messenger_method->template('admin_welcome_activated', $user_row['user_lang']); $messenger_method->template('admin_welcome_activated', $user_row['user_lang']);

View file

@ -11,6 +11,8 @@
* *
*/ */
use phpbb\messenger\method\messenger_interface;
/** /**
* @ignore * @ignore
*/ */
@ -52,10 +54,10 @@ class ucp_prefs
'allowpm' => $request->variable('allowpm', (bool) $user->data['user_allow_pm']), 'allowpm' => $request->variable('allowpm', (bool) $user->data['user_allow_pm']),
); );
if ($data['notifymethod'] == NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml'))) if ($data['notifymethod'] == messenger_interface::NOTIFY_IM && (!$config['jab_enable'] || !$user->data['user_jabber'] || !@extension_loaded('xml')))
{ {
// Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct. // Jabber isnt enabled, or no jabber field filled in. Update the users table to be sure its correct.
$data['notifymethod'] = NOTIFY_BOTH; $data['notifymethod'] = messenger_interface::NOTIFY_BOTH;
} }
/** /**
@ -182,9 +184,9 @@ class ucp_prefs
$template->assign_vars([ $template->assign_vars([
'ERROR' => (count($error)) ? implode('<br />', $error) : '', 'ERROR' => (count($error)) ? implode('<br />', $error) : '',
'S_NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, 'S_NOTIFY_EMAIL' => ($data['notifymethod'] == messenger_interface::NOTIFY_EMAIL) ? true : false,
'S_NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, 'S_NOTIFY_IM' => ($data['notifymethod'] == messenger_interface::NOTIFY_IM) ? true : false,
'S_NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, 'S_NOTIFY_BOTH' => ($data['notifymethod'] == messenger_interface::NOTIFY_BOTH) ? true : false,
'S_VIEW_EMAIL' => $data['viewemail'], 'S_VIEW_EMAIL' => $data['viewemail'],
'S_MASS_EMAIL' => $data['massemail'], 'S_MASS_EMAIL' => $data['massemail'],
'S_ALLOW_PM' => $data['allowpm'], 'S_ALLOW_PM' => $data['allowpm'],

View file

@ -11,6 +11,8 @@
* *
*/ */
use phpbb\messenger\method\messenger_interface;
/** /**
* @ignore * @ignore
*/ */
@ -363,11 +365,11 @@ class ucp_profile
{ {
$data['notify'] = $user->data['user_notify_type']; $data['notify'] = $user->data['user_notify_type'];
if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))) if ($data['notify'] == messenger_interface::NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml')))
{ {
// User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled)
// Disable notify by Jabber now for this user. // Disable notify by Jabber now for this user.
$data['notify'] = NOTIFY_EMAIL; $data['notify'] = messenger_interface::NOTIFY_EMAIL;
} }
$sql_ary = array( $sql_ary = array(

View file

@ -139,7 +139,7 @@ class ucp_resend
foreach ($messenger_collection_iterator as $messenger_method) foreach ($messenger_collection_iterator as $messenger_method)
{ {
$messenger_method->set_use_queue(false); $messenger_method->set_use_queue(false);
if ($messenger_method->get_id() == $row['user_notify_type'] || $row['user_notify_type'] == NOTIFY_BOTH) if ($messenger_method->get_id() == $row['user_notify_type'] || $row['user_notify_type'] == $messenger_method::NOTIFY_BOTH)
{ {
$messenger_method->template('admin_activate', $row['user_lang']); $messenger_method->template('admin_activate', $row['user_lang']);
$messenger_method->set_addresses($row); $messenger_method->set_addresses($row);

View file

@ -11,6 +11,8 @@
* *
*/ */
use phpbb\messenger\method\messenger_interface;
/** /**
* NOTE to potential convertor authors. Please use this file to get * NOTE to potential convertor authors. Please use this file to get
* familiar with the structure since we added some bare explanations here. * familiar with the structure since we added some bare explanations here.
@ -936,7 +938,7 @@ if (!$get_info)
array('user_emailtime', 'users.user_emailtime', 'null_to_zero'), array('user_emailtime', 'users.user_emailtime', 'null_to_zero'),
array('user_notify', 'users.user_notify', 'intval'), array('user_notify', 'users.user_notify', 'intval'),
array('user_notify_pm', 'users.user_notify_pm', 'intval'), array('user_notify_pm', 'users.user_notify_pm', 'intval'),
array('user_notify_type', NOTIFY_EMAIL, ''), array('user_notify_type', $messenger_method::NOTIFY_EMAIL, ''),
array('user_allow_pm', 'users.user_allow_pm', 'intval'), array('user_allow_pm', 'users.user_allow_pm', 'intval'),
array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'), array('user_allow_viewonline', 'users.user_allow_viewonline', 'intval'),
array('user_allow_viewemail', 'users.user_viewemail', 'intval'), array('user_allow_viewemail', 'users.user_viewemail', 'intval'),

View file

@ -13,6 +13,8 @@
namespace phpbb\db\migration\data\v310; namespace phpbb\db\migration\data\v310;
use phpbb\messenger\method\messenger_interface;
class notification_options_reconvert extends \phpbb\db\migration\migration class notification_options_reconvert extends \phpbb\db\migration\migration
{ {
public static function depends_on() public static function depends_on()
@ -67,12 +69,12 @@ class notification_options_reconvert extends \phpbb\db\migration\migration
// In-board notification // In-board notification
$notification_methods[] = ''; $notification_methods[] = '';
if ($row['user_notify_type'] == NOTIFY_EMAIL || $row['user_notify_type'] == NOTIFY_BOTH) if ($row['user_notify_type'] == messenger_interface::NOTIFY_EMAIL || $row['user_notify_type'] == messenger_interface::NOTIFY_BOTH)
{ {
$notification_methods[] = 'email'; $notification_methods[] = 'email';
} }
if ($row['user_notify_type'] == NOTIFY_IM || $row['user_notify_type'] == NOTIFY_BOTH) if ($row['user_notify_type'] == messenger_interface::NOTIFY_IM || $row['user_notify_type'] == messenger_interface::NOTIFY_BOTH)
{ {
$notification_methods[] = 'jabber'; $notification_methods[] = 'jabber';
} }

View file

@ -13,6 +13,8 @@
namespace phpbb\message; namespace phpbb\message;
use phpbb\messenger\method\messenger_interface;
/** /**
* Class admin_form * Class admin_form
* Displays a message to the user and allows him to send an email * Displays a message to the user and allows him to send an email
@ -155,7 +157,7 @@ class admin_form extends form
} }
$this->message->set_sender($this->user->ip, $this->sender_name, $this->sender_address, $this->user->lang_name); $this->message->set_sender($this->user->ip, $this->sender_name, $this->sender_address, $this->user->lang_name);
$this->message->set_sender_notify_type(NOTIFY_EMAIL); $this->message->set_sender_notify_type(messenger_interface::NOTIFY_EMAIL);
} }
$this->message->set_template('contact_admin'); $this->message->set_template('contact_admin');
@ -165,7 +167,7 @@ class admin_form extends form
$this->user->lang['ADMINISTRATOR'], $this->user->lang['ADMINISTRATOR'],
$this->config['board_contact'], $this->config['board_contact'],
$this->config['default_lang'], $this->config['default_lang'],
NOTIFY_EMAIL messenger_interface::NOTIFY_EMAIL
); );
$this->message->set_template_vars(array( $this->message->set_template_vars(array(

View file

@ -13,6 +13,8 @@
namespace phpbb\message; namespace phpbb\message;
use phpbb\messenger\method\messenger_interface;
/** /**
* Class message * Class message
* Holds all information for an email and sends it in the end * Holds all information for an email and sends it in the end
@ -46,7 +48,7 @@ class message
/** @var string */ /** @var string */
protected $sender_jabber = ''; protected $sender_jabber = '';
/** @var int */ /** @var int */
protected $sender_notify_type = NOTIFY_EMAIL; protected $sender_notify_type = messenger_interface::NOTIFY_EMAIL;
/** @var array */ /** @var array */
protected $recipients; protected $recipients;
@ -134,7 +136,7 @@ class message
* @param string $recipient_jabber * @param string $recipient_jabber
* @return void * @return void
*/ */
public function add_recipient($recipient_name, $recipient_address, $recipient_lang, $recipient_notify_type = NOTIFY_EMAIL, $recipient_username = '', $recipient_jabber = '') public function add_recipient($recipient_name, $recipient_address, $recipient_lang, $recipient_notify_type = messenger_interface::NOTIFY_EMAIL, $recipient_username = '', $recipient_jabber = '')
{ {
$this->recipients[] = array( $this->recipients[] = array(
'name' => $recipient_name, 'name' => $recipient_name,
@ -250,7 +252,7 @@ class message
foreach ($messenger_collection_iterator as $messenger_method) foreach ($messenger_collection_iterator as $messenger_method)
{ {
$messenger_method->set_use_queue(false); $messenger_method->set_use_queue(false);
if ($messenger_method->get_id() == $recipient['notify_type'] || $recipient['notify_type'] == NOTIFY_BOTH) if ($messenger_method->get_id() == $recipient['notify_type'] || $recipient['notify_type'] == $messenger_method::NOTIFY_BOTH)
{ {
$messenger_method->template($this->template, $recipient['lang']); $messenger_method->template($this->template, $recipient['lang']);
$messenger_method->set_addresses($recipient); $messenger_method->set_addresses($recipient);

View file

@ -13,6 +13,8 @@
namespace phpbb\message; namespace phpbb\message;
use phpbb\messenger\method\messenger_interface;
/** /**
* Class topic_form * Class topic_form
* Form used to send topics as notification emails * Form used to send topics as notification emails
@ -130,9 +132,9 @@ class topic_form extends form
$this->recipient_name, $this->recipient_name,
$this->recipient_address, $this->recipient_address,
$this->recipient_lang, $this->recipient_lang,
NOTIFY_EMAIL messenger_interface::NOTIFY_EMAIL
); );
$this->message->set_sender_notify_type(NOTIFY_EMAIL); $this->message->set_sender_notify_type(messenger_interface::NOTIFY_EMAIL);
parent::submit($messenger); parent::submit($messenger);
} }

View file

@ -75,7 +75,7 @@ class email extends base
*/ */
public function get_id(): int public function get_id(): int
{ {
return NOTIFY_EMAIL; return self::NOTIFY_EMAIL;
} }
/** /**

View file

@ -115,7 +115,7 @@ class jabber extends base
*/ */
public function get_id(): int public function get_id(): int
{ {
return NOTIFY_IM; return self::NOTIFY_IM;
} }
/** /**

View file

@ -18,6 +18,15 @@ namespace phpbb\messenger\method;
*/ */
interface messenger_interface interface messenger_interface
{ {
/** @var int Email notify method used */
public const NOTIFY_EMAIL = 0;
/** @var int Instant messaging (Jabber) notify method used */
public const NOTIFY_IM = 1;
/** @var int Both notify methods used */
public const NOTIFY_BOTH = 2;
/** /**
* Get messenger method id * Get messenger method id
* *

View file

@ -19,6 +19,7 @@ use phpbb\user_loader;
use phpbb\config\config; use phpbb\config\config;
use phpbb\db\driver\driver_interface; use phpbb\db\driver\driver_interface;
use phpbb\di\service_collection; use phpbb\di\service_collection;
use phpbb\messenger\method\messenger_interface;
/** /**
* Email notification method class * Email notification method class
@ -135,7 +136,7 @@ class email extends \phpbb\notification\method\messenger_base
$insert_buffer->flush(); $insert_buffer->flush();
$this->notify_using_messenger(NOTIFY_EMAIL); $this->notify_using_messenger(messenger_interface::NOTIFY_EMAIL);
} }
/** /**

View file

@ -18,6 +18,7 @@ use phpbb\user;
use phpbb\user_loader; use phpbb\user_loader;
use phpbb\config\config; use phpbb\config\config;
use phpbb\di\service_collection; use phpbb\di\service_collection;
use phpbb\messenger\method\messenger_interface;
/** /**
* Jabber notification method class * Jabber notification method class
@ -98,6 +99,6 @@ class jabber extends \phpbb\notification\method\messenger_base
return; return;
} }
$this->notify_using_messenger(NOTIFY_IM, 'short/'); $this->notify_using_messenger(messenger_interface::NOTIFY_IM, 'short/');
} }
} }

View file

@ -67,7 +67,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
/** /**
* Notify using phpBB messenger * Notify using phpBB messenger
* *
* @param int $notify_method Notify method for messenger (e.g. NOTIFY_IM) * @param int $notify_method Notify method for messenger (e.g. \phpbb\messenger\method\messenger_interface::NOTIFY_IM)
* @param string $template_dir_prefix Base directory to prepend to the email template name * @param string $template_dir_prefix Base directory to prepend to the email template name
* *
* @return void * @return void
@ -115,7 +115,7 @@ abstract class messenger_base extends \phpbb\notification\method\base
$messenger_collection_iterator = $this->messenger->getIterator(); $messenger_collection_iterator = $this->messenger->getIterator();
foreach ($messenger_collection_iterator as $messenger_method) foreach ($messenger_collection_iterator as $messenger_method)
{ {
if ($messenger_method->get_id() == $notify_method || $notify_method == NOTIFY_BOTH) if ($messenger_method->get_id() == $notify_method || $notify_method == $messenger_method::NOTIFY_BOTH)
{ {
$messenger_method->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix); $messenger_method->template($notification->get_email_template(), $user['user_lang'], '', $template_dir_prefix);
$messenger_method->set_addresses($user); $messenger_method->set_addresses($user);