コード例 #1
0
ファイル: DisplayNamesCAPS.cs プロジェクト: x8ball/Aurora-Sim
        public void RegisterCaps(IRegionClientCapsService service)
        {
            IConfig displayNamesConfig = service.ClientCaps.Registry.RequestModuleInterface<ISimulationBase>().ConfigSource.Configs["DisplayNamesModule"];
            if (displayNamesConfig != null)
            {
                if (!displayNamesConfig.GetBoolean ("Enabled", true))
                    return;
                string bannedNamesString = displayNamesConfig.GetString ("BannedUserNames", "");
                if (bannedNamesString != "")
                    bannedNames = new List<string> (bannedNamesString.Split (','));
            }
            m_service = service;
            m_profileConnector = Aurora.DataManager.DataManager.RequestPlugin<IProfileConnector> ();
            m_eventQueue = service.Registry.RequestModuleInterface<IEventQueueService> ();
            m_userService = service.Registry.RequestModuleInterface<IUserAccountService> ();

            string post = CapsUtil.CreateCAPS ("SetDisplayName", "");
            service.AddCAPS ("SetDisplayName", post);
            service.AddStreamHandler ("SetDisplayName", new RestHTTPHandler ("POST", post,
                                                      ProcessSetDisplayName));

            post = CapsUtil.CreateCAPS ("GetDisplayNames", "");
            service.AddCAPS ("GetDisplayNames", post);
            service.AddStreamHandler ("GetDisplayNames", new StreamHandler ("GET", post,
                                                      ProcessGetDisplayName));
        }
コード例 #2
0
        public void RegisterCaps (IRegionClientCapsService service)
        {
            var cfgservice = service.ClientCaps.Registry.RequestModuleInterface<ISimulationBase> ();
            var displayNamesConfig = cfgservice.ConfigSource.Configs ["DisplayNames"];
            if (displayNamesConfig != null) {
                if (!displayNamesConfig.GetBoolean ("Enabled", true))
                    return;

                string bannedNamesString = displayNamesConfig.GetString ("BannedUserNames", "");
                if (bannedNamesString != "")
                    bannedNames = new List<string> (bannedNamesString.Split (','));

                m_update_days = displayNamesConfig.GetDouble ("UpdateDays", m_update_days);

            }
            m_service = service;
            m_profileConnector = Framework.Utilities.DataManager.RequestPlugin<IProfileConnector> ();
            m_eventQueue = service.Registry.RequestModuleInterface<IEventQueueService> ();
            m_userService = service.Registry.RequestModuleInterface<IUserAccountService> ();

            string post = CapsUtil.CreateCAPS ("SetDisplayName", "");
            service.AddStreamHandler ("SetDisplayName", new GenericStreamHandler ("POST", post, ProcessSetDisplayName));

            post = CapsUtil.CreateCAPS ("GetDisplayNames", "");
            service.AddStreamHandler ("GetDisplayNames", new GenericStreamHandler ("GET", post, ProcessGetDisplayName));
        }
コード例 #3
0
        private void MuteUser(UUID sessionid, IEventQueueService eq, UUID AgentID, ChatSessionMember thismember,
                              bool forward)
        {
            ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
            {
                AgentID      = thismember.AvatarKey,
                CanVoiceChat = thismember.CanVoiceChat,
                IsModerator  = thismember.IsModerator,
                MuteText     = thismember.MuteText,
                MuteVoice    = thismember.MuteVoice,
                Transition   = "ENTER"
            };

            // Send an update to the affected user
            IClientAPI affectedUser = GetActiveClient(thismember.AvatarKey);

            if (affectedUser != null)
            {
                eq.ChatterBoxSessionAgentListUpdates(sessionid, new[] { block }, AgentID, "ENTER",
                                                     affectedUser.Scene.RegionInfo.RegionHandle);
            }
            else if (forward)
            {
                SendMutedUserIM(thismember, sessionid);
            }
        }
コード例 #4
0
 public void OpenRegionInfo(IScenePresence presence)
 {
     OSD item = BuildOpenRegionInfo(presence);
     IEventQueueService eq = presence.Scene.RequestModuleInterface<IEventQueueService>();
     if (eq != null)
         eq.Enqueue(item, presence.UUID, presence.Scene.RegionInfo.RegionID);
 }
コード例 #5
0
        private byte[] GetObjectPhysicsData(UUID agentID, Stream request)
        {
            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml(request);

            OSDArray keys = (OSDArray)rm["object_ids"];

            IEventQueueService eqs = m_scene.RequestModuleInterface <IEventQueueService>();

            if (eqs != null)
            {
#if (!ISWIN)
                List <ISceneChildEntity> list = new List <ISceneChildEntity>();
                foreach (OSD key in keys)
                {
                    list.Add(m_scene.GetSceneObjectPart(key.AsUUID()));
                }
                eqs.ObjectPhysicsProperties(list.ToArray(),
                                            agentID, m_scene.RegionInfo.RegionHandle);
#else
                eqs.ObjectPhysicsProperties(keys.Select(key => m_scene.GetSceneObjectPart(key.AsUUID())).ToArray(), agentID, m_scene.RegionInfo.RegionHandle);
#endif
            }
            //Send back data
            return(new byte[0]);
        }
コード例 #6
0
        public void RegisterCaps(IRegionClientCapsService service)
        {
            IConfig displayNamesConfig =
                service.ClientCaps.Registry.RequestModuleInterface <ISimulationBase>().ConfigSource.Configs[
                    "DisplayNamesModule"];

            if (displayNamesConfig != null)
            {
                if (!displayNamesConfig.GetBoolean("Enabled", true))
                {
                    return;
                }
                string bannedNamesString = displayNamesConfig.GetString("BannedUserNames", "");
                if (bannedNamesString != "")
                {
                    bannedNames = new List <string>(bannedNamesString.Split(','));
                }
            }
            m_service          = service;
            m_profileConnector = Framework.Utilities.DataManager.RequestPlugin <IProfileConnector>();
            m_eventQueue       = service.Registry.RequestModuleInterface <IEventQueueService>();
            m_userService      = service.Registry.RequestModuleInterface <IUserAccountService>();

            string post = CapsUtil.CreateCAPS("SetDisplayName", "");

            service.AddStreamHandler("SetDisplayName", new GenericStreamHandler("POST", post,
                                                                                ProcessSetDisplayName));

            post = CapsUtil.CreateCAPS("GetDisplayNames", "");
            service.AddStreamHandler("GetDisplayNames", new GenericStreamHandler("GET", post,
                                                                                 ProcessGetDisplayName));
        }
