An error occurred while loading the file. Please try again.
-
John Koleszar authored0ea50ce9
/*
* Copyright (c) 2010-2022 Belledonne Communications SARL.
*
* This file is part of Liblinphone
* (see https://gitlab.linphone.org/BC/public/liblinphone).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "bctoolbox/crypto.h"
#include "liblinphone_tester.h"
#include "linphone/core.h"
#include "linphone/wrapper_utils.h"
#include "tester_utils.h"
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#endif
void set_ephemeral_cbs(bctbx_list_t *history) {
for (bctbx_list_t *item = history; item; item = bctbx_list_next(item)) {
const LinphoneChatMessage *msg = (LinphoneChatMessage *)bctbx_list_get_data(item);
if (linphone_chat_message_is_ephemeral(msg)) {
LinphoneChatMessageCbs *msgCbs = linphone_chat_message_get_callbacks(msg);
linphone_chat_message_cbs_set_ephemeral_message_timer_started(
msgCbs, liblinphone_tester_chat_message_ephemeral_timer_started);
linphone_chat_message_cbs_set_ephemeral_message_deleted(msgCbs,
liblinphone_tester_chat_message_ephemeral_deleted);
}
}
}
static void ephemeral_message_test(bool_t encrypted, bool_t remained, bool_t expired, const int curveId) {
LinphoneCoreManager *marie = linphone_core_manager_create("marie_rc");
LinphoneCoreManager *pauline = linphone_core_manager_create("pauline_rc");
bctbx_list_t *coresManagerList = NULL;
bctbx_list_t *participantsAddresses = NULL;
coresManagerList = bctbx_list_append(coresManagerList, marie);
coresManagerList = bctbx_list_append(coresManagerList, pauline);
int size;
set_lime_server_and_curve_list(curveId, coresManagerList);
stats initialMarieStats = marie->stat;
stats initialPaulineStats = pauline->stat;
bctbx_list_t *coresList = init_core_for_conference(coresManagerList);
start_core_for_conference(coresManagerList);
participantsAddresses =
bctbx_list_append(participantsAddresses, linphone_address_new(linphone_core_get_identity(pauline->lc)));
// Enable IMDN
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(marie->lc));
linphone_im_notif_policy_enable_all(linphone_core_get_im_notif_policy(pauline->lc));
// Wait for lime users to be created on X3DH server
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_X3dhUserCreationSuccess,
initialMarieStats.number_of_X3dhUserCreationSuccess + 1, x3dhServer_creationTimeout));