Skip to content

Commit 10aba60

Browse files
author
Ibra
committed
Sort unread messages to the top
1 parent ed6b0e4 commit 10aba60

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/WOLBuddyOverlay.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,14 @@ void updateBuddyInfo( void )
610610
auto friendsMap = pSocialInterface->GetCachedFriendsList();
611611
std::vector<std::pair<int64_t, FriendsEntry>> sortedFriends(friendsMap.begin(), friendsMap.end());
612612
std::stable_sort(sortedFriends.begin(), sortedFriends.end(),
613-
[](auto& a, auto& b) { return a.second.online > b.second.online; });
613+
[&](auto& a, auto& b) {
614+
Int unreadA = pSocialInterface->GetNumberUnreadChatMessagesForUser(a.second.user_id);
615+
Int unreadB = pSocialInterface->GetNumberUnreadChatMessagesForUser(b.second.user_id);
616+
if (unreadA != unreadB)
617+
return unreadA > unreadB;
618+
return a.second.online > b.second.online;
619+
});
620+
614621

615622
for (auto& kvPair : sortedFriends)
616623
{

0 commit comments

Comments
 (0)