Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
liblinphone
Commits
f702e9a8
Commit
f702e9a8
authored
Oct 30, 2017
by
Sylvain Berfini
🎩
Browse files
Added new callback for message received on chat room with chat event log
parent
c927f68a
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
63 additions
and
0 deletions
+63
-0
include/linphone/api/c-callbacks.h
include/linphone/api/c-callbacks.h
+7
-0
include/linphone/api/c-chat-room-cbs.h
include/linphone/api/c-chat-room-cbs.h
+14
-0
src/c-wrapper/api/c-chat-room-cbs.cpp
src/c-wrapper/api/c-chat-room-cbs.cpp
+9
-0
src/chat/chat-room/basic-chat-room.cpp
src/chat/chat-room/basic-chat-room.cpp
+4
-0
src/chat/chat-room/basic-chat-room.h
src/chat/chat-room/basic-chat-room.h
+1
-0
src/chat/chat-room/chat-room.cpp
src/chat/chat-room/chat-room.cpp
+14
-0
src/chat/chat-room/chat-room.h
src/chat/chat-room/chat-room.h
+1
-0
src/chat/chat-room/client-group-chat-room.cpp
src/chat/chat-room/client-group-chat-room.cpp
+4
-0
src/chat/chat-room/client-group-chat-room.h
src/chat/chat-room/client-group-chat-room.h
+3
-0
src/chat/chat-room/real-time-text-chat-room.cpp
src/chat/chat-room/real-time-text-chat-room.cpp
+2
-0
src/chat/chat-room/real-time-text-chat-room.h
src/chat/chat-room/real-time-text-chat-room.h
+1
-0
src/chat/chat-room/server-group-chat-room-stub.cpp
src/chat/chat-room/server-group-chat-room-stub.cpp
+2
-0
src/chat/chat-room/server-group-chat-room.h
src/chat/chat-room/server-group-chat-room.h
+1
-0
No files found.
include/linphone/api/c-callbacks.h
View file @
f702e9a8
...
...
@@ -156,6 +156,13 @@ typedef void (*LinphoneChatRoomCbsIsComposingReceivedCb) (LinphoneChatRoom *cr,
*/
typedef
void
(
*
LinphoneChatRoomCbsMessageReceivedCb
)
(
LinphoneChatRoom
*
cr
,
LinphoneChatMessage
*
msg
);
/**
* Callback used to notify a chat room that a chat message has been received.
* @param[in] cr #LinphoneChatRoom object
* @param[in] event_log The #LinphoneChatMessage event log that has been received
*/
typedef
void
(
*
LinphoneChatRoomCbsChatMessageReceivedCb
)
(
LinphoneChatRoom
*
cr
,
const
LinphoneEventLog
*
event_log
);
/**
* Callback used to notify a chat room that a participant has been added.
* @param[in] cr #LinphoneChatRoom object
...
...
include/linphone/api/c-chat-room-cbs.h
View file @
f702e9a8
...
...
@@ -89,6 +89,20 @@ LINPHONE_PUBLIC LinphoneChatRoomCbsMessageReceivedCb linphone_chat_room_cbs_get_
*/
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_message_received
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsMessageReceivedCb
cb
);
/**
* Get the chat message received callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @return The current chat message received callback.
*/
LINPHONE_PUBLIC
LinphoneChatRoomCbsChatMessageReceivedCb
linphone_chat_room_cbs_get_chat_message_received
(
const
LinphoneChatRoomCbs
*
cbs
);
/**
* Set the chat message received callback.
* @param[in] cbs LinphoneChatRoomCbs object.
* @param[in] cb The chat message received callback to be used.
*/
LINPHONE_PUBLIC
void
linphone_chat_room_cbs_set_chat_message_received
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsChatMessageReceivedCb
cb
);
/**
* Get the participant added callback.
* @param[in] cbs LinphoneChatRoomCbs object.
...
...
src/c-wrapper/api/c-chat-room-cbs.cpp
View file @
f702e9a8
...
...
@@ -36,6 +36,7 @@ struct _LinphoneChatRoomCbs {
LinphoneChatRoomCbsStateChangedCb
stateChangedCb
;
LinphoneChatRoomCbsSubjectChangedCb
subjectChangedCb
;
LinphoneChatRoomCbsUndecryptableMessageReceivedCb
undecryptableMessageReceivedCb
;
LinphoneChatRoomCbsChatMessageReceivedCb
chatMessageReceivedCb
;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT
(
LinphoneChatRoomCbs
);
...
...
@@ -88,6 +89,14 @@ void linphone_chat_room_cbs_set_message_received (LinphoneChatRoomCbs *cbs, Linp
cbs
->
messageReceivedCb
=
cb
;
}
LinphoneChatRoomCbsChatMessageReceivedCb
linphone_chat_room_cbs_get_chat_message_received
(
const
LinphoneChatRoomCbs
*
cbs
)
{
return
cbs
->
chatMessageReceivedCb
;
}
void
linphone_chat_room_cbs_set_chat_message_received
(
LinphoneChatRoomCbs
*
cbs
,
LinphoneChatRoomCbsChatMessageReceivedCb
cb
)
{
cbs
->
chatMessageReceivedCb
=
cb
;
}
LinphoneChatRoomCbsParticipantAddedCb
linphone_chat_room_cbs_get_participant_added
(
const
LinphoneChatRoomCbs
*
cbs
)
{
return
cbs
->
participantAddedCb
;
}
...
...
src/chat/chat-room/basic-chat-room.cpp
View file @
f702e9a8
...
...
@@ -40,6 +40,10 @@ BasicChatRoom::BasicChatRoom (LinphoneCore *core, const Address &peerAddress) :
// -----------------------------------------------------------------------------
void
BasicChatRoom
::
onChatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
msg
)
{
}
int
BasicChatRoom
::
getCapabilities
()
const
{
return
static_cast
<
int
>
(
Capabilities
::
Basic
);
}
...
...
src/chat/chat-room/basic-chat-room.h
View file @
f702e9a8
...
...
@@ -35,6 +35,7 @@ public:
CapabilitiesMask
getCapabilities
()
const
override
;
void
onChatMessageReceived
(
const
std
::
shared_ptr
<
ChatMessage
>
&
msg
)
override
;
/* ConferenceInterface. */
void
addParticipant
(
const
Address
&
addr
,
const
CallSessionParams
*
params
,
bool
hasMedia
)
override
;
void
addParticipants
(
const
std
::
list
<
Address
>
&
addresses
,
const
CallSessionParams
*
params
,
bool
hasMedia
)
override
;
...
...
src/chat/chat-room/chat-room.cpp
View file @
f702e9a8
...
...
@@ -20,6 +20,7 @@
#include <algorithm>
#include "c-wrapper/c-wrapper.h"
#include "event-log/conference/conference-chat-message-event.h"
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room-p.h"
#include "chat/notification/imdn.h"
...
...
@@ -435,8 +436,21 @@ end:
// -----------------------------------------------------------------------------
void
ChatRoomPrivate
::
chatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
msg
)
{
L_Q
();
if
((
msg
->
getPrivate
()
->
getContentType
()
!=
ContentType
::
Imdn
)
&&
(
msg
->
getPrivate
()
->
getContentType
()
!=
ContentType
::
ImIsComposing
))
{
q
->
onChatMessageReceived
(
msg
);
LinphoneChatRoom
*
cr
=
L_GET_C_BACK_PTR
(
q
);
LinphoneChatRoomCbs
*
cbs
=
linphone_chat_room_get_callbacks
(
cr
);
LinphoneChatRoomCbsParticipantAddedCb
cb
=
linphone_chat_room_cbs_get_chat_message_received
(
cbs
);
shared_ptr
<
ConferenceChatMessageEvent
>
event
=
make_shared
<
ConferenceChatMessageEvent
>
(
msg
->
getTime
(),
msg
);
if
(
cb
)
{
cb
(
cr
,
L_GET_C_BACK_PTR
(
event
));
}
// Legacy
notifyChatMessageReceived
(
msg
);
remoteIsComposing
.
erase
(
msg
->
getFromAddress
().
asStringUriOnly
());
isComposingHandler
.
stopRemoteRefreshTimer
(
msg
->
getFromAddress
().
asStringUriOnly
());
notifyIsComposingReceived
(
msg
->
getFromAddress
(),
false
);
...
...
src/chat/chat-room/chat-room.h
View file @
f702e9a8
...
...
@@ -69,6 +69,7 @@ public:
State
getState
()
const
;
protected:
virtual
void
onChatMessageReceived
(
const
std
::
shared_ptr
<
ChatMessage
>
&
msg
)
=
0
;
explicit
ChatRoom
(
ChatRoomPrivate
&
p
);
private:
...
...
src/chat/chat-room/client-group-chat-room.cpp
View file @
f702e9a8
...
...
@@ -245,6 +245,10 @@ void ClientGroupChatRoom::setSubject (const string &subject) {
// -----------------------------------------------------------------------------
void
ClientGroupChatRoom
::
onChatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
msg
)
{
}
void
ClientGroupChatRoom
::
onConferenceCreated
(
const
Address
&
addr
)
{
L_D
();
L_D_T
(
RemoteConference
,
dConference
);
...
...
src/chat/chat-room/client-group-chat-room.h
View file @
f702e9a8
...
...
@@ -52,6 +52,9 @@ public:
void
setParticipantAdminStatus
(
std
::
shared_ptr
<
Participant
>
&
participant
,
bool
isAdmin
)
override
;
void
setSubject
(
const
std
::
string
&
subject
)
override
;
private:
void
onChatMessageReceived
(
const
std
::
shared_ptr
<
ChatMessage
>
&
msg
)
override
;
private:
/* ConferenceListener */
void
onConferenceCreated
(
const
Address
&
addr
)
override
;
...
...
src/chat/chat-room/real-time-text-chat-room.cpp
View file @
f702e9a8
...
...
@@ -135,6 +135,8 @@ LinphoneCall *RealTimeTextChatRoom::getCall () const {
// -----------------------------------------------------------------------------
void
RealTimeTextChatRoom
::
onChatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
msg
)
{}
void
RealTimeTextChatRoom
::
addParticipant
(
const
Address
&
addr
,
const
CallSessionParams
*
params
,
bool
hasMedia
)
{
lError
()
<<
"addParticipant() is not allowed on a RealTimeTextChatRoom"
;
}
...
...
src/chat/chat-room/real-time-text-chat-room.h
View file @
f702e9a8
...
...
@@ -38,6 +38,7 @@ public:
uint32_t
getChar
()
const
;
LinphoneCall
*
getCall
()
const
;
void
onChatMessageReceived
(
const
std
::
shared_ptr
<
ChatMessage
>
&
msg
)
override
;
/* ConferenceInterface */
void
addParticipant
(
const
Address
&
addr
,
const
CallSessionParams
*
params
,
bool
hasMedia
)
override
;
void
addParticipants
(
const
std
::
list
<
Address
>
&
addresses
,
const
CallSessionParams
*
params
,
bool
hasMedia
)
override
;
...
...
src/chat/chat-room/server-group-chat-room-stub.cpp
View file @
f702e9a8
...
...
@@ -82,6 +82,8 @@ int ServerGroupChatRoom::getCapabilities () const {
// -----------------------------------------------------------------------------
void
ServerGroupChatRoom
::
onChatMessageReceived
(
const
shared_ptr
<
ChatMessage
>
&
msg
)
{}
void
ServerGroupChatRoom
::
addParticipant
(
const
Address
&
,
const
CallSessionParams
*
,
bool
)
{}
void
ServerGroupChatRoom
::
addParticipants
(
const
list
<
Address
>
&
,
const
CallSessionParams
*
,
bool
)
{}
...
...
src/chat/chat-room/server-group-chat-room.h
View file @
f702e9a8
...
...
@@ -59,6 +59,7 @@ public:
void
setSubject
(
const
std
::
string
&
subject
)
override
;
private:
void
onChatMessageReceived
(
const
std
::
shared_ptr
<
ChatMessage
>
&
msg
)
override
;
/* CallSessionListener */
void
onCallSessionStateChanged
(
const
std
::
shared_ptr
<
const
CallSession
>
&
session
,
LinphoneCallState
state
,
const
std
::
string
&
message
)
override
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment