/// <summary> /// Send array of income friendship requests to user. /// </summary> /// <param name="user">user.</param> /// <exception cref="ConnectionInterruptedException"></exception> private void SendIncomeFriendshipRequests(OnlineUser user) { user.Client.SendMessage(new IncomeFriendshipRequestsMessage { Logins = DBoperations.GetIncomeFriendshipRequests(user.Id) }); }
/// <summary> /// Send array of all users to user. /// </summary> /// <param name="user">user.</param> /// <exception cref="ConnectionInterruptedException"></exception> private void SendAllUsers(OnlineUser user) { string[] allUsers = DBoperations.GetAllUsers(); string[] incomeRequests = DBoperations.GetIncomeFriendshipRequests(user.Id); string[] outcomeRequests = DBoperations.GetOutcomeFriendshipRequests(user.Id); string[] friends = DBoperations.GetFriends(user.Id); string[] users = allUsers.Where(x => !incomeRequests.Contains(x) & !outcomeRequests.Contains(x) & !friends.Contains(x) & x != user.Login).ToArray(); string[] online_users = onlineUsers.Select(x => x.Login).ToArray(); user.Client.SendMessage(new AllUsersMessage { OnlineUsers = users.Where(x => online_users.Contains(x)).ToArray(), OfflineUsers = users.Where(x => !online_users.Contains(x)).ToArray() }); }