コード例 #7
0
        private Hashtable GetObjectPhysicsData(UUID agentID, Hashtable mDhttpMethod)
        {
            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);

            OSDArray keys = (OSDArray)rm["object_ids"];

            IEventQueueService eqs = m_scene.RequestModuleInterface <IEventQueueService>();

            if (eqs != null)
            {
#if (!ISWIN)
                List <ISceneChildEntity> list = new List <ISceneChildEntity>();
                foreach (OSD key in keys)
                {
                    list.Add(m_scene.GetSceneObjectPart(key.AsUUID()));
                }
                eqs.ObjectPhysicsProperties(list.ToArray(),
                                            agentID, m_scene.RegionInfo.RegionHandle);
#else
                eqs.ObjectPhysicsProperties(keys.Select(key => m_scene.GetSceneObjectPart(key.AsUUID())).ToArray(), agentID, m_scene.RegionInfo.RegionHandle);
#endif
            }
            //Send back data
            Hashtable responsedata = new Hashtable();
            responsedata["int_response_code"]   = 200; //501; //410; //404;
            responsedata["content_type"]        = "text/plain";
            responsedata["keepalive"]           = false;
            responsedata["str_response_string"] = "";
            return(responsedata);
        }
コード例 #8
0
 public DeviceBatchManagementController(IEventQueueService eventQueueService,
                                        IOptions <CapBusOptions> capBusOptions,
                                        IDeviceService deviceService,
                                        ICurrent current,
                                        IDbContext dbContext,
                                        IConfiguration configuration,
                                        IMemoryCache memoryCache,
                                        IBackgroundJobManager backgroundJobManager,
                                        ILogger <DeviceBatchManagementController> logger,
                                        IMediator mediator,
                                        ICapPublisher capPublisher,
                                        TracerFactory tracerFactor,
                                        Tracer tracer,
                                        DbContextFactory dbContextFactory,
                                        ICache cache)
 {
     _eventQueueService    = eventQueueService;
     _capBusOptions        = capBusOptions?.Value;
     _deviceService        = deviceService;
     _current              = current;
     _dbContext            = dbContext;
     _configuration        = configuration;
     _logger               = logger;
     _backgroundJobManager = backgroundJobManager;
     _mediator             = mediator;
     _capBus               = capPublisher;
     _tracerFactory        = tracerFactor;
     _tracer               = tracer;
     _dbContextFactory     = dbContextFactory;
     _cache = cache;
 }
コード例 #9
0
 public EQMEventPoster(string url, IEventQueueService handler, ICapsService capsService, ulong handle, IRegistryCore registry) :
     base("POST", url)
 {
     m_eventQueueService = handler;
     m_capsService       = capsService;
     m_ourRegionHandle   = handle;
     m_registry          = registry;
 }
コード例 #10
0
 /// <summary>
 /// Create forwarder
 /// </summary>
 /// <param name="queue"></param>
 public UnknownTelemetryForwarder(IEventQueueService queue)
 {
     if (queue == null)
     {
         throw new ArgumentNullException(nameof(queue));
     }
     _client = queue.OpenAsync().Result;
 }
コード例 #11
0
 /// <summary>
 /// Create forwarder
 /// </summary>
 /// <param name="queue"></param>
 public MonitoredItemSampleForwarder(IEventQueueService queue)
 {
     if (queue == null)
     {
         throw new ArgumentNullException(nameof(queue));
     }
     _client = queue.OpenAsync().Result;
 }
コード例 #12
0
        private void OnInstantMessage(IClientAPI remoteClient, GridInstantMessage im)
        {
            if (m_debugEnabled)
            {
                m_log.DebugFormat("[GROUPS-MESSAGING]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

                DebugGridInstantMessage(im);
            }

            // Start group IM session
            if ((im.dialog == (byte)InstantMessageDialog.SessionGroupStart))
            {
                if (m_debugEnabled)
                {
                    m_log.InfoFormat("[GROUPS-MESSAGING]: imSessionID({0}) toAgentID({1})", im.imSessionID, im.toAgentID);
                }

                UUID GroupID = new UUID(im.imSessionID);
                UUID AgentID = new UUID(im.fromAgentID);

                GroupRecord groupInfo = m_groupData.GetGroupRecord(UUID.Zero, GroupID, null);

                if (groupInfo != null)
                {
                    m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);

                    ChatterBoxSessionStartReplyViaCaps(remoteClient, groupInfo.GroupName, GroupID);

                    IEventQueueService queue = remoteClient.Scene.RequestModuleInterface <IEventQueueService>();
                    queue.ChatterBoxSessionAgentListUpdates(
                        GroupID
                        , AgentID
                        , new UUID(im.toAgentID)
                        , false //canVoiceChat
                        , false //isModerator
                        , false //text mute
                        , remoteClient.Scene.RegionInfo.RegionHandle
                        );
                }
            }

            // Send a message from locally connected client to a group
            if ((im.dialog == (byte)InstantMessageDialog.SessionSend) && im.message != "")
            {
                UUID GroupID = new UUID(im.imSessionID);
                UUID AgentID = new UUID(im.fromAgentID);

                if (m_debugEnabled)
                {
                    m_log.DebugFormat("[GROUPS-MESSAGING]: Send message to session for group {0} with session ID {1}", GroupID, im.imSessionID.ToString());
                }

                //If this agent is sending a message, then they want to be in the session
                m_groupData.AgentInvitedToGroupChatSession(AgentID, GroupID);

                SendMessageToGroup(im, GroupID);
            }
        }
コード例 #13
0
        /// <summary>
        ///   Remove the member from this session
        /// </summary>
        /// <param name = "client"></param>
        /// <param name = "im"></param>
        public void DropMemberFromSession(IClientAPI client, GridInstantMessage im)
        {
            ChatSession session;

            ChatSessions.TryGetValue(im.imSessionID, out session);
            if (session == null)
            {
                return;
            }
            ChatSessionMember member = new ChatSessionMember {
                AvatarKey = UUID.Zero
            };

#if (!ISWIN)
            foreach (ChatSessionMember testmember in session.Members)
            {
                if (testmember.AvatarKey == im.fromAgentID)
                {
                    member = testmember;
                }
            }
#else
            foreach (ChatSessionMember testmember in session.Members.Where(testmember => testmember.AvatarKey == im.fromAgentID))
            {
                member = testmember;
            }
#endif

            if (member.AvatarKey != UUID.Zero)
            {
                session.Members.Remove(member);
            }

            if (session.Members.Count == 0)
            {
                ChatSessions.Remove(session.SessionID);
                return;
            }

            ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
            {
                AgentID      = member.AvatarKey,
                CanVoiceChat = member.CanVoiceChat,
                IsModerator  = member.IsModerator,
                MuteText     = member.MuteText,
                MuteVoice    = member.MuteVoice,
                Transition   = "LEAVE"
            };
            IEventQueueService eq = client.Scene.RequestModuleInterface <IEventQueueService>();
            foreach (ChatSessionMember sessionMember in session.Members)
            {
                eq.ChatterBoxSessionAgentListUpdates(session.SessionID, new[] { block }, sessionMember.AvatarKey, "LEAVE",
                                                     findScene(sessionMember.AvatarKey).RegionInfo.RegionHandle);
            }
        }
コード例 #14
0
        public void SendProfileToClientEQ(IScenePresence presence, RegionLightShareData wl)
        {
            OSD item = BuildSendEQMessage(wl.ToOSD());
            IEventQueueService eq = presence.Scene.RequestModuleInterface <IEventQueueService>();

            if (eq != null)
            {
                eq.Enqueue(item, presence.UUID, presence.Scene.RegionInfo.RegionHandle);
            }
        }
