Пример #1
0
        /// <summary>
        ///     If its a message we deal with, pull it from the client here
        /// </summary>
        /// <param name="client"></param>
        /// <param name="im"></param>
        private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
        {
            byte dialog = im.Dialog;

            switch (dialog)
            {
            case (byte)InstantMessageDialog.SessionGroupStart:
                m_imService.CreateGroupChat(client.AgentId, im);
                break;

            case (byte)InstantMessageDialog.SessionSend:
                m_imService.SendChatToSession(client.AgentId, im);
                break;

            case (byte)InstantMessageDialog.SessionDrop:
                m_imService.DropMemberFromSession(client.AgentId, im);
                break;
            }
        }
        private void chatting(Object sender, IrcMessageEventArgs <TextMessage> e, UUID groupID)
        {
            IInstantMessagingService gMessaging = m_scene.RequestModuleInterface <IInstantMessagingService>();

            gMessaging.EnsureSessionIsStarted(groupID);
            gMessaging.SendChatToSession(UUID.Zero, new GridInstantMessage()
            {
                FromAgentID   = UUID.Random(),
                FromAgentName = e.Message.Sender.Nick,
                ToAgentID     = UUID.Zero,
                Dialog        = (byte)InstantMessageDialog.SessionSend,
                Message       = e.Message.Text,
                FromGroup     = false,
                SessionID     = UUID.Zero,
                Offline       = 0,
                BinaryBucket  = new byte[0],
                Timestamp     = (uint)Util.UnixTimeSinceEpoch()
            });
        }