precise wether or not the chat room is one to one

This commit is contained in:
Benjamin Reis 2018-03-21 11:05:18 +01:00
parent aa6498b6c9
commit a351f6c03c
3 changed files with 9 additions and 7 deletions

View file

@ -532,10 +532,10 @@ ChatRoomId LocalConferenceEventHandler::getChatRoomId () const {
return d->chatRoomId;
}
string LocalConferenceEventHandler::getNotifyForId (int notifyId) {
string LocalConferenceEventHandler::getNotifyForId (int notifyId, bool oneToOne) {
L_D();
if (notifyId == 0)
return d->createNotifyFullState(static_cast<int>(d->lastNotify)); // oneToOne ?
return d->createNotifyFullState(static_cast<int>(d->lastNotify), oneToOne);
else if (notifyId < static_cast<int>(d->lastNotify))
return d->createNotifyMultipart(notifyId);

View file

@ -54,7 +54,7 @@ public:
void setChatRoomId (const ChatRoomId &chatRoomId);
ChatRoomId getChatRoomId () const;
std::string getNotifyForId (int notifyId);
std::string getNotifyForId (int notifyId, bool oneToOne = false);
private:
L_DECLARE_PRIVATE(LocalConferenceEventHandler);

View file

@ -18,6 +18,7 @@
*/
#include "belle-sip/utils.h"
#include "linphone/enums/chat-room-enums.h"
#include "linphone/utils/utils.h"
#include "linphone/api/c-address.h"
@ -97,15 +98,16 @@ void LocalConferenceListEventHandler::subscribeReceived (LinphoneEvent *lev, con
if (!handler)
continue;
string notifyBody = handler->getNotifyForId(notifyId);
if (notifyBody.empty())
continue;
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(linphone_event_get_core(lev))->findChatRoom(chatRoomId);
if (!chatRoom) {
lError() << "Received subscribe for unknown chat room: " << chatRoomId;
continue;
}
string notifyBody = handler->getNotifyForId(notifyId, (chatRoom->getCapabilities() & AbstractChatRoom::Capabilities::OneToOne));
if (notifyBody.empty())
continue;
shared_ptr<Participant> participant = chatRoom->findParticipant(participantAddr);
if (!participant) {
lError() << "Received subscribe for unknown participant: " << participantAddr << " for chat room: " << chatRoomId;