コード例 #15
0
 /// <summary>
 /// Create forwarder
 /// </summary>
 /// <param name="queue"></param>
 /// <param name="serializer"></param>
 public MonitoredItemSampleForwarder(IEventQueueService queue,
                                     IJsonSerializer serializer)
 {
     _serializer = serializer ??
                   throw new ArgumentNullException(nameof(serializer));
     if (queue == null)
     {
         throw new ArgumentNullException(nameof(queue));
     }
     _client = queue.OpenAsync().Result;
 }
コード例 #16
0
 public void FinishedStartup ()
 {
     m_eventQueueService = m_registry.RequestModuleInterface<IEventQueueService> ();
     ISyncMessageRecievedService syncRecievedService =
         m_registry.RequestModuleInterface<ISyncMessageRecievedService> ();
     if (syncRecievedService != null)
         syncRecievedService.OnMessageReceived += syncRecievedService_OnMessageReceived;
     m_groupData = Framework.Utilities.DataManager.RequestPlugin<IGroupsServiceConnector> ();
     m_registry.RequestModuleInterface<ISimulationBase> ().EventManager.RegisterEventHandler ("UserStatusChange",
                                                                                            OnGenericEvent);
 }
コード例 #17
0
 public void TriggerWindlightUpdate(int interpolate)
 {
     foreach (IScenePresence presence in m_scene.GetScenePresences())
     {
         OSD item = BuildEQM(interpolate);
         IEventQueueService eq = presence.Scene.RequestModuleInterface <IEventQueueService>();
         if (eq != null)
         {
             eq.Enqueue(item, presence.UUID, presence.Scene.RegionInfo.RegionID);
         }
     }
 }
コード例 #18
0
        /// <summary>
        ///     Send a console message to the viewer
        /// </summary>
        /// <param name="AgentID"></param>
        /// <param name="text"></param>
        private void SendConsoleEventEQM(UUID AgentID, string text)
        {
            OSDMap item = new OSDMap {
                { "body", text }, { "message", OSD.FromString("SimConsoleResponse") }
            };
            IEventQueueService eq = m_Scene.RequestModuleInterface <IEventQueueService>();

            if (eq != null)
            {
                eq.Enqueue(item, AgentID, m_Scene.RegionInfo.RegionID);
            }
        }
コード例 #19
0
 public EventQueueJob(ILogger <EventQueueJob> logger, ICache cache, ICurrent current, IDataContainer dataContainer, ITypeFinder typeFinder, ITypeResolve typeResolve, IDeviceService deviceService, IDbContext dbContext, IEventQueueService eventQueueService, ICapPublisher capPublisher)
 {
     _logger            = logger;
     _cache             = cache;
     _current           = current;
     _dataContainer     = dataContainer;
     _typeFinder        = typeFinder;
     _typeResolve       = typeResolve;
     _deviceService     = deviceService;
     _dbContext         = dbContext;
     _eventQueueService = eventQueueService;
     _capBus            = capPublisher;
 }
コード例 #20
0
        public void FinishedStartup()
        {
            m_eventQueueService = m_registry.RequestModuleInterface <IEventQueueService> ();
            ISyncMessageRecievedService syncRecievedService = m_registry.RequestModuleInterface <ISyncMessageRecievedService> ();

            if (syncRecievedService != null)
            {
                syncRecievedService.OnMessageReceived += syncRecievedService_OnMessageReceived;
            }
            m_groupData = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();
            m_registry.RequestModuleInterface <ISimulationBase> ().EventManager.RegisterEventHandler("UserStatusChange",
                                                                                                     OnGenericEvent);
        }
コード例 #21
0
        /// <summary>
        /// Send a console message to the viewer
        /// </summary>
        /// <param name="AgentID"></param>
        /// <param name="text"></param>
        private void SendConsoleEventEQM(UUID AgentID, string text)
        {
            OSDMap item = new OSDMap();

            item.Add("body", text);
            item.Add("message", OSD.FromString("SimConsoleResponse"));
            IEventQueueService eq = m_scenes[0].RequestModuleInterface <IEventQueueService> ();

            if (eq != null)
            {
                eq.Enqueue(item, AgentID, findScene(AgentID).RegionInfo.RegionHandle);
            }
        }
コード例 #22
0
        private void ChatterBoxSessionStartReplyViaCaps(IClientAPI remoteClient, string groupName, UUID groupID)
        {
            if (m_debugEnabled)
            {
                MainConsole.Instance.DebugFormat("[GROUPS-MESSAGING]: {0} called", MethodBase.GetCurrentMethod().Name);
            }
            IEventQueueService queue = remoteClient.Scene.RequestModuleInterface <IEventQueueService>();

            if (queue != null)
            {
                queue.ChatterBoxSessionStartReply(groupName, groupID,
                                                  remoteClient.AgentId, remoteClient.Scene.RegionInfo.RegionHandle);
            }
        }
コード例 #23
0
        private byte[] GetObjectPhysicsData(UUID agentID, Stream request)
        {
            OSDMap rm = (OSDMap)OSDParser.DeserializeLLSDXml(HttpServerHandlerHelpers.ReadFully(request));

            OSDArray keys = (OSDArray)rm["object_ids"];

            IEventQueueService eqs = m_scene.RequestModuleInterface <IEventQueueService>();

            if (eqs != null)
            {
                eqs.ObjectPhysicsProperties(keys.Select(key => m_scene.GetSceneObjectPart(key.AsUUID())).ToArray(),
                                            agentID, m_scene.RegionInfo.RegionID);
            }
            //Send back data
            return(new byte[0]);
        }
コード例 #24
0
        /// <summary>
        /// Remove the member from this session
        /// </summary>
        /// <param name="client"></param>
        /// <param name="im"></param>
        public void DropMemberFromSession(IClientAPI client, GridInstantMessage im)
        {
            ChatSession session;

            ChatSessions.TryGetValue(UUID.Parse(im.imSessionID.ToString()), out session);
            if (session == null)
            {
                return;
            }
            ChatSessionMember member = new ChatSessionMember()
            {
                AvatarKey = UUID.Zero
            };

            foreach (ChatSessionMember testmember in session.Members)
            {
                if (member.AvatarKey == UUID.Parse(im.fromAgentID.ToString()))
                {
                    member = testmember;
                }
            }

            if (member.AvatarKey != UUID.Zero)
            {
                session.Members.Remove(member);
            }

            if (session.Members.Count == 0)
            {
                ChatSessions.Remove(session.SessionID);
                return;
            }

            OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block = new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock();
            block.AgentID      = member.AvatarKey;
            block.CanVoiceChat = member.CanVoiceChat;
            block.IsModerator  = member.IsModerator;
            block.MuteText     = member.MuteText;
            block.MuteVoice    = member.MuteVoice;
            block.Transition   = "LEAVE";
            IEventQueueService eq = client.Scene.RequestModuleInterface <IEventQueueService>();

            foreach (ChatSessionMember sessionMember in session.Members)
            {
                eq.ChatterBoxSessionAgentListUpdates(session.SessionID, new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock[] { block }, sessionMember.AvatarKey, "LEAVE", findScene(sessionMember.AvatarKey).RegionInfo.RegionHandle);
            }
        }
