Commit dea31759 authored by Benjamin REIS's avatar Benjamin REIS

Do not change role when adding/removing a device + test

parent adc88d09
......@@ -315,11 +315,8 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceAdded (c
confInfo.setUsers(users);
UserType user = UserType();
UserRolesType roles;
UserType::EndpointSequence endpoints;
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back("participant");
user.setState(StateType::partial);
EndpointType endpoint = EndpointType();
......@@ -339,11 +336,8 @@ string LocalConferenceEventHandlerPrivate::createNotifyParticipantDeviceRemoved
confInfo.setUsers(users);
UserType user = UserType();
UserRolesType roles;
UserType::EndpointSequence endpoints;
user.setRoles(roles);
user.setEntity(addr.asStringUriOnly());
user.getRoles()->getEntry().push_back("participant");
user.setState(StateType::partial);
EndpointType endpoint = EndpointType();
......
......@@ -103,20 +103,30 @@ void RemoteConferenceEventHandlerPrivate::simpleNotifyReceived (const string &xm
isFullState
);
} else {
bool isAdmin = false;
if (user.getState() == StateType::full) {
confListener->onParticipantAdded(
make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantAdded,
tm,
chatRoomId,
lastNotify,
addr
),
isFullState
);
}
if (user.getRoles()) {
bool isAdmin = false;
for (const auto &entry : user.getRoles()->getEntry()) {
if (entry == "admin") {
isAdmin = true;
break;
}
}
}
if (user.getState() == StateType::full) {
confListener->onParticipantAdded(
confListener->onParticipantSetAdmin(
make_shared<ConferenceParticipantEvent>(
EventLog::Type::ConferenceParticipantAdded,
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
tm,
chatRoomId,
lastNotify,
......@@ -126,17 +136,6 @@ void RemoteConferenceEventHandlerPrivate::simpleNotifyReceived (const string &xm
);
}
confListener->onParticipantSetAdmin(
make_shared<ConferenceParticipantEvent>(
isAdmin ? EventLog::Type::ConferenceParticipantSetAdmin : EventLog::Type::ConferenceParticipantUnsetAdmin,
tm,
chatRoomId,
lastNotify,
addr
),
isFullState
);
for (const auto &endpoint : user.getEndpoint()) {
if (!endpoint.getEntity().present())
break;
......
......@@ -1195,6 +1195,8 @@ void send_device_added_notify() {
BC_ASSERT_TRUE(tester->participantDevices.find(aliceAddr.asString()) != tester->participantDevices.end());
BC_ASSERT_EQUAL(tester->participantDevices.find(bobAddr.asString())->second, 0, int, "%d");
BC_ASSERT_EQUAL(tester->participantDevices.find(aliceAddr.asString())->second, 0, int, "%d");
BC_ASSERT_TRUE(!tester->participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester->participants.find(aliceAddr.asString())->second);
notify = localHandlerPrivate->createNotifyParticipantDeviceAdded(aliceAddr, aliceAddr);
tester->handler->notifyReceived(notify);
......@@ -1204,6 +1206,8 @@ void send_device_added_notify() {
BC_ASSERT_TRUE(tester->participantDevices.find(aliceAddr.asString()) != tester->participantDevices.end());
BC_ASSERT_EQUAL(tester->participantDevices.find(bobAddr.asString())->second, 0, int, "%d");
BC_ASSERT_EQUAL(tester->participantDevices.find(aliceAddr.asString())->second, 1, int, "%d");
BC_ASSERT_TRUE(!tester->participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester->participants.find(aliceAddr.asString())->second);
tester = nullptr;
localConf = nullptr;
......@@ -1251,6 +1255,8 @@ void send_device_removed_notify() {
BC_ASSERT_TRUE(tester->participantDevices.find(aliceAddr.asString()) != tester->participantDevices.end());
BC_ASSERT_EQUAL(tester->participantDevices.find(bobAddr.asString())->second, 0, int, "%d");
BC_ASSERT_EQUAL(tester->participantDevices.find(aliceAddr.asString())->second, 0, int, "%d");
BC_ASSERT_TRUE(!tester->participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester->participants.find(aliceAddr.asString())->second);
notify = localHandlerPrivate->createNotifyParticipantDeviceAdded(aliceAddr, aliceAddr);
tester->handler->notifyReceived(notify);
......@@ -1260,6 +1266,8 @@ void send_device_removed_notify() {
BC_ASSERT_TRUE(tester->participantDevices.find(aliceAddr.asString()) != tester->participantDevices.end());
BC_ASSERT_EQUAL(tester->participantDevices.find(bobAddr.asString())->second, 0, int, "%d");
BC_ASSERT_EQUAL(tester->participantDevices.find(aliceAddr.asString())->second, 1, int, "%d");
BC_ASSERT_TRUE(!tester->participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester->participants.find(aliceAddr.asString())->second);
notify = localHandlerPrivate->createNotifyParticipantDeviceRemoved(aliceAddr, aliceAddr);
tester->handler->notifyReceived(notify);
......@@ -1269,6 +1277,8 @@ void send_device_removed_notify() {
BC_ASSERT_TRUE(tester->participantDevices.find(aliceAddr.asString()) != tester->participantDevices.end());
BC_ASSERT_EQUAL(tester->participantDevices.find(bobAddr.asString())->second, 0, int, "%d");
BC_ASSERT_EQUAL(tester->participantDevices.find(aliceAddr.asString())->second, 0, int, "%d");
BC_ASSERT_TRUE(!tester->participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester->participants.find(aliceAddr.asString())->second);
notify = localHandlerPrivate->createNotifyParticipantDeviceRemoved(aliceAddr, aliceAddr);
tester->handler->notifyReceived(notify);
......@@ -1278,6 +1288,8 @@ void send_device_removed_notify() {
BC_ASSERT_TRUE(tester->participantDevices.find(aliceAddr.asString()) != tester->participantDevices.end());
BC_ASSERT_EQUAL(tester->participantDevices.find(bobAddr.asString())->second, 0, int, "%d");
BC_ASSERT_EQUAL(tester->participantDevices.find(aliceAddr.asString())->second, 0, int, "%d");
BC_ASSERT_TRUE(!tester->participants.find(bobAddr.asString())->second);
BC_ASSERT_TRUE(tester->participants.find(aliceAddr.asString())->second);
tester = nullptr;
localConf = nullptr;
......
This diff is collapsed.
......@@ -289,6 +289,7 @@ typedef struct _stats {
int number_of_participant_admin_statuses_changed;
int number_of_participants_removed;
int number_of_subject_changed;
int number_of_participant_devices_added;
}stats;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment