Remove direct usages of TabSupervisor from Chatview

- There still might be inherited usages
- It's still used in the ctor

Areas to test
- Mentions
- Chat notifications
- Username clickable links
This commit is contained in:
Gavin Bisesi 2017-03-17 23:13:35 -04:00 committed by Gavin Bisesi
parent 2c3b85aed3
commit d65a444ac5
11 changed files with 104 additions and 100 deletions

View file

@ -604,4 +604,34 @@ void TabSupervisor::processNotifyUserEvent(const Event_NotifyUser &event)
default: ;
}
}
}
const QString TabSupervisor::getOwnUsername() const
{
return QString::fromStdString(userInfo->name());
}
bool TabSupervisor::isUserBuddy(const QString &userName) const
{
if (!getUserListsTab()) return false;
if (!getUserListsTab()->getBuddyList()) return false;
QMap<QString, UserListTWI *> buddyList = getUserListsTab()->getBuddyList()->getUsers();
bool senderIsBuddy = buddyList.contains(userName);
return senderIsBuddy;
}
const ServerInfo_User * TabSupervisor::getOnlineUser(const QString &userName) const
{
if (!getUserListsTab()) return nullptr;
if (!getUserListsTab()->getAllUsersList()) return nullptr;
QMap<QString, UserListTWI *> userList = getUserListsTab()->getAllUsersList()->getUsers();
const QString &userNameToMatchLower = userName.toLower();
QMap<QString, UserListTWI *>::iterator i;
for (i = userList.begin(); i != userList.end(); ++i)
if (i.key().toLower() == userNameToMatchLower) {
const ServerInfo_User &userInfo = i.value()->getUserInfo();
return &userInfo;
}
return nullptr;
};