Commit 3454bd3a authored by Ronan's avatar Ronan

fix(ChatRoom): clean some pieces of code in Abstract and ServerGroupChatRoom (stub)

parent 9258c5f1
......@@ -357,7 +357,7 @@ LinphoneReason ChatMessagePrivate::receive () {
ChatMessageModifier::Result result = ecmm.decode(q->getSharedFromThis(), errorCode);
if (result == ChatMessageModifier::Result::Error) {
/* Unable to decrypt message */
chatRoom->getPrivate()->notifyUndecryptableMessageReceived(q->getSharedFromThis());
chatRoom->getPrivate()->notifyUndecryptableChatMessageReceived(q->getSharedFromThis());
reason = linphone_error_code_to_reason(errorCode);
q->sendDeliveryNotification(reason);
return reason;
......
......@@ -43,7 +43,7 @@ public:
virtual void addTransientEvent (const std::shared_ptr<EventLog> &eventLog) = 0;
virtual void removeTransientEvent (const std::shared_ptr<EventLog> &eventLog) = 0;
virtual void notifyUndecryptableMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) = 0;
virtual void notifyUndecryptableChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) = 0;
virtual void onChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) = 0;
virtual LinphoneReason onSipMessageReceived (SalOp *op, const SalMessage *message) = 0;
......
......@@ -95,7 +95,7 @@ const list<shared_ptr<Participant>> &BasicChatRoom::getParticipants () const {
return d->participants;
}
void BasicChatRoom::setParticipantAdminStatus (shared_ptr<Participant> &, bool) {
void BasicChatRoom::setParticipantAdminStatus (const shared_ptr<Participant> &, bool) {
lError() << "setParticipantAdminStatus() is not allowed on a BasicChatRoom";
}
......
......@@ -51,7 +51,7 @@ public:
int getParticipantCount () const override;
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
void setParticipantAdminStatus (const std::shared_ptr<Participant> &participant, bool isAdmin) override;
const std::string &getSubject () const override;
void setSubject (const std::string &subject) override;
......
......@@ -47,7 +47,7 @@ public:
void addTransientEvent (const std::shared_ptr<EventLog> &eventLog) override;
void removeTransientEvent (const std::shared_ptr<EventLog> &eventLog) override;
void notifyUndecryptableMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override;
void notifyUndecryptableChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override;
void onChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override;
LinphoneReason onSipMessageReceived (SalOp *op, const SalMessage *message) override;
......
......@@ -271,7 +271,7 @@ void ChatRoomPrivate::notifyStateChanged () {
cb(cr, (LinphoneChatRoomState)state);
}
void ChatRoomPrivate::notifyUndecryptableMessageReceived (const shared_ptr<ChatMessage> &msg) {
void ChatRoomPrivate::notifyUndecryptableChatMessageReceived (const shared_ptr<ChatMessage> &msg) {
L_Q();
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(q);
LinphoneChatRoomCbs *cbs = linphone_chat_room_get_callbacks(cr);
......
......@@ -29,9 +29,6 @@ LINPHONE_BEGIN_NAMESPACE
class ChatRoomPrivate;
class LINPHONE_PUBLIC ChatRoom : public AbstractChatRoom {
friend class Core;
friend class FileTransferChatMessageModifier;
public:
L_OVERRIDE_SHARED_FROM_THIS(ChatRoom);
......
......@@ -247,7 +247,7 @@ const list<shared_ptr<Participant>> &ClientGroupChatRoom::getParticipants () con
return RemoteConference::getParticipants();
}
void ClientGroupChatRoom::setParticipantAdminStatus (shared_ptr<Participant> &participant, bool isAdmin) {
void ClientGroupChatRoom::setParticipantAdminStatus (const shared_ptr<Participant> &participant, bool isAdmin) {
if (isAdmin == participant->isAdmin())
return;
......
......@@ -69,7 +69,7 @@ public:
int getParticipantCount () const override;
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
void setParticipantAdminStatus (const std::shared_ptr<Participant> &participant, bool isAdmin) override;
const std::string &getSubject () const override;
void setSubject (const std::string &subject) override;
......
......@@ -20,36 +20,34 @@
#ifndef _SERVER_GROUP_CHAT_ROOM_P_H_
#define _SERVER_GROUP_CHAT_ROOM_P_H_
// From coreapi.
#include "private.h"
#include "address/address.h"
#include "chat-room-p.h"
#include "server-group-chat-room.h"
#include "conference/session/call-session-listener.h"
#include "server-group-chat-room.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class Participant;
class ServerGroupChatRoomPrivate : public ChatRoomPrivate, public CallSessionListener {
public:
ServerGroupChatRoomPrivate () = default;
std::shared_ptr<Participant> addParticipant (const IdentityAddress &participantAddress);
void removeParticipant (const std::shared_ptr<const Participant> &participant);
std::shared_ptr<Participant> findRemovedParticipant (const std::shared_ptr<const CallSession> &session) const;
std::shared_ptr<Participant> addParticipant (const IdentityAddress &addr);
void confirmCreation ();
void confirmJoining (SalCallOp *op);
std::shared_ptr<Participant> findRemovedParticipant (const std::shared_ptr<const CallSession> &session) const;
std::string generateConferenceId () const;
void removeParticipant (const std::shared_ptr<const Participant> &participant);
void subscribeReceived (LinphoneEvent *event);
void update (SalCallOp *op);
void dispatchMessage (const IdentityAddress &fromAddr, const Content &content);
void dispatchMessage (const IdentityAddress &fromAddress, const Content &content);
void setConferenceAddress (const IdentityAddress &conferenceAddress);
LinphoneReason onSipMessageReceived (SalOp *op, const SalMessage *message) override;
void setConferenceAddress (const IdentityAddress &confAddr);
private:
void designateAdmin ();
......@@ -57,7 +55,11 @@ private:
bool isAdminLeft () const;
// CallSessionListener
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
void onCallSessionStateChanged (
const std::shared_ptr<const CallSession> &session,
LinphoneCallState state,
const std::string &message
) override;
std::list<std::shared_ptr<Participant>> removedParticipants;
......
......@@ -18,7 +18,6 @@
*/
#include "core/core.h"
#include "server-group-chat-room-p.h"
// =============================================================================
......@@ -33,9 +32,7 @@ shared_ptr<Participant> ServerGroupChatRoomPrivate::addParticipant (const Identi
return nullptr;
}
void ServerGroupChatRoomPrivate::confirmCreation () {}
void ServerGroupChatRoomPrivate::confirmJoining (SalCallOp *) {}
void ServerGroupChatRoomPrivate::removeParticipant (const shared_ptr<const Participant> &) {}
shared_ptr<Participant> ServerGroupChatRoomPrivate::findRemovedParticipant (
const shared_ptr<const CallSession> &
......@@ -43,12 +40,18 @@ shared_ptr<Participant> ServerGroupChatRoomPrivate::findRemovedParticipant (
return nullptr;
}
// -----------------------------------------------------------------------------
void ServerGroupChatRoomPrivate::confirmCreation () {}
void ServerGroupChatRoomPrivate::confirmJoining (SalCallOp *) {}
// -----------------------------------------------------------------------------
string ServerGroupChatRoomPrivate::generateConferenceId () const {
return "";
}
void ServerGroupChatRoomPrivate::removeParticipant (const shared_ptr<const Participant> &) {}
void ServerGroupChatRoomPrivate::subscribeReceived (LinphoneEvent *) {}
void ServerGroupChatRoomPrivate::update (SalCallOp *) {}
......@@ -57,12 +60,14 @@ void ServerGroupChatRoomPrivate::update (SalCallOp *) {}
void ServerGroupChatRoomPrivate::dispatchMessage (const IdentityAddress &, const Content &) {}
void ServerGroupChatRoomPrivate::setConferenceAddress (const IdentityAddress &) {}
// -----------------------------------------------------------------------------
LinphoneReason ServerGroupChatRoomPrivate::onSipMessageReceived (SalOp *, const SalMessage *) {
return LinphoneReasonNone;
}
void ServerGroupChatRoomPrivate::setConferenceAddress (const IdentityAddress &confAddr) {}
// -----------------------------------------------------------------------------
void ServerGroupChatRoomPrivate::designateAdmin () {}
......@@ -104,6 +109,10 @@ bool ServerGroupChatRoom::hasBeenLeft () const {
return true;
}
const IdentityAddress &ServerGroupChatRoom::getConferenceAddress () const {
return LocalConference::getConferenceAddress();
}
bool ServerGroupChatRoom::canHandleParticipants () const {
return false;
}
......@@ -112,10 +121,6 @@ void ServerGroupChatRoom::addParticipant (const IdentityAddress &, const CallSes
void ServerGroupChatRoom::addParticipants (const list<IdentityAddress> &, const CallSessionParams *, bool) {}
const IdentityAddress &ServerGroupChatRoom::getConferenceAddress () const {
return LocalConference::getConferenceAddress();
}
void ServerGroupChatRoom::removeParticipant (const shared_ptr<const Participant> &) {}
void ServerGroupChatRoom::removeParticipants (const list<shared_ptr<Participant>> &) {}
......@@ -136,7 +141,7 @@ const list<shared_ptr<Participant>> &ServerGroupChatRoom::getParticipants () con
return LocalConference::getParticipants();
}
void ServerGroupChatRoom::setParticipantAdminStatus (shared_ptr<Participant> &, bool) {}
void ServerGroupChatRoom::setParticipantAdminStatus (const shared_ptr<Participant> &, bool) {}
const string &ServerGroupChatRoom::getSubject () const {
return LocalConference::getSubject();
......
......@@ -20,18 +20,14 @@
#ifndef _SERVER_GROUP_CHAT_ROOM_H_
#define _SERVER_GROUP_CHAT_ROOM_H_
// From coreapi
#include "private.h"
#include "chat/chat-room/chat-room.h"
#include "conference/local-conference.h"
#include "linphone/types.h"
// =============================================================================
LINPHONE_BEGIN_NAMESPACE
class SalCallOp;
class ServerGroupChatRoomPrivate;
class ServerGroupChatRoom : public ChatRoom, public LocalConference {
......@@ -55,19 +51,23 @@ public:
bool canHandleParticipants () 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;
void addParticipant (const IdentityAddress &address, const CallSessionParams *params, bool hasMedia) override;
void addParticipants (
const std::list<IdentityAddress> &addresses,
const CallSessionParams *params,
bool hasMedia
) override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
void removeParticipants (const std::list<std::shared_ptr<Participant>> &participants) override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &addr) const override;
std::shared_ptr<Participant> findParticipant (const IdentityAddress &participantAddress) const override;
std::shared_ptr<Participant> getMe () const override;
int getParticipantCount () const override;
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
void setParticipantAdminStatus (const std::shared_ptr<Participant> &participant, bool isAdmin) override;
const std::string &getSubject () const override;
void setSubject (const std::string &subject) override;
......
......@@ -50,7 +50,7 @@ public:
virtual void leave () = 0;
virtual void removeParticipant (const std::shared_ptr<const Participant> &participant) = 0;
virtual void removeParticipants (const std::list<std::shared_ptr<Participant>> &participants) = 0;
virtual void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) = 0;
virtual void setParticipantAdminStatus (const std::shared_ptr<Participant> &participant, bool isAdmin) = 0;
virtual void setSubject (const std::string &subject) = 0;
};
......
......@@ -110,7 +110,7 @@ void Conference::removeParticipants (const list<shared_ptr<Participant>> &partic
removeParticipant(p);
}
void Conference::setParticipantAdminStatus (shared_ptr<Participant> &participant, bool isAdmin) {
void Conference::setParticipantAdminStatus (const shared_ptr<Participant> &participant, bool isAdmin) {
lError() << "Conference class does not handle setParticipantAdminStatus() generically";
}
......
......@@ -60,7 +60,7 @@ public:
void leave () override;
void removeParticipant (const std::shared_ptr<const Participant> &participant) override;
void removeParticipants (const std::list<std::shared_ptr<Participant>> &participants) override;
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
void setParticipantAdminStatus (const std::shared_ptr<Participant> &participant, bool isAdmin) override;
void setSubject (const std::string &subject) override;
protected:
......
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