Commit c217d70c authored by Azilroka's avatar Azilroka

Friend Groups - Work

parent 1e314ef1
......@@ -396,9 +396,9 @@ function EFL:Initialize()
EFL:RegisterEvent("BN_CONNECTED", 'HandleBN')
EFL:RegisterEvent("BN_DISCONNECTED", 'HandleBN')
--if PA.db.FG then
-- EFL:SecureHook(PA.FG, 'FriendGroups_UpdateFriendButton', function(self, button) EFL:UpdateFriends(button) end)
--else
if PA.db.FriendGroups and PA.db.FriendGroups.Enable then
EFL:SecureHook(_G.FriendGroups, 'FriendGroups_UpdateFriendButton', function(_, button) EFL:UpdateFriends(button) end)
else
EFL:SecureHook("FriendsFrame_UpdateFriendButton", 'UpdateFriends')
--end
end
end
local PA = _G.ProjectAzilroka
local FG = PA:NewModule('FriendGroup', 'AceEvent-3.0', 'AceTimer-3.0', 'AceHook-3.0')
_G.FriendGroup = FG
local FG = PA:NewModule('FriendGroups', 'AceEvent-3.0', 'AceTimer-3.0', 'AceHook-3.0')
_G.FriendGroups= FG
FG.Title = PA.ACL['|cFF16C3F2Friend|r |cFFFFFFFFGroups|r']
FG.Desciption = PA.ACL['Manage Firends List with Groups']
FG.Title = 'Friend Groups'
FG.Header = PA.ACL['|cFF16C3F2Friend|r |cFFFFFFFFGroups|r']
FG.Description = PA.ACL['Manage Firends List with Groups']
FG.Authors = 'Azilroka'
FG.Credits = 'Mikeprod frankkkkk'
local hooks = {}
local function Hook(source, target, secure)
hooks[source] = _G[source]
if secure then
hooksecurefunc(source, target)
else
_G[source] = target
end
end
local FRIENDS_GROUP_NAME_COLOR = NORMAL_FONT_COLOR
local INVITE_RESTRICTION_NO_TOONS = 0
local INVITE_RESTRICTION_CLIENT = 1
local INVITE_RESTRICTION_LEADER = 2
local INVITE_RESTRICTION_FACTION = 3
local INVITE_RESTRICTION_INFO = 4
local INVITE_RESTRICTION_NONE = 5
local ONE_MINUTE = 60
local ONE_HOUR = 60 * ONE_MINUTE
local ONE_DAY = 24 * ONE_HOUR
local ONE_MONTH = 30 * ONE_DAY
local ONE_YEAR = 12 * ONE_MONTH
local FriendButtons = { count = 0 }
local FriendListEntries = {}
local GroupCount = 0
local GroupTotal = {}
local GroupOnline = {}
local GroupSorted = {}
local FriendRequestString = string.sub(FRIEND_REQUESTS,1,-5)
local FriendRequestString = string.sub(FRIEND_REQUESTS,1,-6)
local OPEN_DROPDOWNMENUS_SAVE = nil
local friend_popup_menus = { "FRIEND", "FRIEND_OFFLINE", "BN_FRIEND", "BN_FRIEND_OFFLINE" }
UnitPopupButtons["FRIEND_GROUP_NEW"] = { text = "Create new group", dist = 0 }
UnitPopupButtons["FRIEND_GROUP_ADD"] = { text = "Add to group", dist = 0, nested = 1 }
UnitPopupButtons["FRIEND_GROUP_DEL"] = { text = "Remove from group", dist = 0, nested = 1 }
UnitPopupButtons["FRIEND_GROUP_NEW"] = { text = "Create new group"}
UnitPopupButtons["FRIEND_GROUP_ADD"] = { text = "Add to group", nested = 1}
UnitPopupButtons["FRIEND_GROUP_DEL"] = { text = "Remove from group", nested = 1}
UnitPopupMenus["FRIEND_GROUP_ADD"] = { }
UnitPopupMenus["FRIEND_GROUP_DEL"] = { }
local function ClassColourCode(class,table)
local initialClass = class
for k, v in pairs(LOCALIZED_CLASS_NAMES_FEMALE) do
if class == v then
class = k
break
end
end
if class == initialClass then
for k, v in pairs(LOCALIZED_CLASS_NAMES_MALE) do
if class == v then
class = k
break
end
end
end
if table then
return RAID_CLASS_COLORS[class]
else
local colour = RAID_CLASS_COLORS[class]
return string.format("|cFF%02x%02x%02x", colour.r*255, colour.g*255, colour.b*255)
end
local FriendsScrollFrame
local FriendButtonTemplate
if FriendsListFrameScrollFrame then
FriendsScrollFrame = FriendsListFrameScrollFrame
FriendButtonTemplate = "FriendsListButtonTemplate"
else
FriendsScrollFrame = FriendsFrameFriendsScrollFrame
FriendButtonTemplate = "FriendsFrameButtonTemplate"
end
local function FriendGroups_GetTopButton(offset)
function FG:FriendGroups_GetTopButton(offset)
local usedHeight = 0
for i = 1, FriendButtons.count do
local buttonHeight = FRIENDS_BUTTON_HEIGHTS[FriendButtons[i].buttonType]
for i = 1, #FriendListEntries do
local buttonHeight = FRIENDS_BUTTON_HEIGHTS[FriendListEntries[i].buttonType]
if ( usedHeight + buttonHeight >= offset ) then
return i - 1, offset - usedHeight
else
usedHeight = usedHeight + buttonHeight
end
end
return 0,0
end
local function FriendGroups_UpdateFriendButton(button)
function FG:GetOnlineInfoText(client, isMobile, rafLinkType, locationText)
if not locationText or locationText == "" then
return UNKNOWN
end
if isMobile then
return LOCATION_MOBILE_APP
end
if (client == BNET_CLIENT_WOW) and (rafLinkType ~= Enum.RafLinkType.None) and not isMobile then
if rafLinkType == Enum.RafLinkType.Recruit then
return RAF_RECRUIT_FRIEND:format(locationText)
else
return RAF_RECRUITER_FRIEND:format(locationText)
end
end
return locationText
end
function FG:FriendGroups_UpdateFriendButton(button)
local index = button.index
button.buttonType = FriendButtons[index].buttonType
button.id = FriendButtons[index].id
button.buttonType = FriendListEntries[index].buttonType
button.id = FriendListEntries[index].id
local height = FRIENDS_BUTTON_HEIGHTS[button.buttonType]
local nameText, nameColor, infoText, broadcastText
local hasTravelPassButton = false
if ( button.buttonType == FRIENDS_BUTTON_TYPE_WOW ) then
local name, level, class, area, connected, status, note, isRaF, guid = GetFriendInfo(FriendButtons[index].id)
local nameText, nameColor, infoText, broadcastText, isFavoriteFriend
if button.buttonType == FRIENDS_BUTTON_TYPE_WOW then
local info = C_FriendList.GetFriendInfoByIndex(FriendListEntries[index].id)
broadcastText = nil
if ( connected ) then
if info.connected then
button.background:SetColorTexture(FRIENDS_WOW_BACKGROUND_COLOR.r, FRIENDS_WOW_BACKGROUND_COLOR.g, FRIENDS_WOW_BACKGROUND_COLOR.b, FRIENDS_WOW_BACKGROUND_COLOR.a)
if ( status == "" ) then
button.status:SetTexture(FRIENDS_TEXTURE_ONLINE)
elseif ( status == CHAT_FLAG_AFK ) then
if info.afk then
button.status:SetTexture(FRIENDS_TEXTURE_AFK)
elseif ( status == CHAT_FLAG_DND ) then
elseif ( info.dnd ) then
button.status:SetTexture(FRIENDS_TEXTURE_DND)
else
button.status:SetTexture(FRIENDS_TEXTURE_ONLINE)
end
if FriendGroups_SavedVars.colour_classes then
nameColor = ClassColourCode(class,true)
else
nameColor = FRIENDS_WOW_NAME_COLOR
nameColor = PA:ClassColorCode(info.gameAccountInfo.className)
nameText = info.name..", "..format(FRIENDS_LEVEL_TEMPLATE, info.level, info.className)
if PA.Retail then
infoText = FG:GetOnlineInfoText(BNET_CLIENT_WOW, info.mobile, info.rafLinkType, info.area)
end
nameText = name..", "..format(FRIENDS_LEVEL_TEMPLATE, level, class)
else
button.background:SetColorTexture(FRIENDS_OFFLINE_BACKGROUND_COLOR.r, FRIENDS_OFFLINE_BACKGROUND_COLOR.g, FRIENDS_OFFLINE_BACKGROUND_COLOR.b, FRIENDS_OFFLINE_BACKGROUND_COLOR.a)
button.status:SetTexture(FRIENDS_TEXTURE_OFFLINE)
nameText = name
nameText = info.name
nameColor = FRIENDS_GRAY_COLOR
infoText = FRIENDS_LIST_OFFLINE
end
infoText = area
button.gameIcon:Hide()
button.summonButton:ClearAllPoints()
button.summonButton:SetPoint("TOPRIGHT", button, "TOPRIGHT", 1, -1)
FriendsFrame_SummonButton_Update(button.summonButton)
elseif ( button.buttonType == FRIENDS_BUTTON_TYPE_BNET ) then
local bnetIDAccount, accountName, battleTag, isBattleTag, characterName, bnetIDGameAccount, client, isOnline, lastOnline, isBnetAFK, isBnetDND, messageText, noteText, isRIDFriend, messageTime, canSoR = BNGetFriendInfo(FriendButtons[index].id)
broadcastText = messageText
-- set up player name and character name
local characterName = characterName
if ( accountName ) then
nameText = accountName
if ( isOnline ) then
characterName = BNet_GetValidatedCharacterName(characterName, battleTag, client)
end
else
nameText = UNKNOWN
end
elseif button.buttonType == FRIENDS_BUTTON_TYPE_BNET then
local accountInfo = PA:GetBattleNetInfo(button.id);
if accountInfo then
nameText = accountInfo.accountName
infoText = accountInfo.gameAccountInfo.richPresence
-- append character name
if ( characterName ) then
if ( client == BNET_CLIENT_WOW and CanCooperateWithGameAccount(bnetIDGameAccount) ) then
local level = select(11, BNGetGameAccountInfo(bnetIDGameAccount))
if FriendGroups_SavedVars.colour_classes then
local class = select(8, BNGetGameAccountInfo(bnetIDGameAccount))
nameText = nameText.." "..ClassColourCode(class).."("..characterName.."-"..level..")"..FONT_COLOR_CODE_CLOSE
else
nameText = nameText.." "..FRIENDS_WOW_NAME_COLOR_CODE.."("..characterName.."-"..level..")"..FONT_COLOR_CODE_CLOSE
end
else
local level = select(11, BNGetGameAccountInfo(bnetIDGameAccount))
if ( ENABLE_COLORBLIND_MODE == "1" ) then
characterName = characterName..CANNOT_COOPERATE_LABEL
end
if level ~= "" then
nameText = nameText.." "..FRIENDS_OTHER_NAME_COLOR_CODE.."("..characterName.."-"..level..")"..FONT_COLOR_CODE_CLOSE
else
nameText = nameText.." "..FRIENDS_OTHER_NAME_COLOR_CODE.."("..characterName..")"..FONT_COLOR_CODE_CLOSE
end
end
end
if ( isOnline ) then
local _, _, _, realmName, realmID, faction, _, _, _, zoneName, _, gameText, _, _, _, _, _, isGameAFK, isGameBusy, guid = BNGetGameAccountInfo(bnetIDGameAccount)
if accountInfo.gameAccountInfo.isOnline then
button.background:SetColorTexture(FRIENDS_BNET_BACKGROUND_COLOR.r, FRIENDS_BNET_BACKGROUND_COLOR.g, FRIENDS_BNET_BACKGROUND_COLOR.b, FRIENDS_BNET_BACKGROUND_COLOR.a)
if ( isBnetAFK or isGameAFK ) then
if accountInfo.isAFK or accountInfo.gameAccountInfo.isGameAFK then
button.status:SetTexture(FRIENDS_TEXTURE_AFK)
elseif ( isBnetDND or isGameBusy ) then
elseif accountInfo.isDND or accountInfo.gameAccountInfo.isGameBusy then
button.status:SetTexture(FRIENDS_TEXTURE_DND)
else
button.status:SetTexture(FRIENDS_TEXTURE_ONLINE)
end
if ( client == BNET_CLIENT_WOW ) then
if ( not zoneName or zoneName == "" ) then
if accountInfo.gameAccountInfo.clientProgram == BNET_CLIENT_WOW and accountInfo.gameAccountInfo.wowProjectID == WOW_PROJECT_ID then
if not accountInfo.gameAccountInfo.areaName or accountInfo.gameAccountInfo.areaName == "" then
infoText = UNKNOWN
else
infoText = zoneName
infoText = accountInfo.gameAccountInfo.isWowMobile and LOCATION_MOBILE_APP or info.gameAccountInfo.areaName
end
else
infoText = gameText
end
button.gameIcon:SetTexture(BNet_GetClientTexture(client))
button.gameIcon:SetTexture(BNet_GetClientTexture(accountInfo.gameAccountInfo.clientProgram))
nameColor = FRIENDS_BNET_NAME_COLOR
--Note - this logic should match the logic in FriendsFrame_ShouldShowSummonButton
local fadeIcon = (accountInfo.gameAccountInfo.clientProgram == BNET_CLIENT_WOW) and (accountInfo.gameAccountInfo.wowProjectID ~= WOW_PROJECT_ID)
button.gameIcon:SetAlpha(fadeIcon and .6 or 1)
local shouldShowSummonButton = FriendsFrame_ShouldShowSummonButton(button.summonButton)
button.gameIcon:SetShown(not shouldShowSummonButton)
-- travel pass
hasTravelPassButton = true
local restriction = FriendsFrame_GetInviteRestriction(button.id)
if ( restriction == INVITE_RESTRICTION_NONE ) then
button.travelPassButton:Enable()
else
button.travelPassButton:Disable()
end
button.travelPassButton:SetEnabled(restriction == INVITE_RESTRICTION_NONE)
button.travelPassButton:SetShown(restriction == INVITE_RESTRICTION_NONE)
else
button.background:SetColorTexture(FRIENDS_OFFLINE_BACKGROUND_COLOR.r, FRIENDS_OFFLINE_BACKGROUND_COLOR.g, FRIENDS_OFFLINE_BACKGROUND_COLOR.b, FRIENDS_OFFLINE_BACKGROUND_COLOR.a)
button.status:SetTexture(FRIENDS_TEXTURE_OFFLINE)
......@@ -209,39 +160,45 @@ local function FriendGroups_UpdateFriendButton(button)
button.summonButton:ClearAllPoints()
button.summonButton:SetPoint("CENTER", button.gameIcon, "CENTER", 1, 0)
FriendsFrame_SummonButton_Update(button.summonButton)
end
elseif ( button.buttonType == FRIENDS_BUTTON_TYPE_DIVIDER ) then
local title
local group = FriendButtons[index].text
local group = FriendListEntries[index].text
if group == "" or not group then
title = "[no group]"
else
title = group
end
local counts = "(" .. GroupOnline[group] .. "/" .. GroupTotal[group] .. ")"
if button["text"] then
button.text:SetText(title)
button.text:Show()
local counts = "(" .. GroupOnline[group] .. "/" .. GroupTotal[group] .. ")"
nameText = counts
nameColor = FRIENDS_GROUP_NAME_COLOR
button.name:SetJustifyH("RIGHT")
if FriendGroups_SavedVars.collapsed[group] then
button.status:SetTexture("Interface\\Buttons\\UI-PlusButton-UP")
else
button.status:SetTexture("Interface\\Buttons\\UI-MinusButton-UP")
nameText = title.." "..counts
button.name:SetJustifyH("CENTER")
end
nameColor = FRIENDS_GROUP_NAME_COLOR
-- if FriendGroups_SavedVars.collapsed[group] then
-- button.status:SetTexture("Interface\\Buttons\\UI-PlusButton-UP")
-- else
button.status:SetTexture("Interface\\Buttons\\UI-MinusButton-UP")
-- end
infoText = group
button.info:Hide()
button.gameIcon:Hide()
button.background:SetColorTexture(FRIENDS_OFFLINE_BACKGROUND_COLOR.r, FRIENDS_OFFLINE_BACKGROUND_COLOR.g, FRIENDS_OFFLINE_BACKGROUND_COLOR.b, FRIENDS_OFFLINE_BACKGROUND_COLOR.a)
button.background:SetAlpha(0.5)
local scrollFrame = FriendsFrameFriendsScrollFrame
local divider = scrollFrame.dividerPool:Acquire()
local scrollFrame = FriendsScrollFrame
--[[local divider = scrollFrame.dividerPool:Acquire()
divider:SetParent(scrollFrame.ScrollChild)
divider:SetAllPoints(button)
divider:Show()
divider:Show()--]]
elseif ( button.buttonType == FRIENDS_BUTTON_TYPE_INVITE_HEADER ) then
local header = FriendsFrameFriendsScrollFrame.PendingInvitesHeaderButton
local header = FriendsScrollFrame.PendingInvitesHeaderButton
header:SetPoint("TOPLEFT", button, 1, 0)
header:Show()
header:SetFormattedText(FRIEND_REQUESTS, BNGetNumFriendInvites())
......@@ -255,7 +212,7 @@ local function FriendGroups_UpdateFriendButton(button)
end
nameText = nil
elseif ( button.buttonType == FRIENDS_BUTTON_TYPE_INVITE ) then
local scrollFrame = FriendsFrameFriendsScrollFrame
local scrollFrame = FriendsScrollFrame
local invite = scrollFrame.invitePool:Acquire()
invite:SetParent(scrollFrame.ScrollChild)
invite:SetAllPoints(button)
......@@ -266,14 +223,8 @@ local function FriendGroups_UpdateFriendButton(button)
invite.inviteIndex = button.id
nameText = nil
end
-- travel pass?
if ( hasTravelPassButton ) then
button.travelPassButton:Show()
else
button.travelPassButton:Hide()
end
-- selection
if ( FriendsFrame.selectedFriendType == FriendButtons[index].buttonType and FriendsFrame.selectedFriend == FriendButtons[index].id ) then
if ( FriendsFrame.selectedFriendType == FriendListEntries[index].buttonType and FriendsFrame.selectedFriend == FriendListEntries[index].id ) then
button:LockHighlight()
else
button:UnlockHighlight()
......@@ -281,7 +232,9 @@ local function FriendGroups_UpdateFriendButton(button)
-- finish setting up button if it's not a header
if ( nameText ) then
if button.buttonType ~= FRIENDS_BUTTON_TYPE_DIVIDER then
if button["text"] then
button.text:Hide()
end
button.name:SetJustifyH("LEFT")
button.background:SetAlpha(1)
button.info:Show()
......@@ -290,26 +243,34 @@ local function FriendGroups_UpdateFriendButton(button)
button.name:SetTextColor(nameColor.r, nameColor.g, nameColor.b)
button.info:SetText(infoText)
button:Show()
if isFavoriteFriend and button.Favorite then
button.Favorite:Show()
button.Favorite:ClearAllPoints()
button.Favorite:SetPoint("TOPLEFT", button.name, "TOPLEFT", button.name:GetStringWidth(), 0)
elseif button.Favorite then
button.Favorite:Hide()
end
else
button:Hide()
end
-- update the tooltip if hovering over a button
if ( FriendsTooltip.button == button ) then
if ( FriendsTooltip.button == button ) or ( GetMouseFocus() == button ) then
if FriendsFrameTooltip_Show then
FriendsFrameTooltip_Show(button)
else
button:OnEnter()
end
if ( GetMouseFocus() == button ) then
FriendsFrameTooltip_Show(button)
end
return height
end
local function FriendGroups_UpdateFriends()
local scrollFrame = FriendsFrameFriendsScrollFrame
function FG:FriendGroups_UpdateFriends()
local scrollFrame = FriendsScrollFrame
local offset = HybridScrollFrame_GetOffset(scrollFrame)
local buttons = scrollFrame.buttons
local numButtons = #buttons
local numFriendButtons = FriendButtons.count
local numFriendListEntries = #FriendListEntries
local usedHeight = 0
......@@ -319,9 +280,9 @@ local function FriendGroups_UpdateFriends()
for i = 1, numButtons do
local button = buttons[i]
local index = offset + i
if ( index <= numFriendButtons ) then
if ( index <= numFriendListEntries ) then
button.index = index
local height = FriendGroups_UpdateFriendButton(button)
local height = FG:FriendGroups_UpdateFriendButton(button)
button:SetHeight(height)
usedHeight = usedHeight + height
else
......@@ -331,19 +292,16 @@ local function FriendGroups_UpdateFriends()
end
HybridScrollFrame_Update(scrollFrame, scrollFrame.totalFriendListEntriesHeight, usedHeight)
if hooks["FriendsFrame_UpdateFriends"] then
hooks["FriendsFrame_UpdateFriends"]()
end
-- Delete unused groups in the collapsed part
for key,_ in pairs(FriendGroups_SavedVars.collapsed) do
--[[ for key,_ in pairs(FriendGroups_SavedVars.collapsed) do
if not GroupTotal[key] then
FriendGroups_SavedVars.collapsed[key] = nil
end
end
--]]
end
local function FillGroups(groups, note, ...)
function FG:FillGroups(groups, note, ...)
wipe(groups)
local n = select('#', ...)
for i = 1, n do
......@@ -357,17 +315,17 @@ local function FillGroups(groups, note, ...)
return note
end
local function NoteAndGroups(note, groups)
function FG:NoteAndGroups(note, groups)
if not note then
return FillGroups(groups, "")
return FG:FillGroups(groups, "")
end
if groups then
return FillGroups(groups, strsplit("#", note))
return FG:FillGroups(groups, strsplit("#", note))
end
return strsplit("#", note)
end
local function CreateNote(note, groups)
function FG:CreateNote(note, groups)
local value = ""
if note then
value = note
......@@ -378,23 +336,23 @@ local function CreateNote(note, groups)
return value
end
local function AddGroup(note, group)
function FG:AddGroup(note, group)
local groups = {}
note = NoteAndGroups(note, groups)
note = FG:NoteAndGroups(note, groups)
groups[""] = nil --ew
groups[group] = true
return CreateNote(note, groups)
return FG:CreateNote(note, groups)
end
local function RemoveGroup(note, group)
function FG:RemoveGroup(note, group)
local groups = {}
note = NoteAndGroups(note, groups)
note = FG:NoteAndGroups(note, groups)
groups[""] = nil --ew
groups[group] = nil
return CreateNote(note, groups)
return FG:CreateNote(note, groups)
end
local function IncrementGroup(group, online)
function FG:IncrementGroup(group, online)
if not GroupTotal[group] then
GroupCount = GroupCount + 1
GroupTotal[group] = 0
......@@ -406,18 +364,24 @@ local function IncrementGroup(group, online)
end
end
local function FriendGroups_Update(forceUpdate)
local numBNetTotal, numBNetOnline = BNGetNumFriends()
function FG:FriendGroups_Update(forceUpdate)
local numBNetTotal, numBNetOnline, numBNetFavorite, numBNetFavoriteOnline = BNGetNumFriends()
numBNetFavorite = numBNetFavorite or 0
numBNetFavoriteOnline = numBNetFavoriteOnline or 0
local numBNetOffline = numBNetTotal - numBNetOnline
local numWoWTotal, numWoWOnline = GetNumFriends()
local numBNetFavoriteOffline = numBNetFavorite - numBNetFavoriteOnline
local numWoWTotal = C_FriendList.GetNumFriends()
local numWoWOnline = C_FriendList.GetNumOnlineFriends()
local numWoWOffline = numWoWTotal - numWoWOnline
if QuickJoinToastButton then
QuickJoinToastButton:UpdateDisplayedFriendCount()
end
if ( not FriendsListFrame:IsShown() and not forceUpdate) then
return
end
wipe(FriendButtons)
wipe(FriendListEntries)
wipe(GroupTotal)
wipe(GroupOnline)
wipe(GroupSorted)
......@@ -429,17 +393,17 @@ local function FriendGroups_Update(forceUpdate)
local buttonCount = 0
FriendButtons.count = 0
FriendListEntries.count = 0
local addButtonIndex = 0
local totalButtonHeight = 0
local function AddButtonInfo(buttonType, id)
addButtonIndex = addButtonIndex + 1
if ( not FriendButtons[addButtonIndex] ) then
FriendButtons[addButtonIndex] = { }
if ( not FriendListEntries[addButtonIndex] ) then
FriendListEntries[addButtonIndex] = { }
end
FriendButtons[addButtonIndex].buttonType = buttonType
FriendButtons[addButtonIndex].id = id
FriendButtons.count = FriendButtons.count+1
FriendListEntries[addButtonIndex].buttonType = buttonType
FriendListEntries[addButtonIndex].id = id
FriendListEntries.count = FriendListEntries.count + 1
totalButtonHeight = totalButtonHeight + FRIENDS_BUTTON_HEIGHTS[buttonType]
end
......@@ -450,61 +414,91 @@ local function FriendGroups_Update(forceUpdate)
if not FriendReqGroup[i] then
FriendReqGroup[i] = {}
end
IncrementGroup(FriendRequestString,true)
NoteAndGroups(_, FriendReqGroup[i])
if not FriendGroups_SavedVars.collapsed[group] then
FG:IncrementGroup(FriendRequestString,true)
FG:NoteAndGroups(nil, FriendReqGroup[i])
--if not FriendGroups_SavedVars.collapsed[group] then
buttonCount = buttonCount + 1
AddButtonInfo(FRIENDS_BUTTON_TYPE_INVITE, i)
--end
end
end
end
-- online Battlenet friends
for i = 1, numBNetOnline do
-- favorite friends online
for i = 1, numBNetFavoriteOnline do
if not BnetFriendGroups[i] then
-- print('Bnet Online', i)
BnetFriendGroups[i] = {}
end
local noteText = select(13,BNGetFriendInfo(i))
NoteAndGroups(noteText, BnetFriendGroups[i])
FG:NoteAndGroups(noteText, BnetFriendGroups[i])
for group in pairs(BnetFriendGroups[i]) do
IncrementGroup(group, true)
if not FriendGroups_SavedVars.collapsed[group] then
FG:IncrementGroup(group, true)
--if not FriendGroups_SavedVars.collapsed[group] then
buttonCount = buttonCount + 1
AddButtonInfo(FRIENDS_BUTTON_TYPE_BNET, i)
--end
end
end
--favorite friends offline
for i = 1, numBNetFavoriteOffline do
local j = i + numBNetFavoriteOnline
if not BnetFriendGroups[j] then
BnetFriendGroups[j] = {}
end
local noteText = select(13,BNGetFriendInfo(j))
FG:NoteAndGroups(noteText, BnetFriendGroups[j])
for group in pairs(BnetFriendGroups[j]) do