Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
ba14df8b
Commit
ba14df8b
authored
Jan 17, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(src/components/chat/ChatModel): supports new message states
parent
f422bd7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
31 deletions
+41
-31
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+24
-29
ChatModel.hpp
tests/src/components/chat/ChatModel.hpp
+5
-0
FileMessage.qml
tests/ui/modules/Linphone/Chat/FileMessage.qml
+6
-1
OutgoingMessage.qml
tests/ui/modules/Linphone/Chat/OutgoingMessage.qml
+6
-1
No files found.
tests/src/components/chat/ChatModel.cpp
View file @
ba14df8b
...
...
@@ -92,17 +92,9 @@ private:
emit
m_chat_model
->
dataChanged
(
m_chat_model
->
index
(
row
,
0
),
m_chat_model
->
index
(
row
,
0
));
}
void
onFileTransferRecv
(
const
shared_ptr
<
linphone
::
ChatMessage
>
&
,
const
shared_ptr
<
linphone
::
Content
>
&
,
const
shared_ptr
<
linphone
::
Buffer
>
&
)
override
{
qWarning
()
<<
"`onFileTransferRecv` called."
;
}
shared_ptr
<
linphone
::
Buffer
>
onFileTransferSend
(
const
shared_ptr
<
linphone
::
ChatMessage
>
&
,
const
shared_ptr
<
linphone
::
Content
>
&
,
const
shared_ptr
<
linphone
::
Content
>
&
content
,
size_t
,
size_t
)
override
{
...
...
@@ -136,15 +128,9 @@ private:
if
(
it
==
m_chat_model
->
m_entries
.
end
())
return
;
if
(
state
==
linphone
::
ChatMessageStateFileTransferError
)
state
=
linphone
::
ChatMessageStateNotDelivered
;
else
if
(
state
==
linphone
::
ChatMessageStateFileTransferDone
)
{
if
(
!
message
->
isOutgoing
())
{
createThumbnail
(
message
);
fillThumbnailProperty
((
*
it
).
first
,
message
);
}
state
=
linphone
::
ChatMessageStateDelivered
;
if
(
state
==
linphone
::
ChatMessageStateFileTransferDone
&&
!
message
->
isOutgoing
())
{
createThumbnail
(
message
);
fillThumbnailProperty
((
*
it
).
first
,
message
);
}
(
*
it
).
first
[
"status"
]
=
state
;
...
...
@@ -359,14 +345,17 @@ void ChatModel::resendMessage (int id) {
}
shared_ptr
<
linphone
::
ChatMessage
>
message
=
static_pointer_cast
<
linphone
::
ChatMessage
>
(
entry
.
second
);
int
state
=
message
->
getState
();
if
(
state
!=
linphone
::
ChatMessageStateNotDelivered
&&
state
!=
linphone
::
ChatMessageStateFileTransferError
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to resend message: %1. Bad state."
).
arg
(
id
);
return
;
}
message
->
setListener
(
m_message_handlers
);
m_chat_room
->
sendChatMessage
(
message
);
switch
(
message
->
getState
())
{
case
MessageStatusFileTransferError
:
case
MessageStatusNotDelivered
:
message
->
setListener
(
m_message_handlers
);
m_chat_room
->
sendChatMessage
(
message
);
break
;
default:
qWarning
()
<<
QStringLiteral
(
"Unable to resend message: %1. Bad state."
).
arg
(
id
);
}
}
void
ChatModel
::
sendFileMessage
(
const
QString
&
path
)
{
...
...
@@ -414,10 +403,16 @@ void ChatModel::downloadFile (int id, const QString &download_path) {
return
;
}
int
state
=
message
->
getState
();
if
(
state
!=
linphone
::
ChatMessageStateDelivered
&&
state
!=
linphone
::
ChatMessageStateFileTransferDone
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to download file of entry %1. It was not uploaded."
).
arg
(
id
);
return
;
switch
(
message
->
getState
())
{
case
MessageStatusDelivered
:
case
MessageStatusDeliveredToUser
:
case
MessageStatusDisplayed
:
case
MessageStatusFileTransferDone
:
break
;
default:
qWarning
()
<<
QStringLiteral
(
"Unable to download file of entry %1. It was not uploaded."
).
arg
(
id
);
return
;
}
message
->
setFileTransferFilepath
(
...
...
tests/src/components/chat/ChatModel.hpp
View file @
ba14df8b
...
...
@@ -41,6 +41,11 @@ public:
enum
MessageStatus
{
MessageStatusDelivered
=
linphone
::
ChatMessageStateDelivered
,
MessageStatusDeliveredToUser
=
linphone
::
ChatMessageStateDeliveredToUser
,
MessageStatusDisplayed
=
linphone
::
ChatMessageStateDisplayed
,
MessageStatusFileTransferDone
=
linphone
::
ChatMessageStateFileTransferDone
,
MessageStatusFileTransferError
=
linphone
::
ChatMessageStateFileTransferError
,
MessageStatusIdle
=
linphone
::
ChatMessageStateIdle
,
MessageStatusInProgress
=
linphone
::
ChatMessageStateInProgress
,
MessageStatusNotDelivered
=
linphone
::
ChatMessageStateNotDelivered
};
...
...
tests/ui/modules/Linphone/Chat/FileMessage.qml
View file @
ba14df8b
...
...
@@ -48,7 +48,12 @@ Row {
Rectangle
{
id
:
rectangle
readonly
property
bool
isNotDelivered
:
$chatEntry
.
status
===
ChatModel
.
MessageStatusNotDelivered
readonly
property
bool
isNotDelivered
:
Utils
.
includes
([
ChatModel
.
MessageStatusFileTransferError
,
ChatModel
.
MessageStatusIdle
,
ChatModel
.
MessageStatusInProgress
,
ChatModel
.
MessageStatusNotDelivered
],
$chatEntry
.
status
)
color
:
$chatEntry
.
isOutgoing
?
ChatStyle
.
entry
.
message
.
outgoing
.
backgroundColor
...
...
tests/ui/modules/Linphone/Chat/OutgoingMessage.qml
View file @
ba14df8b
...
...
@@ -32,7 +32,12 @@ Item {
id
:
icon
Icon
{
property
bool
isNotDelivered
:
$chatEntry
.
status
===
ChatModel
.
MessageStatusNotDelivered
property
bool
isNotDelivered
:
Utils
.
includes
([
ChatModel
.
MessageStatusFileTransferError
,
ChatModel
.
MessageStatusIdle
,
ChatModel
.
MessageStatusInProgress
,
ChatModel
.
MessageStatusNotDelivered
],
$chatEntry
.
status
)
icon
:
isNotDelivered
?
'
chat_error
'
:
'
chat_send
'
iconSize
:
ChatStyle
.
entry
.
message
.
outgoing
.
sendIconSize
...
...
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