Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/bp-better-messages/addons/ai/ai.php
+++ b/bp-better-messages/addons/ai/ai.php
@@ -609,7 +609,7 @@
}
}
- public function bot_user_changed( $user_id )
+ public function bot_user_changed( $user_id, $bot_id = null )
{
$user_id = (int) $user_id;
@@ -617,10 +617,28 @@
return;
}
+ if ( null === $bot_id ) {
+ $bot_users = $this->bot_users( true );
+ $bot_id = isset( $bot_users[ $user_id ] ) ? $bot_users[ $user_id ] : 0;
+ }
+
+ $this->forget_bot_user_cache( $bot_id, $user_id );
+
Better_Messages()->users->update_last_changed( $user_id );
do_action( 'better_messages_user_updated', $user_id );
}
+ public function forget_bot_user_cache( $bot_id, $guest_id = 0 )
+ {
+ if ( (int) $bot_id > 0 ) {
+ wp_cache_delete( 'bot_user_' . (int) $bot_id, 'bm_messages' );
+ }
+
+ if ( (int) $guest_id !== 0 ) {
+ wp_cache_delete( 'guest_user_' . absint( $guest_id ), 'bm_messages' );
+ }
+ }
+
public function is_bot_conversation( $bot_id, $thread_id )
{
$bot_thread_id = Better_Messages()->functions->get_thread_meta( $thread_id, 'ai_bot_thread' );
@@ -1710,8 +1728,6 @@
$params = $request->get_json_params();
- $answered = $this->bot_can_answer( $bot_id );
-
if ( isset( $params['name'] ) ) {
$name = sanitize_text_field( $params['name'] );
if ( ! empty( $name ) ) {
@@ -1781,7 +1797,7 @@
$bot_user = $this->get_bot_user( $bot_id );
- if ( $bot_user && $this->bot_can_answer( $bot_id ) !== $answered ) {
+ if ( $bot_user ) {
$this->bot_user_changed( -1 * absint( $bot_user->id ) );
}
@@ -4136,7 +4152,6 @@
if( isset( $_POST['bm'] ) && is_array($_POST['bm']) ){
$old_settings = $this->get_bot_settings( $post->ID );
- $answered = $this->bot_can_answer( $post->ID );
$settings = (array) $_POST['bm'];
@@ -4189,7 +4204,7 @@
$bot_user = $this->get_bot_user( $post->ID );
- if ( $bot_user && $this->bot_can_answer( $post->ID ) !== $answered ) {
+ if ( $bot_user ) {
$this->bot_user_changed( -1 * absint( $bot_user->id ) );
}
}
@@ -4220,6 +4235,8 @@
public function create_or_update_bot_user( $bot_id, $name )
{
+ $this->forget_bot_user_cache( $bot_id );
+
$bot = $this->get_bot_user( $bot_id );
if( $bot ){
@@ -4227,6 +4244,8 @@
global $wpdb;
$wpdb->update( bm_get_table('guests'), ['name' => $name], ['id' => $bot->id] );
+ $this->forget_bot_user_cache( $bot_id, $bot->id );
+ Better_Messages()->users->update_last_changed( absint($bot->id) * -1 );
do_action( 'better_messages_guest_updated', absint($bot->id) * -1 );
do_action( 'better_messages_user_updated', absint($bot->id) * -1 );
}
@@ -4422,18 +4441,9 @@
private function check_mention_trigger( $message, $sender_id )
{
- $content = $message->message;
+ $tokens = Better_Messages()->mentions->parse_tokens( $message->message );
- $mention_match = '<span class="bm-mention" data-user-id="';
- preg_match_all( '/' . preg_quote( $mention_match, '/' ) . '(-?d+)"/', $content, $matches );
-
- if ( empty( $matches[1] ) ) {
- return;
- }
-
- $mentioned_ids = array_unique( array_map( 'intval', $matches[1] ) );
-
- foreach ( $mentioned_ids as $mentioned_user_id ) {
+ foreach ( $tokens['ids'] as $mentioned_user_id ) {
if ( $mentioned_user_id >= 0 ) {
continue;
}
@@ -4505,16 +4515,10 @@
return;
}
- $content = $message->message;
- $mention_match = '<span class="bm-mention" data-user-id="';
- preg_match_all( '/' . preg_quote( $mention_match, '/' ) . '(-?d+)"/', $content, $matches );
-
- if ( ! empty( $matches[1] ) ) {
- $mentioned_ids = array_unique( array_map( 'intval', $matches[1] ) );
- $bot_user_id = $replied_sender_id;
- if ( in_array( $bot_user_id, $mentioned_ids ) ) {
- return;
- }
+ $tokens = Better_Messages()->mentions->parse_tokens( $message->message );
+
+ if ( in_array( $replied_sender_id, $tokens['ids'] ) ) {
+ return;
}
$this->trigger_bot_response( $bot_id, $message, $sender_id );
@@ -5028,7 +5032,7 @@
if ( is_string( $message->message ) && class_exists( 'Better_Messages_E2E_Encryption' ) && strpos( $message->message, Better_Messages_E2E_Encryption::E2E_PREFIX ) === 0 ) {
$message_preview = _x( 'Encrypted message', 'AI Moderation', 'bp-better-messages' );
} else {
- $message_preview = wp_trim_words( strip_tags( $message->message ), 50 );
+ $message_preview = wp_trim_words( strip_tags( Better_Messages_Mentions::mentions_as_names( $message->message ) ), 50 );
}
$body = sprintf( _x( 'Sender: %s (ID: %d)', 'AI Moderation', 'bp-better-messages' ), $sender_name, $sender_id ) . "n";
@@ -5056,11 +5060,7 @@
$body .= "n" . _x( 'Note: This message was sent to the recipient but flagged for review.', 'AI Moderation', 'bp-better-messages' ) . "nn";
$body .= sprintf( _x( 'Review in moderation panel: %s', 'AI Moderation', 'bp-better-messages' ), $admin_url );
- foreach( $email_list as $email ) {
- if( is_email( $email ) ) {
- wp_mail( $email, $subject, $body );
- }
- }
+ Better_Messages()->moderation->send_plain_email( array_filter( $email_list, 'is_email' ), $subject, $body );
}
public function transcribe_voice_message( WP_REST_Request $request )
--- a/bp-better-messages/addons/ai/api/provider-interface.php
+++ b/bp-better-messages/addons/ai/api/provider-interface.php
@@ -987,7 +987,7 @@
};
$text = preg_replace_callback(
- '/<span class="bm-mention" data-user-id="(-?d+|all)">(@[^&]*)</span>/',
+ '/' . Better_Messages_Mentions::stored_span_pattern( '(-?d+|all)' ) . '>(@[^&]*)</span>/',
$callback,
$text
);
--- a/bp-better-messages/addons/mentions.php
+++ b/bp-better-messages/addons/mentions.php
@@ -13,6 +13,8 @@
const MAX_PER_THREAD = 50;
+ const STORED_QUOTE = '(?:"|")';
+
private $targets = array();
public static function instance()
@@ -89,16 +91,28 @@
return Better_Messages()->functions->can_moderate_thread( $thread_id, $user_id );
}
+ public static function stored_span_pattern( $user_id_pattern )
+ {
+ $quote = self::STORED_QUOTE;
+
+ return "<span class={$quote}bm-mention{$quote} data-user-id={$quote}{$user_id_pattern}{$quote}";
+ }
+
+ public static function mentions_as_names( $content )
+ {
+ return preg_replace( '/' . self::stored_span_pattern( '[^&"]*' ) . '>(.*?)</span>/s', '$1', (string) $content );
+ }
+
public static function strip_mention_all( $content )
{
- $content = preg_replace( '/<span class="bm-mention" data-user-id="all">(.*?)</span>/s', '$1', (string) $content );
+ $content = preg_replace( '/' . self::stored_span_pattern( 'all' ) . '>(.*?)</span>/s', '$1', (string) $content );
- return str_replace( 'data-user-id="all"', '', $content );
+ return str_replace( array( 'data-user-id="all"', 'data-user-id="all"' ), '', $content );
}
private function contains_mention_all( $content )
{
- return is_string( $content ) && strpos( $content, 'data-user-id="all"' ) !== false;
+ return is_string( $content ) && ( strpos( $content, 'data-user-id="all"' ) !== false || strpos( $content, 'data-user-id="all"' ) !== false );
}
public function enforce_mention_all_on_send( $message )
@@ -144,7 +158,7 @@
return self::strip_mention_all( $content );
}
- if ( strpos( (string) $message->message, 'data-user-id="all"' ) === false && ! $this->can_mention_all( (int) $message->thread_id, (int) $message->sender_id ) ) {
+ if ( ! $this->contains_mention_all( (string) $message->message ) && ! $this->can_mention_all( (int) $message->thread_id, (int) $message->sender_id ) ) {
return self::strip_mention_all( $content );
}
@@ -153,7 +167,7 @@
public static function token_pattern()
{
- return '/<span class="bm-mention" data-user-id="(all|-?[0-9]{1,19})"/';
+ return '/' . self::stored_span_pattern( '(all|-?[0-9]{1,19})' ) . '/';
}
public static function types_sql( $types )
--- a/bp-better-messages/addons/privacy.php
+++ b/bp-better-messages/addons/privacy.php
@@ -74,7 +74,7 @@
$data = array(
array(
'name' => __( 'Message', 'bp-better-messages' ),
- 'value' => wp_strip_all_tags( $message->message ),
+ 'value' => wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $message->message ) ),
),
array(
'name' => __( 'Date Sent', 'bp-better-messages' ),
--- a/bp-better-messages/addons/urls.php
+++ b/bp-better-messages/addons/urls.php
@@ -85,6 +85,7 @@
$links = array();
$wrap_token = function( $url ) use ( &$links ) {
+ $url = $this->encode_for_message( $url );
return '<' . array_push( $links, '<a target="_blank" href="' . $url . '">' . $url . '</a>' ) . '>';
};
@@ -251,6 +252,11 @@
}
+ public function encode_for_message( $text )
+ {
+ return htmlspecialchars( (string) $text, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8', true );
+ }
+
public function render_nice_link( $message_id, $url, $info )
{
if ( $info == '404' || empty( $info[ 'title' ] ) ) {
@@ -258,12 +264,12 @@
}
ob_start();
?>
- <a href="<?php echo $url; ?>" target="_blank" class="url-wrap">
+ <a href="<?php echo $this->encode_for_message( $url ); ?>" target="_blank" class="url-wrap">
<?php
?>
<span class="url-description">
- <span class="url-title"><?php echo esc_attr( $info[ 'title' ] ); ?></span>
- <span class="url-site"><?php echo esc_attr( $info[ 'site' ] ); ?></span>
+ <span class="url-title"><?php echo $this->encode_for_message( $info[ 'title' ] ); ?></span>
+ <span class="url-site"><?php echo $this->encode_for_message( $info[ 'site' ] ); ?></span>
</span>
</a>
<?php
--- a/bp-better-messages/addons/woocommerce.php
+++ b/bp-better-messages/addons/woocommerce.php
@@ -537,7 +537,7 @@
return $matches[0];
}
- $post_id = url_to_postid( $url );
+ $post_id = url_to_postid( html_entity_decode( $url, ENT_QUOTES ) );
if ( ! $post_id || get_post_type( $post_id ) !== 'product' ) {
return $matches[0];
}
--- a/bp-better-messages/assets/js/modules/versions.php
+++ b/bp-better-messages/assets/js/modules/versions.php
@@ -1,2 +1,2 @@
<?php
-return array('main'=>'1020e395','emoji-smile2emoji'=>'251ae47a','sounds'=>'1023d666','transcode-core'=>'81dc5fc1','tus'=>'2dececb8','emoji-picker'=>'35c9179c','lightbox'=>'92b51ea1','map-leaflet-osm'=>'fd67dc61','cropper'=>'9725cbad','transcode-heif'=>'b6e533ce','leaflet'=>'e916cb4c','deps'=>'dc64dab9','react'=>'b94ade6a','_built'=>1793656366);
+return array('main'=>'b4ab9449','emoji-smile2emoji'=>'251ae47a','sounds'=>'1023d666','transcode-core'=>'81dc5fc1','tus'=>'184b406d','emoji-picker'=>'35c9179c','lightbox'=>'92b51ea1','map-leaflet-osm'=>'fd67dc61','cropper'=>'9725cbad','transcode-heif'=>'b6e533ce','leaflet'=>'e916cb4c','deps'=>'dc64dab9','react'=>'b94ade6a','_built'=>1794006830);
--- a/bp-better-messages/assets/js/workers/versions.php
+++ b/bp-better-messages/assets/js/workers/versions.php
@@ -1,2 +1,2 @@
<?php
-return array('bmdb-shared'=>'62e83db3','bmdb'=>'990ccd56','transcode-ffmpeg-worker'=>'de6e5f21','transcode-ffmpeg'=>'749633fe','transcode-heif'=>'1adfa8ba','transcoder'=>'a3e4ecc5');
+return array('bmdb-shared'=>'769e0248','bmdb'=>'ab86f4d1','transcode-ffmpeg-worker'=>'de6e5f21','transcode-ffmpeg'=>'749633fe','transcode-heif'=>'1adfa8ba','transcoder'=>'4d4fcef9');
--- a/bp-better-messages/bp-better-messages.php
+++ b/bp-better-messages/bp-better-messages.php
@@ -4,7 +4,7 @@
Plugin Name: Better Messages
Plugin URI: https://www.wordplus.org
Description: Realtime private messaging system for WordPress
- Version: 3.2.1
+ Version: 3.2.2
Author: WordPlus
Author URI: https://www.wordplus.org
Requires PHP: 7.4
@@ -18,7 +18,7 @@
if ( ! class_exists( 'Better_Messages' ) ) {
class Better_Messages
{
- public $version = '3.2.1';
+ public $version = '3.2.2';
public $db_version = '3.0.0';
--- a/bp-better-messages/inc/abilities/conversations.php
+++ b/bp-better-messages/inc/abilities/conversations.php
@@ -102,7 +102,7 @@
$last_messages = Better_Messages()->functions->get_messages( $tid, false, 'last_messages', 1 );
if ( ! empty( $last_messages ) && is_array( $last_messages ) ) {
$msg = $last_messages[0];
- $last_message = wp_strip_all_tags( $msg->message );
+ $last_message = wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $msg->message ) );
if ( strlen( $last_message ) > 100 ) {
$last_message = mb_substr( $last_message, 0, 100 ) . '...';
}
@@ -232,7 +232,7 @@
'message_id' => intval( $msg->id ),
'sender_id' => intval( $msg->sender_id ),
'sender_name' => Better_Messages()->functions->get_name( $msg->sender_id ),
- 'content' => wp_strip_all_tags( $msg->message ),
+ 'content' => wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $msg->message ) ),
'created_at' => date( 'c', (int) ( (int) $msg->created_at / 10 / 1000 ) ),
);
}
--- a/bp-better-messages/inc/abilities/messaging.php
+++ b/bp-better-messages/inc/abilities/messaging.php
@@ -186,7 +186,7 @@
'message_id' => intval( $msg->id ),
'sender_id' => intval( $msg->sender_id ),
'sender_name' => Better_Messages()->functions->get_name( $msg->sender_id ),
- 'content' => wp_strip_all_tags( $msg->message ),
+ 'content' => wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $msg->message ) ),
'created_at' => date( 'c', (int) ( (int) $msg->created_at / 10 / 1000 ) ),
);
}
@@ -261,7 +261,7 @@
'message_id' => $mid,
'count' => intval( $item['count'] ),
'sender_name' => $msg ? Better_Messages()->functions->get_name( $msg->sender_id ) : '',
- 'content' => $msg ? wp_strip_all_tags( $msg->message ) : '',
+ 'content' => $msg ? wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $msg->message ) ) : '',
'created_at' => $msg ? date( 'c', (int) ( (int) $msg->created_at / 10 / 1000 ) ) : '',
);
}, $results );
--- a/bp-better-messages/inc/abilities/moderation.php
+++ b/bp-better-messages/inc/abilities/moderation.php
@@ -119,7 +119,7 @@
'thread_id' => intval( $msg->thread_id ),
'sender_id' => intval( $msg->sender_id ),
'sender_name' => Better_Messages()->functions->get_name( $msg->sender_id ),
- 'content' => wp_strip_all_tags( $msg->message ),
+ 'content' => wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $msg->message ) ),
'created_at' => date( 'c', (int) ( (int) $msg->created_at / 10 / 1000 ) ),
);
}
--- a/bp-better-messages/inc/api/admin.php
+++ b/bp-better-messages/inc/api/admin.php
@@ -1266,7 +1266,7 @@
" );
}
- private function get_reported_candidate_ids()
+ public function get_reported_candidate_ids()
{
global $wpdb;
@@ -1906,7 +1906,7 @@
private function readable_mentions( $content ){
$readable = preg_replace(
- '/<span class="bm-mention" data-user-id="(-?d+|all)">((?:(?!<).)*?)</span>/s',
+ '/' . Better_Messages_Mentions::stored_span_pattern( '(-?d+|all)' ) . '>((?:(?!<).)*?)</span>/s',
'<span class="bm-mention" data-user-id="$1">$2</span>',
(string) $content
);
--- a/bp-better-messages/inc/api/conversations.php
+++ b/bp-better-messages/inc/api/conversations.php
@@ -342,14 +342,19 @@
);
}
- $added = false;
+ $added = false;
+ $refused = false;
foreach( $user_ids as $user_id ){
$is_participant = Better_Messages()->functions->is_thread_participant( $user_id, $thread_id, true );
if( ! $is_participant ) {
$add = Better_Messages()->functions->add_participant_to_thread( $thread_id, $user_id );
- if( $add ) $added = true;
+ if( $add ) {
+ $added = true;
+ } else {
+ $refused = true;
+ }
} else if( count( $user_ids ) === 1 ){
return new WP_Error(
'rest_forbidden',
@@ -362,7 +367,9 @@
if( ! $added ){
return new WP_Error(
'rest_forbidden',
- _x( 'All selected users are already participating in this conversation', 'Rest API Error', 'bp-better-messages' ),
+ $refused
+ ? _x( 'Sorry, you are not allowed to add participants to this conversation', 'Rest API Error', 'bp-better-messages' )
+ : _x( 'All selected users are already participating in this conversation', 'Rest API Error', 'bp-better-messages' ),
array( 'status' => rest_authorization_required_code() )
);
}
--- a/bp-better-messages/inc/api/db-migrate.php
+++ b/bp-better-messages/inc/api/db-migrate.php
@@ -4,7 +4,7 @@
class Better_Messages_Rest_Api_DB_Migrate
{
- private $db_version = 2.97;
+ private $db_version = 2.98;
public static function instance()
{
@@ -1158,6 +1158,11 @@
function (){
$this->move_ai_keys_to_keychain();
}
+ ],
+ '2.98' => [
+ function (){
+ $this->refresh_ai_bots();
+ }
]
];
@@ -1193,6 +1198,18 @@
}
}
+ public function refresh_ai_bots(){
+ if ( ! function_exists( 'Better_Messages_AI' ) || ! method_exists( 'Better_Messages_AI', 'bot_user_changed' ) ) {
+ return;
+ }
+
+ $ai = Better_Messages_AI();
+
+ foreach ( $ai->bot_users( true ) as $user_id => $bot_id ) {
+ $ai->bot_user_changed( $user_id, $bot_id );
+ }
+ }
+
public function move_guests_to_registry(){
global $wpdb;
--- a/bp-better-messages/inc/chats.php
+++ b/bp-better-messages/inc/chats.php
@@ -289,6 +289,8 @@
}
public function rest_get_user_facing_chat_rooms( WP_REST_Request $request ) {
+ Better_Messages_Rest_Api()->is_user_authorized( $request );
+
$user_id = Better_Messages()->functions->get_current_user_id();
$display_mode = isset( Better_Messages()->settings['widgetChatRoomsDisplayMode'] )
--- a/bp-better-messages/inc/functions.php
+++ b/bp-better-messages/inc/functions.php
@@ -1507,10 +1507,16 @@
global $wpdb;
- $userIsParticipant = $this->is_user_participant( $thread_id, $user_id );
+ $added = $this->with_lock( 'thread_participants|' . $thread_id, function () use ( $wpdb, $thread_id, $user_id, $context ) {
+ if( $this->is_user_participant( $thread_id, $user_id ) ) {
+ return false;
+ }
+
+ if( ! apply_filters( 'better_messages_can_add_participant', true, $thread_id, $user_id, $context ) ) {
+ return false;
+ }
- if( ! $userIsParticipant ) {
- $return = $wpdb->insert(
+ return (bool) $wpdb->insert(
bm_get_table('recipients'),
array(
'user_id' => $user_id,
@@ -1519,13 +1525,13 @@
'is_deleted' => 0
)
);
+ } );
- if( $return ) {
- do_action('better_messages_thread_updated', $thread_id);
- do_action('better_messages_info_changed', $thread_id, [ $user_id ] );
- do_action('better_messages_participant_added', $thread_id, $user_id, $context );
- return true;
- }
+ if( $added ) {
+ do_action('better_messages_thread_updated', $thread_id);
+ do_action('better_messages_info_changed', $thread_id, [ $user_id ] );
+ do_action('better_messages_participant_added', $thread_id, $user_id, $context );
+ return true;
}
return false;
@@ -1542,14 +1548,24 @@
global $wpdb;
- $result = $wpdb->delete(
- bm_get_table('recipients'),
- array(
- 'user_id' => $user_id,
- 'thread_id' => $thread_id
- ),
- array( '%d', '%d' )
- );
+ $result = $this->with_lock( 'thread_participants|' . $thread_id, function () use ( $wpdb, $thread_id, $user_id ) {
+ for ( $try = 1; ; $try++ ) {
+ $deleted = $wpdb->delete(
+ bm_get_table('recipients'),
+ array(
+ 'user_id' => $user_id,
+ 'thread_id' => $thread_id
+ ),
+ array( '%d', '%d' )
+ );
+
+ if ( $deleted !== false || $try >= 3 || stripos( $wpdb->last_error, 'deadlock' ) === false ) {
+ return $deleted;
+ }
+
+ usleep( 50000 );
+ }
+ } );
if( $result ) {
do_action('better_messages_thread_updated', $thread_id);
@@ -2957,7 +2973,7 @@
$text = __( 'No Subject', 'buddypress' );
}
- if( trim( $subject ) === $text ){
+ if( trim( $subject ) === $text || ! preg_match( '/[^p{Z}p{C}]/u', (string) $subject ) ){
return '';
} else {
return $subject;
--- a/bp-better-messages/inc/hooks.php
+++ b/bp-better-messages/inc/hooks.php
@@ -37,6 +37,8 @@
if( Better_Messages()->settings['chatPage'] !== '0' || (int) Better_Messages()->settings['guestChatPage'] > 0 ){
add_filter( 'the_content', array( $this, 'chat_page' ), 12 );
+ add_action( 'awb_remove_third_party_the_content_changes', array( $this, 'pause_chat_page_for_avada_section' ) );
+ add_action( 'awb_readd_third_party_the_content_changes', array( $this, 'resume_chat_page_after_avada_section' ) );
}
add_action( 'admin_notices', array( $this, 'admin_notice') );
@@ -2317,6 +2319,20 @@
return $content;
}
+ public function pause_chat_page_for_avada_section(){
+ if( ! function_exists( 'Fusion_Template_Builder' ) ) return;
+
+ $builder = Fusion_Template_Builder();
+
+ if( ! method_exists( $builder, 'get_current_override_name' ) || $builder->get_current_override_name() === 'content' ) return;
+
+ remove_filter( 'the_content', array( $this, 'chat_page' ), 12 );
+ }
+
+ public function resume_chat_page_after_avada_section(){
+ add_filter( 'the_content', array( $this, 'chat_page' ), 12 );
+ }
+
public function exclude_attachments_global( $query ){
if( Better_Messages()->settings['attachmentsHide'] === '1' ) {
--- a/bp-better-messages/inc/mobile-app/mobile-app.php
+++ b/bp-better-messages/inc/mobile-app/mobile-app.php
@@ -34,6 +34,8 @@
public $scripts;
+ public $bootstrap;
+
public $web_signin;
public $sessions;
@@ -121,6 +123,9 @@
require_once ($this->path . 'inc/scripts.php');
$this->scripts = Better_Messages_Mobile_App_Scripts();
+ require_once($this->path . 'inc/bootstrap.php');
+ $this->bootstrap = Better_Messages_Mobile_App_Bootstrap::instance();
+
require_once($this->path . 'inc/auth.php');
$this->auth = Better_Messages_Mobile_App_Auth();
--- a/bp-better-messages/inc/moderation.php
+++ b/bp-better-messages/inc/moderation.php
@@ -9,6 +9,10 @@
private $messages_to_review = null;
+ private $review_signal_queued = false;
+
+ private $ids_under_review = null;
+
private $restricted_batch = array();
private $own_batch = array( 'user' => 0, 'threads' => array() );
@@ -46,6 +50,13 @@
add_action( 'edit_user_profile', array( $this, 'render_user_section' ) );
add_filter( 'bp_better_messages_script_variable', array( $this, 'review_script_variables' ), 1000 );
+
+ foreach( array( 'added_bm_message_meta', 'updated_bm_message_meta', 'deleted_bm_message_meta' ) as $hook ){
+ add_action( $hook, array( $this, 'review_meta_changed' ), 10, 4 );
+ }
+
+ add_action( 'better_messages_message_pending', array( $this, 'review_queue_changed' ), 20, 0 );
+ add_action( 'better_messages_before_message_delete', array( $this, 'review_message_deleting' ), 10, 1 );
}
public function can_review_messages(): bool
@@ -104,6 +115,99 @@
return isset( Better_Messages()->mobile_app->auth ) && Better_Messages()->mobile_app->auth->is_mobile_app();
}
+ private function review_signal_available(): bool
+ {
+ return Better_Messages()->realtime
+ && isset( Better_Messages()->websocket )
+ && is_object( Better_Messages()->websocket )
+ && method_exists( Better_Messages()->websocket, 'send_realtime_event' )
+ && ! defined( 'BM_DISABLE_MESSAGES_VIEWER' )
+ && Better_Messages()->settings['messagesViewer'] !== '0';
+ }
+
+ public function review_queue_changed(): void
+ {
+ if ( $this->review_signal_queued || ! $this->review_signal_available() ) {
+ return;
+ }
+
+ $this->review_signal_queued = true;
+
+ add_action( 'shutdown', array( $this, 'send_review_signal' ) );
+ }
+
+ public function review_meta_changed( $meta_ids, $message_id, $meta_key, $meta_value ): void
+ {
+ if ( 'user_reports' === $meta_key ) {
+ $this->review_queue_changed();
+ } elseif ( 'ai_moderation_flagged' === $meta_key && ( 'deleted_bm_message_meta' === current_action() || '1' === (string) $meta_value ) ) {
+ $this->review_queue_changed();
+ }
+ }
+
+ public function review_message_deleting( $message_id ): void
+ {
+ if ( $this->review_signal_queued || ! $this->review_signal_available() ) {
+ return;
+ }
+
+ if ( isset( $this->get_ids_under_review()[ (int) $message_id ] ) ) {
+ $this->review_queue_changed();
+ }
+ }
+
+ private function get_ids_under_review(): array
+ {
+ global $wpdb;
+
+ if ( $this->ids_under_review === null ) {
+ $candidates = function_exists( 'Better_Messages_Rest_Api_Admin' ) ? Better_Messages_Rest_Api_Admin()->get_reported_candidate_ids() : array( 'all_ids' => array() );
+ $held = $wpdb->get_col( "SELECT `id` FROM `" . bm_get_table( 'messages' ) . "` WHERE `is_pending` = 1" );
+
+ $this->ids_under_review = array_fill_keys( array_map( 'intval', array_merge( $candidates['all_ids'], $held ) ), true );
+ }
+
+ return $this->ids_under_review;
+ }
+
+ public function send_review_signal(): void
+ {
+ if ( ! $this->review_signal_available() ) {
+ return;
+ }
+
+ $user_ids = $this->get_reviewer_ids();
+
+ if ( empty( $user_ids ) ) {
+ return;
+ }
+
+ Better_Messages()->websocket->send_realtime_event( $user_ids, array( 'type' => 'review_queue' ) );
+ }
+
+ private function get_reviewer_ids(): array
+ {
+ global $wpdb;
+
+ $max = (int) apply_filters( 'better_messages_review_signal_max_users', 50 );
+ $ids = array_values( array_filter( array_map( 'intval', $this->get_site_admin_ids() ) ) );
+
+ if ( $max <= 0 || empty( $ids ) ) {
+ return array();
+ }
+
+ if ( count( $ids ) <= $max ) {
+ return $ids;
+ }
+
+ $active = array_map( 'intval', $wpdb->get_col( $wpdb->prepare(
+ "SELECT `ID` FROM `" . bm_get_table( 'users' ) . "` WHERE `ID` IN (" . implode( ',', $ids ) . ") ORDER BY `last_activity` DESC LIMIT %d",
+ $max
+ ) ) );
+
+ return array_slice( array_values( array_unique( array_merge( $active, $ids ) ) ), 0, $max );
+ }
+
public function render_user_section( $user )
{
if ( ! current_user_can( 'bm_can_administrate' ) ) {
@@ -1403,6 +1507,10 @@
do_action( 'better_messages_thread_updated', $message->thread_id );
+ if( (int) $message->is_pending === 1 ){
+ $this->review_queue_changed();
+ }
+
return true;
}
@@ -1474,6 +1582,24 @@
return $valid_emails;
}
+ public function send_plain_email( $emails, $subject, $body )
+ {
+ $subject = html_entity_decode( (string) $subject, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
+ $body = html_entity_decode( (string) $body, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
+
+ $plain_text = function() {
+ return 'text/plain';
+ };
+
+ add_filter( 'wp_mail_content_type', $plain_text, PHP_INT_MAX );
+
+ foreach( $emails as $email ){
+ wp_mail( $email, $subject, $body );
+ }
+
+ remove_filter( 'wp_mail_content_type', $plain_text, PHP_INT_MAX );
+ }
+
public function notify_pending_message( $message )
{
if( ! isset( $message->sender_id ) || ! isset( $message->thread_id ) ){
@@ -1498,7 +1624,7 @@
);
$message_content = apply_filters( 'better_messages_moderation_message_content',
- wp_trim_words( wp_strip_all_tags( $message->message ), 50, '...' ),
+ wp_trim_words( wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $message->message ) ), 50, '...' ),
$message
);
@@ -1545,9 +1671,7 @@
$email_body .= "n" . sprintf( _x( 'Review in moderation panel: %s', 'Moderation email', 'bp-better-messages' ), $moderation_url );
- foreach( $emails as $email ){
- wp_mail( $email, $subject, $email_body );
- }
+ $this->send_plain_email( $emails, $subject, $email_body );
}
public function notify_reported_message( $message_id, $thread_id, $reporter_user_id, $category, $description, $reports )
@@ -1586,7 +1710,7 @@
);
$message_content = apply_filters( 'better_messages_moderation_message_content',
- wp_trim_words( wp_strip_all_tags( $message->message ), 50, '...' ),
+ wp_trim_words( wp_strip_all_tags( Better_Messages_Mentions::mentions_as_names( $message->message ) ), 50, '...' ),
$message
);
$report_count = count( $reports );
@@ -1603,9 +1727,7 @@
$moderation_url
);
- foreach( $emails as $email ){
- wp_mail( $email, $subject, $email_body );
- }
+ $this->send_plain_email( $emails, $subject, $email_body );
}
}
--- a/bp-better-messages/inc/notifications.php
+++ b/bp-better-messages/inc/notifications.php
@@ -199,28 +199,23 @@
$subject = $tokens['subject'];
if( $subject === '' ){
- $email_subject = $email->get_subject();
- $email_plaintext = $email->get_content_plaintext();
- $email_html = $email->get_content_html();
-
- $to_remove = [ '"{{subject}}"', '"{{subject}}"', '{{subject}}' ];
-
- foreach ( $to_remove as $str ){
- $email_subject = trim(str_replace( $str, '', $email_subject ) );
- $email_plaintext = trim(str_replace( $str, '', $email_plaintext ) );
- $email_html = trim(str_replace( $str, '', $email_html ) );
- }
+ $email->set_subject( trim( $this->without_subject_placeholder( $email->get_subject() ) ) );
+ $email->set_content_plaintext( trim( $this->without_subject_placeholder( $email->get_content_plaintext() ) ) );
+ $email->set_content_html( trim( $this->without_subject_placeholder( $email->get_content_html() ) ) );
+ }
+ }
+ }
+ private function without_subject_placeholder( $text )
+ {
+ $text = (string) $text;
+ $space = '[ tx{00A0}]*';
+ $token = '{{{?subject}}}?';
+ $quote = '(?:&(?:quot|ldquo|rdquo|bdquo|laquo|raquo|#0*34|#0*171|#0*187|#822[0-2]|#x0*22);|["x{201C}x{201D}x{201E}x{00AB}x{00BB}x{300C}x{300D}x{300E}x{300F}x{FF02}])';
- if(substr($email_subject, -1, 1) === ':'){
- $email_subject = substr($email_subject, 0, strlen($email_subject) - 1);
- }
+ $result = preg_replace( '/' . $space . '[:x{FF1A}]?' . $space . '(?:(?<!=)' . $quote . $space . $token . $space . $quote . '|' . $token . ')/u', '', $text );
- $email->set_subject( $email_subject );
- $email->set_content_plaintext( $email_plaintext );
- $email->set_content_html( $email_html );
- }
- }
+ return $result === null ? $text : $result;
}
public function email_candidate_where(){
@@ -493,7 +488,7 @@
$_message = nl2br( Better_Messages()->functions->markdown_to_plain_text( stripslashes( $message->message ) ) );
$_message = str_replace(['<p>', '</p>'], ['<br>', ''], $_message );
$_message = Better_Messages()->functions->format_message( $_message, $message->id, 'email', $user_id );
- $_message = htmlspecialchars_decode(Better_Messages()->functions->strip_all_tags($_message, '<br>'));
+ $_message = htmlspecialchars_decode(Better_Messages()->functions->strip_all_tags(Better_Messages_Mentions::mentions_as_names($_message), '<br>'));
if ($last_sender_id == 0 || $last_sender_id != $message->sender_id) {
$messageHtml .= '<tr><td colspan="2"><b>' . $author . '</b></td></tr>';
@@ -1061,6 +1056,10 @@
$template = Better_Messages_Options()->get_email_custom_html();
$settings = Better_Messages()->settings;
+ if ( $data['subject'] === '' ) {
+ $template = $this->without_subject_placeholder( $template );
+ }
+
$primary_color = ! empty( $settings['emailPrimaryColor'] ) ? $settings['emailPrimaryColor'] : '#21759b';
$background_color = ! empty( $settings['emailBackgroundColor'] ) ? $settings['emailBackgroundColor'] : '#f6f6f6';
$content_bg_color = ! empty( $settings['emailContentBgColor'] ) ? $settings['emailContentBgColor'] : '#ffffff';
--- a/bp-better-messages/inc/options.php
+++ b/bp-better-messages/inc/options.php
@@ -3351,6 +3351,7 @@
) );
};
add_filter( 'safe_style_css', $allow_all_css );
+ add_filter( 'wp_kses_force_legacy_parser', '__return_true', 20 );
$allowed_html = array_merge(
wp_kses_allowed_html('post'),
@@ -3376,6 +3377,7 @@
$this->settings['emailCustomHtml'] = wp_kses( wp_unslash( $this->settings['emailCustomHtml'] ), $allowed_html );
remove_filter( 'safe_style_css', $allow_all_css );
+ remove_filter( 'wp_kses_force_legacy_parser', '__return_true', 20 );
}
$this->settings['bpProfileSlug'] = preg_replace('/s+/', '', trim( $this->settings['bpProfileSlug'] ) );
--- a/bp-better-messages/inc/rest-api.php
+++ b/bp-better-messages/inc/rest-api.php
@@ -2585,6 +2585,12 @@
$thread_item = apply_filters('better_messages_rest_thread_item', $thread_item, $thread_item['thread_id'], $thread_item['type'], $personal_data, $current_user_id );
+ if( isset( $thread_item['chatRoom']['bots'] ) && is_array( $thread_item['chatRoom']['bots'] ) ){
+ foreach ( $thread_item['chatRoom']['bots'] as $bot_user_id ){
+ $user_ids[] = (int) $bot_user_id;
+ }
+ }
+
$threads[] = $thread_item;
if( $fetch_messages ) {
--- a/bp-better-messages/inc/system-messages.php
+++ b/bp-better-messages/inc/system-messages.php
@@ -630,6 +630,11 @@
return false;
}
+ return (bool) apply_filters( 'better_messages_system_message_should_emit', $this->event_enabled( $thread_id, $event_type ), $thread_id, $event_type );
+ }
+
+ private function event_enabled( $thread_id, $event_type )
+ {
if ( ! $this->is_enabled_for_thread( $thread_id ) ) {
return false;
}
--- a/bp-better-messages/inc/translations/admin-strings.php
+++ b/bp-better-messages/inc/translations/admin-strings.php
@@ -1477,12 +1477,14 @@
array( '_x', 'Missed Call Timeout', 'Settings page' ),
array( '_x', 'Time before an unanswered call is marked as missed', 'Settings page' ),
array( '_x', 'seconds', 'Settings page' ),
+ array( '_x', 'Audio Effects', 'Settings page' ),
+ array( '_x', 'For audio and video calls, private and group alike. People turn them on for their own microphone in the call device settings.', 'Settings page' ),
+ array( '_x', 'AI Noise Removal', 'Settings page' ),
+ array( '_x', 'Takes keyboard typing, fans and other sounds around the voice out of the microphone. It is not part of the plugin: it is downloaded to this site once, from WordPlus Cloud, apart from the video effects.', 'Settings page' ),
array( '_x', 'Video Effects', 'Settings page' ),
- array( '_x', 'For private and group calls. People choose what is behind them in a call in its device settings: none, blur or a picture, and turn on AI Noise Removal there.', 'Settings page' ),
+ array( '_x', 'For private and group calls. People choose what is behind them in a call in its device settings: none, blur or a picture.', 'Settings page' ),
array( '_x', 'Effects Download', 'Settings page' ),
array( '_x', 'The effects are not part of the plugin. They are downloaded to this site once, from WordPlus Cloud.', 'Settings page' ),
- array( '_x', 'AI Noise Removal', 'Settings page' ),
- array( '_x', 'Takes keyboard typing, fans and other sounds around the voice out of the microphone of everyone who turns it on in the call device settings. It is a download of its own from WordPlus Cloud, apart from the effects above.', 'Settings page' ),
array( '_x', 'Built-in Backgrounds', 'Settings page' ),
array( '_x', 'Pictures from WordPlus Cloud that calls offer. Tick the ones you want: each is downloaded to this site, and one you untick is deleted from it.', 'Settings page' ),
array( '_x', 'Site Backgrounds', 'Settings page' ),
@@ -1766,7 +1768,9 @@
array( '_x', 'Notice on Join', 'Settings page' ),
array( '_x', 'People join a group video or audio chat with the camera and microphone off. This tells them so as they join and that the call controls turn them on, with a Preview button that shows their camera only to them, or tests their microphone on an audio chat. When off, nothing is said and the device settings open from the settings button in the call', 'Settings page' ),
array( '_x', 'During the Call', 'Settings page' ),
- array( '_x', 'Background blur, backgrounds and AI Noise Removal work in group calls too. They are set up once for every call, in Calls.', 'Settings page' ),
+ array( '_x', 'Audio and Video Effects', 'Settings page' ),
+ array( '_x', 'AI Noise Removal, background blur and backgrounds work in group calls too. They are set up once for every call, in Calls.', 'Settings page' ),
+ array( '_x', 'Audio Effects Settings', 'Settings page' ),
array( '_x', 'Video Effects Settings', 'Settings page' ),
array( '_x', 'Open Picture in Picture When Leaving the Tab', 'Settings page' ),
array( '_x', 'The browser opens the call in a small window when someone switches to another tab or app, in browsers that support it. With this off, Picture in Picture still opens from the call controls.', 'Settings page' ),
--- a/bp-better-messages/inc/translations/frontend-strings.php
+++ b/bp-better-messages/inc/translations/frontend-strings.php
@@ -337,6 +337,7 @@
array( '_x', 'Missed video call', 'Conversations list item' ),
array( '_x', 'Missed voice call', 'Conversations list item' ),
array( '_x', 'Message hidden', 'Messages from blocked user' ),
+ array( '_x', 'You: %s', 'Conversations list item' ),
array( '_x', 'typing', 'Typing indicator (private conversation)' ),
array( '_x', '(empty message)', 'Conversations list item' ),
array( '__', 'Sticker' ),
@@ -399,6 +400,7 @@
array( '_x', 'Minimize', 'Mini Chats' ),
array( '_x', 'Open', 'Mini Chats' ),
array( '_x', 'Start a new conversation', 'New threads screen' ),
+ array( '_x', 'Messages', 'Mini Widgets - Head' ),
array( '_x', 'Start a new conversation', 'Mini Widgets' ),
array( '_x', 'Remove', 'Mini Widgets' ),
array( '_x', 'Lock with Face ID', 'Mobile App' ),
@@ -505,6 +507,11 @@
array( '_x', 'Logout', 'Mobile App' ),
array( '_x', 'Reloading', 'Mobile App' ),
array( '_x', 'Reload application', 'Mobile App' ),
+ array( '_x', 'Restart', 'Mobile app error screen' ),
+ array( '_x', 'Downloading scripts from server...', 'Mobile app error screen' ),
+ array( '_x', 'Scripts downloaded. Reloading...', 'Mobile app error screen' ),
+ array( '_x', 'Error while downloading scripts. Reloading...', 'Mobile app error screen' ),
+ array( '_x', 'Application error', 'Mobile app error screen' ),
array( '_x', 'Start typing to search members', 'Add Participants Panel' ),
array( '_x', 'Search by name to add members to this conversation.', 'Add Participants Panel' ),
array( '_x', 'Adding...', 'Add Participants Panel' ),
@@ -603,6 +610,7 @@
array( '_nx', '%d message will be sent once you are back online', '%d messages will be sent once you are back online', 'Outbox' ),
array( '_x', 'Message not sent', 'Outbox' ),
array( '_x', 'The server did not accept this message', 'Outbox' ),
+ array( '_x', 'Refresh page', 'Session ended' ),
array( '_x', 'Retry', 'Outbox' ),
array( '_x', 'Messages you send now will go out once you are back online', 'Outbox' ),
array( '_x', 'You are offline', 'Outbox' ),
@@ -668,6 +676,8 @@
array( '_x', 'Being prepared. It can be watched in a few minutes.', 'Call recording' ),
array( '_x', 'Delete Recording', 'Call recording' ),
array( '_nx', '%s message to review', '%s messages to review', 'Messages to review button' ),
+ array( '_x', 'Your session has ended', 'Session ended' ),
+ array( '_x', 'Close', 'Session ended' ),
array( '_x', 'Unknown device', 'User settings screen' ),
array( '_x', 'Last active %s', 'User settings screen' ),
array( '_x', 'Sign out %s? The app on that device will ask to sign in again.', 'User settings screen' ),
@@ -782,6 +792,7 @@
array( '_x', 'Message unpinned', 'Messages pinning' ),
array( '_x', 'Are you sure you want to leave this conversation?', 'Leave conversation action' ),
array( '_x', 'Still too large after optimizing: %1$s MB. The limit for this type of file is %2$s MB.', 'File Uploader' ),
+ array( '_x', 'File encryption failed — please reload the page and try again', 'File Uploader' ),
array( '_x', 'Copy message text', 'Message context menu' ),
array( '_x', 'Text copied to clipboard', 'Message context menu' ),
array( '_x', 'Send now', 'Outbox' ),
@@ -841,6 +852,8 @@
array( '_x', 'This website could not set up Web Push notifications in your browser. Please contact the website administrator.', 'Push Notifications' ),
array( '_x', 'Successfully unsubscribed from Web Push notifications', 'Push Notifications' ),
array( '_x', 'Encrypted message', 'Push notification' ),
+ array( '_x', 'The request was made but no response was received', 'Request error' ),
+ array( '_x', 'An unknown error occurred', 'Request error' ),
array( '__', 'Continue with account' ),
array( '_x', 'Close', 'Guest chat' ),
array( '__', 'A user' ),
@@ -869,7 +882,6 @@
array( '__', '%s started a group video call' ),
array( '__', '%s started a group audio call' ),
array( '__', 'Chat history was cleared automatically' ),
- array( '_x', 'Messages', 'Mini Widgets - Head' ),
array( '_x', 'Messages', 'Mobile view tabs' ),
array( '_x', 'Friends', 'Mini Widgets - Head' ),
array( '_x', 'Friends', 'Mobile view tabs' ),
@@ -1123,6 +1135,14 @@
array( '_x', 'The people who were in the call can watch it in a few minutes.', 'Call recording' ),
array( '_x', 'It is ready to watch a few minutes after it stops.', 'Call recording' ),
array( '_x', 'The recording could not be stopped.', 'Call recording' ),
+ array( '_x', 'Add Person', 'Call Screen' ),
+ array( '_x', 'Loading...', 'Call Screen' ),
+ array( '_x', 'There is no one else to add', 'Call Screen' ),
+ array( '_x', 'Answered', 'Call Screen' ),
+ array( '_x', 'Declined', 'Call Screen' ),
+ array( '_x', 'Busy', 'Call Screen' ),
+ array( '_x', 'No answer', 'Call Screen' ),
+ array( '_x', 'Cancelled', 'Call Screen' ),
array( '_x', 'Calls', 'Call Screen' ),
array( '_x', 'Ongoing Call', 'Call Screen' ),
array( '_x', 'That conversation could not be found', 'Call Screen' ),
@@ -1130,6 +1150,10 @@
array( '__', 'Statistics' ),
array( '__', 'Downloaded' ),
array( '__', 'Uploaded' ),
+ array( '_x', 'Messages', 'Android notification channel' ),
+ array( '_x', 'Notifications for new messages', 'Android notification channel' ),
+ array( '_x', 'Calls', 'Android notification channel' ),
+ array( '_x', 'Notifications for incoming calls', 'Android notification channel' ),
array( '_x', 'A new version of the application has been downloaded.', 'Mobile App' ),
array( '_x', 'Update now', 'Mobile App' ),
array( '_x', 'A new version of the app is available in %s.', 'Mobile App' ),
@@ -1171,6 +1195,8 @@
array( '_x', 'Type to search stickers.', 'Media picker' ),
array( '_x', 'Recently sent stickers will appear here.', 'Media picker' ),
array( '_x', 'This pack is empty.', 'Media picker' ),
+ array( '_x', 'You may have been logged out of this website. Refresh the page to continue messaging.', 'Session ended' ),
+ array( '_x', 'You may have been logged out of this website. This message will be sent once you refresh the page and are logged in again.', 'Session ended' ),
array( '_x', 'New message', 'Design preview' ),
array( '_x', 'Sounds good — see you there', 'Design preview' ),
array( '_x', 'The call has ended', 'Group call alert' ),
@@ -1183,7 +1209,6 @@
array( '_nx', 'Close all notifications, %s more hidden', 'Close all notifications, %s more hidden', 'Onsite notifications' ),
array( '_x', 'Close all notifications', 'Onsite notifications' ),
array( '_x', 'Cannot reach the site. Check your connection and try again.', 'Rest API Error' ),
- array( '_x', 'Authorization failed. Please check if you are still authorized at this website.', 'Rest API Error' ),
array( '_x', 'Mark as unread', 'Conversation menu' ),
array( '_x', 'Notifications: %s', 'Notification level' ),
array( '_x', 'Stop translating', 'Message translation' ),
@@ -1226,9 +1251,9 @@
array( '__', '%1$s were removed from the conversation by %2$s' ),
array( '__', '%s joined the conversation' ),
array( '__', '%s left the conversation' ),
- array( '_x', 'Add Person', 'Call Screen' ),
- array( '_x', 'Loading...', 'Call Screen' ),
- array( '_x', 'There is no one else to add', 'Call Screen' ),
+ array( '_x', 'all', 'Mention of everyone in a conversation, after the @' ),
+ array( '_nx', '%1$s & %2$s more', '%1$s & %2$s more', 'Conversation name of a group without a subject' ),
+ array( '_x', '%1$s & %2$s', 'Conversation name of a group without a subject' ),
array( '_x', 'Your browser blocks the camera for this site', 'Call Ask' ),
array( '_x', 'Your browser blocks the microphone for this site', 'Call Ask' ),
array( '_x', 'Another app is using your camera', 'Call Ask' ),
@@ -1265,6 +1290,11 @@
array( '_x', 'Preparing backgrounds…', 'Call Effects' ),
array( '_x', 'This browser does not keep your pictures, so they last for this call only.', 'Call Effects' ),
array( '_x', 'Backgrounds are not available on this device.', 'Call Effects' ),
+ array( '_x', 'Your device is blurring your background itself with Portrait, so Blur here is paused. It comes back on by itself when you turn Portrait off in Control Center.', 'Call Effects' ),
+ array( '_x', 'Your device is blurring your background itself with Portrait. Turn Portrait off in Control Center to show your room.', 'Call Effects' ),
+ array( '_x', 'Blur here pauses by itself while Portrait is on. Browsers are not told when Background is on, so choose None here when you use it.', 'Call Effects' ),
+ array( '_x', 'This browser cannot tell when either is on, so choose None here once you turn one on.', 'Call Effects' ),
+ array( '_x', 'Your device can blur or replace your background itself: turn on Portrait or Background in Control Center, under Video Effects. It often looks cleaner and is lighter on this device.', 'Call Effects' ),
array( '_x', 'Effect Settings', 'Call Effects' ),
array( '_x', 'Outline', 'Call Effects' ),
array( '_x', 'Tighter', 'Call Effects' ),
@@ -1365,6 +1395,8 @@
array( '_x', 'Turn sound on', 'Call Screen' ),
array( '__', 'Removed from conversation' ),
array( '_x', 'You cannot make this call', 'Call Screen' ),
+ array( '_x', 'Could not start recording', 'Call recording' ),
+ array( '_x', 'Could not stop recording', 'Call recording' ),
array( '_x', 'You were removed from this call', 'Call Screen' ),
array( '_x', 'The user is busy in another call', 'Private Call Screen' ),
array( '_x', 'The user did not answer', 'Private Call Screen' ),
--- a/bp-better-messages/inc/translations/strings.php
+++ b/bp-better-messages/inc/translations/strings.php
@@ -336,6 +336,7 @@
_x('Missed video call', 'Conversations list item', 'bp-better-messages');
_x('Missed voice call', 'Conversations list item', 'bp-better-messages');
_x('Message hidden', 'Messages from blocked user', 'bp-better-messages');
+ _x('You: %s', 'Conversations list item', 'bp-better-messages');
_x('typing', 'Typing indicator (private conversation)', 'bp-better-messages');
_x('(empty message)', 'Conversations list item', 'bp-better-messages');
__('Sticker', 'bp-better-messages');
@@ -398,6 +399,7 @@
_x('Minimize', 'Mini Chats', 'bp-better-messages');
_x('Open', 'Mini Chats', 'bp-better-messages');
_x('Start a new conversation', 'New threads screen', 'bp-better-messages');
+ _x('Messages', 'Mini Widgets - Head', 'bp-better-messages');
_x('Start a new conversation', 'Mini Widgets', 'bp-better-messages');
_x('Remove', 'Mini Widgets', 'bp-better-messages');
_x('Lock with Face ID', 'Mobile App', 'bp-better-messages');
@@ -504,6 +506,11 @@
_x('Logout', 'Mobile App', 'bp-better-messages');
_x('Reloading', 'Mobile App', 'bp-better-messages');
_x('Reload application', 'Mobile App', 'bp-better-messages');
+ _x('Restart', 'Mobile app error screen', 'bp-better-messages');
+ _x('Downloading scripts from server...', 'Mobile app error screen', 'bp-better-messages');
+ _x('Scripts downloaded. Reloading...', 'Mobile app error screen', 'bp-better-messages');
+ _x('Error while downloading scripts. Reloading...', 'Mobile app error screen', 'bp-better-messages');
+ _x('Application error', 'Mobile app error screen', 'bp-better-messages');
_x('Start typing to search members', 'Add Participants Panel', 'bp-better-messages');
_x('Search by name to add members to this conversation.', 'Add Participants Panel', 'bp-better-messages');
_x('Adding...', 'Add Participants Panel', 'bp-better-messages');
@@ -602,6 +609,7 @@
_nx('%d message will be sent once you are back online', '%d messages will be sent once you are back online', 1, 'Outbox', 'bp-better-messages');
_x('Message not sent', 'Outbox', 'bp-better-messages');
_x('The server did not accept this message', 'Outbox', 'bp-better-messages');
+ _x('Refresh page', 'Session ended', 'bp-better-messages');
_x('Retry', 'Outbox', 'bp-better-messages');
_x('Messages you send now will go out once you are back online', 'Outbox', 'bp-better-messages');
_x('You are offline', 'Outbox', 'bp-better-messages');
@@ -667,6 +675,8 @@
_x('Being prepared. It can be watched in a few minutes.', 'Call recording', 'bp-better-messages');
_x('Delete Recording', 'Call recording', 'bp-better-messages');
_nx('%s message to review', '%s messages to review', 1, 'Messages to review button', 'bp-better-messages');
+ _x('Your session has ended', 'Session ended', 'bp-better-messages');
+ _x('Close', 'Session ended', 'bp-better-messages');
_x('Unknown device', 'User settings screen', 'bp-better-messages');
_x('Last active %s', 'User settings screen', 'bp-better-messages');
_x('Sign out %s? The app on that device will ask to sign in again.', 'User settings screen', 'bp-better-messages');
@@ -781,6 +791,7 @@
_x('Message unpinned', 'Messages pinning', 'bp-better-messages');
_x('Are you sure you want to leave this conversation?', 'Leave conversation action', 'bp-better-messages');
_x('Still too large after optimizing: %1$s MB. The limit for this type of file is %2$s MB.', 'File Uploader', 'bp-better-messages');
+ _x('File encryption failed — please reload the page and try again', 'File Uploader', 'bp-better-messages');
_x('Copy message text', 'Message context menu', 'bp-better-messages');
_x('Text copied to clipboard', 'Message context menu', 'bp-better-messages');
_x('Send now', 'Outbox', 'bp-better-messages');
@@ -840,6 +851,8 @@
_x('This website could not set up Web Push notifications in your browser. Please contact the website administrator.', 'Push Notifications', 'bp-better-messages');
_x('Successfully unsubscribed from Web Push notifications', 'Push Notifications', 'bp-better-messages');
_x('Encrypted message', 'Push notification', 'bp-better-messages');
+ _x('The request was made but no response was received', 'Request error', 'bp-better-messages');
+ _x('An unknown error occurred', 'Request error', 'bp-better-messages');
__('Continue with account', 'bp-better-messages');
_x('Close', 'Guest chat', 'bp-better-messages');
__('A user', 'bp-better-messages');
@@ -868,7 +881,6 @@
__('%s started a group video call', 'bp-better-messages');
__('%s started a group audio call', 'bp-better-messages');
__('Chat history was cleared automatically', 'bp-better-messages');
- _x('Messages', 'Mini Widgets - Head', 'bp-better-messages');
_x('Messages', 'Mobile view tabs', 'bp-better-messages');
_x('Friends', 'Mini Widgets - Head', 'bp-better-messages');
_x('Friends', 'Mobile view tabs', 'bp-better-messages');
@@ -1122,6 +1134,14