コード例 #25
0
        /// <summary>
        /// Send chat to all the members of this friend conference
        /// </summary>
        /// <param name="client"></param>
        /// <param name="im"></param>
        public void SendChatToSession(IClientAPI client, GridInstantMessage im)
        {
            ChatSession session;

            ChatSessions.TryGetValue(UUID.Parse(im.imSessionID.ToString()), out session);
            if (session == null)
            {
                return;
            }
            IEventQueueService eq = client.Scene.RequestModuleInterface <IEventQueueService>();

            foreach (ChatSessionMember member in session.Members)
            {
                if (member.HasBeenAdded)
                {
                    im.toAgentID      = member.AvatarKey.Guid;
                    im.binaryBucket   = OpenMetaverse.Utils.StringToBytes(session.Name);
                    im.RegionID       = Guid.Empty;
                    im.ParentEstateID = 0;
                    //im.timestamp = 0;
                    m_TransferModule.SendInstantMessage(im);
                }
                else
                {
                    im.toAgentID = member.AvatarKey.Guid;
                    eq.ChatterboxInvitation(
                        session.SessionID
                        , session.Name
                        , new UUID(im.fromAgentID)
                        , im.message
                        , new UUID(im.toAgentID)
                        , im.fromAgentName
                        , im.dialog
                        , im.timestamp
                        , im.offline == 1
                        , (int)im.ParentEstateID
                        , im.Position
                        , 1
                        , new UUID(im.imSessionID)
                        , false
                        , OpenMetaverse.Utils.StringToBytes(session.Name)
                        , findScene(member.AvatarKey).RegionInfo.RegionHandle
                        );
                }
            }
        }
コード例 #26
0
 public EQMEventPoster(string url, IEventQueueService handler, ICapsService capsService, string SessionID,
                       IRegistryCore registry) :
     base("POST", url)
 {
     m_eventQueueService = handler;
     m_capsService       = capsService;
     m_SessionID         = SessionID;
     if (!ulong.TryParse(SessionID, out m_ourRegionHandle))
     {
         string[] split = SessionID.Split('|');
         if (split.Length == 2)
         {
             ulong.TryParse(split[1], out m_ourRegionHandle);
         }
     }
     m_registry = registry;
 }
コード例 #27
0
        public void AddRegion(IScene scene)
        {
            if (!m_enabled)
            {
                return;
            }

            m_Scene = scene;

            // set up event queue for messaging
            msgQ = m_Scene.RequestModuleInterface <IEventQueueService> ();
            if (msgQ == null)
            {
                m_enabled = false;      // no point if we cannot send messages
                MainConsole.Instance.Warn("[Sim console]: Disabled as no message queue is available.");
                return;
            }

            scene.EventManager.OnRegisterCaps   += OnRegisterCaps;
            scene.EventManager.OnMakeRootAgent  += EventManager_OnMakeRootAgent;
            scene.EventManager.OnMakeChildAgent += EventManager_OnMakeChildAgent;
        }
コード例 #28
0
 public void PostInitialize(IConfigSource config, IRegistryCore registry)
 {
     service = registry.RequestModuleInterface<IEventQueueService>();
     capsService = registry.RequestModuleInterface<ICapsService>();
 }
コード例 #29
0
 public void RegionLoaded(Scene scene)
 {
     m_eventQueue = scene.RequestModuleInterface<IEventQueueService>();
     m_profileConnector = Aurora.DataManager.DataManager.RequestPlugin<IProfileConnector>();
 }
コード例 #30
0
 public EQMEventPoster(string url, IEventQueueService handler, ICapsService capsService, string SessionID,
                       IRegistryCore registry) :
                           base("POST", url)
 {
     m_eventQueueService = handler;
     m_capsService = capsService;
     m_SessionID = SessionID;
     if (!ulong.TryParse(SessionID, out m_ourRegionHandle))
     {
         string[] split = SessionID.Split('|');
         if (split.Length == 2)
             ulong.TryParse(split[1], out m_ourRegionHandle);
     }
     m_registry = registry;
 }
コード例 #31
0
        private void MuteUser(UUID sessionid, IEventQueueService eq, UUID AgentID, ChatSessionMember thismember,
                              bool forward)
        {
            ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block =
                new ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock
                    {
                        AgentID = thismember.AvatarKey,
                        CanVoiceChat = thismember.CanVoiceChat,
                        IsModerator = thismember.IsModerator,
                        MuteText = thismember.MuteText,
                        MuteVoice = thismember.MuteVoice,
                        Transition = "ENTER"
                    };

            // Send an update to the affected user
            IClientAPI affectedUser = GetActiveClient(thismember.AvatarKey);
            if (affectedUser != null)
                eq.ChatterBoxSessionAgentListUpdates(sessionid, new[] {block}, AgentID, "ENTER",
                                                     affectedUser.Scene.RegionInfo.RegionHandle);
            else if (forward)
                SendMutedUserIM(thismember, sessionid);
        }
コード例 #32
0
        public bool CrossAgent(GridRegion crossingRegion, Vector3 pos,
                               Vector3 velocity, AgentCircuitData circuit, AgentData cAgent, UUID AgentID, ulong requestingRegion, out string reason)
        {
            try
            {
                IClientCapsService       clientCaps           = m_registry.RequestModuleInterface <ICapsService>().GetClientCapsService(AgentID);
                IRegionClientCapsService requestingRegionCaps = clientCaps.GetCapsService(requestingRegion);
                ISimulationService       SimulationService    = m_registry.RequestModuleInterface <ISimulationService>();
                if (SimulationService != null)
                {
                    //Note: we have to pull the new grid region info as the one from the region cannot be trusted
                    IGridService GridService = m_registry.RequestModuleInterface <IGridService>();
                    if (GridService != null)
                    {
                        //Set the user in transit so that we block duplicate tps and reset any cancelations
                        if (!SetUserInTransit(AgentID))
                        {
                            reason = "Already in a teleport";
                            return(false);
                        }

                        bool result = false;

                        crossingRegion = GridService.GetRegionByUUID(UUID.Zero, crossingRegion.RegionID);
                        if (!SimulationService.UpdateAgent(crossingRegion, cAgent))
                        {
                            m_log.Warn("[AgentProcessing]: Failed to cross agent " + AgentID + " because region did not accept it. Resetting.");
                            reason = "Failed to update an agent";
                        }
                        else
                        {
                            IEventQueueService EQService = m_registry.RequestModuleInterface <IEventQueueService>();

                            //Add this for the viewer, but not for the sim, seems to make the viewer happier
                            int XOffset = crossingRegion.RegionLocX - requestingRegionCaps.RegionX;
                            pos.X += XOffset;

                            int YOffset = crossingRegion.RegionLocY - requestingRegionCaps.RegionY;
                            pos.Y += YOffset;

                            IRegionClientCapsService otherRegion = clientCaps.GetCapsService(crossingRegion.RegionHandle);
                            //Tell the client about the transfer
                            EQService.CrossRegion(crossingRegion.RegionHandle, pos, velocity, crossingRegion.ExternalEndPoint, otherRegion.CapsUrl,
                                                  AgentID, circuit.SessionID,
                                                  crossingRegion.RegionSizeX, crossingRegion.RegionSizeY,
                                                  requestingRegion);

                            result = WaitForCallback(AgentID);
                            if (!result)
                            {
                                m_log.Warn("[AgentProcessing]: Callback never came in crossing agent " + circuit.AgentID + ". Resetting.");
                                reason = "Crossing timed out";
                            }
                            else
                            {
                                // Next, let's close the child agent connections that are too far away.
                                INeighborService service = m_registry.RequestModuleInterface <INeighborService>();
                                if (service != null)
                                {
                                    //Fix the root agent status
                                    otherRegion.RootAgent          = true;
                                    requestingRegionCaps.RootAgent = false;

                                    CloseNeighborAgents(requestingRegionCaps.Region, crossingRegion, AgentID);
                                }
                                reason = "";
                            }
                        }

                        //All done
                        ResetFromTransit(AgentID);
                        return(result);
                    }
                    else
                    {
                        reason = "Could not find the GridService";
                    }
                }
                else
                {
                    reason = "Could not find the SimulationService";
                }
            }
            catch (Exception ex)
            {
                m_log.WarnFormat("[AgentProcessing]: Failed to cross an agent into a new region. {0}", ex.ToString());
            }
            ResetFromTransit(AgentID);
            reason = "Exception occured";
            return(false);
        }
