public async Task OnMessage(LobbyServerConnection connection, object requestData) { var request = (GroupInviteRequest)requestData; var response = new GroupInviteResponse() { ResponseId = request.RequestId, FriendHandle = request.FriendHandle }; connection.SendMessage(response); LobbyServerConnection user = LobbyServer.GetPlayerByHandle(request.FriendHandle); await user.SendMessage(new GroupConfirmationRequest() { //LeaderFullHandle = connection.PlayerInfo.GetHandle(), //LeaderName = connection.PlayerInfo.GetHandle(), ConfirmationNumber = 1234, ExpirationTime = TimeSpan.FromMinutes(1), GroupId = 508, // TODO //JoinerAccountId = connection.PlayerInfo.GetAccountId(), //JoinerName = connection.PlayerInfo.GetHandle(), RequestId = 0, ResponseId = 0, Type = GroupConfirmationRequest.JoinType.Unicode000E }); }
public async static Task AddFriend(LobbyServerConnection connection, FriendUpdateRequest request) { LobbyServerConnection friend = LobbyServer.GetPlayerByHandle(request.FriendHandle); var friendRequest = new FriendUpdateRequest() { //FriendHandle = connection.PlayerInfo.GetHandle(), //FriendAccountId = connection.PlayerInfo.GetAccountId(), FriendOperation = FriendOperation.Add, RequestId = 0, ResponseId = 0 }; await friend.SendMessage(friendRequest); // Send a "RequestSent" status to the person that wants to add a new friend await connection.SendMessage(new FriendStatusNotification() { FriendList = new Framework.Network.Static.FriendList() { Friends = new Dictionary <long, Framework.Network.Static.FriendInfo>() { { 0, new Framework.Network.Static.FriendInfo() { FriendHandle = request.FriendHandle, FriendAccountId = request.FriendAccountId, FriendStatus = Framework.Constants.Enums.FriendStatus.RequestSent, } } }, IsDelta = true// set this to true to the request to tell the client to not overwrite current friend list } }); // Send a "RequestReceived" status to the person await connection.SendMessage(new FriendStatusNotification() { FriendList = new Framework.Network.Static.FriendList() { Friends = new Dictionary <long, Framework.Network.Static.FriendInfo>() { { 0, new Framework.Network.Static.FriendInfo() { //FriendHandle = connection.PlayerInfo.GetHandle(), //FriendAccountId = connection.PlayerInfo.GetAccountId(), FriendStatus = Framework.Constants.Enums.FriendStatus.RequestReceived, } } }, IsDelta = true // set that this request doesnt have to overwrite friendlist } }); // TODO: SEND FRIENDSTATUSNOTIFICATION WITH STATUS REQUESTSENT }