public void FinishedStartup() { if (m_registry == null) return; //Not enabled m_CapsService = m_registry.RequestModuleInterface<ICapsService> (); m_GridService = m_registry.RequestModuleInterface<IGridService> (); m_PresenceService = m_registry.RequestModuleInterface<IAgentInfoService> (); m_UserAccountService = m_registry.RequestModuleInterface<IUserAccountService> (); m_UserAgentService = m_registry.RequestModuleInterface<IUserAgentService> (); m_SimulationService = m_registry.RequestModuleInterface<ISimulationService> (); m_DefaultGatewayRegion = FindDefaultRegion (); }
public virtual void FinishedStartup() { m_capsService = m_registry.RequestModuleInterface<ICapsService>(); //Also look for incoming messages to display if (m_enabled) m_registry.RequestModuleInterface<ISyncMessageRecievedService>().OnMessageReceived += OnMessageReceived; }
void OnMakeRootAgent(IScenePresence presence) { if ((presence.CallbackURI != null) && !presence.CallbackURI.Equals("")) { WebUtils.ServiceOSDRequest(presence.CallbackURI, null, "DELETE", 10000, false, false); presence.CallbackURI = null; ICapsService service = m_scene.RequestModuleInterface <ICapsService>(); if (service != null) { IClientCapsService clientCaps = service.GetClientCapsService(presence.UUID); if (clientCaps != null) { IRegionClientCapsService regionCaps = clientCaps.GetCapsService(m_scene.RegionInfo.RegionHandle); if (regionCaps != null) { regionCaps.RootAgent = true; foreach (IRegionClientCapsService regionClientCaps in clientCaps.GetCapsServices()) { if (regionCaps.RegionHandle != regionClientCaps.RegionHandle) { regionClientCaps.RootAgent = false; //Reset any other agents that we might have } } } } } } }
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."); }
public void FinishedStartup() { //Also look for incoming messages to display m_messagePost = m_registry.RequestModuleInterface <ISyncMessagePosterService>(); m_capsService = m_registry.RequestModuleInterface <ICapsService>(); m_registry.RequestModuleInterface <ISyncMessageRecievedService>().OnMessageReceived += OnMessageReceived; }
public override bool StoreFriend(UUID PrincipalID, string Friend, int flags) { IUserAccountService userAccountService = m_registry.RequestModuleInterface <IUserAccountService> (); UserAccount agentAccount = userAccountService.GetUserAccount(null, PrincipalID); UUID FriendUUID; if (!UUID.TryParse(Friend, out FriendUUID)) { return(base.StoreFriend(PrincipalID, Friend, flags));//Already set to a UUI } else { UserAccount friendAccount = userAccountService.GetUserAccount(null, FriendUUID); if (agentAccount == null || friendAccount == null) { // remote grid users ICapsService capsService = m_registry.RequestModuleInterface <ICapsService> (); IClientCapsService FriendCaps = capsService.GetClientCapsService(UUID.Parse(Friend)); if (FriendCaps != null && FriendCaps.GetRootCapsService() != null) { Friend = HGUtil.ProduceUserUniversalIdentifier(FriendCaps.GetRootCapsService().CircuitData); } } return(base.StoreFriend(PrincipalID, Friend, flags)); } }
public void FinishedStartup() { //Also look for incoming messages to display m_messagePost = m_registry.RequestModuleInterface<ISyncMessagePosterService>(); m_capsService = m_registry.RequestModuleInterface<ICapsService>(); m_registry.RequestModuleInterface<ISyncMessageRecievedService>().OnMessageReceived += OnMessageReceived; }
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 bool SendGridMessage(UUID toId, string message, bool goDeep, UUID transactionId) { try { if (m_doRemoteCalls) { return((bool)DoRemote(toId, message, goDeep, transactionId)); } ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IClientCapsService client = capsService.GetClientCapsService(toId); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { regionPostHandler.SendGridMessageRegionPostHandler(regionClient.Region, toId, message, transactionId); } } } catch (Exception e) { MainConsole.Instance.ErrorFormat("[CURRENCY CONNECTOR] UserCurrencyUpdate to m_ServerURI: {0}", e.ToString()); } return(false); }
public static bool GetIsForeign(UUID AgentID, string server, IRegistryCore registry, out string serverURL) { serverURL = ""; if (registry == null) { return(true); } ICapsService caps = registry.RequestModuleInterface <ICapsService>(); IClientCapsService clientCaps = caps.GetClientCapsService(AgentID); if (clientCaps == null) { return(false); } IRegionClientCapsService regionClientCaps = clientCaps.GetRootCapsService(); if (regionClientCaps == null) { return(false); } Dictionary <string, object> urls = regionClientCaps.CircuitData.ServiceURLs; if (urls != null && urls.Count > 0) { serverURL = urls[server].ToString(); return(true); } return(false); }
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; }
/// <summary> /// Creates a cap for the given type /// </summary> /// <param name="type"></param> /// <returns></returns> private string AddSpecificUrl(string type) { string capPath = "/cap/" + UUID.Random() + "/" + type; m_server.AddHTTPHandler(capPath, delegate(Hashtable request) { Hashtable responsedata = new Hashtable(); responsedata["content_type"] = "text/html"; responsedata["keepalive"] = false; OSD resp = new OSD(); try { OSDMap r = (OSDMap)OSDParser.DeserializeLLSDXml((string)request["requestbody"]); if (type == "add_to_group") { resp = AddUserToGroup(r); } if (type == "check_name") { resp = CheckName(r); } if (type == "create_user") { resp = CreateUser(r); } if (type == "get_error_codes") { resp = GetErrorCode(r); } if (type == "get_last_names") { resp = GetLastNames(r); } } catch { } responsedata["int_response_code"] = HttpStatusCode.OK; responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(resp); return(responsedata); }); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); if (capsService != null) { capPath = capsService.HostUri + capPath; return(capPath); } return(""); }
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 OSDMap OnMessageReceived(OSDMap message) { //If it is an async message request, make sure that the request is valid and check it if (message["Method"] == "AsyncMessageRequest") { try { ICapsService service = m_registry.RequestModuleInterface <ICapsService>(); OSDMap response = new OSDMap(); OSDMap mapresponse = new OSDMap(); if (message.ContainsKey("RegionHandles")) { OSDArray handles = (OSDArray)message["RegionHandles"]; for (int i = 0; i < handles.Count; i += 2) { ulong regionHandle = handles[i].AsULong(); IRegionCapsService region = service.GetCapsForRegion(regionHandle); if (region != null) { bool verified = (region.Region.SessionID == handles[i + 1].AsUUID()); if (verified) { if (m_regionMessages.ContainsKey(regionHandle)) { //Get the array, then remove it OSDArray array = m_regionMessages[regionHandle]; m_regionMessages.Remove(regionHandle); foreach (var test in m_allRegionMessages.Where(u => !u.RegionsPreviouslyPosted.Contains(regionHandle))) { array.Add(test.Message); test.RegionsPreviouslyPosted.Add(regionHandle); } mapresponse[regionHandle.ToString()] = array; } } } } } response["Messages"] = mapresponse; return(response); } catch { } } return(null); }
public void FinishedStartup() { if (m_registry == null) { return; //Not enabled } m_CapsService = m_registry.RequestModuleInterface <ICapsService> (); m_GridService = m_registry.RequestModuleInterface <IGridService> (); m_PresenceService = m_registry.RequestModuleInterface <IAgentInfoService> (); m_UserAccountService = m_registry.RequestModuleInterface <IUserAccountService> (); m_UserAgentService = m_registry.RequestModuleInterface <IUserAgentService>(); m_SimulationService = m_registry.RequestModuleInterface <ISimulationService>(); m_userFinder = m_registry.RequestModuleInterface <IUserFinder>(); m_DefaultGatewayRegion = FindDefaultRegion(); }
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."); }
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; }
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())); } }
void OnClosingClient(IClientAPI client) { ICapsService service = m_scene.RequestModuleInterface <ICapsService>(); if (service != null) { IClientCapsService clientCaps = service.GetClientCapsService(client.AgentId); if (clientCaps != null) { IRegionClientCapsService regionCaps = clientCaps.GetCapsService(m_scene.RegionInfo.RegionHandle); if (regionCaps != null) { regionCaps.Close(); clientCaps.RemoveCAPS(m_scene.RegionInfo.RegionHandle); } } } }
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 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."); }
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 ServerHandler(string url, string SessionID, IRegistryCore registry) : base("POST", url) { m_SessionID = SessionID; m_registry = registry; m_capsService = m_registry.RequestModuleInterface <ICapsService>(); m_urlModule = m_registry.RequestModuleInterface <IGridRegistrationService>(); if (m_methods == null) { m_methods = new Dictionary <string, List <MethodImplementation> >(); List <string> alreadyRunPlugins = new List <string>(); foreach (ConnectorBase plugin in ConnectorRegistry.Connectors) { if (alreadyRunPlugins.Contains(plugin.PluginName)) { continue; } alreadyRunPlugins.Add(plugin.PluginName); foreach (MethodInfo method in plugin.GetType().GetMethods()) { CanBeReflected reflection = (CanBeReflected)Attribute.GetCustomAttribute(method, typeof(CanBeReflected)); if (reflection != null) { string methodName = reflection.RenamedMethod == "" ? method.Name : reflection.RenamedMethod; List <MethodImplementation> methods = new List <MethodImplementation>(); MethodImplementation imp = new MethodImplementation() { Method = method, Reference = plugin, Attribute = reflection }; if (!m_methods.TryGetValue(methodName, out methods)) { m_methods.Add(methodName, (methods = new List <MethodImplementation>())); } methods.Add(imp); } } } } }
public OSDMap GetParcelDetails(UUID agentId) { try { ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IClientCapsService client = capsService.GetClientCapsService(agentId); if (client != null) { IRegionClientCapsService regionClient = client.GetRootCapsService(); if (regionClient != null) { LandData land = regionPostHandler.ParcelDetailsRegionPostHandler(regionClient.Region, client.AgentID); return(land.ToOSD()); } } } catch (Exception e) { MainConsole.Instance.ErrorFormat("[CURRENCY CONNECTOR] UserCurrencyUpdate to m_ServerURI: {0}", e.ToString()); } return(null); }
protected object OnGenericEvent(string FunctionName, object parameters) { if (FunctionName == "NewUserConnection") { ICapsService service = m_scene.RequestModuleInterface <ICapsService>(); if (service != null) { object[] obj = (object[])parameters; OSDMap param = (OSDMap)obj[0]; AgentCircuitData circuit = (AgentCircuitData)obj[1]; circuit.child = false; //ONLY USE ROOT AGENTS service.CreateCAPS(circuit.AgentID, CapsUtil.GetCapsSeedPath(circuit.CapsPath), m_scene.RegionInfo.RegionHandle, true, circuit); //We ONLY use root agents because of OpenSim's inability to send the correct data IClientCapsService clientCaps = service.GetClientCapsService(circuit.AgentID); if (clientCaps != null) { IRegionClientCapsService regionCaps = clientCaps.GetCapsService(m_scene.RegionInfo.RegionHandle); if (regionCaps != null) { regionCaps.AddCAPS((OSDMap)param["CapsUrls"]); } } } } else if (FunctionName == "UserStatusChange") { UserInfo info = (UserInfo)parameters; if (!info.IsOnline) //Logging out { ICapsService service = m_scene.RequestModuleInterface <ICapsService>(); if (service != null) { service.RemoveCAPS(UUID.Parse(info.UserID)); } } } return(null); }
private object StipendsPayOutEvent(string functionName, object parameters) { if (functionName != "StipendsPayout") { return(null); } StipendsInfo si = new StipendsInfo(); si.FromOSD((OSDMap)OSDParser.DeserializeJson(parameters.ToString())); IUserAccountService userService = m_registry.RequestModuleInterface <IUserAccountService>(); UserAccount ua = userService.GetUserAccount(null, si.AgentID); if ((ua != null) && (ua.UserFlags >= 0) && ((!m_options.StipendsPremiumOnly) || ((ua.UserLevel & Constants.USER_FLAG_MEMBER) == Constants.USER_FLAG_MEMBER))) { if (m_options.GiveStipendsOnlyWhenLoggedIn) { ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IClientCapsService client = capsService.GetClientCapsService(ua.PrincipalID); if (client == null) { return(""); } } IMoneyModule mo = m_registry.RequestModuleInterface <IMoneyModule>(); if (mo == null) { return(null); } UUID transid = UUID.Random(); MainConsole.Instance.Info("[MONEY MODULE] Stipend Payment for " + ua.FirstName + " " + ua.LastName + " is now running"); if (m_currencyService.UserCurrencyTransfer(ua.PrincipalID, UUID.Zero, (uint)m_options.Stipend, "Stipend Payment", TransactionType.StipendPayment, transid)) { return(transid.ToString()); } } return(""); }
protected object OnGenericEvent(string FunctionName, object parameters) { if (FunctionName == "NewUserConnection") { ICapsService service = m_scene.RequestModuleInterface <ICapsService>(); if (service != null) { OSDMap param = (OSDMap)parameters; AgentCircuitData circuit = new AgentCircuitData(); circuit.UnpackAgentCircuitData((OSDMap)param["Agent"]); service.CreateCAPS(circuit.AgentID, CapsUtil.GetCapsSeedPath(circuit.CapsPath), m_scene.RegionInfo.RegionHandle, !circuit.child, circuit); IClientCapsService clientCaps = service.GetClientCapsService(circuit.AgentID); if (clientCaps != null) { IRegionClientCapsService regionCaps = clientCaps.GetCapsService(m_scene.RegionInfo.RegionHandle); if (regionCaps != null) { regionCaps.AddCAPS((OSDMap)param["CapsUrls"]); } } } } else if (FunctionName == "UserStatusChange") { UserInfo info = (UserInfo)parameters; if (!info.IsOnline) //Logging out { ICapsService service = m_scene.RequestModuleInterface <ICapsService>(); if (service != null) { service.RemoveCAPS(UUID.Parse(info.UserID)); } } } return(null); }
void OnMakeRootAgent(IScenePresence presence) { ICapsService service = m_scene.RequestModuleInterface <ICapsService> (); if (service != null) { IClientCapsService clientCaps = service.GetClientCapsService(presence.UUID); if (clientCaps != null) { IRegionClientCapsService regionCaps = clientCaps.GetCapsService(m_scene.RegionInfo.RegionHandle); if (regionCaps != null) { regionCaps.RootAgent = true; foreach (IRegionClientCapsService regionClientCaps in clientCaps.GetCapsServices()) { if (regionCaps.RegionHandle != regionClientCaps.RegionHandle) { regionClientCaps.RootAgent = false; //Reset any other agents that we might have } } } } } if ((presence.CallbackURI != null) && !presence.CallbackURI.Equals("")) { WebUtils.ServiceOSDRequest(presence.CallbackURI, null, "DELETE", 10000, false, false, false); presence.CallbackURI = null; } #if (!ISWIN) Util.FireAndForget(delegate(object o) { DoPresenceUpdate(presence); }); #else Util.FireAndForget(o => DoPresenceUpdate(presence)); #endif }
private object StupendsPayOutEvent(string functionName, object parameters) { if (functionName != "StipendsPayout") { return(null); } StipendsInfo si = new StipendsInfo(); si.FromOSD((OSDMap)OSDParser.DeserializeJson(parameters.ToString())); IUserAccountService userService = m_registry.RequestModuleInterface <IUserAccountService>(); UserAccount ua = userService.GetUserAccount(null, si.AgentID); if ((ua != null) && (ua.UserFlags >= 0) && ((!m_options.StipendsPremiumOnly) || ((ua.UserLevel & 600) == 600))) { if (m_options.GiveStipendsOnlyWhenLoggedIn) { ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); IClientCapsService client = capsService.GetClientCapsService(ua.PrincipalID); if (client == null) { return(""); } } IMoneyModule mo = m_registry.RequestModuleInterface <IMoneyModule>(); if (mo == null) { return(null); } UUID transid = UUID.Random(); if (m_dustCurrencyService.UserCurrencyTransfer(ua.PrincipalID, m_options.BankerPrincipalID, UUID.Zero, UUID.Zero, (uint)m_options.Stipend, "Stipend Payment", TransactionType.StipendPayment, transid)) { return(transid.ToString()); } } return(""); }
public void LogoutAgent(IRegionClientCapsService regionCaps) { //Close all neighbor agents as well, the root is closing itself, so don't call them ISimulationService SimulationService = m_registry.RequestModuleInterface <ISimulationService>(); if (SimulationService != null) { IGridService GridService = m_registry.RequestModuleInterface <IGridService>(); if (GridService != null) { foreach (IRegionClientCapsService regionClient in regionCaps.ClientCaps.GetCapsServices()) { if (regionClient.RegionHandle != regionCaps.RegionHandle) { SimulationService.CloseAgent(regionClient.Region, regionCaps.AgentID); } } } } //Close all caps regionCaps.ClientCaps.Close(); IAgentInfoService agentInfoService = m_registry.RequestModuleInterface <IAgentInfoService>(); if (agentInfoService != null) { agentInfoService.SetLoggedIn(regionCaps.AgentID.ToString(), false, true); } ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); if (capsService != null) { capsService.RemoveCAPS(regionCaps.AgentID); } }
public void PostInitialize(IConfigSource config, IRegistryCore registry) { m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>(); m_GridUserService = registry.RequestModuleInterface<IGridUserService>(); m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>(); m_InventoryService = registry.RequestModuleInterface<IInventoryService>(); m_GridService = registry.RequestModuleInterface<IGridService>(); m_PresenceService = registry.RequestModuleInterface<IPresenceService>(); m_AvatarService = registry.RequestModuleInterface<IAvatarService>(); m_FriendsService = registry.RequestModuleInterface<IFriendsService>(); m_SimulationService = registry.RequestModuleInterface<ISimulationService>(); m_AssetService = registry.RequestModuleInterface<IAssetService>(); m_LibraryService = registry.RequestModuleInterface<ILibraryService>(); m_CapsService = registry.RequestModuleInterface<ICapsService>(); }
public void Start(IConfigSource config, IRegistryCore registry) { m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>().InnerService; m_agentInfoService = registry.RequestModuleInterface<IAgentInfoService>().InnerService; m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>(); m_InventoryService = registry.RequestModuleInterface<IInventoryService>(); m_GridService = registry.RequestModuleInterface<IGridService>(); m_AvatarService = registry.RequestModuleInterface<IAvatarService>().InnerService; m_FriendsService = registry.RequestModuleInterface<IFriendsService>(); m_SimulationService = registry.RequestModuleInterface<ISimulationService>(); m_AssetService = registry.RequestModuleInterface<IAssetService>().InnerService; m_LibraryService = registry.RequestModuleInterface<ILibraryService>(); m_CapsService = registry.RequestModuleInterface<ICapsService>(); m_ArchiveService = registry.RequestModuleInterface<IAvatarAppearanceArchiver>(); if (!Initialized) { Initialized = true; RegisterCommands(); } LoginModules = WhiteCoreModuleLoader.PickupModules<ILoginModule>(); foreach (ILoginModule module in LoginModules) { module.Initialize(this, m_config, registry); } MainConsole.Instance.DebugFormat("[LLOGIN SERVICE]: Starting..."); }
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; }
public CAPSHandler(string pass, ICapsService service) : base("POST", "/CAPS/REGISTER") { CAPSPass = pass; m_capsService = service; }
public void Initialise(ICapsService server, UUID agentID) { m_CapsService = server; m_agentID = agentID; }
public virtual void Start(IConfigSource config, IRegistryCore registry) { m_service = registry.RequestModuleInterface<ICapsService>(); }
public void Start(IConfigSource config, IRegistryCore registry) { m_UserAccountService = registry.RequestModuleInterface<IUserAccountService>().InnerService; m_agentInfoService = registry.RequestModuleInterface<IAgentInfoService>().InnerService; m_AuthenticationService = registry.RequestModuleInterface<IAuthenticationService>(); m_InventoryService = registry.RequestModuleInterface<IInventoryService>(); m_GridService = registry.RequestModuleInterface<IGridService>(); m_AvatarService = registry.RequestModuleInterface<IAvatarService>().InnerService; m_FriendsService = registry.RequestModuleInterface<IFriendsService>(); m_SimulationService = registry.RequestModuleInterface<ISimulationService>(); m_AssetService = registry.RequestModuleInterface<IAssetService> ().InnerService; m_LibraryService = registry.RequestModuleInterface<ILibraryService>(); m_CapsService = registry.RequestModuleInterface<ICapsService>(); if (!Initialized) { Initialized = true; RegisterCommands(); } //Start the grid profile archiver. new GridAvatarProfileArchiver(m_UserAccountService); archiver = new GridAvatarArchiver(m_UserAccountService, m_AvatarService, m_InventoryService, m_AssetService); LoginModules = Aurora.Framework.AuroraModuleLoader.PickupModules<ILoginModule>(); foreach (ILoginModule module in LoginModules) { module.Initialize(this, m_config, m_UserAccountService); } m_log.DebugFormat("[LLOGIN SERVICE]: Starting..."); }
public EQMEventPoster(IEventQueueService handler, ICapsService capsService) : base("POST", "/CAPS/EQMPOSTER") { m_eventQueueService = handler; m_capsService = capsService; }
public ServerHandler(string url, string SessionID, IRegistryCore registry) : base("POST", url) { m_SessionID = SessionID; m_registry = registry; m_capsService = m_registry.RequestModuleInterface<ICapsService>(); m_urlModule = m_registry.RequestModuleInterface<IGridRegistrationService>(); if (m_methods == null) { m_methods = new Dictionary<string, List<MethodImplementation>>(); List<string> alreadyRunPlugins = new List<string>(); foreach (ConnectorBase plugin in ConnectorRegistry.Connectors) { if (alreadyRunPlugins.Contains(plugin.PluginName)) continue; alreadyRunPlugins.Add(plugin.PluginName); foreach (MethodInfo method in plugin.GetType().GetMethods()) { CanBeReflected reflection = (CanBeReflected)Attribute.GetCustomAttribute(method, typeof(CanBeReflected)); if (reflection != null) { string methodName = reflection.RenamedMethod == "" ? method.Name : reflection.RenamedMethod; List<MethodImplementation> methods = new List<MethodImplementation>(); MethodImplementation imp = new MethodImplementation() { Method = method, Reference = plugin, Attribute = reflection }; if (!m_methods.TryGetValue(methodName, out methods)) m_methods.Add(methodName, (methods = new List<MethodImplementation>())); methods.Add(imp); } } } } }
public void Initialise(ICapsService server, UUID agentID) { m_CapsService = server; m_agentID = agentID; m_account = Registry.RequestModuleInterface<IUserAccountService>().GetUserAccount(null, agentID); }
protected OSDMap OnMessageReceived(OSDMap message) { if (!message.ContainsKey("Method")) { return(null); } UUID AgentID = message["AgentID"].AsUUID(); ulong requestingRegion = message["RequestingRegion"].AsULong(); ICapsService capsService = m_registry.RequestModuleInterface <ICapsService>(); if (capsService == null) { //m_log.Info("[AgentProcessing]: Failed OnMessageReceived ICapsService is null"); return(new OSDMap()); } IClientCapsService clientCaps = capsService.GetClientCapsService(AgentID); IRegionClientCapsService regionCaps = null; if (clientCaps != null) { regionCaps = clientCaps.GetCapsService(requestingRegion); } if (message["Method"] == "LogoutRegionAgents") { LogOutAllAgentsForRegion(requestingRegion); } else if (message["Method"] == "RegionIsOnline") //This gets fired when the scene is fully finished starting up { //Log out all the agents first, then add any child agents that should be in this region LogOutAllAgentsForRegion(requestingRegion); IGridService GridService = m_registry.RequestModuleInterface <IGridService>(); if (GridService != null) { int x, y; Util.UlongToInts(requestingRegion, out x, out y); GridRegion requestingGridRegion = GridService.GetRegionByPosition(UUID.Zero, x, y); if (requestingGridRegion != null) { EnableChildAgentsForRegion(requestingGridRegion); } } } else if (message["Method"] == "DisableSimulator") { //KILL IT! if (regionCaps == null || clientCaps == null) { return(null); } regionCaps.Close(); clientCaps.RemoveCAPS(requestingRegion); } else if (message["Method"] == "ArrivedAtDestination") { if (regionCaps == null || clientCaps == null) { return(null); } //Recieved a callback if (clientCaps.InTeleport) //Only set this if we are in a teleport, // otherwise (such as on login), this won't check after the first tp! { clientCaps.CallbackHasCome = true; } regionCaps.Disabled = false; //The agent is getting here for the first time (eg. login) OSDMap body = ((OSDMap)message["Message"]); //Parse the OSDMap int DrawDistance = body["DrawDistance"].AsInteger(); AgentCircuitData circuitData = new AgentCircuitData(); circuitData.UnpackAgentCircuitData((OSDMap)body["Circuit"]); //Now do the creation EnableChildAgents(AgentID, requestingRegion, DrawDistance, circuitData); } else if (message["Method"] == "CancelTeleport") { if (regionCaps == null || clientCaps == null) { return(null); } //Only the region the client is root in can do this IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService(); if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle) { //The user has requested to cancel the teleport, stop them. clientCaps.RequestToCancelTeleport = true; regionCaps.Disabled = false; } } else if (message["Method"] == "AgentLoggedOut") { //ONLY if the agent is root do we even consider it if (regionCaps != null) { if (regionCaps.RootAgent) { LogoutAgent(regionCaps); } } } else if (message["Method"] == "SendChildAgentUpdate") { if (regionCaps == null || clientCaps == null) { return(null); } IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService(); if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle) { OSDMap body = ((OSDMap)message["Message"]); AgentPosition pos = new AgentPosition(); pos.Unpack((OSDMap)body["AgentPos"]); SendChildAgentUpdate(pos, regionCaps); regionCaps.Disabled = false; } } else if (message["Method"] == "TeleportAgent") { if (regionCaps == null || clientCaps == null) { return(null); } IRegionClientCapsService rootCaps = clientCaps.GetRootCapsService(); if (rootCaps != null && rootCaps.RegionHandle == regionCaps.RegionHandle) { OSDMap body = ((OSDMap)message["Message"]); GridRegion destination = new GridRegion(); destination.FromOSD((OSDMap)body["Region"]); uint TeleportFlags = body["TeleportFlags"].AsUInteger(); int DrawDistance = body["DrawDistance"].AsInteger(); AgentCircuitData Circuit = new AgentCircuitData(); Circuit.UnpackAgentCircuitData((OSDMap)body["Circuit"]); AgentData AgentData = new AgentData(); AgentData.Unpack((OSDMap)body["AgentData"]); regionCaps.Disabled = false; OSDMap result = new OSDMap(); string reason = ""; result["Success"] = TeleportAgent(destination, TeleportFlags, DrawDistance, Circuit, AgentData, AgentID, requestingRegion, out reason); result["Reason"] = reason; return(result); } } else if (message["Method"] == "CrossAgent") { if (regionCaps == null || clientCaps == null) { return(null); } if (clientCaps.GetRootCapsService().RegionHandle == regionCaps.RegionHandle) { //This is a simulator message that tells us to cross the agent OSDMap body = ((OSDMap)message["Message"]); Vector3 pos = body["Pos"].AsVector3(); Vector3 Vel = body["Vel"].AsVector3(); GridRegion Region = new GridRegion(); Region.FromOSD((OSDMap)body["Region"]); AgentCircuitData Circuit = new AgentCircuitData(); Circuit.UnpackAgentCircuitData((OSDMap)body["Circuit"]); AgentData AgentData = new AgentData(); AgentData.Unpack((OSDMap)body["AgentData"]); regionCaps.Disabled = false; OSDMap result = new OSDMap(); string reason = ""; result["Success"] = CrossAgent(Region, pos, Vel, Circuit, AgentData, AgentID, requestingRegion, out reason); result["Reason"] = reason; return(result); } } return(null); }
/// <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); }
public void PostInitialize(IConfigSource config, IRegistryCore registry) { service = registry.RequestModuleInterface<IEventQueueService>(); capsService = registry.RequestModuleInterface<ICapsService>(); }
public virtual void Start(IConfigSource config, IRegistryCore registry) { m_service = registry.RequestModuleInterface <ICapsService> (); }