コード例 #33
0
        /// <summary>
        /// Async component for informing client of which neighbors exist
        /// </summary>
        /// <remarks>
        /// This needs to run asynchronously, as a network timeout may block the thread for a long while
        /// </remarks>
        /// <param name="remoteClient"></param>
        /// <param name="a"></param>
        /// <param name="regionHandle"></param>
        /// <param name="endPoint"></param>
        private bool InformClientOfNeighbor(UUID AgentID, ulong requestingRegion, AgentCircuitData circuitData, GridRegion neighbor,
                                            uint TeleportFlags, AgentData agentData, out string reason)
        {
            if (neighbor == null)
            {
                reason = "Could not find neighbor to inform";
                return(false);
            }
            m_log.Info("[AgentProcessing]: Starting to inform client about neighbor " + neighbor.RegionName);

            //Notes on this method
            // 1) the SimulationService.CreateAgent MUST have a fixed CapsUrl for the region, so we have to create (if needed)
            //       a new Caps handler for it.
            // 2) Then we can call the methods (EnableSimulator and EstatablishAgentComm) to tell the client the new Urls
            // 3) This allows us to make the Caps on the grid server without telling any other regions about what the
            //       Urls are.

            ISimulationService SimulationService = m_registry.RequestModuleInterface <ISimulationService>();

            if (SimulationService != null)
            {
                ICapsService       capsService = m_registry.RequestModuleInterface <ICapsService>();
                IClientCapsService clientCaps  = capsService.GetClientCapsService(AgentID);

                IRegionClientCapsService oldRegionService = clientCaps.GetCapsService(neighbor.RegionHandle);

                //If its disabled, it should be removed, so kill it!
                if (oldRegionService != null && oldRegionService.Disabled)
                {
                    clientCaps.RemoveCAPS(neighbor.RegionHandle);
                    oldRegionService = null;
                }

                bool newAgent = oldRegionService == null;
                IRegionClientCapsService otherRegionService = clientCaps.GetOrCreateCapsService(neighbor.RegionHandle,
                                                                                                CapsUtil.GetCapsSeedPath(CapsUtil.GetRandomCapsObjectPath()), circuitData);

                if (!newAgent)
                {
                    //Note: if the agent is already there, send an agent update then
                    bool result = true;
                    if (agentData != null)
                    {
                        result = SimulationService.UpdateAgent(neighbor, agentData);
                        if (result)
                        {
                            oldRegionService.Disabled = false;
                        }
                    }
                    reason = "";
                    return(result);
                }

                ICommunicationService commsService = m_registry.RequestModuleInterface <ICommunicationService>();
                if (commsService != null)
                {
                    circuitData.OtherInformation["UserUrls"] = commsService.GetUrlsForUser(neighbor, circuitData.AgentID);
                }

                #region OpenSim teleport compatibility!

                if (!m_useCallbacks)
                {
                    circuitData.CapsPath    = CapsUtil.GetRandomCapsObjectPath();
                    circuitData.startpos.X += (neighbor.RegionLocX - clientCaps.GetRootCapsService().RegionX);
                    circuitData.startpos.Y += (neighbor.RegionLocY - clientCaps.GetRootCapsService().RegionY);
                }

                #endregion

                bool regionAccepted = SimulationService.CreateAgent(neighbor, circuitData,
                                                                    TeleportFlags, agentData, out reason);
                if (regionAccepted)
                {
                    string otherRegionsCapsURL;
                    //If the region accepted us, we should get a CAPS url back as the reason, if not, its not updated or not an Aurora region, so don't touch it.
                    if (reason != "")
                    {
                        OSDMap responseMap = (OSDMap)OSDParser.DeserializeJson(reason);
                        OSDMap SimSeedCaps = (OSDMap)responseMap["CapsUrls"];
                        otherRegionService.AddCAPS(SimSeedCaps);
                        otherRegionsCapsURL = otherRegionService.CapsUrl;
                    }
                    else
                    {
                        //We are assuming an OpenSim region now!
                        #region OpenSim teleport compatibility!

                        otherRegionsCapsURL = "http://" + otherRegionService.Region.ExternalEndPoint.ToString() +
                                              CapsUtil.GetCapsSeedPath(circuitData.CapsPath);
                        otherRegionService.CapsUrl = otherRegionsCapsURL;

                        #endregion
                    }

                    IEventQueueService EQService = m_registry.RequestModuleInterface <IEventQueueService>();

                    EQService.EnableSimulator(neighbor.RegionHandle,
                                              neighbor.ExternalEndPoint.Address.GetAddressBytes(),
                                              neighbor.ExternalEndPoint.Port, AgentID,
                                              neighbor.RegionSizeX, neighbor.RegionSizeY, requestingRegion);

                    // EnableSimulator makes the client send a UseCircuitCode message to the destination,
                    // which triggers a bunch of things there.
                    // So let's wait
                    Thread.Sleep(300);
                    EQService.EstablishAgentCommunication(AgentID, neighbor.RegionHandle,
                                                          neighbor.ExternalEndPoint.Address.GetAddressBytes(),
                                                          neighbor.ExternalEndPoint.Port, otherRegionsCapsURL, neighbor.RegionSizeX,
                                                          neighbor.RegionSizeY,
                                                          requestingRegion);

                    if (!m_useCallbacks)
                    {
                        Thread.Sleep(3000);  //Give it a bit of time
                    }
                    m_log.Info("[AgentProcessing]: Completed inform client about neighbor " + neighbor.RegionName);
                }
                else
                {
                    m_log.Error("[AgentProcessing]: Failed to inform client about neighbor " + neighbor.RegionName + ", reason: " + reason);
                    return(false);
                }
                return(true);
            }
            reason = "SimulationService does not exist";
            m_log.Error("[AgentProcessing]: Failed to inform client about neighbor " + neighbor.RegionName + ", reason: " + reason + "!");
            return(false);
        }
