Reduce TabSupervisor direct usage in UserContextMenu

This commit is contained in:
Gavin Bisesi 2017-03-17 23:37:00 -04:00 committed by Gavin Bisesi
parent c5aa75d4d1
commit a3f4012d1a
5 changed files with 25 additions and 7 deletions

View file

@ -605,6 +605,12 @@ void TabSupervisor::processNotifyUserEvent(const Event_NotifyUser &event)
}
}
const bool TabSupervisor::isOwnUserRegistered() const
{
return (bool) getUserInfo()->user_level() & ServerInfo_User::IsRegistered;
}
const QString TabSupervisor::getOwnUsername() const
{
return QString::fromStdString(userInfo->name());
@ -619,6 +625,15 @@ bool TabSupervisor::isUserBuddy(const QString &userName) const
return senderIsBuddy;
}
bool TabSupervisor::isUserIgnored(const QString &userName) const
{
if (!getUserListsTab()) return false;
if (!getUserListsTab()->getIgnoreList()) return false;
QMap<QString, UserListTWI *> buddyList = getUserListsTab()->getIgnoreList()->getUsers();
bool senderIsBuddy = buddyList.contains(userName);
return senderIsBuddy;
}
const ServerInfo_User * TabSupervisor::getOnlineUser(const QString &userName) const
{
if (!getUserListsTab()) return nullptr;