Ejemplo n.º 1
0
        public override void Process(IXFireClient context)
        {
            var clientPrefs = new Unknown10();

            context.SendAndProcessMessage(clientPrefs);

            var groups = new Groups();

            context.SendAndProcessMessage(groups);

            var groupsFriends = new GroupsFriends();

            context.SendAndProcessMessage(groupsFriends);

            var serverList = new ServerList();

            context.SendAndProcessMessage(serverList);

            var chatRooms = new ChatRooms();

            context.SendAndProcessMessage(chatRooms);

            var friendsList = new FriendsList(context.User);

            context.SendAndProcessMessage(friendsList);

            var friendsStatus = new FriendsSessionAssign(context.User);

            context.SendAndProcessMessage(friendsStatus);

            // Tell friends this user came online
            //if (context.User.Username == "test") Debugger.Break();
            var friends = context.Server.Database.QueryFriends(context.User);

            friends.ForEach(friend =>
            {
                var otherSession = context.Server.GetSession(friend);
                otherSession?.SendAndProcessMessage(new FriendsSessionAssign(friend));
            });

            var pendingFriendRequests = context.Server.Database.QueryPendingFriendRequests(context.User);

            pendingFriendRequests.ForEach(request =>
            {
                var requester = context.Server.Database.QueryUser(request.UserId);
                context.SendAndProcessMessage(new FriendInvite(requester.Username, requester.Nickname, request.Message));
            });
        }
Ejemplo n.º 2
0
        public override async Task Process(IXFireClient context)
        {
            var clientPrefs = new Unknown10();
            await context.SendAndProcessMessage(clientPrefs);

            var groups = new Groups();
            await context.SendAndProcessMessage(groups);

            var groupsFriends = new GroupsFriends();
            await context.SendAndProcessMessage(groupsFriends);

            var serverList = new ServerList();
            await context.SendAndProcessMessage(serverList);

            var chatRooms = new ChatRooms();
            await context.SendAndProcessMessage(chatRooms);

            var friendsList = new FriendsList(context.User);
            await context.SendAndProcessMessage(friendsList);

            var friendsStatus = new FriendsSessionAssign(context.User);
            await context.SendAndProcessMessage(friendsStatus);

            // Tell friends this user came online
            //if (context.User.Username == "test") Debugger.Break();
            var friends = await context.Server.Database.QueryFriends(context.User);

            foreach (var friend in friends)
            {
                var otherSession = context.Server.GetSession(friend);
                if (otherSession != null)
                {
                    await otherSession.SendAndProcessMessage(new FriendsSessionAssign(friend));
                }
            }

            var pendingFriendRequests = await context.Server.Database.QueryPendingFriendRequests(context.User);

            foreach (var request in pendingFriendRequests.Select(request => new FriendInvite(request.Username, request.Nickname, request.Message)))
            {
                await context.SendAndProcessMessage(request);
            }
        }
Ejemplo n.º 3
0
        public override async Task Process(IXFireClient context)
        {
            var clientPrefs = new Unknown10();
            await context.SendAndProcessMessage(clientPrefs);

            var groups = new Groups();
            await context.SendAndProcessMessage(groups);

            var groupsFriends = new GroupsFriends();
            await context.SendAndProcessMessage(groupsFriends);

            var serverList = new ServerList();
            await context.SendAndProcessMessage(serverList);

            var chatRooms = new ChatRooms();
            await context.SendAndProcessMessage(chatRooms);

            // TODO: Remove chat room mode
            var otherUsers = await context.Server.Database.AddEveryoneAsFriends(context.User);

            var friendsList = new FriendsList(context.User);
            await context.SendAndProcessMessage(friendsList);

            var friendsStatus = new FriendsSessionAssign(context.User);
            await context.SendAndProcessMessage(friendsStatus);

            // TODO: Remove chat room mode
            foreach (var otherUser in otherUsers)
            {
                var otherSession = context.Server.GetSession(otherUser);
                if (otherSession != null)
                {
                    await otherSession.SendAndProcessMessage(new FriendsList(otherSession.User));

                    await otherSession.SendMessage(
                        FriendsSessionAssign.UserCameOnline(context.User, context.SessionId));
                }
            }
        }