function ChatBox_UnitPopup_HideButtons() CB_Orig_UnitPopup_HideButtons(); local dropdownMenu = getglobal(UIDROPDOWNMENU_INIT_MENU); for index, value in UnitPopupMenus[dropdownMenu.which] do if ( value == "WHO" or value == "TARGET" ) then if ( dropdownMenu.name == UnitName("player") ) then UnitPopupShown[index] = 0; else UnitPopupShown[index] = 1; end elseif ( value == "IGNORE" ) then --kinda backasswards, but it works. if ( dropdownMenu.name == UnitName("player") or ChatBox_isOnIgnoreList(dropdownMenu.name) ) then UnitPopupShown[index] = 0; else UnitPopupShown[index] = 1; end elseif ( value == "UNIGNORE" ) then if ( dropdownMenu.name == UnitName("player") or not ChatBox_isOnIgnoreList(dropdownMenu.name) ) then UnitPopupShown[index] = 0; else UnitPopupShown[index] = 1; end elseif ( value == "ADDFRIEND" ) then if ( dropdownMenu.name == UnitName("player") or ChatBox_isPlayerFriend(dropdownMenu.name) ) then UnitPopupShown[index] = 0; else UnitPopupShown[index] = 1; end elseif ( value == "REMOVEFRIEND" ) then if ( dropdownMenu.name == UnitName("player") or not ChatBox_isPlayerFriend(dropdownMenu.name) ) then UnitPopupShown[index] = 0; else UnitPopupShown[index] = 1; end end endendfunction ChatBox_UnitPopup_OnClick() local index = this.value; local dropdownFrame = getglobal(UIDROPDOWNMENU_INIT_MENU); local button = UnitPopupMenus[this.owner][index]; local unit = dropdownFrame.unit; local name = dropdownFrame.name; local notFound = false; if ( button == "WHO" ) then SendWho("n-"..name); elseif ( button == "TARGET" ) then TargetByName(name); elseif ( button == "IGNORE" ) then AddIgnore(name); elseif ( button == "UNIGNORE" ) then DelIgnore(name); elseif ( button == "ADDFRIEND" ) then AddFriend(name); elseif ( button == "REMOVEFRIEND" ) then RemoveFriend(name); else notFound = true; end if notFound then CB_Orig_UnitPopup_OnClick(); else PlaySound("UChatScrollButton"); endendfunction ChatBox_isOnIgnoreList(checkname) local ignores = GetNumIgnores(); for i=1, ignores do local name = GetIgnoreName(i); if(name == checkname) then return true; end end return false;endfunction ChatBox_isPlayerFriend(checkname) local friends = GetNumFriends(); for i=1, friends do local name, level, class, area, connected = GetFriendInfo(i); if(name == checkname) then return true; end end return false;end