コード例 #34
0
        public bool TeleportAgent(GridRegion destination, uint TeleportFlags, int DrawDistance,
                                  AgentCircuitData circuit, AgentData agentData, UUID AgentID, ulong requestingRegion,
                                  out string reason)
        {
            IClientCapsService       clientCaps = m_registry.RequestModuleInterface <ICapsService>().GetClientCapsService(AgentID);
            IRegionClientCapsService regionCaps = clientCaps.GetCapsService(requestingRegion);

            if (regionCaps == null || !regionCaps.RootAgent)
            {
                reason = "";
                return(false);
            }

            bool result = false;

            try
            {
                bool callWasCanceled = false;

                ISimulationService SimulationService = m_registry.RequestModuleInterface <ISimulationService>();
                if (SimulationService != null)
                {
                    //Set the user in transit so that we block duplicate tps and reset any cancelations
                    if (!SetUserInTransit(AgentID))
                    {
                        reason = "Already in a teleport";
                        return(false);
                    }

                    //Note: we have to pull the new grid region info as the one from the region cannot be trusted
                    IGridService GridService = m_registry.RequestModuleInterface <IGridService>();
                    if (GridService != null)
                    {
                        destination = GridService.GetRegionByUUID(UUID.Zero, destination.RegionID);
                        //Inform the client of the neighbor if needed
                        circuit.child = false; //Force child status to the correct type

                        if (!InformClientOfNeighbor(AgentID, requestingRegion, circuit, destination, TeleportFlags,
                                                    agentData, out reason))
                        {
                            ResetFromTransit(AgentID);
                            return(false);
                        }
                    }
                    else
                    {
                        reason = "Could not find the grid service";
                        ResetFromTransit(AgentID);
                        return(false);
                    }

                    IEventQueueService EQService = m_registry.RequestModuleInterface <IEventQueueService>();

                    IRegionClientCapsService otherRegion = clientCaps.GetCapsService(destination.RegionHandle);

                    EQService.TeleportFinishEvent(destination.RegionHandle, destination.Access, destination.ExternalEndPoint, otherRegion.CapsUrl,
                                                  4, AgentID, TeleportFlags,
                                                  destination.RegionSizeX, destination.RegionSizeY,
                                                  requestingRegion);

                    // TeleportFinish makes the client send CompleteMovementIntoRegion (at the destination), which
                    // trigers a whole shebang of things there, including MakeRoot. So let's wait for confirmation
                    // that the client contacted the destination before we send the attachments and close things here.

                    result = WaitForCallback(AgentID, out callWasCanceled);
                    if (!result)
                    {
                        //It says it failed, lets call the sim and check
                        IAgentData data = null;
                        result = SimulationService.RetrieveAgent(destination, AgentID, out data);
                    }
                    if (!result)
                    {
                        if (!callWasCanceled)
                        {
                            m_log.Warn("[AgentProcessing]: Callback never came for teleporting agent " +
                                       AgentID + ". Resetting.");
                        }
                        INeighborService service = m_registry.RequestModuleInterface <INeighborService>();
                        if (service != null)
                        {
                            //Close the agent at the place we just created if it isn't a neighbor
                            if (service.IsOutsideView(regionCaps.RegionX, destination.RegionLocX, regionCaps.Region.RegionSizeX, destination.RegionSizeX,
                                                      regionCaps.RegionY, destination.RegionLocY, regionCaps.Region.RegionSizeY, destination.RegionSizeY))
                            {
                                SimulationService.CloseAgent(destination, AgentID);
                            }
                        }
                        clientCaps.RemoveCAPS(destination.RegionHandle);
                        if (!callWasCanceled)
                        {
                            reason = "The teleport timed out";
                        }
                        else
                        {
                            reason = "Cancelled";
                        }
                    }
                    else
                    {
                        //Fix the root agent status
                        otherRegion.RootAgent = true;
                        regionCaps.RootAgent  = false;

                        // Next, let's close the child agent connections that are too far away.
                        CloseNeighborAgents(regionCaps.Region, destination, AgentID);
                        reason = "";
                    }
                }
                else
                {
                    reason = "No SimulationService found!";
                }
            }
            catch (Exception ex)
            {
                m_log.WarnFormat("[AgentProcessing]: Exception occured during agent teleport, {0}", ex.ToString());
                reason = "Exception occured.";
            }
            //All done
            ResetFromTransit(AgentID);
            return(result);
        }
コード例 #35
0
ファイル: EventQueueHandler.cs プロジェクト: kow/Aurora-Sim
 public EQMEventPoster(string url, IEventQueueService handler, ICapsService capsService, ulong handle, IRegistryCore registry) :
     base("POST", url)
 {
     m_eventQueueService = handler;
     m_capsService = capsService;
     m_ourRegionHandle = handle;
     m_registry = registry;
 }
