ui logick of changing message, not connected yet

This commit is contained in:
Blue 2020-02-08 14:44:15 +03:00
parent ed56cca2e7
commit 6d1b83d0f8
18 changed files with 246 additions and 19 deletions

View file

@ -290,6 +290,27 @@ void Models::Contact::addMessage(const Shared::Message& data)
}
}
void Models::Contact::changeMessage(const QString& id, const QMap<QString, QVariant>& data)
{
bool found = false;
for (Shared::Message& msg : messages) {
if (msg.getId() == id) {
msg.change(data);
found = true;
break;
}
}
if (!found) {
for (Presence* pr : presences) {
found = pr->changeMessage(id, data);
if (found) {
break;
}
}
}
}
unsigned int Models::Contact::getMessagesCount() const
{
return messages.size() + childMessages;