Tweak permissions handling in UserListView

This commit is contained in:
Jaidyn Ann 2021-07-06 13:47:37 -05:00
parent 9d8b35fc86
commit 1515ab0d00

View File

@ -58,10 +58,8 @@ UserListView::_UserPopUp()
return _BlankPopUp(); return _BlankPopUp();
Role* own_role = fChat->GetRole(fChat->GetOwnId()); Role* own_role = fChat->GetRole(fChat->GetOwnId());
if (own_role == NULL) return _BlankPopUp();
Role* selected_role = fChat->GetRole(selected_user->GetId()); Role* selected_role = fChat->GetRole(selected_user->GetId());
if (selected_role == NULL) return _BlankPopUp();
Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer(); Server* server = ((TheApp*)be_app)->GetMainWindow()->GetServer();
BObjectList<BMessage> items = server->UserPopUpItems(); BObjectList<BMessage> items = server->UserPopUpItems();
@ -110,10 +108,11 @@ UserListView::_ProcessItem(BMessage* itemMsg, BPopUpMenu* menu, Role* user,
toSend.AddInt64("instance", fChat->GetProtocolLooper()->GetInstance()); toSend.AddInt64("instance", fChat->GetProtocolLooper()->GetInstance());
msg->ReplaceMessage("_msg", &toSend); msg->ReplaceMessage("_msg", &toSend);
if ((perms == 0 || (user->fPerms & perms)) if ((perms == 0 || ((user != NULL) && (user->fPerms & perms)))
&& (target_perms == 0 || (target->fPerms & target_perms)) && ((target == NULL) ||
((target_perms == 0 || (target->fPerms & target_perms))
&& (target_antiperms == 0 || (!(target->fPerms & target_antiperms))) && (target_antiperms == 0 || (!(target->fPerms & target_antiperms)))
&& ((priority == false) || (user->fPriority > target->fPriority))) && ((priority == false) || (user->fPriority > target->fPriority)))))
{ {
BMenuItem* item = new BMenuItem(msg); BMenuItem* item = new BMenuItem(msg);
if (msg->GetBool("x_to_protocol", true) == true) if (msg->GetBool("x_to_protocol", true) == true)