mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 06:09:39 +00:00
fix last notify and eenhance tester
This commit is contained in:
parent
361b4c764b
commit
676ab1a8f5
9 changed files with 63 additions and 15 deletions
|
|
@ -38,6 +38,8 @@ public:
|
|||
void setCallSessionListener (CallSessionListener *listener);
|
||||
void setChatRoomListener (ChatRoomListener *listener) { chatRoomListener = listener; }
|
||||
|
||||
unsigned int getLastNotifyId () const;
|
||||
|
||||
// ChatRoomListener
|
||||
void onChatRoomInsertRequested (const std::shared_ptr<AbstractChatRoom> &chatRoom) override;
|
||||
void onChatRoomInsertInDatabaseRequested (const std::shared_ptr<AbstractChatRoom> &chatRoom) override;
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ void ClientGroupChatRoomPrivate::multipartNotifyReceived (const string &body) {
|
|||
void ClientGroupChatRoomPrivate::setCallSessionListener (CallSessionListener *listener) {
|
||||
L_Q();
|
||||
L_Q_T(RemoteConference, qConference);
|
||||
|
||||
callSessionListener = listener;
|
||||
shared_ptr<CallSession> session = qConference->getPrivate()->focus->getPrivate()->getSession();
|
||||
if (session)
|
||||
|
|
@ -103,6 +104,11 @@ void ClientGroupChatRoomPrivate::setCallSessionListener (CallSessionListener *li
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int ClientGroupChatRoomPrivate::getLastNotifyId () const {
|
||||
L_Q_T(RemoteConference, qConference);
|
||||
return qConference->getPrivate()->eventHandler->getLastNotify();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void ClientGroupChatRoomPrivate::onChatRoomInsertRequested (const shared_ptr<AbstractChatRoom> &chatRoom) {
|
||||
|
|
@ -112,7 +118,10 @@ void ClientGroupChatRoomPrivate::onChatRoomInsertRequested (const shared_ptr<Abs
|
|||
|
||||
void ClientGroupChatRoomPrivate::onChatRoomInsertInDatabaseRequested (const shared_ptr<AbstractChatRoom> &chatRoom) {
|
||||
L_Q();
|
||||
q->getCore()->getPrivate()->insertChatRoomWithDb(chatRoom);
|
||||
L_Q_T(RemoteConference, qConference);
|
||||
|
||||
unsigned int notifyId = qConference->getPrivate()->eventHandler->getLastNotify();;
|
||||
q->getCore()->getPrivate()->insertChatRoomWithDb(chatRoom, notifyId);
|
||||
}
|
||||
|
||||
void ClientGroupChatRoomPrivate::onChatRoomDeleteRequested (const shared_ptr<AbstractChatRoom> &chatRoom) {
|
||||
|
|
|
|||
|
|
@ -43,7 +43,8 @@ public:
|
|||
void onChatRoomInsertInDatabaseRequested (const shared_ptr<AbstractChatRoom> &chatRoom) override {
|
||||
L_Q();
|
||||
// Insert the proxy chat room instead of the real one
|
||||
q->getCore()->getPrivate()->insertChatRoomWithDb(q->getSharedFromThis());
|
||||
unsigned int notifyId = static_cast<ClientGroupChatRoomPrivate *>(chatRoom->getPrivate())->getLastNotifyId();
|
||||
q->getCore()->getPrivate()->insertChatRoomWithDb(q->getSharedFromThis(), notifyId);
|
||||
}
|
||||
|
||||
void onChatRoomDeleteRequested (const shared_ptr<AbstractChatRoom> &chatRoom) override {
|
||||
|
|
|
|||
|
|
@ -171,9 +171,9 @@ void CorePrivate::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom)
|
|||
}
|
||||
}
|
||||
|
||||
void CorePrivate::insertChatRoomWithDb (const shared_ptr<AbstractChatRoom> &chatRoom) {
|
||||
void CorePrivate::insertChatRoomWithDb (const shared_ptr<AbstractChatRoom> &chatRoom, unsigned int notifyId) {
|
||||
L_ASSERT(chatRoom->getState() == ChatRoom::State::Created);
|
||||
mainDb->insertChatRoom(chatRoom);
|
||||
mainDb->insertChatRoom(chatRoom, notifyId);
|
||||
}
|
||||
|
||||
void CorePrivate::loadChatRooms () {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public:
|
|||
|
||||
void loadChatRooms ();
|
||||
void insertChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom);
|
||||
void insertChatRoomWithDb (const std::shared_ptr<AbstractChatRoom> &chatRoom);
|
||||
void insertChatRoomWithDb (const std::shared_ptr<AbstractChatRoom> &chatRoom, unsigned int notifyId = 0);
|
||||
std::shared_ptr<AbstractChatRoom> createBasicChatRoom (const ChatRoomId &chatRoomId, AbstractChatRoom::CapabilitiesMask capabilities);
|
||||
std::shared_ptr<AbstractChatRoom> createClientGroupChatRoom (const std::string &subject, const std::string &uri = "", bool fallback = true);
|
||||
void replaceChatRoom (const std::shared_ptr<AbstractChatRoom> &replacedChatRoom, const std::shared_ptr<AbstractChatRoom> &newChatRoom);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ private:
|
|||
long long localSipAddressId,
|
||||
const tm &creationTime
|
||||
);
|
||||
long long insertChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom);
|
||||
long long insertChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom, unsigned int notifyId = 0);
|
||||
long long insertChatRoomParticipant (long long chatRoomId, long long participantSipAddressId, bool isAdmin);
|
||||
void insertChatRoomParticipantDevice (long long participantId, long long participantDeviceSipAddressId);
|
||||
void insertChatMessageParticipant (long long chatMessageId, long long sipAddressId, int state);
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ long long MainDbPrivate::insertOrUpdateImportedBasicChatRoom (
|
|||
return dbSession.getLastInsertId();
|
||||
}
|
||||
|
||||
long long MainDbPrivate::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom) {
|
||||
long long MainDbPrivate::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom, unsigned int notifyId) {
|
||||
const ChatRoomId &chatRoomId = chatRoom->getChatRoomId();
|
||||
const long long &peerSipAddressId = insertSipAddress(chatRoomId.getPeerAddress().asString());
|
||||
const long long &localSipAddressId = insertSipAddress(chatRoomId.getLocalAddress().asString());
|
||||
|
|
@ -336,10 +336,14 @@ long long MainDbPrivate::insertChatRoom (const shared_ptr<AbstractChatRoom> &cha
|
|||
const string &subject = chatRoom->getSubject();
|
||||
const int &flags = chatRoom->hasBeenLeft();
|
||||
*dbSession.getBackendSession() << "INSERT INTO chat_room ("
|
||||
" peer_sip_address_id, local_sip_address_id, creation_time, last_update_time, capabilities, subject, flags"
|
||||
") VALUES (:peerSipAddressId, :localSipAddressId, :creationTime, :lastUpdateTime, :capabilities, :subject, :flags)",
|
||||
soci::use(peerSipAddressId), soci::use(localSipAddressId), soci::use(creationTime), soci::use(lastUpdateTime),
|
||||
soci::use(capabilities), soci::use(subject), soci::use(flags);
|
||||
" peer_sip_address_id, local_sip_address_id, creation_time,"
|
||||
" last_update_time, capabilities, subject, flags, last_notify_id"
|
||||
") VALUES ("
|
||||
" :peerSipAddressId, :localSipAddressId, :creationTime,"
|
||||
" :lastUpdateTime, :capabilities, :subject, :flags, :lastNotifyId"
|
||||
")",
|
||||
soci::use(peerSipAddressId), soci::use(localSipAddressId), soci::use(creationTime),
|
||||
soci::use(lastUpdateTime), soci::use(capabilities), soci::use(subject), soci::use(flags), soci::use(notifyId);
|
||||
|
||||
id = dbSession.getLastInsertId();
|
||||
if (!chatRoom->canHandleParticipants())
|
||||
|
|
@ -2372,11 +2376,11 @@ list<shared_ptr<AbstractChatRoom>> MainDb::getChatRooms () const {
|
|||
};
|
||||
}
|
||||
|
||||
void MainDb::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom) {
|
||||
void MainDb::insertChatRoom (const shared_ptr<AbstractChatRoom> &chatRoom, unsigned int notifyId) {
|
||||
L_DB_TRANSACTION {
|
||||
L_D();
|
||||
|
||||
d->insertChatRoom(chatRoom);
|
||||
d->insertChatRoom(chatRoom, notifyId);
|
||||
tr.commit();
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ public:
|
|||
// ---------------------------------------------------------------------------
|
||||
|
||||
std::list<std::shared_ptr<AbstractChatRoom>> getChatRooms () const;
|
||||
void insertChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom);
|
||||
void insertChatRoom (const std::shared_ptr<AbstractChatRoom> &chatRoom, unsigned int notifyId = 0);
|
||||
void deleteChatRoom (const ChatRoomId &chatRoomId);
|
||||
void enableChatRoomMigration (const ChatRoomId &chatRoomId, bool enable);
|
||||
|
||||
|
|
|
|||
|
|
@ -3316,10 +3316,12 @@ static void group_chat_room_list_subscription (void) {
|
|||
linphone_chat_room_set_participant_admin_status(marieCr1, laureParticipant1, TRUE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participant_admin_statuses_changed, initialMarieStats.number_of_participant_admin_statuses_changed + 2, 1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participant_admin_statuses_changed, initialLaureStats.number_of_participant_admin_statuses_changed + 2, 1000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 2, 1000));
|
||||
BC_ASSERT_TRUE(linphone_participant_is_admin(laureParticipant1));
|
||||
linphone_chat_room_set_participant_admin_status(marieCr3, laureParticipant3, TRUE);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_participant_admin_statuses_changed, initialMarieStats.number_of_participant_admin_statuses_changed + 3, 1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_participant_admin_statuses_changed, initialLaureStats.number_of_participant_admin_statuses_changed + 3, 1000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 3, 1000));
|
||||
BC_ASSERT_TRUE(linphone_participant_is_admin(laureParticipant3));
|
||||
|
||||
// Marie now changes the subject or chat room 1
|
||||
|
|
@ -3327,6 +3329,7 @@ static void group_chat_room_list_subscription (void) {
|
|||
linphone_chat_room_set_subject(marieCr1, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_FALSE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr1), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr1), newSubject);
|
||||
|
||||
|
|
@ -3354,13 +3357,42 @@ static void group_chat_room_list_subscription (void) {
|
|||
wait_for_list(coresList, &dummy, 1, 5000);
|
||||
|
||||
// Check that Pauline receive the missing info and not more
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 3, 1000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_participant_admin_statuses_changed, initialPaulineStats.number_of_participant_admin_statuses_changed + 2, 1000));
|
||||
BC_ASSERT_TRUE(linphone_participant_is_admin(laureParticipantOfPauline1));
|
||||
BC_ASSERT_TRUE(linphone_participant_is_admin(laureParticipantOfPauline3));
|
||||
BC_ASSERT_FALSE(linphone_participant_is_admin(laureParticipantOfPauline2));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 1, 10000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr1), newSubject);
|
||||
|
||||
// Check that Pauline can still receive info once back
|
||||
// Marie now changes the subject or chat room 1
|
||||
newSubject = "New New subject";
|
||||
linphone_chat_room_set_subject(marieCr1, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 2, 10000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr1), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr1), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr1), newSubject);
|
||||
// Marie now changes the subject or chat room 2
|
||||
newSubject = "Newer subject";
|
||||
linphone_chat_room_set_subject(marieCr2, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 3, 10000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr2), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr2), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr2), newSubject);
|
||||
// Marie now changes the subject or chat room 3
|
||||
newSubject = "Newest subject";
|
||||
linphone_chat_room_set_subject(marieCr3, newSubject);
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &marie->stat.number_of_subject_changed, initialMarieStats.number_of_subject_changed + 4, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &laure->stat.number_of_subject_changed, initialLaureStats.number_of_subject_changed + 4, 10000));
|
||||
BC_ASSERT_TRUE(wait_for_list(coresList, &pauline->stat.number_of_subject_changed, initialPaulineStats.number_of_subject_changed + 4, 10000));
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(marieCr3), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(laureCr3), newSubject);
|
||||
BC_ASSERT_STRING_EQUAL(linphone_chat_room_get_subject(paulineCr3), newSubject);
|
||||
|
||||
// Clean db from chat room
|
||||
linphone_core_manager_delete_chat_room(marie, marieCr1, coresList);
|
||||
linphone_core_manager_delete_chat_room(pauline, paulineCr1, coresList);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue