Commit 3a39020f authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added canHandleCpim method on chat rooms to know whether or not send Cpim messages through it

parent 963f29b2
......@@ -547,7 +547,7 @@ void ChatMessagePrivate::send () {
if (applyModifiers) {
// Do not multipart or encapsulate with CPIM in an old ChatRoom to maintain backward compatibility
if (q->getChatRoom()->canHandleParticipants()) {
if (q->getChatRoom()->canHandleCpim()) {
if ((currentSendStep &ChatMessagePrivate::Step::Multipart) == ChatMessagePrivate::Step::Multipart) {
lInfo() << "Multipart step already done, skipping";
} else {
......@@ -575,7 +575,7 @@ void ChatMessagePrivate::send () {
currentSendStep |= ChatMessagePrivate::Step::Encryption;
}
if (q->getChatRoom()->canHandleParticipants()) {
if (q->getChatRoom()->canHandleCpim()) {
if ((currentSendStep &ChatMessagePrivate::Step::Cpim) == ChatMessagePrivate::Step::Cpim) {
lInfo() << "Cpim step already done, skipping";
} else {
......
......@@ -34,6 +34,7 @@ public:
private:
std::string subject;
std::list<std::shared_ptr<Participant>> participants;
bool allowCpim = false;
L_DECLARE_PUBLIC(BasicChatRoom);
};
......
......@@ -55,6 +55,16 @@ 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>();
......
......@@ -39,6 +39,7 @@ public:
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;
......@@ -60,6 +61,8 @@ 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);
......
......@@ -200,6 +200,10 @@ bool ClientGroupChatRoom::canHandleParticipants () const {
return RemoteConference::canHandleParticipants();
}
bool ClientGroupChatRoom::canHandleCpim () const {
return true;
}
const IdentityAddress &ClientGroupChatRoom::getConferenceAddress () const {
return RemoteConference::getConferenceAddress();
}
......
......@@ -61,6 +61,7 @@ public:
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;
......
......@@ -278,6 +278,10 @@ bool ProxyChatRoom::canHandleParticipants () const {
return d->chatRoom->canHandleParticipants();
}
bool ProxyChatRoom::canHandleCpim () const {
return true;
}
void ProxyChatRoom::addParticipant (
const IdentityAddress &participantAddress,
const CallSessionParams *params,
......
......@@ -75,6 +75,7 @@ public:
const IdentityAddress &getConferenceAddress () const override;
bool canHandleParticipants () const override;
bool canHandleCpim () const override;
void addParticipant (
const IdentityAddress &participantAddress,
......
......@@ -132,6 +132,10 @@ 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) {}
......
......@@ -50,6 +50,7 @@ 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 (
......
......@@ -48,6 +48,7 @@ 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,6 +72,10 @@ bool Conference::canHandleParticipants () const {
return true;
}
bool Conference::canHandleCpim () const {
return true;
}
const IdentityAddress &Conference::getConferenceAddress () const {
L_D();
return d->conferenceAddress;
......
......@@ -50,6 +50,7 @@ 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;
......
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