Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
savoirfairelinux
jami-lrc
Commits
1d900c23
Commit
1d900c23
authored
Mar 19, 2020
by
Sébastien Blin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conversationmodel: send read status
Change-Id: Icc8beda4859f3f29e432ce5b3edc076f8212d44a
parent
fed16f24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
src/conversationmodel.cpp
src/conversationmodel.cpp
+14
-7
src/qtwrapper/configurationmanager_wrap.h
src/qtwrapper/configurationmanager_wrap.h
+4
-0
No files found.
src/conversationmodel.cpp
View file @
1d900c23
...
...
@@ -111,14 +111,16 @@ public:
const
std
::
time_t
&
duration
=
-
1
);
/**
* Add a new message from a peer in the database
* @param from the author uri
* @param body the content of the message
* @param timestamp the timestamp of the message
* @param from the author uri
* @param body the content of the message
* @param timestamp the timestamp of the message
* @param daemonId the daemon id
* @return msgId generated (in db)
*/
int
addIncomingMessage
(
const
QString
&
from
,
const
QString
&
body
,
const
uint64_t
&
timestamp
=
0
);
const
uint64_t
&
timestamp
=
0
,
const
QString
&
daemonId
=
""
);
/**
* Change the status of an interaction. Listen from callbacksHandler
* @param accountId, account linked
...
...
@@ -1121,6 +1123,8 @@ ConversationModel::setInteractionRead(const QString& convId,
}
if
(
emitUpdated
)
{
pimpl_
->
dirtyConversations
=
{
true
,
true
};
auto
daemonId
=
storage
::
getDaemonIdByInteractionId
(
pimpl_
->
db
,
QString
::
number
(
interactionId
));
ConfigurationManager
::
instance
().
setMessageDisplayed
(
owner
.
id
,
pimpl_
->
conversations
[
conversationIdx
].
participants
.
front
(),
daemonId
,
3
);
storage
::
setInteractionRead
(
pimpl_
->
db
,
interactionId
);
emit
interactionStatusUpdated
(
convId
,
interactionId
,
itCopy
);
emit
pimpl_
->
behaviorController
.
newReadInteraction
(
owner
.
id
,
convId
,
interactionId
);
...
...
@@ -1794,8 +1798,7 @@ ConversationModelPimpl::slotNewAccountMessage(const QString& accountId,
for
(
const
auto
&
payload
:
payloads
.
keys
())
{
if
(
payload
.
contains
(
"text/plain"
))
{
auto
dbId
=
addIncomingMessage
(
from
,
payloads
.
value
(
payload
));
storage
::
addDaemonMsgId
(
db
,
QString
::
number
(
dbId
),
msgId
);
addIncomingMessage
(
from
,
payloads
.
value
(
payload
),
0
,
msgId
);
}
}
}
...
...
@@ -1826,7 +1829,8 @@ ConversationModelPimpl::slotIncomingCallMessage(const QString& callId, const QSt
int
ConversationModelPimpl
::
addIncomingMessage
(
const
QString
&
from
,
const
QString
&
body
,
const
uint64_t
&
timestamp
)
const
uint64_t
&
timestamp
,
const
QString
&
daemonId
)
{
auto
convIds
=
storage
::
getConversationsWithPeer
(
db
,
from
);
if
(
convIds
.
empty
())
{
...
...
@@ -1836,6 +1840,9 @@ ConversationModelPimpl::addIncomingMessage(const QString& from,
timestamp
==
0
?
std
::
time
(
nullptr
)
:
static_cast
<
time_t
>
(
timestamp
),
0
,
interaction
::
Type
::
TEXT
,
interaction
::
Status
::
SUCCESS
,
false
};
auto
msgId
=
storage
::
addMessageToConversation
(
db
,
convIds
[
0
],
msg
);
if
(
!
daemonId
.
isEmpty
())
{
storage
::
addDaemonMsgId
(
db
,
QString
::
number
(
msgId
),
daemonId
);
}
auto
conversationIdx
=
indexOf
(
convIds
[
0
]);
// Add the conversation if not already here
if
(
conversationIdx
==
-
1
)
{
...
...
src/qtwrapper/configurationmanager_wrap.h
View file @
1d900c23
...
...
@@ -717,6 +717,10 @@ public Q_SLOTS: // METHODS
DRing
::
setIsComposing
(
accountId
.
toStdString
(),
contactId
.
toStdString
(),
isComposing
);
}
bool
setMessageDisplayed
(
const
QString
&
accountId
,
const
QString
&
contactId
,
const
QString
&
messageId
,
int
status
)
{
DRing
::
setMessageDisplayed
(
accountId
.
toStdString
(),
contactId
.
toStdString
(),
messageId
.
toStdString
(),
status
);
}
Q_SIGNALS:
// SIGNALS
void
volumeChanged
(
const
QString
&
device
,
double
value
);
void
accountsChanged
();
...
...
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