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
78f4b39a
Commit
78f4b39a
authored
Sep 26, 2017
by
Sylvain Berfini
🎩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finish cleaning of c-chat-message, still work to do in ChatMessage
parent
20690528
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1104 additions
and
968 deletions
+1104
-968
coreapi/private.h
coreapi/private.h
+0
-1
include/linphone/api/c-chat-message.h
include/linphone/api/c-chat-message.h
+3
-3
src/c-wrapper/api/c-chat-message.cpp
src/c-wrapper/api/c-chat-message.cpp
+130
-932
src/chat/chat-message-p.h
src/chat/chat-message-p.h
+7
-2
src/chat/chat-message.cpp
src/chat/chat-message.cpp
+914
-22
src/chat/chat-message.h
src/chat/chat-message.h
+49
-5
src/chat/chat-room.cpp
src/chat/chat-room.cpp
+0
-2
tester/message_tester.c
tester/message_tester.c
+1
-1
No files found.
coreapi/private.h
View file @
78f4b39a
...
...
@@ -1099,7 +1099,6 @@ void linphone_chat_message_set_file_transfer_information(LinphoneChatMessage *ms
LinphoneChatMessageDir
linphone_chat_message_get_direction
(
const
LinphoneChatMessage
*
msg
);
SalOp
*
linphone_chat_message_get_sal_op
(
const
LinphoneChatMessage
*
msg
);
void
linphone_chat_message_set_sal_op
(
LinphoneChatMessage
*
msg
,
SalOp
*
op
);
void
linphone_chat_message_set_chat_room
(
LinphoneChatMessage
*
msg
,
LinphoneChatRoom
*
room
);
void
linphone_chat_message_destroy
(
LinphoneChatMessage
*
msg
);
void
linphone_chat_message_update_state
(
LinphoneChatMessage
*
msg
,
LinphoneChatMessageState
new_state
);
void
linphone_chat_message_set_is_secured
(
LinphoneChatMessage
*
msg
,
bool_t
secured
);
...
...
include/linphone/api/c-chat-message.h
View file @
78f4b39a
...
...
@@ -105,7 +105,7 @@ LINPHONE_PUBLIC void linphone_chat_message_set_from_address(LinphoneChatMessage*
* @param[in] message #LinphoneChatMessage obj
* @return #LinphoneAddress
*/
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_from_address
(
const
LinphoneChatMessage
*
msg
);
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_from_address
(
LinphoneChatMessage
*
msg
);
/**
* Set destination of the message
...
...
@@ -119,7 +119,7 @@ LINPHONE_PUBLIC void linphone_chat_message_set_to_address(LinphoneChatMessage* m
* @param[in] message #LinphoneChatMessage obj
* @return #LinphoneAddress
*/
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_to_address
(
const
LinphoneChatMessage
*
msg
);
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_to_address
(
LinphoneChatMessage
*
msg
);
/**
* Get the content type of a chat message.
...
...
@@ -301,7 +301,7 @@ LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_message_get_peer_address(Li
*@param message #LinphoneChatMessage obj
*@return #LinphoneAddress
*/
LINPHONE_PUBLIC
LinphoneAddress
*
linphone_chat_message_get_local_address
(
const
LinphoneChatMessage
*
message
);
LINPHONE_PUBLIC
const
LinphoneAddress
*
linphone_chat_message_get_local_address
(
LinphoneChatMessage
*
message
);
/**
* Add custom headers to the message.
...
...
src/c-wrapper/api/c-chat-message.cpp
View file @
78f4b39a
This diff is collapsed.
Click to expand it.
src/chat/chat-message-p.h
View file @
78f4b39a
...
...
@@ -41,18 +41,23 @@ private:
ChatMessage
::
Direction
direction
=
ChatMessage
::
Incoming
;
ChatMessage
::
State
state
=
ChatMessage
::
Idle
;
unsigned
int
storageId
;
// Linphone
Address
*
from;
// Linphone
Address
*
to;
std
::
shared_ptr
<
Address
>
from
;
std
::
shared_ptr
<
Address
>
to
;
time_t
time
=
0
;
std
::
string
id
;
std
::
string
appData
;
std
::
string
fileTransferFilePath
;
bool
isSecured
=
false
;
bool
isReadOnly
=
false
;
bool
isToBeStored
=
false
;
std
::
list
<
std
::
shared_ptr
<
Content
>
>
contents
;
std
::
shared_ptr
<
Content
>
internalContent
;
std
::
unordered_map
<
std
::
string
,
std
::
string
>
customHeaders
;
std
::
shared_ptr
<
EventsDb
>
eventsDb
;
std
::
shared_ptr
<
ErrorInfo
>
errorInfo
;
belle_http_request_t
*
httpRequest
;
SalOp
*
salOp
;
SalCustomHeader
*
salCustomHeaders
;
L_DECLARE_PUBLIC
(
ChatMessage
);
};
...
...
src/chat/chat-message.cpp
View file @
78f4b39a
This diff is collapsed.
Click to expand it.
src/chat/chat-message.h
View file @
78f4b39a
...
...
@@ -22,6 +22,8 @@
#include <list>
#include <memory>
#include "imdn.h"
#include "linphone/api/c-types.h"
#include "linphone/api/c-chat-message.h"
#include "object/object.h"
...
...
@@ -62,7 +64,24 @@ public:
LinphoneChatMessage
*
getBackPtr
();
std
::
shared_ptr
<
ChatRoom
>
getChatRoom
()
const
;
void
setChatRoom
(
std
::
shared_ptr
<
ChatRoom
>
cr
);
// -----------------------------------------------------------------------------
// Methods
// -----------------------------------------------------------------------------
void
updateState
(
State
state
);
void
reSend
();
void
sendImdn
();
void
sendDeliveryNotification
();
void
sendDisplayNotification
();
int
uploadFile
();
int
downloadFile
();
void
cancelFileTransfer
();
int
putCharacter
(
uint32_t
character
);
// -----------------------------------------------------------------------------
// Getters & setters
// -----------------------------------------------------------------------------
Direction
getDirection
()
const
;
...
...
@@ -89,25 +108,50 @@ public:
std
::
string
getAppdata
()
const
;
void
setAppdata
(
const
std
::
string
&
appData
);
std
::
shared_ptr
<
Address
>
getFromAddress
()
const
;
void
setFromAddress
(
std
::
shared_ptr
<
Address
>
from
);
std
::
shared_ptr
<
Address
>
getToAddress
()
const
;
void
setToAddress
(
std
::
shared_ptr
<
Address
>
to
);
std
::
string
getFileTransferFilepath
()
const
;
void
setFileTransferFilepath
(
const
std
::
string
&
path
);
bool
isToBeStored
()
const
;
void
setIsToBeStored
(
bool
store
);
// -----------------------------------------------------------------------------
// Deprecated methods, only used for C wrapper
// -----------------------------------------------------------------------------
std
::
string
getContentType
()
const
;
void
setContentType
(
std
::
string
contentType
);
std
::
string
getText
()
const
;
void
setText
(
std
::
string
text
);
std
::
shared_ptr
<
Content
>
getFileTransferInformation
()
const
;
void
setFileTransferInformation
(
std
::
shared_ptr
<
Content
>
content
);
unsigned
int
getStorageId
()
const
;
void
setStorageId
(
unsigned
int
id
);
void
setTime
(
time_t
time
);
// -----------------------------------------------------------------------------
belle_http_request_t
*
getHttpRequest
()
const
;
void
setHttpRequest
(
belle_http_request_t
*
request
);
SalOp
*
getSalOp
()
const
;
void
setSalOp
(
SalOp
*
op
);
std
::
shared_ptr
<
const
Address
>
getFromAddress
()
const
;
std
::
shared_ptr
<
const
Address
>
getToAddress
()
const
;
std
::
shared_ptr
<
const
Address
>
getLocalAddress
()
const
;
std
::
shared_ptr
<
const
Address
>
getRemoteAddress
()
const
;
SalCustomHeader
*
getSalCustomHeaders
()
const
;
void
setSalCustomHeaders
(
SalCustomHeader
*
headers
);
void
addSalCustomHeader
(
std
::
string
name
,
std
::
string
value
);
void
removeSalCustomHeader
(
std
::
string
name
);
std
::
string
getSalCustomHeaderValue
(
std
::
string
name
);
// -----------------------------------------------------------------------------
std
::
shared_ptr
<
const
ErrorInfo
>
getErrorInfo
()
const
;
...
...
src/chat/chat-room.cpp
View file @
78f4b39a
...
...
@@ -593,7 +593,6 @@ void ChatRoom::compose () {
LinphoneChatMessage
*
ChatRoom
::
createFileTransferMessage
(
const
LinphoneContent
*
initialContent
)
{
L_D
(
ChatRoom
);
LinphoneChatMessage
*
msg
=
createMessage
(
""
);
linphone_chat_message_set_chat_room
(
msg
,
L_GET_C_BACK_PTR
(
this
));
linphone_chat_message_set_text
(
msg
,
NULL
);
linphone_chat_message_set_file_transfer_information
(
msg
,
linphone_content_copy
(
initialContent
));
linphone_chat_message_set_outgoing
(
msg
);
...
...
@@ -612,7 +611,6 @@ LinphoneChatMessage *ChatRoom::createFileTransferMessage (const LinphoneContent
LinphoneChatMessage
*
ChatRoom
::
createMessage
(
const
string
&
message
)
{
shared_ptr
<
ChatMessage
>
chatMessage
=
make_shared
<
ChatMessage
>
(
static_pointer_cast
<
ChatRoom
>
(
shared_from_this
()));
LinphoneChatMessage
*
msg
=
chatMessage
->
getBackPtr
();
linphone_chat_message_set_chat_room
(
msg
,
L_GET_C_BACK_PTR
(
this
));
linphone_chat_message_set_state
(
msg
,
LinphoneChatMessageStateIdle
);
linphone_chat_message_set_text
(
msg
,
message
.
empty
()
?
nullptr
:
ms_strdup
(
message
.
c_str
()));
linphone_chat_message_set_content_type
(
msg
,
ms_strdup
(
"text/plain"
));
...
...
tester/message_tester.c
View file @
78f4b39a
...
...
@@ -741,7 +741,7 @@ static void file_transfer_2_messages_simultaneously(void) {
linphone_chat_room_send_chat_message
(
pauline_room
,
msg
);
linphone_chat_room_send_chat_message
(
pauline_room
,
msg2
);
if
(
BC_ASSERT_TRUE
(
wait_for_until
(
pauline
->
lc
,
marie
->
lc
,
&
marie
->
stat
.
number_of_LinphoneMessageReceivedWithFile
,
1
,
60000
)))
{
msg
=
linphone_chat_message_
clone
(
marie
->
stat
.
last_received_chat_message
);
msg
=
linphone_chat_message_
ref
(
marie
->
stat
.
last_received_chat_message
);
BC_ASSERT_TRUE
(
wait_for_until
(
pauline
->
lc
,
marie
->
lc
,
&
marie
->
stat
.
number_of_LinphoneMessageReceivedWithFile
,
2
,
60000
));
msg2
=
marie
->
stat
.
last_received_chat_message
;
BC_ASSERT_EQUAL
((
unsigned
int
)
bctbx_list_size
(
linphone_core_get_chat_rooms
(
marie
->
lc
)),
1
,
unsigned
int
,
"%u"
);
...
...
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