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
490ff801
Commit
490ff801
authored
Jan 17, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(src/components/chat/ChatModel): avoid the duplication of message on resend
parent
9dcc3375
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
linphone
submodules/linphone
+1
-1
ChatModel.cpp
tests/src/components/chat/ChatModel.cpp
+18
-8
No files found.
linphone
@
030b1c05
Subproject commit
c0048ed884a411dc29f92daf7bf4c6941074675
a
Subproject commit
030b1c05d5d77dac2d34a1be1c98516a8fb9887
a
tests/src/components/chat/ChatModel.cpp
View file @
490ff801
...
...
@@ -251,7 +251,7 @@ void ChatModel::setSipAddress (const QString &sip_address) {
// TODO: Remove me in a future linphone core version.
if
(
message
->
getState
()
==
linphone
::
ChatMessageStateInProgress
)
map
[
"status"
]
=
linphone
::
ChatMessageStateDelivered
;
map
[
"status"
]
=
linphone
::
ChatMessageState
Not
Delivered
;
m_entries
<<
qMakePair
(
map
,
static_pointer_cast
<
void
>
(
message
));
}
...
...
@@ -344,19 +344,29 @@ void ChatModel::resendMessage (int id) {
}
const
ChatEntryData
&
entry
=
m_entries
[
id
];
if
(
entry
.
first
[
"type"
]
!=
EntryType
::
MessageEntry
)
{
const
QVariantMap
&
map
=
entry
.
first
;
if
(
map
[
"type"
]
!=
EntryType
::
MessageEntry
)
{
qWarning
()
<<
QStringLiteral
(
"Unable to resend entry %1. It's not a message."
).
arg
(
id
);
return
;
}
shared_ptr
<
linphone
::
ChatMessage
>
message
=
static_pointer_cast
<
linphone
::
ChatMessage
>
(
entry
.
second
);
switch
(
message
->
getState
())
{
switch
(
map
[
"status"
].
toInt
())
{
case
MessageStatusFileTransferError
:
case
MessageStatusNotDelivered
:
message
->
setListener
(
m_message_handlers
);
m_chat_room
->
sendChatMessage
(
message
);
case
MessageStatusNotDelivered
:
{
shared_ptr
<
linphone
::
ChatMessage
>
message
=
static_pointer_cast
<
linphone
::
ChatMessage
>
(
entry
.
second
);
// TODO: Remove workaround in a future linphone core version.
// `sendChatMessage` duplicates the message on resend.
shared_ptr
<
linphone
::
ChatMessage
>
message2
=
message
->
clone
();
message2
->
setListener
(
m_message_handlers
);
m_chat_room
->
sendChatMessage
(
message2
);
removeEntry
(
id
);
insertMessageAtEnd
(
message2
);
break
;
}
default:
qWarning
()
<<
QStringLiteral
(
"Unable to resend message: %1. Bad state."
).
arg
(
id
);
...
...
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