mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
feat(EventLog): wrap (partially)
This commit is contained in:
parent
2d242ad9c4
commit
6b143b0cad
14 changed files with 184 additions and 134 deletions
|
|
@ -1658,66 +1658,68 @@ LinphoneCallStats *linphone_call_stats_new(void);
|
|||
/** Belle Sip-based objects need unique ids
|
||||
*/
|
||||
|
||||
BELLE_SIP_DECLARE_TYPES_BEGIN(linphone,10000)
|
||||
BELLE_SIP_DECLARE_TYPES_BEGIN(linphone, 10000)
|
||||
BELLE_SIP_TYPE_ID(LinphoneAccountCreator),
|
||||
BELLE_SIP_TYPE_ID(LinphoneAccountCreatorCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneAccountCreatorService),
|
||||
BELLE_SIP_TYPE_ID(LinphoneAddress),
|
||||
BELLE_SIP_TYPE_ID(LinphoneAuthInfo),
|
||||
BELLE_SIP_TYPE_ID(LinphoneBuffer),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCall),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallLog),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallParams),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallStats),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessageCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatMessageEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatRoom),
|
||||
BELLE_SIP_TYPE_ID(LinphoneChatRoomCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConference),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConferenceEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConferenceParams),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConferenceParticipantEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
|
||||
BELLE_SIP_TYPE_ID(LinphoneContent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCore),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCoreCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneErrorInfo),
|
||||
BELLE_SIP_TYPE_ID(LinphoneEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneEventLog),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFactory),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFriend),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFriendList),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFriendListCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngine),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImEncryptionEngineCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneImNotifPolicy),
|
||||
BELLE_SIP_TYPE_ID(LinphoneInfoMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactProvider),
|
||||
BELLE_SIP_TYPE_ID(LinphoneLDAPContactSearch),
|
||||
BELLE_SIP_TYPE_ID(LinphoneProxyConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFriend),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFriendList),
|
||||
BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequest),
|
||||
BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequestCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession),
|
||||
BELLE_SIP_TYPE_ID(LinphoneTunnel),
|
||||
BELLE_SIP_TYPE_ID(LinphoneTunnelConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFriendListCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneNatPolicy),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCore),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCoreCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneFactory),
|
||||
BELLE_SIP_TYPE_ID(LinphoneAuthInfo),
|
||||
BELLE_SIP_TYPE_ID(LinphoneVcard),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceModel),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceService),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresencePerson),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceActivity),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceNote),
|
||||
BELLE_SIP_TYPE_ID(LinphoneErrorInfo),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConferenceParams),
|
||||
BELLE_SIP_TYPE_ID(LinphoneConference),
|
||||
BELLE_SIP_TYPE_ID(LinphoneInfoMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneParticipant),
|
||||
BELLE_SIP_TYPE_ID(LinphonePayloadType),
|
||||
BELLE_SIP_TYPE_ID(LinphoneRange),
|
||||
BELLE_SIP_TYPE_ID(LinphoneVideoDefinition),
|
||||
BELLE_SIP_TYPE_ID(LinphoneTransports),
|
||||
BELLE_SIP_TYPE_ID(LinphoneVideoActivationPolicy),
|
||||
BELLE_SIP_TYPE_ID(LinphoneCallStats),
|
||||
BELLE_SIP_TYPE_ID(LinphonePlayer),
|
||||
BELLE_SIP_TYPE_ID(LinphonePlayerCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneEventLog),
|
||||
BELLE_SIP_TYPE_ID(LinphoneMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneMessageEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneParticipant)
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceActivity),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceModel),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceNote),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresencePerson),
|
||||
BELLE_SIP_TYPE_ID(LinphonePresenceService),
|
||||
BELLE_SIP_TYPE_ID(LinphoneProxyConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphoneRange),
|
||||
BELLE_SIP_TYPE_ID(LinphoneTransports),
|
||||
BELLE_SIP_TYPE_ID(LinphoneTunnel),
|
||||
BELLE_SIP_TYPE_ID(LinphoneTunnelConfig),
|
||||
BELLE_SIP_TYPE_ID(LinphoneVcard),
|
||||
BELLE_SIP_TYPE_ID(LinphoneVideoActivationPolicy),
|
||||
BELLE_SIP_TYPE_ID(LinphoneVideoDefinition),
|
||||
BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequest),
|
||||
BELLE_SIP_TYPE_ID(LinphoneXmlRpcRequestCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession)
|
||||
BELLE_SIP_DECLARE_TYPES_END
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,16 +28,19 @@
|
|||
#endif // ifdef __cplusplus
|
||||
|
||||
LINPHONE_PUBLIC LinphoneEventLog *linphone_event_log_new ();
|
||||
LINPHONE_PUBLIC LinphoneEventLog *linphone_event_log_clone (const LinphoneEventLog *event_log);
|
||||
LINPHONE_PUBLIC LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log);
|
||||
LINPHONE_PUBLIC LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCallEvent *linphone_call_event_clone (const LinphoneCallEvent *call_event);
|
||||
LINPHONE_PUBLIC LinphoneCall *linphone_call_event_get_call (const LinphoneCallEvent *call_event);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceEvent *linphone_conference_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *address
|
||||
);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceEvent *linphone_conference_event_clone (const LinphoneConferenceEvent *conference_event);
|
||||
LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_event_get_address (const LinphoneConferenceEvent *conference_event);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceParticipantEvent *linphone_conference_participant_event_new (
|
||||
|
|
@ -45,11 +48,20 @@ LINPHONE_PUBLIC LinphoneConferenceParticipantEvent *linphone_conference_particip
|
|||
const LinphoneAddress *conferenceAddress,
|
||||
const LinphoneAddress *participantAddress
|
||||
);
|
||||
LINPHONE_PUBLIC LinphoneConferenceParticipantEvent *linphone_conference_participant_event_clone (
|
||||
const LinphoneConferenceParticipantEvent *conference_participant_event
|
||||
);
|
||||
LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_participant_event_get_participant_address (
|
||||
const LinphoneConferenceParticipantEvent *conference_participant_event
|
||||
);
|
||||
|
||||
LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_participant_event_get_participant_address (const LinphoneConferenceParticipantEvent *conference_participant_event);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneMessageEvent *linphone_message_event_new (LinphoneMessage *message);
|
||||
LINPHONE_PUBLIC LinphoneMessage *linphone_message_event_get_message (const LinphoneMessageEvent *message_event);
|
||||
LINPHONE_PUBLIC LinphoneChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *chat_message);
|
||||
LINPHONE_PUBLIC LinphoneChatMessageEvent *linphone_chat_message_event_clone (
|
||||
const LinphoneChatMessageEvent *chat_message_event
|
||||
);
|
||||
LINPHONE_PUBLIC LinphoneChatMessage *linphone_chat_message_event_get_chat_message (
|
||||
const LinphoneChatMessageEvent *chat_message_event
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ typedef struct _LinphoneCallEvent LinphoneCallEvent;
|
|||
typedef struct _LinphoneConferenceEvent LinphoneConferenceEvent;
|
||||
typedef struct _LinphoneConferenceParticipantEvent LinphoneConferenceParticipantEvent;
|
||||
typedef struct _LinphoneEventLog LinphoneEventLog;
|
||||
typedef struct _LinphoneMessageEvent LinphoneMessageEvent;
|
||||
typedef struct _LinphoneChatMessageEvent LinphoneChatMessageEvent;
|
||||
|
||||
// =============================================================================
|
||||
// C Enums.
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#define L_ENUM_VALUES_EVENT_LOG_TYPE(F) \
|
||||
F(None) \
|
||||
F(Message) \
|
||||
F(ChatMessage) \
|
||||
F(CallStart) \
|
||||
F(CallEnd) \
|
||||
F(ConferenceCreated) \
|
||||
|
|
|
|||
|
|
@ -78,12 +78,12 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
db/provider/db-session.h
|
||||
enums.h
|
||||
event-log/call-event.h
|
||||
event-log/chat-message-event.h
|
||||
event-log/conference-event-p.h
|
||||
event-log/conference-event.h
|
||||
event-log/conference-participant-event.h
|
||||
event-log/event-log-p.h
|
||||
event-log/event-log.h
|
||||
event-log/message-event.h
|
||||
logger/logger.h
|
||||
nat/ice-agent.h
|
||||
nat/stun-client.h
|
||||
|
|
@ -143,10 +143,10 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
db/provider/db-session-provider.cpp
|
||||
db/provider/db-session.cpp
|
||||
event-log/call-event.cpp
|
||||
event-log/chat-message-event.cpp
|
||||
event-log/conference-event.cpp
|
||||
event-log/conference-participant-event.cpp
|
||||
event-log/event-log.cpp
|
||||
event-log/message-event.cpp
|
||||
logger/logger.cpp
|
||||
nat/ice-agent.cpp
|
||||
nat/stun-client.cpp
|
||||
|
|
|
|||
|
|
@ -16,68 +16,80 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "linphone/api/c-chat-message.h"
|
||||
#include "linphone/api/c-event-log.h"
|
||||
|
||||
#include "c-wrapper/c-tools.h"
|
||||
#include "call/call.h"
|
||||
#include "chat/chat-message.h"
|
||||
#include "event-log/call-event.h"
|
||||
#include "event-log/chat-message-event.h"
|
||||
#include "event-log/conference-participant-event.h"
|
||||
#include "event-log/message-event.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
L_DECLARE_C_CLONABLE_STRUCT_IMPL(EventLog, EventLog, event_log);
|
||||
L_DECLARE_C_CLONABLE_STRUCT_IMPL(CallEvent, CallEvent, call_event);
|
||||
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ConferenceEvent, ConferenceEvent, conference_event);
|
||||
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ConferenceParticipantEvent, ConferenceParticipantEvent, conference_participant_event);
|
||||
L_DECLARE_C_CLONABLE_STRUCT_IMPL(ChatMessageEvent, ChatMessageEvent, chat_message_event);
|
||||
|
||||
using namespace std;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Event log.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(EventLog, EventLog, event_log);
|
||||
L_DECLARE_C_STRUCT_NEW_DEFAULT(EventLog, event_log);
|
||||
|
||||
LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *eventLog) {
|
||||
return static_cast<LinphoneEventLogType>(eventLog->cppPtr->getType());
|
||||
LinphoneEventLog *linphone_event_log_new () {
|
||||
LinphoneEventLog *event_log = _linphone_event_log_init();
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(event_log, new LINPHONE_NAMESPACE::EventLog());
|
||||
return event_log;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Message event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(MessageEvent, MessageEvent, message_event);
|
||||
|
||||
LinphoneMessageEvent *linphone_message_event_new (LinphoneMessage *message) {
|
||||
LinphoneMessageEvent *object = _linphone_message_event_init();
|
||||
// TODO: call make_shared with cppPtr.
|
||||
object->cppPtr = make_shared<LINPHONE_NAMESPACE::MessageEvent>(nullptr);
|
||||
return object;
|
||||
LinphoneEventLog *linphone_event_log_ref (LinphoneEventLog *event_log) {
|
||||
belle_sip_object_ref(event_log);
|
||||
return event_log;
|
||||
}
|
||||
|
||||
LinphoneMessage *linphone_message_event_get_message (const LinphoneMessageEvent *messageEvent) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log) {
|
||||
return static_cast<LinphoneEventLogType>(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(event_log, EventLog, EventLog)->getType()
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Call event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// L_DECLARE_C_STRUCT_IMPL(CallEvent, call_event);
|
||||
|
||||
LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneCall *call) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
LinphoneCallEvent *call_event = _linphone_call_event_init();
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(
|
||||
call_event,
|
||||
new LINPHONE_NAMESPACE::CallEvent(
|
||||
static_cast<LINPHONE_NAMESPACE::EventLog::Type>(type),
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(call, Call, Call)
|
||||
)
|
||||
);
|
||||
return call_event;
|
||||
}
|
||||
|
||||
// TODO: REMOVE ME.
|
||||
extern LinphoneCall *_linphone_call_init ();
|
||||
|
||||
LinphoneCall *linphone_call_event_get_call (const LinphoneCallEvent *call_event) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
return L_GET_C_BACK_PTR(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(
|
||||
call_event, CallEvent, CallEvent
|
||||
)->getCall(),
|
||||
Call,
|
||||
call
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Conference event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// L_DECLARE_C_STRUCT_IMPL(ConferenceEvent, conference_event);
|
||||
|
||||
LinphoneConferenceEvent *linphone_conference_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *address
|
||||
|
|
@ -95,18 +107,46 @@ const LinphoneAddress *linphone_conference_event_get_address (const LinphoneConf
|
|||
// Conference participant event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// L_DECLARE_C_STRUCT_IMPL(ConferenceParticipantEvent, conference_participant_event);
|
||||
|
||||
LinphoneConferenceParticipantEvent *linphone_conference_participant_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *conference_address,
|
||||
const LinphoneAddress *participant_address
|
||||
const LinphoneAddress *conferenceAddress,
|
||||
const LinphoneAddress *participantAddress
|
||||
) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const LinphoneAddress *linphone_conference_participant_event_get_participant_address (const LinphoneConferenceParticipantEvent *conference_participant_event) {
|
||||
const LinphoneAddress *linphone_conference_participant_event_get_participant_address (
|
||||
const LinphoneConferenceParticipantEvent *conference_participant_event
|
||||
) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Message event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LinphoneChatMessageEvent *linphone_chat_message_event_new (LinphoneChatMessage *chat_message) {
|
||||
LinphoneChatMessageEvent *chat_message_event = _linphone_chat_message_event_init();
|
||||
L_SET_CPP_PTR_FROM_C_STRUCT(
|
||||
chat_message_event,
|
||||
new LINPHONE_NAMESPACE::ChatMessageEvent(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(chat_message, ChatMessage, ChatMessage)
|
||||
)
|
||||
);
|
||||
return chat_message_event;
|
||||
}
|
||||
|
||||
// TODO: REMOVE ME.
|
||||
extern LinphoneChatMessage *_linphone_chat_message_init ();
|
||||
|
||||
LinphoneChatMessage *linphone_chat_message_event_get_chat_message (const LinphoneChatMessageEvent *chat_message_event) {
|
||||
return L_GET_C_BACK_PTR(
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(
|
||||
chat_message_event, ChatMessageEvent, ChatMessageEvent
|
||||
)->getChatMessage(),
|
||||
ChatMessage,
|
||||
chat_message
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "abstract/abstract-db-p.h"
|
||||
#include "chat/chat-message.h"
|
||||
#include "event-log/call-event.h"
|
||||
#include "event-log/message-event.h"
|
||||
#include "event-log/chat-message-event.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
#include "events-db.h"
|
||||
|
|
@ -283,7 +283,7 @@ EventsDb::EventsDb () : AbstractDb(*new EventsDbPrivate) {}
|
|||
switch (eventLog.getType()) {
|
||||
case EventLog::Type::None:
|
||||
return false;
|
||||
case EventLog::Type::Message:
|
||||
case EventLog::Type::ChatMessage:
|
||||
case EventLog::Type::CallStart:
|
||||
case EventLog::Type::CallEnd:
|
||||
case EventLog::Type::ConferenceCreated:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* message-event.cpp
|
||||
* chat-message-event.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "event-log-p.h"
|
||||
|
||||
#include "message-event.h"
|
||||
#include "chat-message-event.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -26,35 +26,35 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class MessageEventPrivate : public EventLogPrivate {
|
||||
class ChatMessageEventPrivate : public EventLogPrivate {
|
||||
public:
|
||||
shared_ptr<Message> message;
|
||||
shared_ptr<ChatMessage> chatMessage;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
MessageEvent::MessageEvent (const shared_ptr<Message> &message) :
|
||||
EventLog(*new MessageEventPrivate, EventLog::Type::Message) {
|
||||
L_D(MessageEvent);
|
||||
L_ASSERT(message);
|
||||
d->message = message;
|
||||
ChatMessageEvent::ChatMessageEvent (const shared_ptr<ChatMessage> &chatMessage) :
|
||||
EventLog(*new ChatMessageEventPrivate, EventLog::Type::ChatMessage) {
|
||||
L_D(ChatMessageEvent);
|
||||
L_ASSERT(chatMessage);
|
||||
d->chatMessage = chatMessage;
|
||||
}
|
||||
|
||||
MessageEvent::MessageEvent (const MessageEvent &src) : MessageEvent(src.getMessage()) {}
|
||||
ChatMessageEvent::ChatMessageEvent (const ChatMessageEvent &src) : ChatMessageEvent(src.getChatMessage()) {}
|
||||
|
||||
MessageEvent &MessageEvent::operator= (const MessageEvent &src) {
|
||||
L_D(MessageEvent);
|
||||
ChatMessageEvent &ChatMessageEvent::operator= (const ChatMessageEvent &src) {
|
||||
L_D(ChatMessageEvent);
|
||||
if (this != &src) {
|
||||
EventLog::operator=(src);
|
||||
d->message = src.getPrivate()->message;
|
||||
EventLog::operator= (src);
|
||||
d->chatMessage = src.getPrivate()->chatMessage;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
shared_ptr<Message> MessageEvent::getMessage () const {
|
||||
L_D(const MessageEvent);
|
||||
return d->message;
|
||||
shared_ptr<ChatMessage> ChatMessageEvent::getChatMessage () const {
|
||||
L_D(const ChatMessageEvent);
|
||||
return d->chatMessage;
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* message-event.h
|
||||
* chat-message-event.h
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -16,8 +16,8 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _MESSAGE_EVENT_H_
|
||||
#define _MESSAGE_EVENT_H_
|
||||
#ifndef _CHAT_MESSAGE_EVENT_H_
|
||||
#define _CHAT_MESSAGE_EVENT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
|
@ -27,22 +27,22 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class Message;
|
||||
class MessageEventPrivate;
|
||||
class ChatMessage;
|
||||
class ChatMessageEventPrivate;
|
||||
|
||||
class LINPHONE_PUBLIC MessageEvent : public EventLog {
|
||||
class LINPHONE_PUBLIC ChatMessageEvent : public EventLog {
|
||||
public:
|
||||
MessageEvent (const std::shared_ptr<Message> &message);
|
||||
MessageEvent (const MessageEvent &src);
|
||||
ChatMessageEvent (const std::shared_ptr<ChatMessage> &chatMessage);
|
||||
ChatMessageEvent (const ChatMessageEvent &src);
|
||||
|
||||
MessageEvent &operator= (const MessageEvent &src);
|
||||
ChatMessageEvent &operator= (const ChatMessageEvent &src);
|
||||
|
||||
std::shared_ptr<Message> getMessage () const;
|
||||
std::shared_ptr<ChatMessage> getChatMessage () const;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(MessageEvent);
|
||||
L_DECLARE_PRIVATE(ChatMessageEvent);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _MESSAGE_EVENT_H_
|
||||
#endif // ifndef _CHAT_MESSAGE_EVENT_H_
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef _CONFERENCE_EVENT_P_H_
|
||||
#define _CONFERENCE_EVENT_P_H_
|
||||
|
||||
#include "address/address.h"
|
||||
#include "conference-event.h"
|
||||
|
||||
#include "event-log-p.h"
|
||||
|
|
@ -29,7 +30,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
class ConferenceEventPrivate : public EventLogPrivate {
|
||||
private:
|
||||
std::shared_ptr<const Address> address;
|
||||
Address address;
|
||||
|
||||
L_DECLARE_PUBLIC(ConferenceEvent);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -27,34 +27,32 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
ConferenceEvent::ConferenceEvent (Type type, const shared_ptr<const Address> &address) :
|
||||
ConferenceEvent::ConferenceEvent (Type type, const Address &address) :
|
||||
EventLog(*new ConferenceEventPrivate, type) {
|
||||
L_D(ConferenceEvent);
|
||||
L_ASSERT(type == Type::ConferenceCreated || type == Type::ConferenceDestroyed);
|
||||
L_ASSERT(address);
|
||||
d->address = make_shared<Address>(*address);
|
||||
d->address = address;
|
||||
}
|
||||
|
||||
ConferenceEvent::ConferenceEvent (const ConferenceEvent &src) : ConferenceEvent(src.getType(), src.getAddress()) {}
|
||||
|
||||
ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const shared_ptr<const Address> &address) :
|
||||
ConferenceEvent::ConferenceEvent (ConferenceEventPrivate &p, Type type, const Address &address) :
|
||||
EventLog(p, type) {
|
||||
L_D(ConferenceEvent);
|
||||
L_ASSERT(address);
|
||||
d->address = make_shared<Address>(*address);
|
||||
d->address = address;
|
||||
}
|
||||
|
||||
ConferenceEvent &ConferenceEvent::operator= (const ConferenceEvent &src) {
|
||||
L_D(ConferenceEvent);
|
||||
if (this != &src) {
|
||||
EventLog::operator=(src);
|
||||
d->address = make_shared<Address>(*src.getPrivate()->address);
|
||||
d->address = src.getPrivate()->address;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> ConferenceEvent::getAddress () const {
|
||||
const Address &ConferenceEvent::getAddress () const {
|
||||
L_D(const ConferenceEvent);
|
||||
return d->address;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,6 @@
|
|||
#ifndef _CONFERENCE_EVENT_H_
|
||||
#define _CONFERENCE_EVENT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "event-log.h"
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -32,16 +30,16 @@ class ConferenceEventPrivate;
|
|||
|
||||
class LINPHONE_PUBLIC ConferenceEvent : public EventLog {
|
||||
public:
|
||||
ConferenceEvent (Type type, const std::shared_ptr<const Address> &address);
|
||||
ConferenceEvent (Type type, const Address &address);
|
||||
ConferenceEvent (const ConferenceEvent &src);
|
||||
virtual ~ConferenceEvent () = default;
|
||||
|
||||
ConferenceEvent &operator= (const ConferenceEvent &src);
|
||||
|
||||
std::shared_ptr<const Address> getAddress () const;
|
||||
const Address &getAddress () const;
|
||||
|
||||
protected:
|
||||
ConferenceEvent (ConferenceEventPrivate &p, Type type, const std::shared_ptr<const Address> &address);
|
||||
ConferenceEvent (ConferenceEventPrivate &p, Type type, const Address &address);
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(ConferenceEvent);
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
class ConferenceParticipantEventPrivate : public ConferenceEventPrivate {
|
||||
public:
|
||||
shared_ptr<const Address> participantAddress;
|
||||
Address participantAddress;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
ConferenceParticipantEvent::ConferenceParticipantEvent (
|
||||
Type type,
|
||||
const shared_ptr<const Address> &conferenceAddress,
|
||||
const shared_ptr<const Address> &participantAddress
|
||||
const Address &conferenceAddress,
|
||||
const Address &participantAddress
|
||||
) : ConferenceEvent(*new ConferenceParticipantEventPrivate, type, conferenceAddress) {
|
||||
L_D(ConferenceParticipantEvent);
|
||||
L_ASSERT(
|
||||
|
|
@ -46,8 +46,7 @@ ConferenceParticipantEvent::ConferenceParticipantEvent (
|
|||
type == Type::ConferenceParticipantSetAdmin ||
|
||||
type == Type::ConferenceParticipantUnsetAdmin
|
||||
);
|
||||
L_ASSERT(participantAddress);
|
||||
d->participantAddress = make_shared<Address>(*participantAddress);
|
||||
d->participantAddress = participantAddress;
|
||||
}
|
||||
|
||||
ConferenceParticipantEvent::ConferenceParticipantEvent (const ConferenceParticipantEvent &src) :
|
||||
|
|
@ -57,13 +56,13 @@ ConferenceParticipantEvent &ConferenceParticipantEvent::operator= (const Confere
|
|||
L_D(ConferenceParticipantEvent);
|
||||
if (this != &src) {
|
||||
ConferenceEvent::operator=(src);
|
||||
d->participantAddress = make_shared<Address>(*src.getPrivate()->participantAddress);
|
||||
d->participantAddress = src.getPrivate()->participantAddress;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
shared_ptr<const Address> ConferenceParticipantEvent::getParticipantAddress () const {
|
||||
const Address &ConferenceParticipantEvent::getParticipantAddress () const {
|
||||
L_D(const ConferenceParticipantEvent);
|
||||
return d->participantAddress;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ class LINPHONE_PUBLIC ConferenceParticipantEvent : public ConferenceEvent {
|
|||
public:
|
||||
ConferenceParticipantEvent (
|
||||
Type type,
|
||||
const std::shared_ptr<const Address> &conferenceAddress,
|
||||
const std::shared_ptr<const Address> &participantAddress
|
||||
const Address &conferenceAddress,
|
||||
const Address &participantAddress
|
||||
);
|
||||
ConferenceParticipantEvent (const ConferenceParticipantEvent &src);
|
||||
|
||||
ConferenceParticipantEvent &operator= (const ConferenceParticipantEvent &src);
|
||||
|
||||
std::shared_ptr<const Address> getParticipantAddress () const;
|
||||
const Address &getParticipantAddress () const;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(ConferenceParticipantEvent);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue