Commit ae935149 authored by Ghislain MARY's avatar Ghislain MARY

Add canHandleMultipart() method on chat rooms.

parent 3f344bb5
......@@ -600,7 +600,7 @@ void ChatMessagePrivate::send () {
if (applyModifiers) {
// Do not multipart or encapsulate with CPIM in an old ChatRoom to maintain backward compatibility
if (q->getChatRoom()->canHandleCpim()) {
if (q->getChatRoom()->canHandleMultipart()) {
if ((currentSendStep &ChatMessagePrivate::Step::Multipart) == ChatMessagePrivate::Step::Multipart) {
lInfo() << "Multipart step already done, skipping";
} else {
......
......@@ -51,6 +51,9 @@ public:
typedef EnumMask<Capabilities> CapabilitiesMask;
virtual bool canHandleCpim () const = 0;
virtual bool canHandleMultipart () const = 0;
virtual const ChatRoomId &getChatRoomId () const = 0;
virtual const IdentityAddress &getPeerAddress () const = 0;
......
......@@ -34,7 +34,8 @@ public:
private:
std::string subject;
std::list<std::shared_ptr<Participant>> participants;
bool allowCpim = false;
bool cpimAllowed = false;
bool multipartAllowed = false;
L_DECLARE_PUBLIC(BasicChatRoom);
};
......
......@@ -43,6 +43,26 @@ BasicChatRoom::BasicChatRoom (
d->participants.push_back(make_shared<Participant>(getPeerAddress()));
}
void BasicChatRoom::allowCpim (bool value) {
L_D();
d->cpimAllowed = value;
}
void BasicChatRoom::allowMultipart (bool value) {
L_D();
d->multipartAllowed = value;
}
bool BasicChatRoom::canHandleCpim () const {
L_D();
return d->cpimAllowed;
}
bool BasicChatRoom::canHandleMultipart () const {
L_D();
return d->multipartAllowed;
}
BasicChatRoom::CapabilitiesMask BasicChatRoom::getCapabilities () const {
return { Capabilities::Basic, Capabilities::OneToOne };
}
......@@ -55,16 +75,6 @@ bool BasicChatRoom::canHandleParticipants () const {
return false;
}
bool BasicChatRoom::canHandleCpim () const {
L_D();
return d->allowCpim;
}
void BasicChatRoom::allowCpim (bool isCpimAllowed) {
L_D();
d->allowCpim = isCpimAllowed;
}
const IdentityAddress &BasicChatRoom::getConferenceAddress () const {
lError() << "a BasicChatRoom does not have a conference address";
return Utils::getEmptyConstRefObject<IdentityAddress>();
......
......@@ -33,13 +33,17 @@ class LINPHONE_PUBLIC BasicChatRoom : public ChatRoom {
friend class CorePrivate;
public:
void allowCpim (bool value);
void allowMultipart (bool value);
bool canHandleCpim () const override;
bool canHandleMultipart () const override;
CapabilitiesMask getCapabilities () const override;
bool hasBeenLeft () const override;
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const override;
bool canHandleCpim () const override;
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) override;
......@@ -61,7 +65,6 @@ public:
void join () override;
void leave () override;
void allowCpim (bool isCpimAllowed);
protected:
explicit BasicChatRoom (BasicChatRoomPrivate &p, const std::shared_ptr<Core> &core, const ChatRoomId &chatRoomId);
......
......@@ -205,6 +205,14 @@ shared_ptr<Core> ClientGroupChatRoom::getCore () const {
return ChatRoom::getCore();
}
bool ClientGroupChatRoom::canHandleCpim () const {
return true;
}
bool ClientGroupChatRoom::canHandleMultipart () const {
return true;
}
ClientGroupChatRoom::CapabilitiesMask ClientGroupChatRoom::getCapabilities () const {
L_D();
return d->capabilities;
......@@ -218,10 +226,6 @@ bool ClientGroupChatRoom::canHandleParticipants () const {
return RemoteConference::canHandleParticipants();
}
bool ClientGroupChatRoom::canHandleCpim () const {
return true;
}
const IdentityAddress &ClientGroupChatRoom::getConferenceAddress () const {
return RemoteConference::getConferenceAddress();
}
......
......@@ -57,13 +57,15 @@ public:
std::shared_ptr<Core> getCore () const;
bool canHandleCpim () const override;
bool canHandleMultipart () const override;
CapabilitiesMask getCapabilities () const override;
bool hasBeenLeft () const override;
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const override;
bool canHandleCpim () const override;
void deleteFromDb () override;
......
......@@ -298,13 +298,19 @@ const IdentityAddress &ProxyChatRoom::getConferenceAddress () const {
// -----------------------------------------------------------------------------
bool ProxyChatRoom::canHandleParticipants () const {
bool ProxyChatRoom::canHandleCpim () const {
L_D();
return d->chatRoom->canHandleParticipants();
return d->chatRoom->canHandleCpim();
}
bool ProxyChatRoom::canHandleCpim () const {
return true;
bool ProxyChatRoom::canHandleMultipart () const {
L_D();
return d->chatRoom->canHandleMultipart();
}
bool ProxyChatRoom::canHandleParticipants () const {
L_D();
return d->chatRoom->canHandleParticipants();
}
void ProxyChatRoom::addParticipant (
......
......@@ -75,8 +75,10 @@ public:
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const override;
bool canHandleCpim () const override;
bool canHandleMultipart () const override;
bool canHandleParticipants () const override;
void addParticipant (
const IdentityAddress &participantAddress,
......
......@@ -125,6 +125,14 @@ ServerGroupChatRoom::CapabilitiesMask ServerGroupChatRoom::getCapabilities () co
return 0;
}
bool ServerGroupChatRoom::canHandleCpim () const {
return true;
}
bool ServerGroupChatRoom::canHandleMultipart () const {
return true;
}
bool ServerGroupChatRoom::hasBeenLeft () const {
return true;
}
......@@ -137,10 +145,6 @@ bool ServerGroupChatRoom::canHandleParticipants () const {
return false;
}
bool ServerGroupChatRoom::canHandleCpim () const {
return true;
}
void ServerGroupChatRoom::addParticipant (const IdentityAddress &, const CallSessionParams *, bool) {}
void ServerGroupChatRoom::addParticipants (const list<IdentityAddress> &, const CallSessionParams *, bool) {}
......
......@@ -47,6 +47,9 @@ public:
std::shared_ptr<Core> getCore () const;
bool canHandleCpim () const override;
bool canHandleMultipart () const override;
std::shared_ptr<Participant> findParticipant (const std::shared_ptr<const CallSession> &session) const;
CapabilitiesMask getCapabilities () const override;
......@@ -55,7 +58,6 @@ public:
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const override;
bool canHandleCpim () const override;
void addParticipant (const IdentityAddress &address, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (
......
......@@ -47,7 +47,6 @@ public:
bool hasMedia
) = 0;
virtual bool canHandleParticipants () const = 0;
virtual bool canHandleCpim () const = 0;
virtual std::shared_ptr<Participant> findParticipant (const IdentityAddress &participantAddress) const = 0;
virtual const IdentityAddress &getConferenceAddress () const = 0;
virtual std::shared_ptr<Participant> getMe () const = 0;
......
......@@ -72,10 +72,6 @@ bool Conference::canHandleParticipants () const {
return true;
}
bool Conference::canHandleCpim () const {
return true;
}
const IdentityAddress &Conference::getConferenceAddress () const {
L_D();
return d->conferenceAddress;
......
......@@ -50,7 +50,6 @@ public:
void addParticipant (const IdentityAddress &addr, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (const std::list<IdentityAddress> &addresses, const CallSessionParams *params, bool hasMedia) override;
bool canHandleParticipants () const override;
bool canHandleCpim () const override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const override;
const IdentityAddress &getConferenceAddress () const override;
std::shared_ptr<Participant> getMe () const override;
......
......@@ -42,6 +42,7 @@ static void chat_message_multipart_modifier_base(bool first_file_transfer, bool
IdentityAddress paulineAddress(linphone_address_as_string_uri_only(pauline->identity));
shared_ptr<AbstractChatRoom> marieRoom = pauline->lc->cppPtr->getOrCreateBasicChatRoom(paulineAddress);
static_pointer_cast<BasicChatRoom>(marieRoom)->allowMultipart(true);
shared_ptr<ChatMessage> marieMessage = marieRoom->createChatMessage();
if (first_file_transfer) {
......
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