protected OSDMap OnMessageReceived(OSDMap message) { //We need to check and see if this is an AgentStatusChange if (message.ContainsKey("Method") && message["Method"] == "AgentStatusChange") { OSDMap innerMessage = (OSDMap)message["Message"]; //We got a message, now pass it on to the clients that need it UUID AgentID = innerMessage["AgentID"].AsUUID(); UUID FriendToInformID = innerMessage["FriendToInformID"].AsUUID(); bool NewStatus = innerMessage["NewStatus"].AsBoolean(); //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangable) SceneManager manager = m_registry.RequestModuleInterface <SceneManager>(); if (manager != null && manager.Scenes.Count > 0) { IFriendsModule friendsModule = manager.Scenes[0].RequestModuleInterface <IFriendsModule>(); if (friendsModule != null) { //Send the message friendsModule.SendFriendsStatusMessage(FriendToInformID, AgentID, NewStatus); } } } return(null); }
private void DoPresenceUpdate(IScenePresence presence) { ReportAgent(presence); IFriendsModule friendsModule = m_scene.RequestModuleInterface <IFriendsModule>(); IAgentInfoService aservice = m_scene.RequestModuleInterface <IAgentInfoService>(); if (friendsModule != null) { Interfaces.FriendInfo[] friends = friendsModule.GetFriends(presence.UUID); List <string> s = new List <string>(); for (int i = 0; i < friends.Length; i++) { s.Add(friends[i].Friend); } List <UserInfo> infos = aservice.GetUserInfos(s); foreach (UserInfo u in infos) { if (u != null && u.IsOnline) { friendsModule.SendFriendsStatusMessage(presence.UUID, UUID.Parse(u.UserID), true); } } foreach (UserInfo u in infos) { if (u != null && u.IsOnline) { if (!IsLocal(u, presence)) { DoNonLocalPresenceUpdateCall(u, presence); } else { friendsModule.SendFriendsStatusMessage(UUID.Parse(u.UserID), presence.UUID, true); } } } } }
protected OSDMap OnMessageReceived(OSDMap message) { if (!message.ContainsKey("Method")) { return(null); // nothing to do here... } var method = message ["Method"].AsString(); ISyncMessagePosterService asyncPost = m_registry.RequestModuleInterface <ISyncMessagePosterService> (); //We need to check and see if this is an AgentStatusChange if (method == "AgentStatusChange") { OSDMap innerMessage = (OSDMap)message ["Message"]; //We got a message, now pass it on to the clients that need it UUID AgentID = innerMessage ["AgentID"].AsUUID(); UUID FriendToInformID = innerMessage ["FriendToInformID"].AsUUID(); bool NewStatus = innerMessage ["NewStatus"].AsBoolean(); //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangeable) ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager> (); if (manager != null) { foreach (IScene scene in manager.Scenes) { if (scene.GetScenePresence(FriendToInformID) != null && !scene.GetScenePresence(FriendToInformID).IsChildAgent) { IFriendsModule friendsModule = scene.RequestModuleInterface <IFriendsModule> (); if (friendsModule != null) { //Send the message friendsModule.SendFriendsStatusMessage(FriendToInformID, new [] { AgentID }, NewStatus); } } } } } else if (method == "AgentStatusChanges") { OSDMap innerMessage = (OSDMap)message ["Message"]; //We got a message, now pass it on to the clients that need it List <UUID> AgentIDs = ((OSDArray)innerMessage ["AgentIDs"]).ConvertAll <UUID> ((o) => o); UUID FriendToInformID = innerMessage ["FriendToInformID"].AsUUID(); bool NewStatus = innerMessage ["NewStatus"].AsBoolean(); //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangeable) ISceneManager manager = m_registry.RequestModuleInterface <ISceneManager> (); if (manager != null) { foreach (IScene scene in manager.Scenes) { if (scene.GetScenePresence(FriendToInformID) != null && !scene.GetScenePresence(FriendToInformID).IsChildAgent) { IFriendsModule friendsModule = scene.RequestModuleInterface <IFriendsModule> (); if (friendsModule != null) { //Send the message friendsModule.SendFriendsStatusMessage(FriendToInformID, AgentIDs.ToArray(), NewStatus); } } } } } else if (method == "FriendGrantRights") { OSDMap body = (OSDMap)message ["Message"]; UUID targetID = body ["Target"].AsUUID(); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); UserInfo info; if (agentInfoService != null && (info = agentInfoService.GetUserInfo(targetID.ToString())) != null && info.IsOnline) { //Forward the message asyncPost.Post(info.CurrentRegionURI, message); } } else if (method == "FriendshipOffered") { OSDMap body = (OSDMap)message ["Message"]; UUID targetID = body ["Friend"].AsUUID(); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); UserInfo info; if (agentInfoService != null && (info = agentInfoService.GetUserInfo(targetID.ToString())) != null && info.IsOnline) { //Forward the message asyncPost.Post(info.CurrentRegionURI, message); } } else if (method == "FriendTerminated") { OSDMap body = (OSDMap)message ["Message"]; UUID targetID = body ["ExFriend"].AsUUID(); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); UserInfo info; if (agentInfoService != null && (info = agentInfoService.GetUserInfo(targetID.ToString())) != null && info.IsOnline) { //Forward the message asyncPost.Post(info.CurrentRegionURI, message); } } else if (method == "FriendshipDenied") { OSDMap body = (OSDMap)message ["Message"]; UUID targetID = body ["FriendID"].AsUUID(); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); UserInfo info; if (agentInfoService != null && (info = agentInfoService.GetUserInfo(targetID.ToString())) != null && info.IsOnline) { //Forward the message asyncPost.Post(info.CurrentRegionURI, message); } } else if (method == "FriendshipApproved") { OSDMap body = (OSDMap)message ["Message"]; UUID targetID = body ["FriendID"].AsUUID(); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService> (); UserInfo info; if (agentInfoService != null && (info = agentInfoService.GetUserInfo(targetID.ToString())) != null && info.IsOnline) { //Forward the message asyncPost.Post(info.CurrentRegionURI, message); } } return(null); }
protected OSDMap OnMessageReceived(OSDMap message) { IGridService gridService = m_registry.RequestModuleInterface <IGridService>(); IAsyncMessagePostService asyncPost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); //We need to check and see if this is an AgentStatusChange if (message.ContainsKey("Method") && message["Method"] == "AgentStatusChange") { OSDMap innerMessage = (OSDMap)message["Message"]; //We got a message, now pass it on to the clients that need it UUID AgentID = innerMessage["AgentID"].AsUUID(); UUID FriendToInformID = innerMessage["FriendToInformID"].AsUUID(); bool NewStatus = innerMessage["NewStatus"].AsBoolean(); //Do this since IFriendsModule is a scene module, not a ISimulationBase module (not interchangable) SceneManager manager = m_registry.RequestModuleInterface <SceneManager>(); if (manager != null && manager.Scenes.Count > 0) { IFriendsModule friendsModule = manager.Scenes[0].RequestModuleInterface <IFriendsModule>(); if (friendsModule != null) { //Send the message friendsModule.SendFriendsStatusMessage(FriendToInformID, AgentID, NewStatus); } } } else if (message.ContainsKey("Method") && message["Method"] == "FriendGrantRights") { OSDMap body = (OSDMap)message["Message"]; UUID targetID = body["Target"].AsUUID(); UserInfo friendSession = m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID); //Forward the message asyncPost.Post(region.RegionHandle, message); } } else if (message.ContainsKey("Method") && message["Method"] == "FriendshipOffered") { OSDMap body = (OSDMap)message["Message"]; UUID targetID = body["Friend"].AsUUID(); UserInfo friendSession = m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID); //Forward the message asyncPost.Post(region.RegionHandle, message); } } else if (message.ContainsKey("Method") && message["Method"] == "FriendTerminated") { OSDMap body = (OSDMap)message["Message"]; UUID targetID = body["ExFriend"].AsUUID(); UserInfo friendSession = m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID); //Forward the message asyncPost.Post(region.RegionHandle, message); } } else if (message.ContainsKey("Method") && message["Method"] == "FriendshipDenied") { OSDMap body = (OSDMap)message["Message"]; UUID targetID = body["FriendID"].AsUUID(); UserInfo friendSession = m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID); //Forward the message asyncPost.Post(region.RegionHandle, message); } } else if (message.ContainsKey("Method") && message["Method"] == "FriendshipApproved") { OSDMap body = (OSDMap)message["Message"]; UUID targetID = body["FriendID"].AsUUID(); UserInfo friendSession = m_registry.RequestModuleInterface <IAgentInfoService>().GetUserInfo(targetID.ToString()); if (friendSession != null && friendSession.IsOnline) { GridRegion region = gridService.GetRegionByUUID(UUID.Zero, friendSession.CurrentRegionID); //Forward the message asyncPost.Post(region.RegionHandle, message); } } return(null); }