Commit 30389fd9 authored by Ronan's avatar Ronan

fix(BasicToClientGroupChatRoom): Capabilities mask contains Migratable

parent 5ff20768
......@@ -20,7 +20,7 @@
#ifndef _TRAITS_H_
#define _TRAITS_H_
#include "general.h"
#include "linphone/utils/general.h"
// =============================================================================
......
......@@ -100,7 +100,6 @@ namespace Utils {
LINPHONE_PUBLIC std::string stringToLower (const std::string &str);
// Return a buffer allocated with new.
LINPHONE_PUBLIC char *utf8ToChar (uint32_t ic);
LINPHONE_PUBLIC inline std::string cStringToCppString (const char *str) {
......
......@@ -90,6 +90,11 @@ private:
BasicToClientGroupChatRoom::BasicToClientGroupChatRoom (const shared_ptr<ChatRoom> &chatRoom) :
ProxyChatRoom(*new BasicToClientGroupChatRoomPrivate, chatRoom) {}
BasicToClientGroupChatRoom::CapabilitiesMask BasicToClientGroupChatRoom::getCapabilities () const {
L_D();
return d->chatRoom->getCapabilities() | BasicToClientGroupChatRoom::Capabilities::Migratable;
}
shared_ptr<ChatMessage> BasicToClientGroupChatRoom::createChatMessage () {
shared_ptr<ChatMessage> msg = ProxyChatRoom::createChatMessage();
msg->getPrivate()->setChatRoom(getSharedFromThis());
......
......@@ -33,10 +33,15 @@ class LINPHONE_PUBLIC BasicToClientGroupChatRoom : public ProxyChatRoom {
public:
BasicToClientGroupChatRoom (const std::shared_ptr<ChatRoom> &chatRoom);
CapabilitiesMask getCapabilities () const override;
std::shared_ptr<ChatMessage> createChatMessage () override;
std::shared_ptr<ChatMessage> createChatMessage (const std::string &text) override;
static void migrate(const std::shared_ptr<ClientGroupChatRoom> &clientGroupChatRoom, const std::shared_ptr<AbstractChatRoom> &chatRoom);
static void migrate (
const std::shared_ptr<ClientGroupChatRoom> &clientGroupChatRoom,
const std::shared_ptr<AbstractChatRoom> &chatRoom
);
private:
L_DECLARE_PRIVATE(BasicToClientGroupChatRoom);
......
......@@ -73,14 +73,11 @@ shared_ptr<AbstractChatRoom> CorePrivate::createBasicChatRoom (
if (capabilities & ChatRoom::Capabilities::RealTimeText)
chatRoom.reset(new RealTimeTextChatRoom(q->getSharedFromThis(), chatRoomId));
else {
bool isToMigrate = (capabilities & ChatRoom::Capabilities::Migratable);
if (isToMigrate) {
shared_ptr<BasicChatRoom> bcr;
bcr.reset(new BasicChatRoom(q->getSharedFromThis(), chatRoomId));
chatRoom.reset(new BasicToClientGroupChatRoom(bcr));
} else {
chatRoom.reset(new BasicChatRoom(q->getSharedFromThis(), chatRoomId));
}
BasicChatRoom *basicChatRoom = new BasicChatRoom(q->getSharedFromThis(), chatRoomId);
if (capabilities & ChatRoom::Capabilities::Migratable)
chatRoom.reset(new BasicToClientGroupChatRoom(shared_ptr<BasicChatRoom>(basicChatRoom)));
else
chatRoom.reset(basicChatRoom);
}
AbstractChatRoomPrivate *dChatRoom = chatRoom->getPrivate();
......
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