add simple username tabbing for recent chatters

This commit is contained in:
Rasmus Karlsson
2017-12-17 17:49:32 +01:00
parent 5839b9f522
commit e41c855545
6 changed files with 63 additions and 9 deletions
+25
View File
@@ -38,6 +38,13 @@ void Channel::addMessage(std::shared_ptr<Message> message)
{
std::shared_ptr<Message> deleted;
const QString &username = message->username;
if (!username.isEmpty()) {
// TODO: Add recent chatters display name. This should maybe be a setting
this->addRecentChatter(username);
}
// if (_loggingChannel.get() != nullptr) {
// _loggingChannel->append(message);
// }
@@ -49,6 +56,24 @@ void Channel::addMessage(std::shared_ptr<Message> message)
this->messageAppended(message);
}
void Channel::addRecentChatter(const QString &username)
{
std::lock_guard<std::mutex> lock(this->recentChattersMutex);
this->recentChatters.insert(username);
}
std::set<QString> Channel::getUsernamesForCompletions()
{
std::set<QString> usernames;
this->recentChattersMutex.lock();
usernames.insert(this->recentChatters.begin(), this->recentChatters.end());
this->recentChattersMutex.unlock();
return usernames;
}
bool Channel::canSendMessage() const
{
return false;