void Server::Accept() { auto new_client_session = std::make_shared< ClientSession >(*this); acceptor_.async_accept(new_client_session->GetSocket(), [this, new_client_session](const boost::system::error_code& ec) { if (!ec) { new_client_session->StartRead(); sessions_.insert(new_client_session.get()); std::cout << "client connected, id = " << new_client_session->GetClientId() << std::endl; } Accept(); } ); }
const FString FFriendItem::GetClientName() const { FString Result; FString ClientId = GetClientId(); if (!ClientId.IsEmpty()) { // hardcoded for now, need a generic way to receive client names or map client ids to names if (ClientId == FFriendItem::FortniteClientId) { Result = TEXT("Fortnite"); } else if (ClientId == FFriendItem::UnrealTournamentClientId) { Result = TEXT("Unreal Tournament"); } else if (FFriendItem::LauncherClientIds.Contains(ClientId)) { Result = TEXT("Epic Games Launcher"); } } return Result; }
virtual bool CanPerformAction(const EFriendActionType::Type ActionType) override { switch (ActionType) { case EFriendActionType::JoinGame: { return FriendsAndChatManager.Pin()->JoinGameAllowed(GetClientId()); } case EFriendActionType::AcceptFriendRequest: case EFriendActionType::RemoveFriend: case EFriendActionType::IgnoreFriendRequest: case EFriendActionType::BlockFriend: case EFriendActionType::RejectFriendRequest: case EFriendActionType::CancelFriendRequest: case EFriendActionType::SendFriendRequest: case EFriendActionType::InviteToGame: case EFriendActionType::RejectGame: case EFriendActionType::Chat: default: { return true; } } }
bool FFriendItem::CanInvite() const { FString FriendsClientID = GetClientId(); return FriendsClientID == FriendsAndChatManager.Pin()->GetUserClientId() || FFriendItem::LauncherClientIds.Contains(FriendsClientID); }
bool FFriendItem::CanInvite() const { FString FriendsClientID = GetClientId(); return FriendsClientID == FFriendsAndChatManager::Get()->GetUserClientId() || FriendsClientID == FFriendItem::LauncherClientId; }
bool FFriendPartyInviteItem::CanInvite() const { FString FriendsClientID = GetClientId(); return FriendsClientID == GameAndPartyService->GetUserClientId() || FFriendItem::LauncherClientIds.Contains(FriendsClientID); }