コード例 #36
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an GroupSessionAgentUpdate
            if (message.ContainsKey("Method") && message ["Method"] == "GroupSessionAgentUpdate")
            {
                //COMES IN ON WhiteCore.SERVER SIDE
                //Send it on to whomever it concerns
                OSDMap innerMessage = (OSDMap)message ["Message"];
                if (innerMessage ["message"] == "ChatterBoxSessionAgentListUpdates")
                // ONLY forward on this type of message
                {
                    UUID agentID                 = message ["AgentID"];
                    IEventQueueService eqs       = m_registry.RequestModuleInterface <IEventQueueService> ();
                    IAgentInfoService  agentInfo = m_registry.RequestModuleInterface <IAgentInfoService> ();
                    if (agentInfo != null)
                    {
                        UserInfo user = agentInfo.GetUserInfo(agentID.ToString());
                        if (user != null && user.IsOnline)
                        {
                            eqs.Enqueue(innerMessage, agentID, user.CurrentRegionID);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message ["Method"] == "FixGroupRoleTitles")
            {
                // This message comes in on WhiteCore.Server side from the region
                UUID groupID = message ["GroupID"].AsUUID();
                UUID agentID = message ["AgentID"].AsUUID();
                UUID roleID  = message ["RoleID"].AsUUID();
                byte type    = (byte)message ["Type"].AsInteger();
                IGroupsServiceConnector     con     = Framework.Utilities.DataManager.RequestPlugin <IGroupsServiceConnector> ();
                List <GroupRoleMembersData> members = con.GetGroupRoleMembers(agentID, groupID);
                List <GroupRolesData>       roles   = con.GetGroupRoles(agentID, groupID);
                GroupRolesData everyone             = null;

                foreach (GroupRolesData role in roles.Where(role => role.Name == "Everyone"))
                {
                    everyone = role;
                }

                List <UserInfo> regionsToBeUpdated = new List <UserInfo> ();
                foreach (GroupRoleMembersData data in members)
                {
                    if (data.RoleID == roleID)
                    {
                        // They were affected by the change
                        switch ((GroupRoleUpdate)type)
                        {
                        case GroupRoleUpdate.Create:
                        case GroupRoleUpdate.NoUpdate:     // No changes...
                            break;

                        case GroupRoleUpdate.UpdatePowers: // Possible we don't need to send this?
                        case GroupRoleUpdate.UpdateAll:
                        case GroupRoleUpdate.UpdateData:
                        case GroupRoleUpdate.Delete:
                            if (type == (byte)GroupRoleUpdate.Delete)
                            {
                                // Set them to the most limited role since their role is gone
                                con.SetAgentGroupSelectedRole(data.MemberID, groupID, everyone.RoleID);
                            }

                            // Need to update their title inworld
                            IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> ();
                            UserInfo          info;
                            if (agentInfoService != null &&
                                (info = agentInfoService.GetUserInfo(agentID.ToString())) != null && info.IsOnline)
                            {
                                // Forward the message
                                regionsToBeUpdated.Add(info);
                            }
                            break;
                        }
                    }
                }
                if (regionsToBeUpdated.Count != 0)
                {
                    ISyncMessagePosterService messagePost = m_registry.RequestModuleInterface <ISyncMessagePosterService> ();
                    if (messagePost != null)
                    {
                        foreach (UserInfo userInfo in regionsToBeUpdated)
                        {
                            OSDMap outgoingMessage = new OSDMap();
                            outgoingMessage ["Method"]   = "ForceUpdateGroupTitles";
                            outgoingMessage ["GroupID"]  = groupID;
                            outgoingMessage ["RoleID"]   = roleID;
                            outgoingMessage ["RegionID"] = userInfo.CurrentRegionID;
                            messagePost.Post(userInfo.CurrentRegionURI, outgoingMessage);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message ["Method"] == "ForceUpdateGroupTitles")
            {
                // This message comes in on the region side from WhiteCore.Server
                UUID          groupID  = message ["GroupID"].AsUUID();
                UUID          roleID   = message ["RoleID"].AsUUID();
                UUID          regionID = message ["RegionID"].AsUUID();
                IGroupsModule gm       = m_registry.RequestModuleInterface <IGroupsModule> ();
                if (gm != null)
                {
                    gm.UpdateUsersForExternalRoleUpdate(groupID, roleID, regionID);
                }
            }
            return(null);
        }
コード例 #37
0
 public EQMEventPoster(IEventQueueService handler, ICapsService capsService) :
     base("POST", "/CAPS/EQMPOSTER")
 {
     m_eventQueueService = handler;
     m_capsService = capsService;
 }
コード例 #38
0
        protected OSDMap OnMessageReceived(OSDMap message)
        {
            //We need to check and see if this is an GroupSessionAgentUpdate
            if (message.ContainsKey("Method") && message["Method"] == "GroupSessionAgentUpdate")
            {
                //COMES IN ON AURORA.SERVER SIDE
                //Send it on to whomever it concerns
                OSDMap innerMessage = (OSDMap)message["Message"];
                if (innerMessage["message"] == "ChatterBoxSessionAgentListUpdates")
                //ONLY forward on this type of message
                {
                    UUID agentID            = message["AgentID"];
                    IEventQueueService eqs  = m_registry.RequestModuleInterface <IEventQueueService>();
                    ICapsService       caps = m_registry.RequestModuleInterface <ICapsService>();
                    if (caps != null)
                    {
                        IClientCapsService clientCaps = caps.GetClientCapsService(agentID);
                        if (clientCaps != null && clientCaps.GetRootCapsService() != null)
                        {
                            eqs.Enqueue(innerMessage, agentID, clientCaps.GetRootCapsService().RegionHandle);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "FixGroupRoleTitles")
            {
                //COMES IN ON AURORA.SERVER SIDE FROM REGION
                UUID groupID = message["GroupID"].AsUUID();
                UUID agentID = message["AgentID"].AsUUID();
                UUID roleID  = message["RoleID"].AsUUID();
                byte type    = (byte)message["Type"].AsInteger();
                IGroupsServiceConnector     con     = DataManager.RequestPlugin <IGroupsServiceConnector>();
                List <GroupRoleMembersData> members = con.GetGroupRoleMembers(agentID, groupID);
                List <GroupRolesData>       roles   = con.GetGroupRoles(agentID, groupID);
                GroupRolesData everyone             = null;
#if (!ISWIN)
                foreach (GroupRolesData role in roles)
                {
                    if (role.Name == "Everyone")
                    {
                        everyone = role;
                    }
                }
#else
                foreach (GroupRolesData role in roles.Where(role => role.Name == "Everyone"))
                {
                    everyone = role;
                }
#endif

                List <ulong> regionsToBeUpdated = new List <ulong>();
                foreach (GroupRoleMembersData data in members)
                {
                    if (data.RoleID == roleID)
                    {
                        //They were affected by the change
                        switch ((GroupRoleUpdate)type)
                        {
                        case GroupRoleUpdate.Create:
                        case GroupRoleUpdate.NoUpdate:
                            //No changes...
                            break;

                        case GroupRoleUpdate.UpdatePowers:     //Possible we don't need to send this?
                        case GroupRoleUpdate.UpdateAll:
                        case GroupRoleUpdate.UpdateData:
                        case GroupRoleUpdate.Delete:
                            if (type == (byte)GroupRoleUpdate.Delete)
                            {
                                //Set them to the most limited role since their role is gone
                                con.SetAgentGroupSelectedRole(data.MemberID, groupID, everyone.RoleID);
                            }
                            //Need to update their title inworld
                            ICapsService caps = m_registry.RequestModuleInterface <ICapsService>();
                            if (caps != null)
                            {
                                IClientCapsService clientCaps = caps.GetClientCapsService(agentID);
                                if (clientCaps != null && clientCaps.GetRootCapsService() != null)
                                {
                                    regionsToBeUpdated.Add(clientCaps.GetRootCapsService().RegionHandle);
                                }
                            }
                            break;
                        }
                    }
                }
                if (regionsToBeUpdated.Count != 0)
                {
                    IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>();
                    if (messagePost != null)
                    {
                        foreach (ulong regionhandle in regionsToBeUpdated)
                        {
                            OSDMap outgoingMessage = new OSDMap();
                            outgoingMessage["Method"]   = "ForceUpdateGroupTitles";
                            outgoingMessage["GroupID"]  = groupID;
                            outgoingMessage["RoleID"]   = roleID;
                            outgoingMessage["RegionID"] = regionhandle;
                            messagePost.Post(regionhandle, outgoingMessage);
                        }
                    }
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "ForceUpdateGroupTitles")
            {
                //COMES IN ON REGION SIDE FROM AURORA.SERVER
                UUID          groupID  = message["GroupID"].AsUUID();
                UUID          roleID   = message["RoleID"].AsUUID();
                ulong         regionID = message["RegionID"].AsULong();
                IGroupsModule gm       = m_registry.RequestModuleInterface <IGroupsModule>();
                if (gm != null)
                {
                    gm.UpdateUsersForExternalRoleUpdate(groupID, roleID, regionID);
                }
            }
            else if (message.ContainsKey("Method") && message["Method"] == "SendGroupNoticeToUsers")
            {
                //COMES IN ON REGION SIDE FROM AURORA.SERVER
                GroupNoticeInfo notice = new GroupNoticeInfo();
                notice.FromOSD((OSDMap)message["Notice"]);
                IGroupsModule gm = m_registry.RequestModuleInterface <IGroupsModule>();
                if (gm != null)
                {
                    gm.SendGroupNoticeToUsers(null, notice, true);
                }
            }
            return(null);
        }
コード例 #39
0
        private Hashtable ProcessChatSessionRequest(Hashtable mDhttpMethod, UUID Agent)
        {
            OSDMap rm     = (OSDMap)OSDParser.DeserializeLLSDXml((string)mDhttpMethod["requestbody"]);
            string method = rm["method"].AsString();

            UUID sessionid = UUID.Parse(rm["session-id"].AsString());

            IScenePresence     SP = findScenePresence(Agent);
            IEventQueueService eq = SP.Scene.RequestModuleInterface <IEventQueueService>();

            if (method == "start conference")
            {
                //Create the session.
                CreateSession(new ChatSession()
                {
                    Members   = new List <ChatSessionMember>(),
                    SessionID = sessionid,
                    Name      = SP.Name + " Conference"
                });

                OSDArray parameters = (OSDArray)rm["params"];
                //Add other invited members.
                foreach (OSD param in parameters)
                {
                    AddDefaultPermsMemberToSession(param.AsUUID(), sessionid);
                }

                //Add us to the session!
                AddMemberToGroup(new ChatSessionMember()
                {
                    AvatarKey    = Agent,
                    CanVoiceChat = true,
                    IsModerator  = true,
                    MuteText     = false,
                    MuteVoice    = false,
                    HasBeenAdded = true
                }, sessionid);


                //Inform us about our room
                OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block = new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock();
                block.AgentID      = Agent;
                block.CanVoiceChat = true;
                block.IsModerator  = true;
                block.MuteText     = false;
                block.MuteVoice    = false;
                block.Transition   = "ENTER";
                eq.ChatterBoxSessionAgentListUpdates(sessionid, new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock[] { block }, Agent, "ENTER", findScene(Agent).RegionInfo.RegionHandle);

                OpenMetaverse.Messages.Linden.ChatterBoxSessionStartReplyMessage cs = new OpenMetaverse.Messages.Linden.ChatterBoxSessionStartReplyMessage();
                cs.VoiceEnabled   = true;
                cs.TempSessionID  = UUID.Random();
                cs.Type           = 1;
                cs.Success        = true;
                cs.SessionID      = sessionid;
                cs.SessionName    = SP.Name + " Conference";
                cs.ModeratedVoice = true;

                Hashtable responsedata = new Hashtable();
                responsedata["int_response_code"] = 200; //501; //410; //404;
                responsedata["content_type"]      = "text/plain";
                responsedata["keepalive"]         = false;
                OSDMap map = cs.Serialize();
                responsedata["str_response_string"] = map.ToString();
                return(responsedata);
            }
            else if (method == "accept invitation")
            {
                //They would like added to the group conversation
                List <OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> Us          = new List <OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();
                List <OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock> NotUsAgents = new List <OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock>();

                ChatSession session = GetSession(sessionid);
                if (session != null)
                {
                    ChatSessionMember thismember = FindMember(sessionid, Agent);
                    //Tell all the other members about the incoming member
                    foreach (ChatSessionMember sessionMember in session.Members)
                    {
                        OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block = new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock();
                        block.AgentID      = sessionMember.AvatarKey;
                        block.CanVoiceChat = sessionMember.CanVoiceChat;
                        block.IsModerator  = sessionMember.IsModerator;
                        block.MuteText     = sessionMember.MuteText;
                        block.MuteVoice    = sessionMember.MuteVoice;
                        block.Transition   = "ENTER";
                        if (sessionMember.AvatarKey == thismember.AvatarKey)
                        {
                            Us.Add(block);
                        }
                        else
                        {
                            if (sessionMember.HasBeenAdded) // Don't add not joined yet agents. They don't watn to be here.
                            {
                                NotUsAgents.Add(block);
                            }
                        }
                    }
                    thismember.HasBeenAdded = true;
                    foreach (ChatSessionMember member in session.Members)
                    {
                        if (member.AvatarKey == thismember.AvatarKey)
                        {
                            //Tell 'us' about all the other agents in the group
                            eq.ChatterBoxSessionAgentListUpdates(session.SessionID, NotUsAgents.ToArray(), member.AvatarKey, "ENTER", findScene(Agent).RegionInfo.RegionHandle);
                        }
                        else
                        {
                            //Tell 'other' agents about the new agent ('us')
                            eq.ChatterBoxSessionAgentListUpdates(session.SessionID, Us.ToArray(), member.AvatarKey, "ENTER", findScene(Agent).RegionInfo.RegionHandle);
                        }
                    }
                }
                Hashtable responsedata = new Hashtable();
                responsedata["int_response_code"]   = 200; //501; //410; //404;
                responsedata["content_type"]        = "text/plain";
                responsedata["keepalive"]           = false;
                responsedata["str_response_string"] = "Accepted";
                return(responsedata);
            }
            else if (method == "mute update")
            {
                //Check if the user is a moderator
                Hashtable responsedata = new Hashtable();
                if (!CheckModeratorPermission(Agent, sessionid))
                {
                    responsedata["int_response_code"]   = 200; //501; //410; //404;
                    responsedata["content_type"]        = "text/plain";
                    responsedata["keepalive"]           = false;
                    responsedata["str_response_string"] = "Accepted";
                    return(responsedata);
                }

                OSDMap parameters  = (OSDMap)rm["params"];
                UUID   AgentID     = parameters["agent_id"].AsUUID();
                OSDMap muteInfoMap = (OSDMap)parameters["mute_info"];

                ChatSessionMember thismember = FindMember(sessionid, Agent);
                if (muteInfoMap.ContainsKey("text"))
                {
                    thismember.MuteText = muteInfoMap["text"].AsBoolean();
                }
                if (muteInfoMap.ContainsKey("voice"))
                {
                    thismember.MuteVoice = muteInfoMap["voice"].AsBoolean();
                }

                OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock block = new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock();
                block.AgentID      = thismember.AvatarKey;
                block.CanVoiceChat = thismember.CanVoiceChat;
                block.IsModerator  = thismember.IsModerator;
                block.MuteText     = thismember.MuteText;
                block.MuteVoice    = thismember.MuteVoice;
                block.Transition   = "ENTER";

                // Send an update to the affected user
                eq.ChatterBoxSessionAgentListUpdates(sessionid, new OpenMetaverse.Messages.Linden.ChatterBoxSessionAgentListUpdatesMessage.AgentUpdatesBlock[] { block }, AgentID, "", findScene(Agent).RegionInfo.RegionHandle);

                responsedata["int_response_code"]   = 200; //501; //410; //404;
                responsedata["content_type"]        = "text/plain";
                responsedata["keepalive"]           = false;
                responsedata["str_response_string"] = "Accepted";
                return(responsedata);
            }
            else
            {
                m_log.Warn("ChatSessionRequest : " + method);
                Hashtable responsedata = new Hashtable();
                responsedata["int_response_code"]   = 200; //501; //410; //404;
                responsedata["content_type"]        = "text/plain";
                responsedata["keepalive"]           = false;
                responsedata["str_response_string"] = "Accepted";
                return(responsedata);
            }
        }