Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
liblinphone
Commits
554ad75c
Commit
554ad75c
authored
Dec 22, 2017
by
Benjamin REIS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WORKAROUND set correct cpp pointer to C LinphoneChatRoom
parent
fb8d255b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
8 deletions
+46
-8
coreapi/chat.c
coreapi/chat.c
+18
-2
coreapi/linphonecore.c
coreapi/linphonecore.c
+12
-4
src/chat/chat-message/chat-message.cpp
src/chat/chat-message/chat-message.cpp
+15
-1
src/chat/chat-room/chat-room.cpp
src/chat/chat-room/chat-room.cpp
+1
-1
No files found.
coreapi/chat.c
View file @
554ad75c
...
...
@@ -38,6 +38,7 @@
#include "c-wrapper/c-wrapper.h"
#include "chat/chat-room/basic-chat-room.h"
#include "chat/chat-room/client-group-chat-room.h"
#include "chat/chat-room/client-group-to-basic-chat-room.h"
#include "chat/chat-room/real-time-text-chat-room-p.h"
#include "chat/chat-room/real-time-text-chat-room.h"
#include "content/content-type.h"
...
...
@@ -131,10 +132,24 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
localAddress
=
op
->
get_to
();
}
shared_ptr
<
LinphonePrivate
::
AbstractChatRoom
>
chatRoom
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
findChatRoom
(
LinphonePrivate
::
ChatRoomId
(
LinphonePrivate
::
IdentityAddress
(
peerAddress
),
LinphonePrivate
::
IdentityAddress
(
localAddress
))
// TODO: remove when using signals
LinphoneChatRoom
*
cr
=
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
findChatRoom
(
LinphonePrivate
::
ChatRoomId
(
LinphonePrivate
::
IdentityAddress
(
peerAddress
),
LinphonePrivate
::
IdentityAddress
(
localAddress
)
))
);
if
(
!
cr
)
return
LinphoneReasonNone
;
shared_ptr
<
LinphonePrivate
::
AbstractChatRoom
>
chatRoom
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
);
shared_ptr
<
LinphonePrivate
::
AbstractChatRoom
>
acr
;
if
(
chatRoom
->
getCapabilities
()
&
LinphonePrivate
::
ChatRoom
::
Capabilities
::
Proxy
)
acr
=
static_pointer_cast
<
LinphonePrivate
::
ClientGroupToBasicChatRoom
>
(
chatRoom
)
->
getProxiedChatRoom
();
else
acr
=
chatRoom
;
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
acr
);
if
(
chatRoom
)
reason
=
L_GET_PRIVATE
(
chatRoom
)
->
onSipMessageReceived
(
op
,
sal_msg
);
else
{
...
...
@@ -145,6 +160,7 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
reason
=
L_GET_PRIVATE_FROM_C_OBJECT
(
cr
)
->
onSipMessageReceived
(
op
,
sal_msg
);
linphone_address_unref
(
addr
);
}
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
chatRoom
);
return
reason
;
}
...
...
coreapi/linphonecore.c
View file @
554ad75c
...
...
@@ -2136,10 +2136,14 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
const
LinphoneAddress
*
resource
=
linphone_event_get_resource
(
lev
);
const
LinphoneAddress
*
from
=
linphone_event_get_from
(
lev
);
shared_ptr
<
AbstractChatRoom
>
chatRoom
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
findChatRoom
(
LinphonePrivate
::
ChatRoomId
(
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
resource
)),
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
from
))
));
// TODO: remove when using signals
LinphoneChatRoom
*
cr
=
L_GET_C_BACK_PTR
(
L_GET_CPP_PTR_FROM_C_OBJECT
(
lc
)
->
findChatRoom
(
LinphonePrivate
::
ChatRoomId
(
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
resource
)),
IdentityAddress
(
*
L_GET_CPP_PTR_FROM_C_OBJECT
(
from
))
))
);
shared_ptr
<
AbstractChatRoom
>
chatRoom
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
);
if
(
chatRoom
)
{
shared_ptr
<
ClientGroupChatRoom
>
cgcr
;
...
...
@@ -2148,6 +2152,8 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
static_pointer_cast
<
ClientGroupToBasicChatRoom
>
(
chatRoom
)
->
getProxiedChatRoom
());
else
cgcr
=
static_pointer_cast
<
ClientGroupChatRoom
>
(
chatRoom
);
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
cgcr
);
if
(
linphone_content_is_multipart
(
body
))
{
// TODO : migrate to c++ 'Content'.
int
i
=
0
;
...
...
@@ -2158,6 +2164,8 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
}
}
else
L_GET_PRIVATE
(
cgcr
)
->
notifyReceived
(
linphone_content_get_string_buffer
(
body
));
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
chatRoom
);
}
}
}
...
...
src/chat/chat-message/chat-message.cpp
View file @
554ad75c
...
...
@@ -28,6 +28,7 @@
#include "chat/chat-message/chat-message-p.h"
#include "chat/chat-room/chat-room-p.h"
#include "chat/chat-room/client-group-to-basic-chat-room.h"
#include "chat/chat-room/real-time-text-chat-room.h"
#include "chat/modifier/cpim-chat-message-modifier.h"
#include "chat/modifier/encryption-chat-message-modifier.h"
...
...
@@ -857,7 +858,20 @@ void ChatMessage::send () {
return
;
}
getChatRoom
()
->
getPrivate
()
->
sendChatMessage
(
getSharedFromThis
());
// TODO: remove when using signals
LinphoneChatRoom
*
cr
=
L_GET_C_BACK_PTR
(
getCore
()
->
findChatRoom
(
getChatRoom
()
->
getChatRoomId
()));
shared_ptr
<
LinphonePrivate
::
AbstractChatRoom
>
chatRoom
=
L_GET_CPP_PTR_FROM_C_OBJECT
(
cr
);
shared_ptr
<
LinphonePrivate
::
AbstractChatRoom
>
acr
;
if
(
chatRoom
->
getCapabilities
()
&
LinphonePrivate
::
ChatRoom
::
Capabilities
::
Proxy
)
acr
=
static_pointer_cast
<
LinphonePrivate
::
ClientGroupToBasicChatRoom
>
(
chatRoom
)
->
getProxiedChatRoom
();
else
acr
=
chatRoom
;
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
acr
);
acr
->
getPrivate
()
->
sendChatMessage
(
getSharedFromThis
());
L_SET_CPP_PTR_FROM_C_OBJECT
(
cr
,
chatRoom
);
}
void
ChatMessage
::
sendDeliveryNotification
(
LinphoneReason
reason
)
{
...
...
src/chat/chat-room/chat-room.cpp
View file @
554ad75c
...
...
@@ -52,7 +52,7 @@ void ChatRoomPrivate::sendChatMessage (const shared_ptr<ChatMessage> &chatMessag
LinphoneChatRoom
*
cr
=
L_GET_C_BACK_PTR
(
q
);
LinphoneChatRoomCbs
*
cbs
=
linphone_chat_room_get_callbacks
(
cr
);
LinphoneChatRoomCbs
ParticipantAdded
Cb
cb
=
linphone_chat_room_cbs_get_chat_message_sent
(
cbs
);
LinphoneChatRoomCbs
ChatMessageSent
Cb
cb
=
linphone_chat_room_cbs_get_chat_message_sent
(
cbs
);
// TODO: server currently don't stock message, remove condition in the future.
if
(
cb
&&
!
linphone_core_conference_server_enabled
(
q
->
getCore
()
->
getCCore
()))
{
...
...
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