/// <summary> /// Server side /// </summary> /// <param name = "FunctionName"></param> /// <param name = "parameters"></param> /// <returns></returns> protected object OnGenericEvent(string FunctionName, object parameters) { if (FunctionName == "EstateUpdated") { EstateSettings es = (EstateSettings)parameters; IEstateConnector estateConnector = DataManager.RequestPlugin <IEstateConnector>(); if (estateConnector != null) { List <UUID> regions = estateConnector.GetRegions((int)es.EstateID); if (regions != null) { foreach (UUID region in regions) { //Send the message to update all regions that are in this estate, as a setting changed IAsyncMessagePostService asyncPoster = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); IGridService gridService = m_registry.RequestModuleInterface <IGridService>(); if (gridService != null && asyncPoster != null) { GridRegion r = gridService.GetRegionByUUID(null, region); if (r != null) { asyncPoster.Post(r.RegionHandle, SyncMessageHelper.UpdateEstateInfo(es.EstateID, region)); } } } } } } return(null); }
public void KickUser(UUID avatarID, string message) { //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IClientCapsService client = capsService.GetClientCapsService(avatarID); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { //Send the message to the client messagePost.Post(regionClient.RegionHandle, BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString())); IAgentProcessing agentProcessor = m_registry.RequestModuleInterface <IAgentProcessing>(); if (agentProcessor != null) { agentProcessor.LogoutAgent(regionClient, true); } MainConsole.Instance.Info("User will be kicked in less than 30 seconds."); return; } } MainConsole.Instance.Info("Could not find user to send message to."); }
protected void SendGridMessage(string module, string[] cmd) { //Combine the params and figure out the message string user = CombineParams(cmd, 3, 5); string message = CombineParams(cmd, 5); //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IUserAccountService userService = m_registry.RequestModuleInterface <IUserAccountService>(); UserAccount account = userService.GetUserAccount(UUID.Zero, user.Split(' ')[0], user.Split(' ')[1]); if (account == null) { m_log.Info("User does not exist."); return; } IClientCapsService client = capsService.GetClientCapsService(account.PrincipalID); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { //Send the message to the client messagePost.Post(regionClient.RegionHandle, BuildRequest("GridWideMessage", message, regionClient.AgentID.ToString())); m_log.Info("Message sent."); return; } } m_log.Info("Could not find user to send message to."); }
public void InformAllUsersOfNewGroupNotice(GroupNoticeInfo groupNotice) { IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); if (messagePost != null) { OSDMap outgoingMessage = new OSDMap(); outgoingMessage["Method"] = "SendGroupNoticeToUsers"; outgoingMessage["Notice"] = groupNotice.ToOSD(); messagePost.PostToAll(outgoingMessage); } }
public void FinishedStartup() { if (m_registry == null) { return;//Not enabled } m_GridService = m_registry.RequestModuleInterface <IGridService> (); m_asyncPostService = m_registry.RequestModuleInterface <IAsyncMessagePostService> (); m_GatekeeperConnector = new GatekeeperServiceConnector(m_registry.RequestModuleInterface <IAssetService> ()); m_GatekeeperService = m_registry.RequestModuleInterface <IGatekeeperService> (); m_FriendsService = m_registry.RequestModuleInterface <IFriendsService> (); m_PresenceService = m_registry.RequestModuleInterface <IAgentInfoService> (); m_UserAccountService = m_registry.RequestModuleInterface <IUserAccountService> (); }
protected object OnGenericEvent(string FunctionName, object parameters) { if (FunctionName == "UserStatusChange") { //A user has logged in or out... we need to update friends lists across the grid IAsyncMessagePostService asyncPoster = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); IFriendsService friendsService = m_registry.RequestModuleInterface <IFriendsService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IGridService gridService = m_registry.RequestModuleInterface <IGridService>(); if (asyncPoster != null && friendsService != null && capsService != null && gridService != null) { //Get all friends UserInfo info = (UserInfo)parameters; FriendInfo[] friends = friendsService.GetFriends(UUID.Parse(info.UserID)); List <UUID> OnlineFriends = new List <UUID>(); UUID us = UUID.Parse(info.UserID); foreach (FriendInfo friend in friends) { UUID FriendToInform = UUID.Parse(friend.Friend); //Now find their caps service so that we can find where they are root (and if they are logged in) IClientCapsService clientCaps = capsService.GetClientCapsService(FriendToInform); if (clientCaps != null) { OnlineFriends.Add(FriendToInform); //Find the root agent IRegionClientCapsService regionClientCaps = clientCaps.GetRootCapsService(); if (regionClientCaps != null) { //Post! asyncPoster.Post(regionClientCaps.RegionHandle, SyncMessageHelper.AgentStatusChange(us, FriendToInform, info.IsOnline)); } } } //If they are online, send all friends online statuses to them if (info.IsOnline) { GridRegion ourRegion = gridService.GetRegionByUUID(UUID.Zero, info.CurrentRegionID); if (ourRegion != null) { foreach (UUID onlineFriend in OnlineFriends) { asyncPoster.Post(ourRegion.RegionHandle, SyncMessageHelper.AgentStatusChange(onlineFriend, us, info.IsOnline)); } } } } } return(null); }
protected void NegotiateUrls(string module, string[] cmd) { //Combine the params and figure out the message string message = CombineParams(cmd, 2); //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); List <IRegionCapsService> clients = capsService.GetRegionsCapsServices(); //Go through all clients, and send the message asyncly to all agents that are root foreach (IRegionCapsService client in clients) { //Send the message to the region messagePost.Post(client.RegionHandle, BuildRequest("NegotiateUrl", message, UUID.Zero.ToString())); } }
public void SendAlert(string message) { //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); List <IClientCapsService> clients = capsService.GetClientsCapsServices(); //Go through all clients, and send the message asyncly to all agents that are root foreach (IRegionClientCapsService regionClient in from client in clients from regionClient in client.GetCapsServices() where regionClient.RootAgent select regionClient) { MainConsole.Instance.Debug("[GridWideMessageModule]: Informed " + regionClient.ClientCaps.AccountInfo.Name); //Send the message to the client messagePost.Post(regionClient.RegionHandle, BuildRequest("GridWideMessage", message, regionClient.AgentID.ToString())); } MainConsole.Instance.Info("[GridWideMessageModule]: Sent alert, will be delievered across the grid in the next 3 minutes."); }
protected void KickUserMessage(string module, string[] cmd) { //Combine the params and figure out the message string user = CombineParams(cmd, 2, 4); if (user.EndsWith(" ")) { user = user.Remove(user.Length - 1); } string message = CombineParams(cmd, 5); //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IUserAccountService userService = m_registry.RequestModuleInterface <IUserAccountService>(); UserAccount account = userService.GetUserAccount(UUID.Zero, user); if (account == null) { m_log.Info("User does not exist."); return; } IClientCapsService client = capsService.GetClientCapsService(account.PrincipalID); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { //Send the message to the client messagePost.Post(regionClient.RegionHandle, BuildRequest("KickUserMessage", message, regionClient.AgentID.ToString())); IAgentProcessing agentProcessor = m_registry.RequestModuleInterface <IAgentProcessing>(); if (agentProcessor != null) { agentProcessor.LogoutAgent(regionClient); } m_log.Info("User Kicked sent."); return; } } m_log.Info("Could not find user to send message to."); }
public void SendAlert(string message) { //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService> (); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService> (); List <IClientCapsService> clients = capsService.GetClientsCapsServices(); //Go through all clients, and send the message asyncly to all agents that are root foreach (IClientCapsService client in clients) { foreach (IRegionClientCapsService regionClient in client.GetCapsServices()) { if (regionClient.RootAgent) { //Send the message to the client messagePost.Post(regionClient.RegionHandle, BuildRequest("GridWideMessage", message, regionClient.AgentID.ToString())); } } } }
public void MessageUser(UUID avatarID, string message) { //Get required interfaces IAsyncMessagePostService messagePost = m_registry.RequestModuleInterface <IAsyncMessagePostService> (); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService> (); IClientCapsService client = capsService.GetClientCapsService(avatarID); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { //Send the message to the client messagePost.Post(regionClient.RegionHandle, BuildRequest("GridWideMessage", message, regionClient.AgentID.ToString())); m_log.Info("Message sent."); return; } } m_log.Info("Could not find user to send message to."); }
private void FixNeighbors(GridRegion regionInfos, List <GridRegion> neighbors, bool down) { IAsyncMessagePostService postService = m_registryCore.RequestModuleInterface <IAsyncMessagePostService>(); foreach (GridRegion r in neighbors) { if (m_KnownNeighbors.ContainsKey(r.RegionID)) { //Add/Remove them to/from the list if (down) { m_KnownNeighbors[r.RegionID].Remove(regionInfos); } else if (m_KnownNeighbors[r.RegionID].Find(delegate(GridRegion rr) { if (rr.RegionID == regionInfos.RegionID) { return(true); } return(false); }) == null) { m_KnownNeighbors[r.RegionID].Add(regionInfos); } } if (postService != null) { postService.Post(r.RegionHandle, SyncMessageHelper.NeighborChange(r.RegionID, regionInfos.RegionID, down)); } } if (down) { m_KnownNeighbors.Remove(regionInfos.RegionID); } }
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); }
public void FinishedStartup() { if (m_registry == null) return;//Not enabled m_GridService = m_registry.RequestModuleInterface<IGridService> (); m_asyncPostService = m_registry.RequestModuleInterface<IAsyncMessagePostService> (); m_GatekeeperConnector = new GatekeeperServiceConnector (m_registry.RequestModuleInterface<IAssetService> ()); m_GatekeeperService = m_registry.RequestModuleInterface<IGatekeeperService> (); m_FriendsService = m_registry.RequestModuleInterface<IFriendsService> (); m_PresenceService = m_registry.RequestModuleInterface<IAgentInfoService> (); m_UserAccountService = m_registry.RequestModuleInterface<IUserAccountService> (); }
protected object OnGenericEvent(string FunctionName, object parameters) { if (FunctionName == "UserStatusChange") { //A user has logged in or out... we need to update friends lists across the grid IAsyncMessagePostService asyncPoster = m_registry.RequestModuleInterface <IAsyncMessagePostService>(); IFriendsService friendsService = m_registry.RequestModuleInterface <IFriendsService>(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IGridService gridService = m_registry.RequestModuleInterface <IGridService>(); if (asyncPoster != null && friendsService != null && capsService != null && gridService != null) { //Get all friends object[] info = (object[])parameters; UUID us = UUID.Parse(info[0].ToString()); bool isOnline = bool.Parse(info[1].ToString()); List <FriendInfo> friends = friendsService.GetFriends(us); List <UUID> OnlineFriends = new List <UUID>(); List <string> previouslyContactedURLs = new List <string>(); foreach (FriendInfo friend in friends) { if (friend.TheirFlags == -1 || friend.MyFlags == -1) { continue; //Not validiated yet! } UUID FriendToInform = UUID.Zero; string url, first, last, secret; if (!UUID.TryParse(friend.Friend, out FriendToInform)) { HGUtil.ParseUniversalUserIdentifier(friend.Friend, out FriendToInform, out url, out first, out last, out secret); } //Now find their caps service so that we can find where they are root (and if they are logged in) IClientCapsService clientCaps = capsService.GetClientCapsService(FriendToInform); if (clientCaps != null) { //Find the root agent IRegionClientCapsService regionClientCaps = clientCaps.GetRootCapsService(); if (regionClientCaps != null) { OnlineFriends.Add(FriendToInform); //Post! asyncPoster.Post(regionClientCaps.RegionHandle, SyncMessageHelper.AgentStatusChange(us, FriendToInform, isOnline)); } else { //If they don't have a root agent, wtf happened? capsService.RemoveCAPS(clientCaps.AgentID); } } else { IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService>(); if (agentInfoService != null) { UserInfo friendinfo = agentInfoService.GetUserInfo(FriendToInform.ToString()); if (friendinfo != null && friendinfo.IsOnline) { OnlineFriends.Add(FriendToInform); //Post! GridRegion r = gridService.GetRegionByUUID(UUID.Zero, friendinfo.CurrentRegionID); if (r != null) { asyncPoster.Post(r.RegionHandle, SyncMessageHelper.AgentStatusChange(us, FriendToInform, isOnline)); } } else { IUserAgentService uas = m_registry.RequestModuleInterface <IUserAgentService>(); if (uas != null) { bool online = uas.RemoteStatusNotification(friend, us, isOnline); if (online) { OnlineFriends.Add(FriendToInform); } } } } } } //If the user is coming online, send all their friends online statuses to them if (isOnline) { GridRegion ourRegion = gridService.GetRegionByUUID(UUID.Zero, UUID.Parse(info[2].ToString())); if (ourRegion != null) { foreach (UUID onlineFriend in OnlineFriends) { asyncPoster.Post(ourRegion.RegionHandle, SyncMessageHelper.AgentStatusChange(onlineFriend, us, isOnline)); } } } } } 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); }