Ejemplo n.º 1
0
        private void AddUserToGroup(Client Client, SiteRequest Request)
        {
            int ItemId = Request.PopInt32();

            if (ItemId <= 0)
            {
                return;
            }

            int FriendId = Request.PopInt32();

            if (FriendId <= 0)
            {
                return;
            }

            int CategoryId = Request.PopInt32();

            if (CategoryId <= 0)
            {
                return;
            }

            BrickEngine.GetMessengerHandler().AddUserToGroup(ItemId, Request.GetUserId(), FriendId, CategoryId);
        }
Ejemplo n.º 2
0
        private void AddUserTag(Client Client, SiteRequest Request)
        {
            string Tag = Request.PopString();

            if (!Client.GetUser().Tags.Contains(Tag))
            {
                Client.GetUser().Tags.Add(Tag);
            }
        }
Ejemplo n.º 3
0
        private void AddFriend(Client Client, SiteRequest Request)
        {
            int FriendId = Request.PopInt32();

            if (FriendId <= 0 || FriendId == Request.GetUserId())
            {
                return;
            }

            BrickEngine.GetMessengerHandler().RequestUser(Request.GetUserId(), FriendId);
        }
Ejemplo n.º 4
0
        public void HandlePacket(string Packet)
        {
            if (!string.IsNullOrEmpty(Packet))
            {
                if (Packet.Contains('_'))
                {
                    SiteRequest Request = new SiteRequest(BrickEngine.CleanString(Packet));

                    SiteRequestHandler.HandleRequest(Request);
                }
            }
        }
Ejemplo n.º 5
0
        public void HandleRequest(SiteRequest Request)
        {
            if (!Interactions.ContainsKey(Request.GetHeader()))
            {
                return;
            }

            if (NeedsOnline(Request.GetHeader()))
            {
                if (GainUserClient(Request) == null)
                {
                    return;
                }
            }

            Interactions[Request.GetHeader()].Invoke(GainUserClient(Request), Request);
        }
Ejemplo n.º 6
0
        private void UpdateEnableFollow(Client Client, SiteRequest Request)
        {
            Boolean EnableFollow = Request.PopBoolean();

            if (Client.GetUser().EnableFollow.Equals(EnableFollow))
            {
                return;
            }

            Client.GetUser().EnableFollow = EnableFollow;

            lock (Client.GetUser().MessengerLocker)
            {
                BrickEngine.GetMessengerHandler().AlertStatusFriends(Client.GetUser(), true);
            }
        }
Ejemplo n.º 7
0
        private void DeleteUserGroup(Client Client, SiteRequest Request)
        {
            int GroupId = Request.PopInt32();

            if (GroupId <= 0)
            {
                return;
            }

            BrickEngine.GetMessengerHandler().DeleteGroup(GroupId, Request.GetUserId());
        }
Ejemplo n.º 8
0
        private void EditUserGroup(Client Client, SiteRequest Request)
        {
            int GroupId = Request.PopInt32();

            if (GroupId <= 0)
            {
                return;
            }

            string Name = BrickEngine.CleanString(Request.PopString());

            if (string.IsNullOrEmpty(Name))
            {
                return;
            }

            if (!Regex.IsMatch(Name, @"^[a-zA-Z]+$"))
            {
                return;
            }

            if (Name.Length > 32)
            {
                Name = Name.Substring(32);
            }

            BrickEngine.GetMessengerHandler().RenameGroup(GroupId, Request.GetUserId(), Name);
        }
Ejemplo n.º 9
0
        private void UpdateMotto(Client Client, SiteRequest Request)
        {
            string Motto = BrickEngine.CleanString(Request.PopStringToEnd());

            if (Client.GetUser().Motto.Equals(Motto))
            {
                return;
            }

            Client.GetUser().Motto = Motto;
            Client.GetUser().RefreshUser();

            BrickEngine.GetStreamHandler().AddStream(Request.GetUserId(), HabboHotel.Users.Handlers.Messenger.Streaming.StreamType.EditedMotto, Motto);
        }
Ejemplo n.º 10
0
        private void UpdateEnableWordFilter(Client Client, SiteRequest Request)
        {
            Boolean EnableWordFilter = Request.PopBoolean();

            if (Client.GetUser().EnableWordfilter.Equals(EnableWordFilter))
            {
                return;
            }

            Client.GetUser().EnableWordfilter = EnableWordFilter;
        }
