示例#1
0
        private static void OnInvite(Session Session, ClientMessage Message)
        {
            int         Count   = Message.PopWiredInt32();
            List <uint> Targets = new List <uint>();

            for (int i = 0; (i < Count && i < 50); i++)
            {
                Targets.Add(Message.PopWiredUInt32());
            }

            string MessageText = UserInputFilter.FilterString(Message.PopString());

            if (MessageText.Length > 121)
            {
                MessageText = MessageText.Substring(0, 121);
            }

            foreach (uint UserId in Targets)
            {
                if (!Session.MessengerFriendCache.Friends.Contains(UserId))
                {
                    continue;
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

                if (TargetSession == null)
                {
                    continue;
                }

                TargetSession.SendData(MessengerImInviteComposer.Compose(Session.CharacterId, MessageText));
            }
        }
示例#2
0
        private static void OnInvite(Session Session, ClientMessage Message)
        {
            int         Count   = Message.PopWiredInt32();
            List <uint> Targets = new List <uint>();

            for (int i = 0; (i < Count && i < 50); i++)
            {
                Targets.Add(Message.PopWiredUInt32());
            }

            string MessageText = UserInputFilter.FilterString(Message.PopString());

            if (MessageText.Length > 121)
            {
                MessageText = MessageText.Substring(0, 121);
            }

            List <Session> Users = new List <Session>();

            foreach (uint UserId in Targets)
            {
                if (!Session.MessengerFriendCache.Friends.Contains(UserId))
                {
                    continue;
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

                if (TargetSession == null)
                {
                    continue;
                }

                Users.Add(TargetSession);

                TargetSession.SendData(MessengerImInviteComposer.Compose(Session.CharacterId, Wordfilter.Filter(MessageText)));
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                String to = "";
                foreach (Session User in Users)
                {
                    to += User.CharacterInfo.Username + " [" + User.CharacterId + "], ";
                }
                to = to.Substring(0, to.Length - 2);
                ModerationLogs.LogChatMessage(MySqlClient, Session.CharacterId, 0, "(INVITATION to " + to + ") " + MessageText);
            }
        }