primitive messages receiving

This commit is contained in:
Blue 2019-04-10 01:01:25 +03:00
parent 4775c7b700
commit 3cc53dfaf6
15 changed files with 264 additions and 22 deletions

View file

@ -69,7 +69,7 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
break;
case Item::presence:{
Presence* presence = static_cast<Presence*>(item);
result = QIcon::fromTheme(Shared::availabilityThemeIcons[presence->getAvailability()]);
result = presence->getStatusIcon();
}
break;
default:
@ -492,3 +492,23 @@ void Models::Roster::removePresence(const QString& account, const QString& jid,
cBeg->second->removePresence(name);
}
}
void Models::Roster::addMessage(const QString& account, const QMap<QString, QString>& data)
{
ElId id(account, data.value("from"));
std::multimap<ElId, Contact*>::iterator cBeg = contacts.lower_bound(id);
std::multimap<ElId, Contact*>::iterator cEnd = contacts.upper_bound(id);
for (;cBeg != cEnd; ++cBeg) {
cBeg->second->addMessage(data);
}
}
void Models::Roster::dropMessages(const QString& account, const QString& jid)
{
ElId id(account, jid);
for (std::multimap<ElId, Contact*>::iterator cBeg = contacts.lower_bound(id), cEnd = contacts.upper_bound(id) ;cBeg != cEnd; ++cBeg) {
cBeg->second->dropMessages();
}
}