Ejemplo n.º 11
0
        private void UpdateEnableShowOnline(Client Client, SiteRequest Request)
        {
            Boolean EnableShowOnline = Request.PopBoolean();

            if (Client.GetUser().EnableShowOnline.Equals(EnableShowOnline))
            {
                return;
            }

            if (EnableShowOnline)
            {
                lock (Client.GetUser().MessengerLocker)
                {
                    BrickEngine.GetMessengerHandler().AlertStatusFriends(Client.GetUser(), true);
                }
            }
            else
            {
                lock (Client.GetUser().MessengerLocker)
                {
                    BrickEngine.GetMessengerHandler().AlertStatusFriends(Client.GetUser(), false);
                }
            }

            Client.GetUser().EnableShowOnline = EnableShowOnline;
        }
Ejemplo n.º 12
0
        private void UpdateEnableTrade(Client Client, SiteRequest Request)
        {
            Boolean EnableTrade = Request.PopBoolean();

            if (Client.GetUser().EnableTrade.Equals(EnableTrade))
            {
                return;
            }

            Client.GetUser().EnableTrade = EnableTrade;
        }
Ejemplo n.º 13
0
        private void DeleteFriend(Client Client, SiteRequest Request)
        {
            int FriendId = Request.PopInt32();

            if (FriendId <= 0 || FriendId == Request.GetUserId())
            {
                return;
            }

            if (!BrickEngine.GetMessengerHandler().HasFriend(Request.GetUserId(), FriendId))
            {
                return;
            }

            BrickEmulator.HabboHotel.Users.Handlers.Messenger.Friend Friend = BrickEngine.GetMessengerHandler().GetFriend(Request.GetUserId(), FriendId);

            if (Friend == null)
            {
                return;
            }

            if (Friend.IsAlive)
            {
                Response Response = new Response(13);
                Response.AppendBoolean(false);
                Response.AppendBoolean(true);
                Response.AppendInt32(-1);
                Response.AppendInt32(Request.GetUserId());

                Friend.GetClient().SendResponse(Response);
            }

            if (Client != null)
            {
                Response MyResponse = new Response(13);
                MyResponse.AppendBoolean(false);
                MyResponse.AppendBoolean(true);
                MyResponse.AppendInt32(-1);
                MyResponse.AppendInt32(FriendId);
                Client.SendResponse(MyResponse);
            }

            BrickEngine.GetMessengerHandler().DeleteFriend(Request.GetUserId(), FriendId);
        }
Ejemplo n.º 14
0
        private void UpdateEnableFriends(Client Client, SiteRequest Request)
        {
            Boolean EnableFriends = Request.PopBoolean();

            if (Client.GetUser().EnableNewFriends.Equals(EnableFriends))
            {
                return;
            }

            Client.GetUser().EnableNewFriends = EnableFriends;
        }
Ejemplo n.º 15
0
        private void UpdateCredits(Client Client, SiteRequest Request)
        {
            int Credits = Request.PopInt32();

            if (Credits <= 0)
            {
                Credits = 0;
            }

            if (Client.GetUser().Credits.Equals(Credits))
            {
                return;
            }

            Client.GetUser().Credits = Credits;
            Client.GetUser().UpdateCredits(false);
        }
Ejemplo n.º 16
0
 private void SignoutUser(Client Client, SiteRequest Request)
 {
     Client.Dispose();
 }
Ejemplo n.º 17
0
        private void RemoveUserTag(Client Client, SiteRequest Request)
        {
            string Tag = Request.PopString();

            if (Client.GetUser().Tags.Contains(Tag))
            {
                Client.GetUser().Tags.Remove(Tag);
            }
        }
Ejemplo n.º 18
0
        private void RemoveUserFromGroup(Client Client, SiteRequest Request)
        {
            int ItemId = Request.PopInt32();

            if (ItemId <= 0)
            {
                return;
            }

            BrickEngine.GetMessengerHandler().RemoveUserFromGroup(ItemId, Request.GetUserId());
        }
Ejemplo n.º 19
0
        private Client GainUserClient(SiteRequest Request)
        {
            if (!BrickEngine.GetUserReactor().IsOnline(Request.GetUserId()))
            {
                return null;
            }

            SocketClient Client = BrickEngine.GetSocketShield().GetSocketClientByHabboId(Request.GetUserId());

            if (Client == null || !Client.GetClient().IsValidUser)
            {
                return null;
            }

            return Client.GetClient();
        }